forked from benzBrake/FirefoxCustomize
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrowsertoolbox.uc.js
50 lines (43 loc) · 2.11 KB
/
browsertoolbox.uc.js
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// ==UserScript==
// @name browsertoolbox.uc.js
// @description 添加一个快捷打开浏览器内容工具箱的按钮
// @author Endor8
// @include main
// @charset UTF-8
// @compatibility Firefox 100
// @homepage https://github.com/Endor8/userChrome.js/blob/master/Firefox-96/browsertoolbox.uc.js
// ==/UserScript==
(function () {
if (location != 'chrome://browser/content/browser.xhtml')
return;
ChromeUtils.import("resource:///modules/CustomizableUI.jsm");
try {
CustomizableUI.createWidget({
id: 'browser-toolbox-button',
type: 'custom',
defaultArea: CustomizableUI.AREA_NAVBAR,
onBuild: function (aDocument) {
var toolbaritem = aDocument.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'toolbarbutton');
var props = {
id: 'browser-toolbox-button',
class: 'toolbarbutton-1 chromeclass-toolbar-additional',
label: '浏览器内容工具箱',
tooltiptext: '浏览器内容工具箱',
style: 'list-style-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAdUlEQVQokZVSwRHAIAgLPYfoXs7RCTpG53Avt7APrhaFU8gLMEEJAkEQgFbc7IxkVjt0r6Sp7VIVITumBpKt00FA2ThmjXzkfMMWO8EZFSj8LrUyjsG9b9DaJXq+qAIVxEUxtLHpaXE95dj1NcK2rmbwaGJ4Af0tIg00j/6iAAAAAElFTkSuQmCC)',
oncommand: '(' + onCommand.toString() + ')()'
};
for (var p in props)
toolbaritem.setAttribute(p, props[p]);
return toolbaritem;
}
});
} catch (e) { };
function onCommand() {
var document = event.target.ownerDocument;
if (!document.getElementById('menu_browserToolbox')) {
let { require } = Cu.import("resource://devtools/shared/loader/Loader.jsm", {});
require("devtools/client/framework/devtools-browser");
};
document.getElementById('menu_browserToolbox').click();
};
})();