MSFX/chrome/go_button.uc.js
2023-03-01 18:54:13 -07:00

41 lines
1.3 KiB
JavaScript

(function () {
try {
Components.utils.import("resource:///modules/CustomizableUI.jsm");
var { Services } = Components.utils.import(
"resource://gre/modules/Services.jsm",
{}
);
var sss = Components.classes[
"@mozilla.org/content/style-sheet-service;1"
].getService(Components.interfaces.nsIStyleSheetService);
var appversion = parseInt(Services.appinfo.version);
var button_label = "Go";
CustomizableUI.createWidget({
id: "go-button", // button id
defaultArea: CustomizableUI.AREA_NAVBAR,
removable: true,
label: button_label, // button title
tooltiptext: button_label, // tooltip title
onClick: function (event) {
var cancelQuit = Components.classes[
"@mozilla.org/supports-PRBool;1"
].createInstance(Components.interfaces.nsISupportsPRBool);
var observerSvc = Components.classes[
"@mozilla.org/observer-service;1"
].getService(Components.interfaces.nsIObserverService);
if (event.button == "0") {
// left/middle-click - restart
gURLBar.handleCommand(event);
}
},
onCreated: function (button) {
return button;
},
});
} catch (e) {
Components.utils.reportError(e);
}
})();