shenyixin99
狐狸大王
狐狸大王
  • UID30127
  • 注册日期2009-08-19
  • 最后登录2011-11-20
  • 发帖数318
  • 经验10枚
  • 威望0点
  • 贡献值0点
  • 好评度0点
阅读:1573回复:1

这段userChrome.js代码,是不是在firefox4.0失效了

楼主#
更多 发布于:2011-04-02 12:48
// 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);
   })();
dawlen
狐狸大王
狐狸大王
  • UID34286
  • 注册日期2010-10-20
  • 最后登录2015-05-28
  • 发帖数311
  • 经验15枚
  • 威望0点
  • 贡献值8点
  • 好评度0点
  • 社区居民
1楼#
发布于:2011-04-02 12:48
不懂,你可以换用UC扩展试试
游客

返回顶部