You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

33 lines
1.8 KiB

// add window management buttons to navbar
// this allows full functionality while hiding the titlebar, see userChrome.css
function applyCustomScriptToNewWindow(win) {
let windowbuttonbox = win.document.getElementsByClassName("titlebar-buttonbox")[1].cloneNode(true);
let privatebrowsing = win.document.getElementById("private-browsing-indicator-with-label").cloneNode(true);
//let spacer = win.document.getElementsByClassName("titlebar-spacer")[0].cloneNode(true);
// reusing the titlebar spacers has unintended side effects (namely them not showing up reliably)
let spacer = win.document.createElement("hbox");
spacer.style["display"] = "-moz-box";
// having some space to drag the window around is important on some setups
spacer.style["width"] = "40px";
let navbar = win.document.getElementById("nav-bar");
navbar.prepend(spacer); // nice consistent method naming you got there.
navbar.appendChild(privatebrowsing);
navbar.appendChild(windowbuttonbox);
}
try {
let { classes: Cc, interfaces: Ci, manager: Cm } = Components;
const {Services} = Components.utils.import('resource://gre/modules/Services.jsm');
function ConfigJS() { Services.obs.addObserver(this, 'chrome-document-global-created', false); }
ConfigJS.prototype = {
observe: function (aSubject) { aSubject.addEventListener('DOMContentLoaded', this, {once: true}); },
handleEvent: function (aEvent) {
let document = aEvent.originalTarget; let window = document.defaultView; let location = window.location;
if (/^(chrome:(?!\/\/(global\/content\/commonDialog|browser\/content\/webext-panels)\.x?html)|about:(?!blank))/i.test(location.href)) {
if (window._gBrowser) applyCustomScriptToNewWindow(window);
}
}
};
if (!Services.appinfo.inSafeMode) { new ConfigJS(); }
} catch(ex) {};