-
Notifications
You must be signed in to change notification settings - Fork 11
/
cbSourceEditor.html
35 lines (33 loc) · 55.8 KB
/
cbSourceEditor.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!DOCTYPE HTML>
<meta charset="utf-8"/>
<title>Source Editor [0.1.0a11 - 2020-01-29]</title>
<body>
<a href="custombutton://%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%0D%0A%3Ccustombutton%20xmlns%3Acb%3D%22http%3A//xsms.nm.ru/custombuttons/%22%3E%0A%20%20%3Cname%3ESource%20Editor%3C/name%3E%0A%20%20%3Cimage%3E%3C%21%5BCDATA%5Bdata%3Aimage/png%3Bbase64%2CiVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAALtSURBVBgZTcFLaFxVAIDh/5577jwzj0wSUmqMtKIiBltbbJ1FUCxVoQu3FrHGVRU3BVcKrkTcKOhCUOtOAyJ23WIQtFawpoooZWKJpnbsNJN5PzP3PO5xArPo93nOOfasXCgfAz48mE8UhzpiqCN0FLFrog7QA+qABVpAA/gC+FYyERlz/NC+qeIbT85xt4GKckMV5Voju6A09ELLzXqfi38PTgLnJBORMfPZmMeectsSeB7SA19CPBAsxgW+EAQ+PLaQZH8uXTj/S+UDwYTVOitxmAh6yqOjoR1CZwSdETR2Yadv2fPm6i2KB9IszQZzkgkVmvnLZcuP21VeO1rgs+tdAu1YOZxlKiHw8fA9iADPdvn5nxa/3epUBGOH39sqjETu2UJG4oUwDB2RcmRSHuevdtjpWgZhxEBH4KDaDflobbNrlVoRh97demHpgfTth+5J5ZpNw5kjWQxw6mCa7aYlk4bPr7X54XqfkfGIHNjAYpQ6cOH1x9fEw/cnP13M+Ik7bc3ZYxniMR9PQCElObmYptox7E97XK0MscbhHJgwxKrQMiZ+v9Y9u3knHBUCn08ut6m2DQJHe6C5WOqQl4KbVcXR2QSxwENbS38wNEapLmNi4/0Hv/r3zxvHN0p1YnGP1e/r4ODr9TbZlKBTU7xSnKG4lCUZQKMfYkJVvfT2c44xyVjKr6lpEUI3g3UOPIE1lu6O5aUTcyRjPjhISUGttYtVYYUJuXxudRZ4p/jIvZx+eoHvSopmz/Ly8jyJwBFIkD7EfMimYLM8xChVZUJapU4Ap34tbdHalfRDh7aOUHsoE2FsROQchVyOV5/Zx3ZjiFWqxoS0Wh95/qlHk2+9+AR3sw60dSgDOPj4UoVUAL3+EKt1gwlptd7arnf4cq1EfipJPpsgn46TS8fJpGLEY4K4FJxenicuodbsYbX+jwkZGfPNlfWNhSvrG/cBM8AMMA1MA7lELAgSiYBsOkk+m+KPv8o3gJ+Y+B9yFXCQeyJWrQAAAABJRU5ErkJggg%3D%3D%5D%5D%3E%3C/image%3E%0A%20%20%3Cmode%3E0%3C/mode%3E%0A%20%20%3Cinitcode%3E%3C%21%5BCDATA%5B//%20https%3A//github.com/Infocatcher/Custom_Buttons/tree/master/CB_Source_Editor%0A//%20http%3A//infocatcher.ucoz.net/js/cb/cbSourceEditor.js%0A%0A//%20Source%20Editor%20%28formerly%20Orion%20Editor%29%20button%20for%20Custom%20Buttons%0A//%20%28code%20for%20%22initialization%22%20section%29%0A%0A//%20%28c%29%20Infocatcher%202012-2020%0A//%20version%200.1.0a11%20-%202020-01-29%0A%0Avar%20options%20%3D%20%7B%0A%09cssInHelp%3A%20true%2C%0A%09codeMirror%3A%20%7B%0A%09%09lineNumbers%3A%20true%2C%0A%09%09enableCodeFolding%3A%20true%2C%0A%09%09showTrailingSpace%3A%20true%2C%0A%09%09lineWrapping%3A%20false%2C%0A%09%09autocomplete%3A%20true%2C%0A%09%09fontSize%3A%2012%0A%09%7D%2C%0A%09orion%3A%20%7B%0A%09%09lineNumbers%3A%20true%0A%09%7D%0A%7D%3B%0A//%20Also%20see%20devtools.editor.*%20preferences%20in%20about%3Aconfig%0A%0Aconst%20watcherId%20%3D%20%22customButtonsSourceEditor_%22%20+%20this.id%3B%0Avar%20%7BComponents%7D%20%3D%20window%3B%20//%20Prevent%20garbage%20collection%20in%20Firefox%203.6%20and%20older%0Avar%20storage%20%3D%20%28function%28%29%20%7B%0A%09if%28%21%28%22Services%22%20in%20window%29%29%20//%20Firefox%203.6%20and%20older%0A%09%09return%20Application.storage%3B%0A%09//%20Simple%20replacement%20for%20Application.storage%0A%09//%20See%20https%3A//bugzilla.mozilla.org/show_bug.cgi%3Fid%3D1090880%0A%09//var%20global%20%3D%20Components.utils.getGlobalForObject%28Services%29%3B%0A%09//%20Ensure%2C%20that%20we%20have%20global%20object%20%28because%20window.Services%20may%20be%20overwritten%29%0A%09var%20global%20%3D%20Components.utils.import%28%22resource%3A//gre/modules/Services.jsm%22%2C%20%7B%7D%29%3B%0A%09var%20ns%20%3D%20%22_cbSourceEditorStorage%22%3B%0A%09//%20Note%3A%20Firefox%2057+%20returns%20NonSyntacticVariablesObject%20w/o%20.Object%20property%0A%09var%20storage%20%3D%20global%5Bns%5D%20%7C%7C%20%28global%5Bns%5D%20%3D%20Components.utils.getGlobalForObject%28global%29.Object.create%28null%29%29%3B%0A%09return%20%7B%0A%09%09get%3A%20function%28key%2C%20defaultVal%29%20%7B%0A%09%09%09if%28key%20in%20storage%29%0A%09%09%09%09return%20storage%5Bkey%5D%3B%0A%09%09%09return%20defaultVal%3B%0A%09%09%7D%2C%0A%09%09set%3A%20function%28key%2C%20val%29%20%7B%0A%09%09%09if%28key%20%3D%3D%3D%20null%29%0A%09%09%09%09delete%20storage%5Bkey%5D%3B%0A%09%09%09else%0A%09%09%09%09storage%5Bkey%5D%20%3D%20val%3B%0A%09%09%7D%0A%09%7D%3B%0A%7D%29%28%29%3B%0Avar%20watcher%20%3D%20storage.get%28watcherId%2C%20null%29%3B%0Aif%28%21watcher%29%20%7B%0A%09watcher%20%3D%20%7B%0A%09%09REASON_STARTUP%3A%201%2C%0A%09%09REASON_SHUTDOWN%3A%202%2C%0A%09%09REASON_WINDOW_LOADED%3A%203%2C%0A%09%09REASON_WINDOW_CLOSED%3A%204%2C%0A%0A%09%09get%20obs%28%29%20%7B%0A%09%09%09delete%20this.obs%3B%0A%09%09%09return%20this.obs%20%3D%20Components.classes%5B%[email protected]/observer-service%3B1%22%5D%0A%09%09%09%09.getService%28Components.interfaces.nsIObserverService%29%3B%0A%09%09%7D%2C%0A%09%09get%20ww%28%29%20%7B%0A%09%09%09delete%20this.ww%3B%0A%09%09%09return%20this.ww%20%3D%20Components.classes%5B%[email protected]/embedcomp/window-watcher%3B1%22%5D%0A%09%09%09%09.getService%28Components.interfaces.nsIWindowWatcher%29%3B%0A%09%09%7D%2C%0A%09%09get%20wm%28%29%20%7B%0A%09%09%09delete%20this.wm%3B%0A%09%09%09return%20this.wm%20%3D%20Components.classes%5B%[email protected]/appshell/window-mediator%3B1%22%5D%0A%09%09%09%09.getService%28Components.interfaces.nsIWindowMediator%29%3B%0A%09%09%7D%2C%0A%09%09get%20platformVersion%28%29%20%7B%0A%09%09%09delete%20this.platformVersion%3B%0A%09%09%09return%20this.platformVersion%20%3D%20parseFloat%28Services.appinfo.platformVersion%29%3B%0A%09%09%7D%2C%0A%09%09get%20hasCodeMirror%28%29%20%7B%0A%09%09%09delete%20this.hasCodeMirror%3B%0A%09%09%09return%20this.hasCodeMirror%20%3D%20Services.appinfo.name%20%3D%3D%20%22Pale%20Moon%22%20//%7E%20todo%3A%20test%0A%09%09%09%09%7C%7C%20this.platformVersion%20%3E%3D%2027%3B%0A%09%09%7D%2C%0A%09%09init%3A%20function%28reason%29%20%7B%0A%09%09%09if%28%21this.hasCodeMirror%29%20%7B%0A%09%09%09%09this.isBrowserWindow%20%3D%20function%28%29%20%7B%0A%09%09%09%09%09return%20false%3B%0A%09%09%09%09%7D%3B%0A%09%09%09%7D%0A%09%09%09this.obs.addObserver%28this%2C%20%22quit-application-granted%22%2C%20false%29%3B%0A%09%09%09var%20ws%20%3D%20this.wm.getEnumerator%28null%29%3B%0A%09%09%09while%28ws.hasMoreElements%28%29%29%0A%09%09%09%09this.initWindow%28ws.getNext%28%29%2C%20reason%29%3B%0A%09%09%09this.ww.registerNotification%28this%29%3B%0A%09%09%7D%2C%0A%09%09destroy%3A%20function%28reason%29%20%7B%0A%09%09%09this.obs.removeObserver%28this%2C%20%22quit-application-granted%22%29%3B%0A%09%09%09var%20ws%20%3D%20this.wm.getEnumerator%28null%29%3B%0A%09%09%09while%28ws.hasMoreElements%28%29%29%0A%09%09%09%09this.destroyWindow%28ws.getNext%28%29%2C%20reason%29%3B%0A%09%09%09this.ww.unregisterNotification%28this%29%3B%0A%09%09%7D%2C%0A%09%09initWindow%3A%20function%28window%2C%20reason%2C%20isFrame%29%20%7B%0A%09%09%09if%28this.isBrowserWindow%28window%29%29%20%7B%0A%09%09%09%09this.initBrowserWindow%28window%2C%20reason%29%3B%0A%09%09%09%09return%3B%0A%09%09%09%7D%0A%09%09%09if%28%21this.isEditorWindow%28window%29%29%0A%09%09%09%09return%3B%0A%09%09%09_log%28%22initWindow%28%29%3A%20isFrame%3A%20%22%20+%20isFrame%29%3B%0A%09%09%09var%20document%20%3D%20window.document%3B%0A%09%09%09if%28isFrame%29%0A%09%09%09%09window.addEventListener%28%22unload%22%2C%20this%2C%20false%29%3B%0A%0A%09%09%09Components.classes%5B%[email protected]/moz/jssubscript-loader%3B1%22%5D%0A%09%09%09%09.getService%28Components.interfaces.mozIJSSubScriptLoader%29%0A%09%09%09%09.loadSubScript%28%22chrome%3A//global/content/globalOverlay.js%22%2C%20window%29%3B%0A%0A%09%09%09var%20isCodeMirror%20%3D%20false%3B%0A%09%09%09try%20%7B%20//%20See%20chrome%3A//browser/content/devtools/scratchpad.js%0A%09%09%09%09Components.utils.import%28%22resource%3A///modules/source-editor.jsm%22%2C%20window%29%3B%0A%09%09%09%7D%0A%09%09%09catch%28e%29%20%7B%0A%09%09%09%09var%20loader%20%3D%20this.platformVersion%20%3E%3D%2044%20//%20See%20https%3A//bugzilla.mozilla.org/show_bug.cgi%3Fid%3D912121%0A%09%09%09%09%09%3F%20%22resource%3A//devtools/shared/Loader.jsm%22%0A%09%09%09%09%09%3A%20%22resource%3A//gre/modules/devtools/Loader.jsm%22%3B%0A%09%09%09%09var%20g%20%3D%20Components.utils.import%28loader%2C%20%7B%7D%29%3B%0A%09%09%09%09var%20require%20%3D%20%28g.devtools%20%7C%7C%20g%29.require%3B%0A%09%09%09%09%5B%0A%09%09%09%09%09%22devtools/sourceeditor/editor%22%2C%0A%09%09%09%09%09%22devtools/client/sourceeditor/editor%22%2C%20//%20Firefox%2044+%0A%09%09%09%09%09%22devtools/client/shared/sourceeditor/editor%22%20//%20Firefox%2068+%0A%09%09%09%09%5D.some%28function%28path%29%20%7B%0A%09%09%09%09%09try%20%7B%0A%09%09%09%09%09%09return%20window.SourceEditor%20%3D%20require%28path%29%3B%0A%09%09%09%09%09%7D%0A%09%09%09%09%09catch%28e%29%20%7B%0A%09%09%09%09%09%7D%0A%09%09%09%09%09return%20null%3B%0A%09%09%09%09%7D%29%3B%0A%09%09%09%09isCodeMirror%20%3D%20true%3B%0A%09%09%09%7D%0A%09%09%09var%20SourceEditor%20%3D%20window.SourceEditor%3B%0A%0A%09%09%09//%20See%20view-source%3Achrome%3A//browser/content/devtools/scratchpad.xul%0A%09%09%09//%20+%20view-source%3Achrome%3A//browser/content/devtools/source-editor-overlay.xul%0A%09%09%09var%20psXUL%20%3D%20%28isCodeMirror%0A%09%09%09%3F%20%27%3C%21DOCTYPE%20popupset%20%5B%5C%0A%09%09%09%09%3C%21ENTITY%20%25%20editMenuStrings%20SYSTEM%20%22chrome%3A//global/locale/editMenuOverlay.dtd%22%3E%5C%0A%09%09%09%09%25editMenuStrings%3B%5C%0A%09%09%09%09%3C%21ENTITY%20%25%20sourceEditorStrings%20SYSTEM%20%22%27%20+%20%28%0A%09%09%09%09%09Services.appinfo.name%20%3D%3D%20%22Pale%20Moon%22%20%7C%7C%20Services.appinfo.name%20%3D%3D%20%22Basilisk%22%0A%09%09%09%09%09%09%3F%20this.platformVersion%20%3E%3D%204.1%0A%09%09%09%09%09%09%09%3F%20%22chrome%3A//devtools/locale/sourceeditor.dtd%22%0A%09%09%09%09%09%09%09%3A%20%22chrome%3A//global/locale/devtools/sourceeditor.dtd%22%0A%09%09%09%09%09%09%3A%20this.platformVersion%20%3E%3D%2045%0A%09%09%09%09%09%09%09%3F%20%22chrome%3A//devtools/locale/sourceeditor.dtd%22%0A%09%09%09%09%09%09%09%3A%20%22chrome%3A//browser/locale/devtools/sourceeditor.dtd%22%0A%09%09%09%09%29%20+%20%27%22%3E%5C%0A%09%09%09%09%25sourceEditorStrings%3B%5C%0A%09%09%09%5D%3E%5C%0A%09%09%09%3Cpopupset%20id%3D%22sourceEditorPopupset%22%5C%0A%09%09%09%09xmlns%3D%22http%3A//www.mozilla.org/keymaster/gatekeeper/there.is.only.xul%22%3E%5C%0A%09%09%09%09%3Cmenupopup%20id%3D%22sourceEditorContext%22%5C%0A%09%09%09%09%09onpopupshowing%3D%22goUpdateSourceEditorMenuItems%28%29%22%3E%5C%0A%09%09%09%09%09%3Cmenuitem%20id%3D%22menu_undo%22%20label%3D%22%26undoCmd.label%3B%22%20accesskey%3D%22%26undoCmd.accesskey%3B%22%5C%0A%09%09%09%09%09%09oncommand%3D%22goDoCommand%28%5C%27cmd_undo%5C%27%29%22%20/%3E%5C%0A%09%09%09%09%09%3Cmenuitem%20id%3D%22menu_redo%22%20label%3D%22%26redoCmd.label%3B%22%20accesskey%3D%22%26redoCmd.accesskey%3B%22%5C%0A%09%09%09%09%09%09oncommand%3D%22goDoCommand%28%5C%27cmd_redo%5C%27%29%22%20/%3E%5C%0A%09%09%09%09%09%3Cmenuseparator/%3E%5C%0A%09%09%09%09%09%3Cmenuitem%20id%3D%22menu_cut%22%20label%3D%22%26cutCmd.label%3B%22%20accesskey%3D%22%26cutCmd.accesskey%3B%22%5C%0A%09%09%09%09%09%09oncommand%3D%22goDoCommand%28%5C%27cmd_cut%5C%27%29%22%20/%3E%5C%0A%09%09%09%09%09%3Cmenuitem%20id%3D%22menu_copy%22%20label%3D%22%26copyCmd.label%3B%22%20accesskey%3D%22%26copyCmd.accesskey%3B%22%5C%0A%09%09%09%09%09%09oncommand%3D%22goDoCommand%28%5C%27cmd_copy%5C%27%29%22%20/%3E%5C%0A%09%09%09%09%09%3Cmenuitem%20id%3D%22menu_paste%22%20label%3D%22%26pasteCmd.label%3B%22%20accesskey%3D%22%26pasteCmd.accesskey%3B%22%5C%0A%09%09%09%09%09%09oncommand%3D%22goDoCommand%28%5C%27cmd_paste%5C%27%29%22%20/%3E%5C%0A%09%09%09%09%09%3Cmenuitem%20id%3D%22menu_delete%22%20label%3D%22%26deleteCmd.label%3B%22%20accesskey%3D%22%26deleteCmd.accesskey%3B%22%5C%0A%09%09%09%09%09%09oncommand%3D%22goDoCommand%28%5C%27cmd_delete%5C%27%29%22%20/%3E%5C%0A%09%09%09%09%09%3Cmenuseparator/%3E%5C%0A%09%09%09%09%09%3Cmenuitem%20id%3D%22menu_selectAll%22%20label%3D%22%26selectAllCmd.label%3B%22%20accesskey%3D%22%26selectAllCmd.accesskey%3B%22%5C%0A%09%09%09%09%09%09oncommand%3D%22goDoCommand%28%5C%27cmd_selectAll%5C%27%29%22%20/%3E%5C%0A%09%09%09%09%09%3Cmenuseparator/%3E%5C%0A%09%09%09%09%09%3Cmenuitem%20id%3D%22menu_find%22%20label%3D%22%26findCmd.label%3B%22%20accesskey%3D%22%26findCmd.accesskey%3B%22%20/%3E%5C%0A%09%09%09%09%09%3Cmenuitem%20id%3D%22menu_findAgain%22%20label%3D%22%26findAgainCmd.label%3B%22%20accesskey%3D%22%26findAgainCmd.accesskey%3B%22%20/%3E%5C%0A%09%09%09%09%09%3Cmenuseparator/%3E%5C%0A%09%09%09%09%09%3Cmenuitem%20id%3D%22se-menu-gotoLine%22%5C%0A%09%09%09%09%09%09label%3D%22%26gotoLineCmd.label%3B%22%5C%0A%09%09%09%09%09%09accesskey%3D%22%26gotoLineCmd.accesskey%3B%22%5C%0A%09%09%09%09%09%09key%3D%22key_gotoLine%22%5C%0A%09%09%09%09%09%09oncommand%3D%22goDoCommand%28%5C%27cmd_gotoLine%5C%27%29%22/%3E%5C%0A%09%09%09%09%3C/menupopup%3E%5C%0A%09%09%09%3C/popupset%3E%27%0A%09%09%09%3A%20%27%3Cpopupset%20id%3D%22sourceEditorPopupset%22%5C%0A%09%09%09%09xmlns%3D%22http%3A//www.mozilla.org/keymaster/gatekeeper/there.is.only.xul%22%3E%5C%0A%09%09%09%09%3Cmenupopup%20id%3D%22sourceEditorContext%22%5C%0A%09%09%09%09%09onpopupshowing%3D%22goUpdateSourceEditorMenuItems%28%29%22%3E%5C%0A%09%09%09%09%09%3Cmenuitem%20id%3D%22se-menu-undo%22/%3E%5C%0A%09%09%09%09%09%3Cmenuitem%20id%3D%22se-menu-redo%22/%3E%5C%0A%09%09%09%09%09%3Cmenuseparator/%3E%5C%0A%09%09%09%09%09%3Cmenuitem%20id%3D%22se-menu-cut%22/%3E%5C%0A%09%09%09%09%09%3Cmenuitem%20id%3D%22se-menu-copy%22/%3E%5C%0A%09%09%09%09%09%3Cmenuitem%20id%3D%22se-menu-paste%22/%3E%5C%0A%09%09%09%09%09%3Cmenuitem%20id%3D%22se-menu-delete%22/%3E%5C%0A%09%09%09%09%09%3Cmenuseparator/%3E%5C%0A%09%09%09%09%09%3Cmenuitem%20id%3D%22se-menu-selectAll%22/%3E%5C%0A%09%09%09%09%09%3Cmenuseparator/%3E%5C%0A%09%09%09%09%09%3Cmenuitem%20id%3D%22se-menu-find%22/%3E%5C%0A%09%09%09%09%09%3Cmenuitem%20id%3D%22se-menu-findAgain%22/%3E%5C%0A%09%09%09%09%09%3Cmenuseparator/%3E%5C%0A%09%09%09%09%09%3Cmenuitem%20id%3D%22se-menu-gotoLine%22/%3E%5C%0A%09%09%09%09%3C/menupopup%3E%5C%0A%09%09%09%3C/popupset%3E%27%0A%09%09%09%29.replace%28/%3E%5Cs+%3C/g%2C%20%22%3E%3C%22%29%3B%0A%0A%09%09%09var%20ps%20%3D%20this.parseXULFromString%28psXUL%29%3B%0A%20%20%20%20%20%20%20%20%20%20%20%20//%20%22Edit%20Custom%20Button%20in%20Tab%22%20button%2C%20Firefox%2071+%0A%20%20%20%20%20%20%20%20%20%20%20%20if%28isFrame%20%26%26%20%22parseFromSafeString%22%20in%20window.DOMParser.prototype%29%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20ps%20%3D%20window.MozXULElement.parseXULToFragment%28ps.outerHTML%29%3B%0A%09%09%09document.documentElement.appendChild%28ps%29%3B%0A%0A%09%09%09window.setTimeout%28function%28%29%20%7B%0A%09%09%09%09function%20appendNode%28nodeName%2C%20id%29%20%7B%0A%09%09%09%09%09var%20node%20%3D%20document.createElementNS%28xulns%2C%20nodeName%29%3B%0A%09%09%09%09%09node.id%20%3D%20id%3B%0A%09%09%09%09%09document.documentElement.appendChild%28node%29%3B%0A%09%09%09%09%7D%0A%09%09%09%09appendNode%28%22commandset%22%2C%20%22editMenuCommands%22%29%3B%0A%09%09%09%09appendNode%28%22commandset%22%2C%20%22sourceEditorCommands%22%29%3B%0A%09%09%09%09appendNode%28%22keyset%22%2C%20%22sourceEditorKeys%22%29%3B%0A%09%09%09%09appendNode%28%22keyset%22%2C%20%22editMenuKeys%22%29%3B%0A%0A%09%09%09%09this.loadOverlays%28%0A%09%09%09%09%09window%2C%0A%09%09%09%09%09function%20done%28%29%20%7B%0A%09%09%09%09%09%09window.setTimeout%28function%28%29%20%7B%0A%09%09%09%09%09%09%09var%20mp%20%3D%20document.getElementById%28%22sourceEditorContext%22%29%3B%0A%09%09%09%09%09%09%09if%28mp.state%20%3D%3D%20%22closed%22%29%0A%09%09%09%09%09%09%09%09return%3B%0A%09%09%09%09%09%09%09Array.prototype.forEach.call%28%0A%09%09%09%09%09%09%09%09mp.getElementsByAttribute%28%22command%22%2C%20%22*%22%29%2C%0A%09%09%09%09%09%09%09%09function%28mi%29%20%7B%0A%09%09%09%09%09%09%09%09%09var%20cmd%20%3D%20mi.getAttribute%28%22command%22%29%3B%0A%09%09%09%09%09%09%09%09%09var%20controller%20%3D%20document.commandDispatcher%0A%09%09%09%09%09%09%09%09%09%09.getControllerForCommand%28cmd%29%3B%0A%09%09%09%09%09%09%09%09%09if%28controller%20%26%26%20%21controller.isCommandEnabled%28cmd%29%29%0A%09%09%09%09%09%09%09%09%09%09mi.setAttribute%28%22disabled%22%2C%20%22true%22%29%3B%0A%09%09%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09%09%29%3B%0A%09%09%09%09%09%09%7D%2C%200%29%3B%0A%09%09%09%09%09%09if%28%21isCodeMirror%29%0A%09%09%09%09%09%09%09return%3B%0A%09%09%09%09%09%09//%20See%20view-source%3Achrome%3A//browser/content/devtools/scratchpad.xul%20in%20Firefox%2027.0a1%0A%09%09%09%09%09%09window.goUpdateSourceEditorMenuItems%20%3D%20function%28%29%20%7B%0A%09%09%09%09%09%09%09goUpdateGlobalEditMenuItems%28%29%3B%0A%09%09%09%09%09%09%09var%20commands%20%3D%20%5B%22cmd_undo%22%2C%20%22cmd_redo%22%2C%20%22cmd_cut%22%2C%20%22cmd_paste%22%2C%20%22cmd_delete%22%5D%3B%0A%09%09%09%09%09%09%09commands.forEach%28goUpdateCommand%29%3B%0A%09%09%09%09%09%09%7D%3B%0A%09%09%09%09%09%09var%20cmdsMap%20%3D%20%7B%0A%09%09%09%09%09%09%09%22se-menu-undo%22%3A%20%20%20%22cmd_undo%22%2C%0A%09%09%09%09%09%09%09%22se-menu-redo%22%3A%20%20%20%22cmd_redo%22%2C%0A%09%09%09%09%09%09%09%22se-menu-cut%22%3A%20%20%20%20%22cmd_cut%22%2C%0A%09%09%09%09%09%09%09%22se-menu-copy%22%3A%20%20%20%22cmd_copy%22%2C%0A%09%09%09%09%09%09%09%22se-menu-paste%22%3A%20%20%22cmd_paste%22%2C%0A%09%09%09%09%09%09%09%22se-menu-delete%22%3A%20%22cmd_delete%22%2C%0A%09%09%09%09%09%09%09__proto__%3A%20null%0A%09%09%09%09%09%09%7D%3B%0A%09%09%09%09%09%09for%28var%20id%20in%20cmdsMap%29%20%7B%0A%09%09%09%09%09%09%09var%20mi%20%3D%20document.getElementById%28id%29%3B%0A%09%09%09%09%09%09%09mi%20%26%26%20mi.setAttribute%28%22command%22%2C%20cmdsMap%5Bid%5D%29%3B%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09//%20We%20can%27t%20use%20command%3D%22cmd_selectAll%22%2C%20menuitem%20will%20be%20wrongly%20disabled%20sometimes%0A%09%09%09%09%09%09var%20enabledCmdsMap%20%3D%20%7B%0A%09%09%09%09%09%09%09%22se-menu-selectAll%22%3A%20%22cmd_selectAll%22%2C%0A%09%09%09%09%09%09%09%22se-menu-findAgain%22%3A%20%22cmd_findAgain%22%2C%0A%09%09%09%09%09%09%09__proto__%3A%20null%0A%09%09%09%09%09%09%7D%3B%0A%09%09%09%09%09%09for%28var%20id%20in%20enabledCmdsMap%29%20%7B%0A%09%09%09%09%09%09%09var%20mi%20%3D%20document.getElementById%28id%29%3B%0A%09%09%09%09%09%09%09if%28mi%29%20%7B%0A%09%09%09%09%09%09%09%09mi.removeAttribute%28%22command%22%29%3B%0A%09%09%09%09%09%09%09%09mi.removeAttribute%28%22disabled%22%29%3B%0A%09%09%09%09%09%09%09%09mi.setAttribute%28%22oncommand%22%2C%20%22goDoCommand%28%27%22%20+%20enabledCmdsMap%5Bid%5D%20+%20%22%27%29%3B%22%29%3B%0A%09%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09//%20Workaround%3A%20emulate%20keyboard%20shortcut%0A%09%09%09%09%09%09var%20keyCmdsMap%20%3D%20%7B%0A%09%09%09%09%09%09%09%22menu_find%22%3A%20%20%20%20%20%20%7B%20keyCode%3A%20KeyboardEvent.DOM_VK_F%2C%20charCode%3A%20%22f%22.charCodeAt%280%29%2C%20ctrlKey%3A%20true%20%7D%2C%0A%09%09%09%09%09%09%09%22menu_findAgain%22%3A%20%7B%20keyCode%3A%20KeyboardEvent.DOM_VK_G%2C%20charCode%3A%20%22g%22.charCodeAt%280%29%2C%20ctrlKey%3A%20true%20%7D%2C%0A%09%09%09%09%09%09%09__proto__%3A%20null%0A%09%09%09%09%09%09%7D%3B%0A%09%09%09%09%09%09var%20_key%20%3D%20function%28%29%20%7B%0A%09%09%09%09%09%09%09var%20e%20%3D%20this._keyData%3B%0A%09%09%09%09%09%09%09var%20evt%20%3D%20document.createEvent%28%22KeyboardEvent%22%29%3B%0A%09%09%09%09%09%09%09evt.initKeyEvent%28%0A%09%09%09%09%09%09%09%09%22keydown%22%2C%20true%20/*bubbles*/%2C%20true%20/*cancelable*/%2C%20window%2C%0A%09%09%09%09%09%09%09%09e.ctrlKey%20%7C%7C%20false%2C%20e.altKey%20%7C%7C%20false%2C%20e.shiftKey%20%7C%7C%20false%2C%20e.metaKey%20%7C%7C%20false%2C%0A%09%09%09%09%09%09%09%09e.keyCode%20%7C%7C%200%2C%20e.charCode%20%7C%7C%200%0A%09%09%09%09%09%09%09%29%3B%0A%09%09%09%09%09%09%09document.commandDispatcher.focusedElement.dispatchEvent%28evt%29%3B%0A%09%09%09%09%09%09%7D%3B%0A%09%09%09%09%09%09for%28var%20id%20in%20keyCmdsMap%29%20%7B%0A%09%09%09%09%09%09%09var%20mi%20%3D%20document.getElementById%28id%29%3B%0A%09%09%09%09%09%09%09if%28mi%29%20%7B%0A%09%09%09%09%09%09%09%09mi.removeAttribute%28%22command%22%29%3B%0A%09%09%09%09%09%09%09%09mi.removeAttribute%28%22disabled%22%29%3B%0A%09%09%09%09%09%09%09%09mi.setAttribute%28%22oncommand%22%2C%20%22this._key%28%29%3B%22%29%3B%0A%09%09%09%09%09%09%09%09mi._keyData%20%3D%20keyCmdsMap%5Bid%5D%3B%0A%09%09%09%09%09%09%09%09mi._key%20%3D%20_key%3B%0A%09%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09//%20Fix%20styles%20for%20autocomplete%20tooltip%0A%09%09%09%09%09%09function%20css%28uri%29%20%7B%0A%09%09%09%09%09%09%09document.insertBefore%28document.createProcessingInstruction%28%0A%09%09%09%09%09%09%09%09%22xml-stylesheet%22%2C%0A%09%09%09%09%09%09%09%09%27href%3D%22%27%20+%20uri%20+%20%27%22%20type%3D%22text/css%22%27%0A%09%09%09%09%09%09%09%29%2C%20document.documentElement%29%3B%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09css%28%22resource%3A//devtools/client/themes/variables.css%22%29%3B%0A%09%09%09%09%09%09css%28%22resource%3A//devtools/client/themes/common.css%22%29%3B%0A%09%09%09%09%09%09css%28%22chrome%3A//devtools/skin/tooltips.css%22%29%3B%0A%09%09%09%09%09%09if%28this.platformVersion%20%3E%3D%2068%29%20window.setTimeout%28function%20fixSelection%28%29%20%7B%0A%09%09%09%09%09%09%09var%20sheets%20%3D%20document.styleSheets%3B%0A%09%09%09%09%09%09%09for%28var%20i%20%3D%20sheets.length%20-%201%3B%20i%20%3E%3D%200%3B%20--i%29%20%7B%0A%09%09%09%09%09%09%09%09var%20sheet%20%3D%20sheets%5Bi%5D%3B%0A%09%09%09%09%09%09%09%09if%28sheet.href%20%21%3D%20%22resource%3A//devtools/client/themes/common.css%22%29%0A%09%09%09%09%09%09%09%09%09continue%3B%0A%09%09%09%09%09%09%09%09try%20%7B%0A%09%09%09%09%09%09%09%09%09var%20rules%20%3D%20sheet.cssRules%3B%0A%09%09%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09%09%09catch%28e%29%20%7B%0A%09%09%09%09%09%09%09%09%09//%20InvalidAccessError%3A%0A%09%09%09%09%09%09%09%09%09//%20A%20parameter%20or%20an%20operation%20is%20not%20supported%20by%20the%20underlying%20object%0A%09%09%09%09%09%09%09%09%09return%20window.setTimeout%28fixSelection%2C%2010%29%3B%0A%09%09%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09%09%09for%28var%20j%20%3D%200%2C%20len%20%3D%20rules.length%3B%20j%20%3C%20len%3B%20++j%29%0A%09%09%09%09%09%09%09%09%09if%28rules%5Bj%5D.selectorText%20%3D%3D%20%22%3A%3Aselection%22%29%0A%09%09%09%09%09%09%09%09%09%09return%20%21sheet.deleteRule%28j%29%3B%0A%09%09%09%09%09%09%09%09break%3B%0A%09%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09%09return%20false%3B%0A%09%09%09%09%09%09%7D%2C%2010%29%3B%0A%09%09%09%09%09%7D.bind%28this%29%2C%0A%09%09%09%09%09%5B%22chrome%3A//global/content/editMenuOverlay.xul%22%2C%20function%20check%28window%29%20%7B%0A%09%09%09%09%09%09return%20window.document.getElementById%28%22editMenuCommands%22%29.hasChildNodes%28%29%3B%0A%09%09%09%09%09%7D%5D%2C%0A%09%09%09%09%09%5B%22chrome%3A//browser/content/devtools/source-editor-overlay.xul%22%2C%20function%20check%28window%29%20%7B%0A%09%09%09%09%09%09return%20window.document.getElementById%28%22sourceEditorCommands%22%29.hasChildNodes%28%29%3B%0A%09%09%09%09%09%7D%5D%0A%09%09%09%09%29%3B%0A%09%09%09%7D.bind%28this%29%2C%20500%29%3B%20//%20We%20should%20wait%20to%20not%20break%20other%20extensions%20with%20document.loadOverlay%28%29%0A%0A%09%09%09var%20tabs%20%3D%20document.getElementById%28%22custombuttons-editbutton-tabbox%22%29%3B%0A%09%09%09var%20selectedPanel%20%3D%20tabs.selectedPanel%3B%0A%09%09%09Array.prototype.slice.call%28document.getElementsByTagName%28%22cbeditor%22%29%29.forEach%28function%28cbEditor%29%20%7B%0A%09%09%09%09if%28%22__sourceEditor%22%20in%20cbEditor%29%0A%09%09%09%09%09return%3B%0A%09%09%09%09var%20code%20%3D%20cbEditor.value%3B%0A%09%09%09%09var%20isCSS%20%3D%20options.cssInHelp%20%26%26%20cbEditor.id%20%3D%3D%20%22help%22%3B%0A%09%09%09%09if%28isCodeMirror%29%20%7B%0A%09%09%09%09%09var%20opts%20%3D%20%7B%0A%09%09%09%09%09%09mode%3A%20isCSS%0A%09%09%09%09%09%09%09%3F%20SourceEditor.modes.css%0A%09%09%09%09%09%09%09%3A%20SourceEditor.modes.js%2C%0A%09%09%09%09%09%09value%3A%20code%2C%0A%09%09%09%09%09%09lineNumbers%3A%20true%2C%0A%09%09%09%09%09%09enableCodeFolding%3A%20true%2C%0A%09%09%09%09%09%09showTrailingSpace%3A%20true%2C%0A%09%09%09%09%09%09autocomplete%3A%20true%2C%0A%09%09%09%09%09%09contextMenu%3A%20%22sourceEditorContext%22%0A%09%09%09%09%09%7D%3B%0A%09%09%09%09%09var%20optsOvr%20%3D%20options.codeMirror%3B%0A%09%09%09%09%09for%28var%20opt%20in%20optsOvr%29%20if%28optsOvr.hasOwnProperty%28opt%29%29%0A%09%09%09%09%09%09opts%5Bopt%5D%20%3D%20optsOvr%5Bopt%5D%3B%0A%09%09%09%09%09var%20se%20%3D%20new%20SourceEditor%28opts%29%3B%0A%09%09%09%09%09if%28%22codeMirror%22%20in%20se%29%20window.setTimeout%28function%28%29%20%7B%0A%09%09%09%09%09%09if%28%22insertCommandsController%22%20in%20se%29%0A%09%09%09%09%09%09%09se.insertCommandsController%28%29%3B%20//%20Pale%20Moon%20and%20Basilisk%0A%09%09%09%09%09%09else%0A%09%09%09%09%09%09%09this.insertCommandsController%28se%29%3B%0A%09%09%09%09%09%7D.bind%28this%29%2C%20200%29%3B%0A%09%09%09%09%7D%0A%09%09%09%09else%20%7B%0A%09%09%09%09%09var%20se%20%3D%20new%20SourceEditor%28%29%3B%0A%09%09%09%09%7D%0A%09%09%09%09se.__isCodeMirror%20%3D%20isCodeMirror%3B%0A%09%09%09%09var%20seElt%20%3D%20document.createElementNS%28xulns%2C%20%22hbox%22%29%3B%0A%09%09%09%09if%28cbEditor.id%29%0A%09%09%09%09%09seElt.id%20%3D%20%22sourceEditor-%22%20+%20cbEditor.id%3B%0A%09%09%09%09seElt.className%20%3D%20%22sourceEditor%22%3B%0A%09%09%09%09seElt.setAttribute%28%22flex%22%2C%201%29%3B%0A%09%09%09%09seElt.__sourceEditor%20%3D%20se%3B%0A%09%09%09%09cbEditor.parentNode.insertBefore%28seElt%2C%20cbEditor%29%3B%0A%09%09%09%09//cbEditor.setAttribute%28%22hidden%22%2C%20%22true%22%29%3B%0A%09%09%09%09cbEditor.setAttribute%28%22collapsed%22%2C%20%22true%22%29%3B%0A%09%09%09%09cbEditor.parentNode.appendChild%28cbEditor%29%3B%0A%09%09%09%09cbEditor.__sourceEditor%20%3D%20se%3B%0A%09%09%09%09cbEditor.__sourceEditorElt%20%3D%20seElt%3B%0A%09%09%09%09cbEditor.__defineGetter__%28%22value%22%2C%20function%28%29%20%7B%0A%09%09%09%09%09if%28%22__sourceEditor%22%20in%20this%29%20%7B%0A%09%09%09%09%09%09var%20se%20%3D%20this.__sourceEditor%3B%0A%09%09%09%09%09%09if%28%21se.__initialized%29%0A%09%09%09%09%09%09%09return%20se.__value%3B%0A%09%09%09%09%09%09return%20se.getText%28%29.replace%28/%5Cr%5Cn%3F%7C%5Cn%5Cr%3F/g%2C%20%22%5Cn%22%29%3B%0A%09%09%09%09%09%7D%0A%09%09%09%09%09return%20this.textbox.value%3B%0A%09%09%09%09%7D%29%3B%0A%09%09%09%09cbEditor.__defineSetter__%28%22value%22%2C%20function%28v%29%20%7B%0A%09%09%09%09%09if%28%22__sourceEditor%22%20in%20this%29%20%7B%0A%09%09%09%09%09%09var%20se%20%3D%20this.__sourceEditor%3B%0A%09%09%09%09%09%09if%28%21se.__initialized%29%20%7B%0A%09%09%09%09%09%09%09var%20_this%20%3D%20this%3B%0A%09%09%09%09%09%09%09se.__onLoadCallbacks.push%28function%28%29%20%7B%0A%09%09%09%09%09%09%09%09_this.value%20%3D%20v%3B%0A%09%09%09%09%09%09%09%7D%29%3B%0A%09%09%09%09%09%09%09return%20se.__value%20%3D%20v%3B%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09return%20se.setText%28v.replace%28/%5Cr%5Cn%3F%7C%5Cn%5Cr%3F/g%2C%20%22%5Cn%22%29%29%3B%0A%09%09%09%09%09%7D%0A%09%09%09%09%09return%20this.textbox.value%20%3D%20v%3B%0A%09%09%09%09%7D%29%3B%0A%09%09%09%09cbEditor.selectLine%20%3D%20function%28lineNumber%29%20%7B%0A%09%09%09%09%09if%28%22__sourceEditor%22%20in%20this%29%20%7B%0A%09%09%09%09%09%09var%20se%20%3D%20this.__sourceEditor%3B%0A%09%09%09%09%09%09if%28%21se.__initialized%29%20%7B%0A%09%09%09%09%09%09%09var%20_this%20%3D%20this%2C%20args%20%3D%20arguments%3B%0A%09%09%09%09%09%09%09se.__onLoadCallbacks.push%28function%28%29%20%7B%0A%09%09%09%09%09%09%09%09_this.selectLine.apply%28_this%2C%20args%29%3B%0A%09%09%09%09%09%09%09%7D%29%3B%0A%09%09%09%09%09%09%09return%20undefined%3B%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09if%28se.__isCodeMirror%29%20%7B%0A%09%09%09%09%09%09%09//se.focus%28%29%3B%0A%09%09%09%09%09%09%09//se.setCursor%28%7B%20line%3A%20lineNumber%20-%201%2C%20ch%3A%200%20%7D%29%3B%0A%09%09%09%09%09%09%09//%7E%20todo%3A%20optimize%0A%09%09%09%09%09%09%09var%20val%20%3D%20this.value%3B%0A%09%09%09%09%09%09%09var%20lines%20%3D%20val.split%28%22%5Cn%22%29%3B%0A%09%09%09%09%09%09%09var%20line%20%3D%20Math.min%28lineNumber%20-%201%2C%20lines.length%29%3B%0A%09%09%09%09%09%09%09var%20ch%20%3D%20lines%5Bline%5D.length%3B%0A%09%09%09%09%09%09%09se.focus%28%29%3B%0A%09%09%09%09%09%09%09return%20se.setSelection%28%7B%20line%3A%20line%2C%20ch%3A%200%20%7D%2C%20%7B%20line%3A%20line%2C%20ch%3A%20ch%20%7D%29%3B%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09else%20%7B%0A%09%09%09%09%09%09%09var%20selStart%20%3D%20se.getLineStart%28lineNumber%20-%201%29%3B%0A%09%09%09%09%09%09%09var%20selEnd%20%3D%20se.getLineEnd%28lineNumber%20-%201%2C%20false%29%3B%0A%09%09%09%09%09%09%09se.focus%28%29%3B%0A%09%09%09%09%09%09%09return%20se.setSelection%28selStart%2C%20selEnd%29%3B%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%7D%0A%09%09%09%09%09return%20this.__proto__.selectLine.apply%28this%2C%20arguments%29%3B%0A%09%09%09%09%7D%3B%0A%0A%09%09%09%09//%20For%20edit_button%28%29%20from%20chrome%3A//custombuttons/content/editExternal.js%0A%09%09%09%09seElt.__cbEditor%20%3D%20cbEditor%3B%0A%09%09%09%09seElt.__defineGetter__%28%22localName%22%2C%20function%28%29%20%7B%0A%09%09%09%09%09return%20%22cbeditor%22%3B%0A%09%09%09%09%7D%29%3B%0A%09%09%09%09seElt.__defineGetter__%28%22value%22%2C%20function%28%29%20%7B%0A%09%09%09%09%09return%20this.__cbEditor.value%3B%0A%09%09%09%09%7D%29%3B%0A%09%09%09%09seElt.__defineSetter__%28%22value%22%2C%20function%28val%29%20%7B%0A%09%09%09%09%09this.__cbEditor.value%20%3D%20val%3B%0A%09%09%09%09%7D%29%3B%0A%0A%09%09%09%09se.__initialized%20%3D%20false%3B%0A%09%09%09%09se.__onLoadCallbacks%20%3D%20%5B%5D%3B%0A%09%09%09%09se.__value%20%3D%20code%3B%0A%09%09%09%09var%20onTextChanged%20%3D%20se.__onTextChanged%20%3D%20function%28%29%20%7B%0A%09%09%09%09%09window.editor.changed%20%3D%20true%3B%0A%09%09%09%09%7D%3B%0A%09%09%09%09var%20isLoaded%20%3D%20reason%20%3D%3D%20this.REASON_WINDOW_LOADED%3B%0A%09%09%09%09function%20done%28%29%20%7B%0A%09%09%09%09%09se.__initialized%20%3D%20true%3B%0A%09%09%09%09%09se.__onLoadCallbacks.forEach%28function%28fn%29%20%7B%0A%09%09%09%09%09%09try%20%7B%0A%09%09%09%09%09%09%09fn%28%29%3B%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09catch%28e%29%20%7B%0A%09%09%09%09%09%09%09Components.utils.reportError%28e%29%3B%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%7D%29%3B%0A%09%09%09%09%09delete%20se.__onLoadCallbacks%3B%0A%09%09%09%09%09delete%20se.__value%3B%0A%09%09%09%09%7D%0A%09%09%09%09if%28isCodeMirror%29%20%7B%0A%09%09%09%09%09se.appendTo%28seElt%29.then%28function%28%29%20%7B%0A%09%09%09%09%09%09try%20%7B%0A%09%09%09%09%09%09%09se.setupAutoCompletion%28%29%3B%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09catch%28e%29%20%7B%0A%09%09%09%09%09%09%09Components.utils.reportError%28e%29%3B%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09if%28%22setFontSize%22%20in%20se%29%20try%20%7B%0A%09%09%09%09%09%09%09se.setFontSize%28options.codeMirror.fontSize%29%3B%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09catch%28e%29%20%7B%0A%09%09%09%09%09%09%09Components.utils.reportError%28e%29%3B%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09window.setTimeout%28function%28%29%20%7B%0A%09%09%09%09%09%09%09window.editor.changed%20%3D%20false%3B%20//%20Strange...%0A%09%09%09%09%09%09%09window.setTimeout%28function%28%29%20%7B%20//%20Workaround%20for%20unexpected%20onTextChanged%28%29%20calls%0A%09%09%09%09%09%09%09%09if%28window.editor.changed%20%26%26%20cbEditor.value%20%3D%3D%20code%29%0A%09%09%09%09%09%09%09%09%09window.editor.changed%20%3D%20false%3B%0A%09%09%09%09%09%09%09%7D%2C%20100%29%3B%0A%09%09%09%09%09%09%09se.on%28%22change%22%2C%20onTextChanged%29%3B%0A%09%09%09%09%09%09%09if%28isLoaded%29%20%7B%0A%09%09%09%09%09%09%09%09if%28%22clearHistory%22%20in%20se%29%0A%09%09%09%09%09%09%09%09%09se.clearHistory%28%29%3B%0A%09%09%09%09%09%09%09%09else%20%7B%0A%09%09%09%09%09%09%09%09%09var%20seGlobal%20%3D%20Components.utils.getGlobalForObject%28SourceEditor.prototype%29%3B%0A%09%09%09%09%09%09%09%09%09//%20Note%3A%20this%20is%20resource%3A//app/modules/devtools/gDevTools.jsm%20scope%20in%20Firefox%2034+%0A%09%09%09%09%09%09%09%09%09var%20cm%20%3D%20seGlobal.editors.get%28se%29%3B%0A%09%09%09%09%09%09%09%09%09cm.clearHistory%28%29%3B%0A%09%09%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09%7D%2C%20isFrame%20%3F%2050%20%3A%2015%29%3B%20//%20Oh%2C%20magic%20delays...%0A%09%09%09%09%09%09done%28%29%3B%0A%0A%09%09%09%09%09%09//%20See%20resource%3A///modules/devtools/sourceeditor/editor.js%0A%09%09%09%09%09%09//%20doc.defaultView.controllers.insertControllerAt%280%2C%20controller%28this%2C%20doc.defaultView%29%29%3B%0A%09%09%09%09%09%09var%20controllers%20%3D%20window.controllers%3B%20//%20nsIControllers%0A%09%09%09%09%09%09var%20controller%20%3D%20se.__cmdController%20%3D%20controllers.getControllerAt%280%29%3B%0A%09%09%09%09%09%09if%28%22__cmdControllers%22%20in%20tabs%29%0A%09%09%09%09%09%09%09tabs.__cmdControllers.push%28controller%29%3B%0A%09%09%09%09%09%09else%20%7B%0A%09%09%09%09%09%09%09tabs.__cmdControllers%20%3D%20%5Bcontroller%5D%3B%0A%09%09%09%09%09%09%09var%20onSelect%20%3D%20tabs.__onSelect%20%3D%20function%28%29%20%7B%0A%09%09%09%09%09%09%09%09var%20seElt%20%3D%20tabs.selectedPanel%3B%0A%09%09%09%09%09%09%09%09if%28%21seElt%20%7C%7C%20%21%28%22__sourceEditor%22%20in%20seElt%29%29%0A%09%09%09%09%09%09%09%09%09return%3B%0A%09%09%09%09%09%09%09%09var%20se%20%3D%20seElt.__sourceEditor%3B%0A%09%09%09%09%09%09%09%09var%20curController%20%3D%20se.__cmdController%3B%0A%09%09%09%09%09%09%09%09tabs.__cmdControllers.forEach%28function%28controller%29%20%7B%0A%09%09%09%09%09%09%09%09%09try%20%7B%0A%09%09%09%09%09%09%09%09%09%09if%28controller%20%3D%3D%20curController%29%0A%09%09%09%09%09%09%09%09%09%09%09controllers.insertControllerAt%280%2C%20controller%29%3B%0A%09%09%09%09%09%09%09%09%09%09else%0A%09%09%09%09%09%09%09%09%09%09%09controllers.removeController%28controller%29%3B%0A%09%09%09%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09%09%09%09catch%28e%29%20%7B%0A%09%09%09%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09%09%09%7D%29%3B%0A%09%09%09%09%09%09%09%7D%3B%0A%09%09%09%09%09%09%09tabs.addEventListener%28%22select%22%2C%20onSelect%2C%20false%29%3B%0A%09%09%09%09%09%09%09window.setTimeout%28onSelect%2C%200%29%3B%20//%20Activate%20controller%20from%20selected%20tab%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%7D%29%3B%0A%09%09%09%09%7D%0A%09%09%09%09else%20%7B%0A%09%09%09%09%09var%20opts%20%3D%20%7B%0A%09%09%09%09%09%09mode%3A%20isCSS%0A%09%09%09%09%09%09%09%3F%20SourceEditor.MODES.CSS%0A%09%09%09%09%09%09%09%3A%20SourceEditor.MODES.JAVASCRIPT%2C%0A%09%09%09%09%09%09showLineNumbers%3A%20true%2C%0A%09%09%09%09%09%09initialText%3A%20code%2C%0A%09%09%09%09%09%09placeholderText%3A%20code%2C%20//%20For%20backward%20compatibility%0A%09%09%09%09%09%09contextMenu%3A%20%22sourceEditorContext%22%0A%09%09%09%09%09%7D%3B%0A%09%09%09%09%09var%20optsOvr%20%3D%20options.orion%3B%0A%09%09%09%09%09for%28var%20opt%20in%20optsOvr%29%20if%28optsOvr.hasOwnProperty%28opt%29%29%0A%09%09%09%09%09%09opts%5Bopt%5D%20%3D%20optsOvr%5Bopt%5D%3B%0A%09%09%09%09%09se.init%28seElt%2C%20opts%2C%20function%20callback%28%29%20%7B%0A%09%09%09%09%09%09done%28%29%3B%0A%09%09%09%09%09%09isLoaded%20%26%26%20se.resetUndo%20%26%26%20se.resetUndo%28%29%3B%0A%09%09%09%09%09%09se.addEventListener%28SourceEditor.EVENTS.TEXT_CHANGED%2C%20onTextChanged%29%3B%0A%0A%09%09%09%09%09%09//%20Hack%20to%20use%20selected%20editor%0A%09%09%09%09%09%09var%20controller%20%3D%20se.ui._controller%3B%0A%09%09%09%09%09%09controller.__defineGetter__%28%22_editor%22%2C%20function%28%29%20%7B%0A%09%09%09%09%09%09%09var%20seElt%20%3D%20tabs.selectedPanel%3B%0A%09%09%09%09%09%09%09var%20se%20%3D%20seElt%20%26%26%20seElt.__sourceEditor%0A%09%09%09%09%09%09%09%09%7C%7C%20document.getElementsByTagName%28%22cbeditor%22%29%5B0%5D.__sourceEditor%3B%0A%09%09%09%09%09%09%09return%20se%3B%0A%09%09%09%09%09%09%7D%29%3B%0A%09%09%09%09%09%09controller.__defineSetter__%28%22_editor%22%2C%20function%28%29%20%7B%7D%29%3B%0A%09%09%09%09%09%7D%29%3B%0A%09%09%09%09%7D%0A%09%09%09%7D%2C%20this%29%3B%0A%09%09%09//%20Trick%20to%20select%20correct%20tab%20%28especially%20if%20was%20selected%20%22Button%20settings%22%20tab%29%0A%09%09%09tabs.tabs.advanceSelectedTab%281%2C%20true%29%3B%0A%09%09%09tabs.tabs.advanceSelectedTab%28-1%2C%20true%29%3B%0A%0A%09%09%09var%20origExecCmd%20%3D%20window.editor.execute_oncommand_code%3B%0A%09%09%09window.editor.execute_oncommand_code%20%3D%20function%28%29%20%7B%0A%09%09%09%09var%20cd%20%3D%20document.commandDispatcher%3B%0A%09%09%09%09var%20cdFake%20%3D%20%7B%0A%09%09%09%09%09__proto__%3A%20cd%2C%0A%09%09%09%09%09get%20focusedElement%28%29%20%7B%0A%09%09%09%09%09%09var%20selectedTab%20%3D%20tabs.selectedTab%3B%0A%09%09%09%09%09%09if%28selectedTab%20%26%26%20selectedTab.id%20%3D%3D%20%22code-tab%22%29%0A%09%09%09%09%09%09%09return%20document.getElementById%28%22code%22%29.textbox.inputField%3B%0A%09%09%09%09%09%09return%20cd.focusedElement%3B%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D%3B%0A%09%09%09%09document.__defineGetter__%28%22commandDispatcher%22%2C%20function%28%29%20%7B%0A%09%09%09%09%09return%20cdFake%3B%0A%09%09%09%09%7D%29%3B%0A%09%09%09%09try%20%7B%0A%09%09%09%09%09var%20ret%20%3D%20origExecCmd.apply%28this%2C%20arguments%29%3B%0A%09%09%09%09%7D%0A%09%09%09%09catch%28e%29%20%7B%0A%09%09%09%09%09Components.utils.reportError%28e%29%3B%0A%09%09%09%09%7D%0A%09%09%09%09//%20document.hasOwnProperty%28%22commandDispatcher%22%29%20%3D%3D%20false%2C%20so%20we%20cat%20just%20delete%20our%20fake%20property%0A%09%09%09%09delete%20document.commandDispatcher%3B%0A%09%09%09%09return%20ret%3B%0A%09%09%09%7D%3B%0A%0A%09%09%09window.addEventListener%28%22load%22%2C%20function%20ensureObserversAdded%28%29%20%7B%0A%09%09%09%09window.removeEventListener%28%22load%22%2C%20ensureObserversAdded%2C%20false%29%3B%0A%09%09%09%09window.setTimeout%28function%28%29%20%7B%20window.editor.removeObservers%28%29%3B%20%7D%2C%200%29%3B%0A%09%09%09%09window.setTimeout%28function%28%29%20%7B%20window.editor.addObservers%28%29%3B%20%20%20%20%7D%2C%200%29%3B%0A%09%09%09%7D%2C%20false%29%3B%0A%09%09%09//%20Fix%20for%20Ctrl+S%20hotkey%20%28catched%20by%20CodeMirror%29%0A%09%09%09var%20hke%20%3D%20this.handleKeyEvent%3B%0A%09%09%09window.addEventListener%28%22keydown%22%2C%20%20hke%2C%20true%29%3B%0A%09%09%09window.addEventListener%28%22keypress%22%2C%20hke%2C%20true%29%3B%0A%09%09%09window.addEventListener%28%22keyup%22%2C%20%20%20%20hke%2C%20true%29%3B%0A%09%09%7D%2C%0A%09%09insertCommandsController%3A%20function%28se%29%20%7B%0A%09%09%09this.insertCommandsController%20%3D%20insertCommandsController%3B%0A%09%09%09return%20insertCommandsController%28se%29%3B%0A%09%09%09//%20devtools/client/sourceeditor/editor-commands-controller%20in%20Pale%20Moon/Basilisk%0A%09%09%09function%20createController%28ed%29%20%7B%0A%09%09%09%09return%20%7B%0A%09%09%09%09%09supportsCommand%3A%20function%20%28cmd%29%20%7B%0A%09%09%09%09%09%09switch%20%28cmd%29%20%7B%0A%09%09%09%09%09%09%09case%20%22cmd_find%22%3A%0A%09%09%09%09%09%09%09case%20%22cmd_findAgain%22%3A%0A%09%09%09%09%09%09%09case%20%22cmd_gotoLine%22%3A%0A%09%09%09%09%09%09%09case%20%22cmd_undo%22%3A%0A%09%09%09%09%09%09%09case%20%22cmd_redo%22%3A%0A%09%09%09%09%09%09%09case%20%22cmd_delete%22%3A%0A%09%09%09%09%09%09%09case%20%22cmd_selectAll%22%3A%0A%09%09%09%09%09%09%09%09return%20true%3B%0A%09%09%09%09%09%09%7D%0A%0A%09%09%09%09%09%09return%20false%3B%0A%09%09%09%09%09%7D%2C%0A%0A%09%09%09%09%09isCommandEnabled%3A%20function%20%28cmd%29%20%7B%0A%09%09%09%09%09%09let%20cm%20%3D%20ed.codeMirror%3B%0A%0A%09%09%09%09%09%09switch%20%28cmd%29%20%7B%0A%09%09%09%09%09%09%09case%20%22cmd_find%22%3A%0A%09%09%09%09%09%09%09case%20%22cmd_gotoLine%22%3A%0A%09%09%09%09%09%09%09case%20%22cmd_selectAll%22%3A%0A%09%09%09%09%09%09%09%09return%20true%3B%0A%09%09%09%09%09%09%09case%20%22cmd_findAgain%22%3A%0A%09%09%09%09%09%09%09%09return%20cm.state.search%20%21%3D%20null%20%26%26%20cm.state.search.query%20%21%3D%20null%3B%0A%09%09%09%09%09%09%09case%20%22cmd_undo%22%3A%0A%09%09%09%09%09%09%09%09return%20ed.canUndo%28%29%3B%0A%09%09%09%09%09%09%09case%20%22cmd_redo%22%3A%0A%09%09%09%09%09%09%09%09return%20ed.canRedo%28%29%3B%0A%09%09%09%09%09%09%09case%20%22cmd_delete%22%3A%0A%09%09%09%09%09%09%09%09return%20ed.somethingSelected%28%29%3B%0A%09%09%09%09%09%09%7D%0A%0A%09%09%09%09%09%09return%20false%3B%0A%09%09%09%09%09%7D%2C%0A%0A%09%09%09%09%09doCommand%3A%20function%20%28cmd%29%20%7B%0A%09%09%09%09%09%09let%20cm%20%3D%20ed.codeMirror%3B%0A%0A%09%09%09%09%09%09let%20map%20%3D%20%7B%0A%09%09%09%09%09%09%09%22cmd_selectAll%22%3A%20%22selectAll%22%2C%0A%09%09%09%09%09%09%09%22cmd_find%22%3A%20%22find%22%2C%0A%09%09%09%09%09%09%09%22cmd_undo%22%3A%20%22undo%22%2C%0A%09%09%09%09%09%09%09%22cmd_redo%22%3A%20%22redo%22%2C%0A%09%09%09%09%09%09%09%22cmd_delete%22%3A%20%22delCharAfter%22%2C%0A%09%09%09%09%09%09%09%22cmd_findAgain%22%3A%20%22findNext%22%0A%09%09%09%09%09%09%7D%3B%0A%0A%09%09%09%09%09%09if%20%28map%5Bcmd%5D%29%20%7B%0A%09%09%09%09%09%09%09cm.execCommand%28map%5Bcmd%5D%29%3B%0A%09%09%09%09%09%09%09return%3B%0A%09%09%09%09%09%09%7D%0A%0A%09%09%09%09%09%09if%20%28cmd%20%3D%3D%20%22cmd_gotoLine%22%29%20%7B%0A%09%09%09%09%09%09%09ed.jumpToLine%28%29%3B%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%7D%2C%0A%0A%09%09%09%09%09onEvent%3A%20function%20%28%29%20%7B%7D%0A%09%09%09%09%7D%3B%0A%09%09%09%7D%0A%09%09%09function%20insertCommandsController%28sourceEditor%29%20%7B%0A%09%09%09%09let%20input%20%3D%20sourceEditor.codeMirror.getInputField%28%29%3B%0A%09%09%09%09let%20controller%20%3D%20createController%28sourceEditor%29%3B%0A%09%09%09%09input.controllers.insertControllerAt%280%2C%20controller%29%3B%0A%09%09%09%7D%0A%09%09%7D%2C%0A%09%09destroyWindow%3A%20function%28window%2C%20reason%2C%20isFrame%29%20%7B%0A%09%09%09if%28reason%20%3D%3D%20this.REASON_WINDOW_CLOSED%29%0A%09%09%09%09window.removeEventListener%28this.loadEvent%2C%20this%2C%20false%29%3B%20//%20Window%20can%20be%20closed%20before%20DOMContentLoaded%0A%09%09%09if%28this.isBrowserWindow%28window%29%29%20%7B%0A%09%09%09%09this.destroyBrowserWindow%28window%2C%20reason%29%3B%0A%09%09%09%09return%3B%0A%09%09%09%7D%0A%09%09%09if%28%21this.isEditorWindow%28window%29%20%7C%7C%20%21%28%22SourceEditor%22%20in%20window%29%29%0A%09%09%09%09return%3B%0A%09%09%09_log%28%22destroyWindow%28%29%3A%20isFrame%3A%20%22%20+%20isFrame%29%3B%0A%09%09%09var%20document%20%3D%20window.document%3B%0A%09%09%09if%28isFrame%29%0A%09%09%09%09window.removeEventListener%28%22unload%22%2C%20this%2C%20false%29%3B%0A%0A%09%09%09var%20tabs%20%3D%20document.getElementById%28%22custombuttons-editbutton-tabbox%22%29%3B%0A%09%09%09if%28%22__onSelect%22%20in%20tabs%29%20%7B%0A%09%09%09%09tabs.removeEventListener%28%22select%22%2C%20tabs.__onSelect%2C%20false%29%3B%0A%09%09%09%09delete%20tabs.__onSelect%3B%0A%09%09%09%09delete%20tabs.__cmdControllers%3B%0A%09%09%09%7D%0A%0A%09%09%09Array.prototype.slice.call%28document.getElementsByTagName%28%22cbeditor%22%29%29.forEach%28function%28cbEditor%29%20%7B%0A%09%09%09%09if%28%21%28%22__sourceEditor%22%20in%20cbEditor%29%29%0A%09%09%09%09%09return%3B%0A%09%09%09%09var%20se%20%3D%20cbEditor.__sourceEditor%3B%0A%09%09%09%09var%20isCodeMirror%20%3D%20se.__isCodeMirror%3B%0A%09%09%09%09if%28isCodeMirror%29%0A%09%09%09%09%09se.off%28%22change%22%2C%20se.__onTextChanged%29%3B%0A%09%09%09%09else%0A%09%09%09%09%09se.removeEventListener%28window.SourceEditor.EVENTS.TEXT_CHANGED%2C%20se.__onTextChanged%29%3B%0A%09%09%09%09delete%20se.__onTextChanged%3B%0A%09%09%09%09if%28reason%20%3D%3D%20this.REASON_SHUTDOWN%29%20%7B%0A%09%09%09%09%09var%20val%20%3D%20cbEditor.value%3B%0A%09%09%09%09%09delete%20cbEditor.value%3B%0A%09%09%09%09%09delete%20cbEditor.selectLine%3B%0A%0A%09%09%09%09%09var%20seElt%20%3D%20cbEditor.__sourceEditorElt%3B%0A%09%09%09%09%09seElt.parentNode.insertBefore%28cbEditor%2C%20seElt%29%3B%0A%09%09%09%09%09seElt.parentNode.removeChild%28seElt%29%3B%0A%09%09%09%09%09delete%20cbEditor.__sourceEditorElt%3B%0A%09%09%09%09%09delete%20cbEditor.__sourceEditor%3B%0A%09%09%09%09%09delete%20seElt.__sourceEditor%3B%0A%09%09%09%09%09delete%20seElt.__cbEditor%3B%0A%0A%09%09%09%09%09cbEditor.value%20%3D%20val%3B%0A%09%09%09%09%09window.setTimeout%28function%28%29%20%7B%0A%09%09%09%09%09%09cbEditor.removeAttribute%28%22collapsed%22%29%3B%0A%09%09%09%09%09%7D%2C%200%29%3B%0A%09%09%09%09%7D%0A%09%09%09%09se.destroy%28%29%3B%0A%09%09%09%09if%28%22__cmdController%22%20in%20se%29%20%7B%0A%09%09%09%09%09try%20%7B%0A%09%09%09%09%09%09window.controllers.removeController%28se.__cmdController%29%3B%0A%09%09%09%09%09%7D%0A%09%09%09%09%09catch%28e%29%20%7B%0A%09%09%09%09%09%7D%0A%09%09%09%09%09delete%20se.__cmdController%3B%0A%09%09%09%09%7D%0A%09%09%09%7D%2C%20this%29%3B%0A%0A%09%09%09if%28reason%20%3D%3D%20this.REASON_SHUTDOWN%29%20%7B%0A%09%09%09%09delete%20window.editor.execute_oncommand_code%3B%0A%09%09%09%09%5B%0A%09%09%09%09%09%22sourceEditorPopupset%22%2C%0A%09%09%09%09%09%22editMenuCommands%22%2C%0A%09%09%09%09%09%22sourceEditorCommands%22%2C%0A%09%09%09%09%09%22sourceEditorKeys%22%2C%0A%09%09%09%09%09%22editMenuKeys%22%0A%09%09%09%09%5D.forEach%28function%28id%29%20%7B%0A%09%09%09%09%09var%20node%20%3D%20document.getElementById%28id%29%3B%0A%09%09%09%09%09node%20%26%26%20node.parentNode.removeChild%28node%29%3B%0A%09%09%09%09%7D%29%3B%0A%09%09%09%09%5B%0A%09%09%09%09%09//%20chrome%3A//global/content/globalOverlay.js%0A%09%09%09%09%09%22closeWindow%22%2C%20%22canQuitApplication%22%2C%20%22goQuitApplication%22%2C%20%22goUpdateCommand%22%2C%20%22goDoCommand%22%2C%0A%09%09%09%09%09%22goSetCommandEnabled%22%2C%20%22goSetMenuValue%22%2C%20%22goSetAccessKey%22%2C%20%22goOnEvent%22%2C%20%22visitLink%22%2C%0A%09%09%09%09%09%22setTooltipText%22%2C%20%22NS_ASSERT%22%2C%0A%09%09%09%09%09//%20chrome%3A//global/content/editMenuOverlay.xul%20%3D%3E%20view-source%3Achrome%3A//global/content/editMenuOverlay.js%0A%09%09%09%09%09%22goUpdateGlobalEditMenuItems%22%2C%20%22goUpdateUndoEditMenuItems%22%2C%20%22goUpdatePasteMenuItems%22%0A%09%09%09%09%5D.forEach%28function%28p%29%20%7B%0A%09%09%09%09%09delete%20window%5Bp%5D%3B%0A%09%09%09%09%7D%29%3B%0A%09%09%09%09for%28var%20child%20%3D%20document.documentElement%3B%20child%20%3D%20child.previousSibling%3B%20%29%20%7B%0A%09%09%09%09%09if%28%0A%09%09%09%09%09%09child.nodeType%20%3D%3D%20child.PROCESSING_INSTRUCTION_NODE%0A%09%09%09%09%09%09%26%26%20child.data.indexOf%28%22%3A//devtools/%22%29%20%21%3D%20-1%0A%09%09%09%09%09%29%20%7B%0A%09%09%09%09%09%09setTimeout%28function%28child%29%20%7B%0A%09%09%09%09%09%09%09child.parentNode.removeChild%28child%29%3B%0A%09%09%09%09%09%09%7D%2C%200%2C%20child%29%3B%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D%0A%09%09%09%09delete%20window.SourceEditor%3B%0A%09%09%09%7D%0A%09%09%09var%20hke%20%3D%20this.handleKeyEvent%3B%0A%09%09%09window.removeEventListener%28%22keydown%22%2C%20%20hke%2C%20true%29%3B%0A%09%09%09window.removeEventListener%28%22keypress%22%2C%20hke%2C%20true%29%3B%0A%09%09%09window.removeEventListener%28%22keyup%22%2C%20%20%20%20hke%2C%20true%29%3B%0A%09%09%09//%7E%20todo%3A%20we%20have%20one%20not%20removed%20controller%21%0A%09%09%09//LOG%28%22getControllerCount%28%29%3A%20%22%20+%20window.controllers.getControllerCount%28%29%29%3B%0A%09%09%7D%2C%0A%09%09initBrowserWindow%3A%20function%28window%2C%20reason%29%20%7B%0A%09%09%09_log%28%22initBrowserWindow%28%29%22%29%3B%0A%09%09%09window.addEventListener%28%22DOMContentLoaded%22%2C%20this%2C%20false%29%3B%0A%09%09%09Array.prototype.forEach.call%28window.frames%2C%20function%28frame%29%20%7B%0A%09%09%09%09this.initWindow%28frame%2C%20reason%2C%20true%29%3B%0A%09%09%09%7D%2C%20this%29%3B%0A%09%09%7D%2C%0A%09%09destroyBrowserWindow%3A%20function%28window%2C%20reason%29%20%7B%0A%09%09%09_log%28%22destroyBrowserWindow%28%29%22%29%3B%0A%09%09%09window.removeEventListener%28%22DOMContentLoaded%22%2C%20this%2C%20false%29%3B%0A%09%09%09Array.prototype.forEach.call%28window.frames%2C%20function%28frame%29%20%7B%0A%09%09%09%09this.destroyWindow%28frame%2C%20reason%2C%20true%29%3B%0A%09%09%09%7D%2C%20this%29%3B%0A%09%09%7D%2C%0A%09%09isEditorWindow%3A%20function%28window%29%20%7B%0A%09%09%09return%20window.location.href.substr%280%2C%2041%29%20%3D%3D%20%22chrome%3A//custombuttons/content/editor.xul%22%3B%0A%09%09%7D%2C%0A%09%09isBrowserWindow%3A%20function%28window%29%20%7B%0A%09%09%09var%20loc%20%3D%20window.location.href%3B%0A%09%09%09return%20loc%20%3D%3D%20%22chrome%3A//browser/content/browser.xul%22%0A%09%09%09%09%7C%7C%20loc%20%3D%3D%20%22chrome%3A//browser/content/browser.xhtml%22%20//%20Firefox%2069+%0A%09%09%09%09%7C%7C%20loc%20%3D%3D%20%22chrome%3A//navigator/content/navigator.xul%22%3B%0A%09%09%7D%2C%0A%09%09get%20loadEvent%28%29%20%7B%20//%20%22DOMContentLoaded%22%20-%3E%20initWindow%28%29%20may%20hang%20editor%20window%20%28and%20browser%29%0A%09%09%09delete%20this.loadEvent%3B%0A%09%09%09return%20this.loadEvent%20%3D%20this.platformVersion%20%3E%3D%2073%20%3F%20%22load%22%20%3A%20%22DOMContentLoaded%22%3B%0A%09%09%7D%2C%0A%09%09observe%3A%20function%28subject%2C%20topic%2C%20data%29%20%7B%0A%09%09%09if%28topic%20%3D%3D%20%22quit-application-granted%22%29%0A%09%09%09%09this.destroy%28%29%3B%0A%09%09%09else%20if%28topic%20%3D%3D%20%22domwindowopened%22%29%0A%09%09%09%09subject.addEventListener%28this.loadEvent%2C%20this%2C%20false%29%3B%0A%09%09%09else%20if%28topic%20%3D%3D%20%22domwindowclosed%22%29%0A%09%09%09%09this.destroyWindow%28subject%2C%20this.REASON_WINDOW_CLOSED%29%3B%0A%09%09%7D%2C%0A%09%09handleEvent%3A%20function%28e%29%20%7B%0A%09%09%09switch%28e.type%29%20%7B%0A%09%09%09%09case%20%22DOMContentLoaded%22%3A%0A%09%09%09%09case%20%22load%22%3A%0A%09%09%09%09%09//var%20window%20%3D%20e.currentTarget%3B%0A%09%09%09%09%09var%20window%20%3D%20e.target.defaultView%20%7C%7C%20e.target%3B%0A%09%09%09%09%09window.removeEventListener%28e.type%2C%20this%2C%20false%29%3B%0A%09%09%09%09%09var%20isFrame%20%3D%20window%20%21%3D%20e.currentTarget%3B%0A%09%09%09%09%09this.initWindow%28window%2C%20this.REASON_WINDOW_LOADED%2C%20isFrame%29%3B%0A%09%09%09%09break%3B%0A%09%09%09%09case%20%22unload%22%3A%0A%09%09%09%09%09//var%20window%20%3D%20e.currentTarget%3B%0A%09%09%09%09%09var%20window%20%3D%20e.target.defaultView%20%7C%7C%20e.target%3B%0A%09%09%09%09%09window.removeEventListener%28e.type%2C%20this%2C%20false%29%3B%0A%09%09%09%09%09this.destroyWindow%28window%2C%20this.REASON_WINDOW_CLOSED%2C%20true%29%3B%0A%09%09%09%7D%0A%09%09%7D%2C%0A%09%09handleKeyEvent%3A%20function%28e%29%20%7B%0A%09%09%09if%28%0A%09%09%09%09%28e.keyCode%20%3D%3D%20e.DOM_VK_S%20%7C%7C%20String.fromCharCode%28e.charCode%29.toUpperCase%28%29%20%3D%3D%20%22S%22%29%0A%09%09%09%09%26%26%20e.ctrlKey%20%26%26%20%21e.altKey%20%26%26%20%21e.shiftKey%20%26%26%20%21e.metaKey%0A%09%09%09%29%20%7B%0A%09%09%09%09e.preventDefault%28%29%3B%0A%09%09%09%09e.stopPropagation%28%29%3B%0A%09%09%09%09if%28e.type%20%3D%3D%20%22keydown%22%29%20%7B%0A%09%09%09%09%09var%20window%20%3D%20e.currentTarget%3B%0A%09%09%09%09%09window.editor.updateButton%28%29%3B%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%2C%0A%09%09loadOverlays%3A%20function%28%29%20%7B%0A%09%09%09this.runGenerator%28this.loadOverlaysGen%2C%20this%2C%20arguments%29%3B%0A%09%09%7D%2C%0A%0A%09%09get%20loadOverlaysGen%28%29%20%7B%0A%09%09%09var%20fn%20%3D%20this._loadOverlaysGen.toString%28%29%0A%09%09%09%09.replace%28/__yield/g%2C%20%22yield%22%29%3B%0A%09%09%09try%20%7B%0A%09%09%09%09new%20Function%28%22function%20test%28%29%20%7B%20yield%200%3B%20%7D%22%29%3B%0A%09%09%09%7D%0A%09%09%09catch%28e%29%20%7B%20//%20Firefox%2058+%3A%20SyntaxError%3A%20yield%20expression%20is%20only%20valid%20in%20generators%0A%09%09%09%09fn%20%3D%20fn.replace%28%22function%22%2C%20%22function*%22%29%3B%20//%20Firefox%2026+%0A%09%09%09%7D%0A%09%09%09delete%20this.loadOverlaysGen%3B%0A%09%09%09return%20this.loadOverlaysGen%20%3D%20eval%28%22%28%22%20+%20fn%20+%20%22%29%22%29%3B%0A%09%09%7D%2C%0A%09%09_loadOverlaysGen%3A%20function%20loadOverlaysGen%28window%2C%20callback/*%2C%20overlayData1%2C%20...*/%29%20%7B%0A%09%09%09var%20gen%20%3D%20loadOverlaysGen.__generator%3B%0A%09%09%09for%28var%20i%20%3D%202%2C%20l%20%3D%20arguments.length%3B%20i%20%3C%20l%3B%20++i%29%20%7B%0A%09%09%09%09var%20overlayData%20%3D%20arguments%5Bi%5D%3B%0A%09%09%09%09this.loadOverlay%28window%2C%20overlayData%5B0%5D%2C%20overlayData%5B1%5D%2C%20function%28%29%20%7B%0A%09%09%09%09%09gen.next%28%29%3B%0A%09%09%09%09%7D%29%3B%0A%09%09%09%09__yield%280%29%3B%0A%09%09%09%7D%0A%09%09%09callback%28%29%3B%0A%09%09%09__yield%280%29%3B%0A%09%09%7D%2C%0A%09%09loadOverlay%3A%20function%28window%2C%20uri%2C%20check%2C%20callback%29%20%7B%0A%09%09%09var%20document%20%3D%20window.document%3B%0A%09%09%09var%20stopWait%20%3D%20Date.now%28%29%20+%204500%3B%0A%09%09%09window.setTimeout%28function%20load%28%29%20%7B%0A%09%09%09%09_log%28%22loadOverlay%28%29%3A%20%22%20+%20uri%29%3B%0A%09%09%09%09var%20tryAgain%20%3D%20Date.now%28%29%20+%20800%3B%0A%09%09%09%09try%20%7B%0A%09%09%09%09%09document.loadOverlay%28uri%2C%20null%29%3B%0A%09%09%09%09%7D%0A%09%09%09%09catch%28e%29%20%7B%0A%09%09%09%09%09window.setTimeout%28callback%2C%200%29%3B%0A%09%09%09%09%09return%3B%0A%09%09%09%09%7D%0A%09%09%09%09window.setTimeout%28function%20ensureLoaded%28%29%20%7B%0A%09%09%09%09%09if%28check%28window%29%29%0A%09%09%09%09%09%09window.setTimeout%28callback%2C%200%29%3B%0A%09%09%09%09%09else%20if%28Date.now%28%29%20%3E%20stopWait%29%0A%09%09%09%09%09%09return%3B%0A%09%09%09%09%09else%20if%28Date.now%28%29%20%3E%20tryAgain%29%0A%09%09%09%09%09%09window.setTimeout%28load%2C%200%29%3B%0A%09%09%09%09%09else%0A%09%09%09%09%09%09window.setTimeout%28ensureLoaded%2C%2050%29%3B%0A%09%09%09%09%7D%2C%2050%29%3B%0A%09%09%09%7D%2C%200%29%3B%0A%09%09%7D%2C%0A%09%09runGenerator%3A%20function%28genFunc%2C%20context%2C%20args%29%20%7B%0A%09%09%09var%20gen%20%3D%20genFunc.apply%28context%2C%20args%29%3B%0A%09%09%09genFunc.__generator%20%3D%20gen%3B%0A%09%09%09gen.next%28%29%3B%0A%09%09%7D%2C%0A%09%09parseXULFromString%3A%20function%28xul%29%20%7B%0A%09%09%09xul%20%3D%20xul.replace%28/%3E%5Cs+%3C/g%2C%20%22%3E%3C%22%29%3B%0A%09%09%09try%20%7B%0A%09%09%09%09return%20new%20DOMParser%28%29.parseFromString%28xul%2C%20%22application/xml%22%29.documentElement%3B%0A%09%09%09%7D%0A%09%09%09catch%28e%29%20%7B%0A%09%09%09%09//%20See%20http%3A//custombuttons.sourceforge.net/forum/viewtopic.php%3Ff%3D5%26t%3D3720%0A%09%09%09%09//%20+%20https%3A//forum.mozilla-russia.org/viewtopic.php%3Fpid%3D732243%23p732243%0A%09%09%09%09var%20dummy%20%3D%20document.createElement%28%22dummy%22%29%3B%0A%09%09%09%09dummy.innerHTML%20%3D%20xul.trimLeft%28%29%3B%0A%09%09%09%09return%20dummy.firstChild%3B%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%3B%0A%09storage.set%28watcherId%2C%20watcher%29%3B%0A%09setTimeout%28function%28%29%20%7B%0A%09%09watcher.init%28watcher.REASON_STARTUP%29%3B%0A%09%7D%2C%2050%29%3B%0A%7D%0Afunction%20destructor%28reason%29%20%7B%0A%09if%28reason%20%3D%3D%20%22update%22%20%7C%7C%20reason%20%3D%3D%20%22delete%22%29%20%7B%0A%09%09watcher.destroy%28watcher.REASON_SHUTDOWN%29%3B%0A%09%09storage.set%28watcherId%2C%20null%29%3B%0A%09%7D%0A%7D%0Aif%28%0A%09typeof%20addDestructor%20%3D%3D%20%22function%22%20//%20Custom%20Buttons%200.0.5.6pre4+%0A%09%26%26%20addDestructor%20%21%3D%20%28%22addDestructor%22%20in%20window%20%26%26%20window.addDestructor%29%0A%29%0A%09addDestructor%28destructor%2C%20this%29%3B%0Aelse%0A%09this.onDestroy%20%3D%20destructor%3B%0A%0Afunction%20ts%28%29%20%7B%0A%09var%20d%20%3D%20new%20Date%28%29%3B%0A%09var%20ms%20%3D%20d.getMilliseconds%28%29%3B%0A%09return%20d.toTimeString%28%29.replace%28/%5E.*%5Cd+%3A%28%5Cd+%3A%5Cd+%29.*%24/%2C%20%22%241%22%29%20+%20%22%3A%22%20+%20%22000%22.substr%28%28%22%22%20+%20ms%29.length%29%20+%20ms%20+%20%22%20%22%3B%0A%7D%0Afunction%20_log%28s%29%20%7B%0A%09Services.console.logStringMessage%28%22%5BCustom%20Buttons%20%3A%3A%20Source%20Editor%5D%20%22%20+%20ts%28%29%20+%20s%29%3B%0A%7D%5D%5D%3E%3C/initcode%3E%0A%20%20%3Ccode%3E%3C%21%5BCDATA%5B/*CODE*/%5D%5D%3E%3C/code%3E%0A%20%20%3Caccelkey%3E%3C%21%5BCDATA%5B%5D%5D%3E%3C/accelkey%3E%0A%20%20%3Chelp%3E%3C%21%5BCDATA%5B%5D%5D%3E%3C/help%3E%0A%20%20%3Cattributes/%3E%0A%3C/custombutton%3E"
>Install</a>
| <a href="https://github.com/Infocatcher/Custom_Buttons/tree/master/CB_Source_Editor">Source</a>
| <a href="https://github.com/Infocatcher/Custom_Buttons#usage">Instructions</a>
<script type="text/javascript">
var a = document.getElementsByTagName("a")[0];
a.title = document.title;
if(/%3Cimage%3E%3C%21%5BCDATA%5B(data%3A\S+)%5D%5D%3E%3C\/image%3E/.test(a.href)) {
var icon = decodeURIComponent(RegExp.$1);
var img = document.createElement("img");
img.src = icon;
img.alt = "";
img.style.verticalAlign = "middle";
img.style.marginRight = "4px";
img.style.border = "none";
a.insertBefore(img, a.firstChild);
var link = document.createElement("link");
link.rel = "shortcut icon";
link.href = icon;
document.documentElement.insertBefore(link, document.documentElement.firstChild);
}
</script>
<script type="text/javascript" src="https://infocatcher.github.io/Custom_Buttons/viewCustomButton.js"></script>
<script type="text/javascript">
if("viewCustomButtonCode" in window) setTimeout(function() {
viewCustomButtonCode(a.href);
}, 0);
</script>
</body>