/* :::::::: Sub-Script/XUL Loader ::::::::::::::: */ // automatically includes all files ending in .uc.js and .uc.xul from the profile's chrome folder (function() { var getURLSpecFromFile = Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService).getProtocolHandler("file").QueryInterface(Components.interfaces.nsIFileProtocolHandler).getURLSpecFromFile; var chromeDir = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("UChrm", Components.interfaces.nsILocalFile); var files = chromeDir.directoryEntries.QueryInterface(Components.interfaces.nsISimpleEnumerator); var xul_files = []; while (files.hasMoreElements()) { var file = files.getNext().QueryInterface(Components.interfaces.nsIFile); if (/\.uc\.js$/i.test(file.leafName)) { setTimeout(function(aFile) { Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader).loadSubScript(getURLSpecFromFile(aFile)); }, 0, file); } else if (/(^userChrome|\.uc)\.xul$/i.test(file.leafName)) { xul_files.push(file); } } setTimeout(function() { if (xul_files.length > 0) { document.loadOverlay(getURLSpecFromFile(xul_files.shift()), null); setTimeout(arguments.callee, 0); } }, 0); })();