>>191 // ==UserScript==
// @name RestoreGMStatusbar.uc.js
// @description Greasemonkeyのステータスバーアイコンを復活させる(for Fx4)
// @include main
// ==/UserScript==
(function(){
var observer = {
observe: function(subject, topic, data){
if(topic == "xul-overlay-merged") this.initGMStatusbar();
},
initGMStatusbar: function(){
var code = this.readFile("chrome://greasemonkey/content/statusbar.js");
if(!code) return;
code = code.replace("window.addEventListener('load', function() {", "").replace("}, false);", "");
eval(code);
},
readFile: function(url){ try{
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
var channel = ios.newChannelFromURI(ios.newURI(url, null, null));
var stream = channel.open();
var sstream = Cc["@mozilla.org/scriptableinputstream;1"].getService(Ci.nsIScriptableInputStream);
sstream.init(stream);
var content = sstream.read(sstream.available());
sstream.close();
return content;
}catch(e){ return null; }
}
};
window.userChrome_js.loadOverlay("chrome://greasemonkey/content/statusbar.xul", observer);
})();