forked from alice0775/userChrome.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0000-loadInSidebarMix.uc.js
51 lines (50 loc) · 1.63 KB
/
0000-loadInSidebarMix.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
51
// ==UserScript==
// @name loadInSidebarMix.uc.js
// @namespace http://space.geocities.yahoo.co.jp/gl/alice0775
// @description
// @include chrome://sidebarmix/content/sidebarmix.xul
// @compatibility Firefox 3.0
// @author Alice0775
// @version 2008/03/26 06:00
// @Note
// ==/UserScript==
var loadInSidebarMix = {
sidebarWindow: null,
init: function(sidebarWindow){
this.sidebarWindow = sidebarWindow;
this.sidebarWindow.document.addEventListener("load", this, true)
this.sidebarWindow.addEventListener("unload", this, false)
},
handleEvent: function(event){
switch (event.type) {
case "unload":
this.uninit(event);
break;
case "load":
this.load(event);
break;
}
},
uninit: function(event){
this.sidebarWindow.document.removeEventListener("load", this, true)
this.sidebarWindow.removeEventListener("unload", this, false)
},
getMainWindow:function(){
var mediator = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
var enumerator = mediator.getEnumerator("navigator:browser");
return enumerator.getNext();
},
load: function(event){
var mainWindow = this.getMainWindow();
var that = mainWindow.userChrome_js;
var doc = event.originalTarget;
var href = doc.location.href;
if( !/^chrome:/.test(href) )return;
that.debug("load SidebarMix " + href);
setTimeout(function(){that.runScripts(doc);
setTimeout(function(){that.runOverlays(doc);},0);
},0);
}
}
loadInSidebarMix.init(window);