Code: Select all
eval("OpenSearch = " + OpenSearch.toString().replace('window.open(defaultSearchURL, "_blank");', 'gBrowser.addTab(defaultSearchURL);'));
Code: Select all
/* :::::::: WindowHook :::::::: */
//by Zeniko http://forums.mozillazine.org/viewtopic.php?p=2169699#2169699
//allows userChrome.js to target all windows / not only the main window
function() {
var WindowHook = {
observe: function(aSubject, aTopic, aData) {
if(!aSubject._WindowHook) {
aSubject._WindowHook = this;
aSubject.addEventListener("load", this.onLoad_window, false);
}
},
onLoad_window: function() {
this.removeEventListener("load", this._WindowHook.onLoad_window, false);
var funcs = this._WindowHook.mFuncs[this.document.location.href] || null;
if(funcs) {
funcs.forEach(function(aFunc) { aFunc(this); }, this);
}
delete this._WindowHook;
},
register: function(aURL, aFunc) {
if(!this.mFuncs) {
this.mFuncs = {};
Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService)
.addObserver(this, "domwindowopened", false);
}
if(!this.mFuncs[aURL]) {
this.mFuncs[aURL] = [];
}
this.mFuncs[aURL].push(aFunc);
}
};
function moveThrobber(win, id) {
var throbber = win.document.getElementById("throbber-box");
throbber.style.backgroundColor = "transparent";
throbber.style.backgroundImage = "none";
var spring = win.document.createElement("toolbarspring");
spring.setAttribute("flex", 1);
var menubar = win.document.getElementById(id);
menubar.appendChild(spring);
menubar.appendChild(throbber);
}
//Mail window
WindowHook.register("chrome://messenger/content/messenger.xul",
function(aWindow) {
moveThrobber(aWindow, "mailMenubar");
}, false);
//Composer window
WindowHook.register("chrome://editor/content/editor.xul",
function(aWindow) {
moveThrobber(aWindow, "main-menubar");
}, false);
//Address Book window
WindowHook.register("chrome://messenger/content/addressbook/addressbook.xul",
function(aWindow) {
moveThrobber(aWindow, "ab-menubar");
}, false);
//Mail Compose window
WindowHook.register("chrome://messenger/content/messengercompose/messengercompose.xul",
function(aWindow) {
moveThrobber(aWindow, "compose-menubar");
}, false);
//Main window
WindowHook.register("chrome://navigator/content/navigator.xul",
function(aWindow) {
moveThrobber(aWindow, "main-menubar");
}, false);
//Mail window
document.getElementById("mailMenubar").appendChild(document.getElementById("throbber-box"));
})();