OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * | 9 * |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 17 matching lines...) Expand all Loading... | |
28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 var WebInspector = { | 31 var WebInspector = { |
32 _registerModules: function() | 32 _registerModules: function() |
33 { | 33 { |
34 var configuration; | 34 var configuration; |
35 if (WebInspector.isWorkerFrontend()) { | 35 if (WebInspector.isWorkerFrontend()) { |
36 configuration = ["sources", "timeline", "profiles", "console", "code mirror"]; | 36 configuration = ["sources", "timeline", "profiles", "console", "code mirror"]; |
37 } else { | 37 } else { |
38 configuration = ["elements", "network", "sources", "timeline", "prof iles", "resources", "audits", "console", "codemirror", "extensions", "sources-fo rmatter-actions"]; | 38 configuration = ["core", "elements", "network", "sources", "timeline ", "profiles", "resources", "audits", "console", "codemirror", "extensions", "se ttings", "sources-formatter-actions"]; |
39 if (WebInspector.experimentsSettings.layersPanel.isEnabled()) | 39 if (WebInspector.experimentsSettings.layersPanel.isEnabled()) |
40 configuration.push("layers"); | 40 configuration.push("layers"); |
41 } | 41 } |
42 WebInspector.moduleManager.registerModules(configuration); | 42 WebInspector.moduleManager.registerModules(configuration); |
43 }, | 43 }, |
44 | 44 |
45 _createGlobalStatusBarItems: function() | 45 _createGlobalStatusBarItems: function() |
46 { | 46 { |
47 if (this.inspectElementModeController) | 47 if (this.inspectElementModeController) |
48 this.inspectorView.appendToLeftToolbar(this.inspectElementModeContro ller.toggleSearchButton.element); | 48 this.inspectorView.appendToLeftToolbar(this.inspectElementModeContro ller.toggleSearchButton.element); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 * @return {boolean} | 126 * @return {boolean} |
127 */ | 127 */ |
128 isWorkerFrontend: function() | 128 isWorkerFrontend: function() |
129 { | 129 { |
130 return !!WebInspector.queryParamsObject["dedicatedWorkerId"] || | 130 return !!WebInspector.queryParamsObject["dedicatedWorkerId"] || |
131 !!WebInspector.queryParamsObject["isSharedWorker"]; | 131 !!WebInspector.queryParamsObject["isSharedWorker"]; |
132 }, | 132 }, |
133 | 133 |
134 showConsole: function() | 134 showConsole: function() |
135 { | 135 { |
136 if (this.consoleView.isShowing()) | |
137 return; | |
138 this.inspectorView.showViewInDrawer("console"); | 136 this.inspectorView.showViewInDrawer("console"); |
139 }, | 137 }, |
140 | 138 |
141 _resetErrorAndWarningCounts: function() | 139 _resetErrorAndWarningCounts: function() |
142 { | 140 { |
143 WebInspector.inspectorView.setErrorAndWarningCounts(0, 0); | 141 WebInspector.inspectorView.setErrorAndWarningCounts(0, 0); |
144 }, | 142 }, |
145 | 143 |
146 _updateErrorAndWarningCounts: function() | 144 _updateErrorAndWarningCounts: function() |
147 { | 145 { |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
356 | 354 |
357 new WebInspector.DebuggerScriptMapping(this.debuggerModel, this.workspace, t his.networkWorkspaceProvider); | 355 new WebInspector.DebuggerScriptMapping(this.debuggerModel, this.workspace, t his.networkWorkspaceProvider); |
358 this.liveEditSupport = new WebInspector.LiveEditSupport(this.workspace); | 356 this.liveEditSupport = new WebInspector.LiveEditSupport(this.workspace); |
359 new WebInspector.CSSStyleSheetMapping(this.cssModel, this.workspace, this.ne tworkWorkspaceProvider); | 357 new WebInspector.CSSStyleSheetMapping(this.cssModel, this.workspace, this.ne tworkWorkspaceProvider); |
360 new WebInspector.PresentationConsoleMessageHelper(this.workspace); | 358 new WebInspector.PresentationConsoleMessageHelper(this.workspace); |
361 | 359 |
362 // Create settings before loading modules. | 360 // Create settings before loading modules. |
363 WebInspector.settings.initializeBackendSettings(); | 361 WebInspector.settings.initializeBackendSettings(); |
364 | 362 |
365 this._registerModules(); | 363 this._registerModules(); |
364 WebInspector.KeyboardShortcut.loadBindings(); | |
366 | 365 |
367 this.panels = {}; | 366 this.panels = {}; |
368 WebInspector.inspectorView = new WebInspector.InspectorView(); | 367 WebInspector.inspectorView = new WebInspector.InspectorView(); |
369 WebInspector.inspectorView.show(document.body); | 368 WebInspector.inspectorView.show(document.body); |
370 this._createGlobalStatusBarItems(); | 369 this._createGlobalStatusBarItems(); |
371 | 370 |
372 this.addMainEventListeners(document); | 371 this.addMainEventListeners(document); |
373 | 372 |
374 window.addEventListener("resize", this.windowResize.bind(this), true); | 373 window.addEventListener("resize", this.windowResize.bind(this), true); |
375 | 374 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
583 event.consume(true); | 582 event.consume(true); |
584 return; | 583 return; |
585 } | 584 } |
586 } | 585 } |
587 | 586 |
588 if (WebInspector.advancedSearchController.handleShortcut(event)) | 587 if (WebInspector.advancedSearchController.handleShortcut(event)) |
589 return; | 588 return; |
590 if (WebInspector.inspectElementModeController && WebInspector.inspectElement ModeController.handleShortcut(event)) | 589 if (WebInspector.inspectElementModeController && WebInspector.inspectElement ModeController.handleShortcut(event)) |
591 return; | 590 return; |
592 | 591 |
593 switch (event.keyIdentifier) { | |
594 case "U+004F": // O key | |
595 case "U+0050": // P key | |
596 if (!event.shiftKey && !event.altKey && WebInspector.KeyboardShortcu t.eventHasCtrlOrMeta(event)) { | |
597 WebInspector.showPanel("sources").showGoToSourceDialog(); | |
598 event.consume(true); | |
599 } | |
600 break; | |
601 case "U+0052": // R key | |
602 if (WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(event)) { | |
603 WebInspector.debuggerModel.skipAllPauses(true, true); | |
604 WebInspector.resourceTreeModel.reloadPage(event.shiftKey); | |
605 event.consume(true); | |
606 } | |
607 if (window.DEBUG && event.altKey) { | |
608 WebInspector.reload(); | |
609 return; | |
610 } | |
611 break; | |
612 case "F5": | |
613 if (!WebInspector.isMac()) { | |
614 WebInspector.resourceTreeModel.reloadPage(event.ctrlKey || event .shiftKey); | |
615 event.consume(true); | |
616 } | |
617 break; | |
618 } | |
619 | |
620 var isValidZoomShortcut = WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(e vent) && | 592 var isValidZoomShortcut = WebInspector.KeyboardShortcut.eventHasCtrlOrMeta(e vent) && |
621 !event.altKey && | 593 !event.altKey && |
622 !InspectorFrontendHost.isStub; | 594 !InspectorFrontendHost.isStub; |
623 if (isValidZoomShortcut && WebInspector.handleZoomEvent(event)) { | 595 if (isValidZoomShortcut && WebInspector.handleZoomEvent(event)) { |
624 event.consume(true); | 596 event.consume(true); |
625 return; | 597 return; |
626 } | 598 } |
627 | 599 |
628 if (event.keyCode === WebInspector.KeyboardShortcut.Keys.F1.code || | 600 WebInspector.KeyboardShortcut.handleShortcut(event); |
629 (event.keyCode === WebInspector.KeyboardShortcut.Keys.QuestionMark.code && event.shiftKey && (!WebInspector.isBeingEdited(event.target) || event.metaKey ))) { | |
630 this.settingsController.showSettingsScreen(WebInspector.SettingsScreen.T abs.General); | |
631 event.consume(true); | |
632 return; | |
633 } | |
634 | |
635 var Esc = "U+001B"; | |
636 var doNotOpenDrawerOnEsc = WebInspector.experimentsSettings.doNotOpenDrawerO nEsc.isEnabled(); | |
637 if (event.keyIdentifier === Esc) { | |
638 if (this.inspectorView.drawerVisible()) | |
639 this.inspectorView.closeDrawer(); | |
640 else if (!doNotOpenDrawerOnEsc) | |
641 this.inspectorView.showDrawer(); | |
642 } | |
643 | |
644 if (event.keyCode === WebInspector.KeyboardShortcut.Keys.Tilde.code && event .ctrlKey && !event.shiftKey && !event.altKey && !event.metaKey) | |
645 this.showConsole(); | |
646 } | 601 } |
647 | 602 |
648 WebInspector.documentCanCopy = function(event) | 603 WebInspector.documentCanCopy = function(event) |
649 { | 604 { |
650 if (WebInspector.inspectorView.currentPanel() && WebInspector.inspectorView. currentPanel().handleCopyEvent) | 605 if (WebInspector.inspectorView.currentPanel() && WebInspector.inspectorView. currentPanel().handleCopyEvent) |
651 event.preventDefault(); | 606 event.preventDefault(); |
652 } | 607 } |
653 | 608 |
654 WebInspector.documentCopy = function(event) | 609 WebInspector.documentCopy = function(event) |
655 { | 610 { |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
845 | 800 |
846 WebInspector.addMainEventListeners = function(doc) | 801 WebInspector.addMainEventListeners = function(doc) |
847 { | 802 { |
848 doc.addEventListener("keydown", this.postDocumentKeyDown.bind(this), false); | 803 doc.addEventListener("keydown", this.postDocumentKeyDown.bind(this), false); |
849 doc.addEventListener("beforecopy", this.documentCanCopy.bind(this), true); | 804 doc.addEventListener("beforecopy", this.documentCanCopy.bind(this), true); |
850 doc.addEventListener("copy", this.documentCopy.bind(this), false); | 805 doc.addEventListener("copy", this.documentCopy.bind(this), false); |
851 doc.addEventListener("contextmenu", this.contextMenuEventFired.bind(this), t rue); | 806 doc.addEventListener("contextmenu", this.contextMenuEventFired.bind(this), t rue); |
852 doc.addEventListener("click", this.documentClick.bind(this), false); | 807 doc.addEventListener("click", this.documentClick.bind(this), false); |
853 } | 808 } |
854 | 809 |
810 /** | |
811 * @constructor | |
812 * @implements {WebInspector.ActionDelegate} | |
813 */ | |
814 WebInspector.SkipAllPausesAndReloadActionDelegate = function() | |
pfeldman
2014/02/21 16:29:16
This does not belong to the inspector.js
apavlov
2014/02/24 09:57:57
I was unsure about these two, since they don't see
| |
815 { | |
816 } | |
817 | |
818 WebInspector.SkipAllPausesAndReloadActionDelegate.prototype = { | |
819 /** | |
820 * @param {!KeyboardEvent=} keyEvent | |
821 * @return {boolean} | |
822 */ | |
823 handleAction: function(keyEvent) | |
824 { | |
825 WebInspector.debuggerModel.skipAllPauses(true, true); | |
826 WebInspector.resourceTreeModel.reloadPage(keyEvent && keyEvent.shiftKey) ; | |
827 return true; | |
828 } | |
829 } | |
830 | |
831 /** | |
832 * @constructor | |
833 * @implements {WebInspector.ActionDelegate} | |
834 */ | |
835 WebInspector.DebugReloadActionDelegate = function() | |
pfeldman
2014/02/21 16:29:16
ditto
apavlov
2014/03/17 13:40:59
Agreed on leaving these here for now offline.
| |
836 { | |
837 } | |
838 | |
839 WebInspector.DebugReloadActionDelegate.prototype = { | |
840 /** | |
841 * @param {!KeyboardEvent=} keyEvent | |
842 * @return {boolean} | |
843 */ | |
844 handleAction: function(keyEvent) | |
845 { | |
846 if (window.DEBUG) { | |
847 WebInspector.reload(); | |
848 return true; | |
849 } | |
850 return false; | |
851 } | |
852 } | |
853 | |
854 | |
855 window.DEBUG = true; | 855 window.DEBUG = true; |
OLD | NEW |