MSFX/chrome/go_button.uc.js

40 lines
1.3 KiB
JavaScript

(function () {
try {
Components.utils.import("resource:///modules/CustomizableUI.jsm");
var Services =
globalThis.Services ||
ChromeUtils.import("resource://gre/modules/Services.jsm").Services;
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);
}
})();