wenshanliren
小狐狸
小狐狸
  • UID28120
  • 注册日期2009-02-27
  • 最后登录2019-06-17
  • 发帖数34
  • 经验63枚
  • 威望0点
  • 贡献值48点
  • 好评度1点
  • 社区居民
阅读:118回复:0

升级67.0.1以后UC脚本关于添加按钮的失效

楼主#
更多 发布于:2019-06-07 22:11
升级67.0.1以后UC脚本关于添加按钮的失效
// 导航栏添加XX-net按钮
(function () {
    CustomizableUI.createWidget({
        id : "XX-net",
        label : "XX-net",
        tooltiptext : "XX-net",
        onClick : function (event) {
                var path ="D:\\Tools\\XX-Net\\start.vbs";   var file = Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsIFile);file.initWithPath(path.replace(/^\./, Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("SysD", Components.interfaces.nsIFile).path));file.launch();
        }
    });
 
    var cssStr = '@-moz-document url("chrome://browser/content/browser.xul"){'
         + '#XX-net .toolbarbutton-icon {'
         + 'list-style-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAA6lBMVEUAAABCSpP/ywBTV5r/ygB5cKTsvRLbtB9maqX/4QBBSqL/ygBRV5+qj0v6xwTasR4pOKxNU5f/ygD/0wD/ygD/0gBCRoT/ygD/3wA3Q6ZkZaJSV5n/2gBITJJRVpc+RJEqPsJMUJP/zgBNUJOAdWr/ygBvc41QV4bltRVTU3//ywBWW5flthRHS39JTpNTVodvda1SVqB8gq8tOZmSgFr/3gD/ygBFS5ZKUJhGTJr/1ABITpX/2wD/zgAaML5LUZtDSZX/2AArO7EuPqhPVqJIUaBFTJ89Q5xASZlgXYR3bnDrwhD70gP/zABLwy68AAAANnRSTlMAg3RRJhgWBQT9+vjr4ODf3trUysXAtLOwq6imo52Wlo2MjIeEdnFuamdlX1ZSTUxANCkkGQ+gSVWCAAAAnElEQVQY002OVQ7CUBQFLy20xd3d3eE+qeO6/+0QaGje/M0kJzmwaAYCIRBYXnSnAiKDK70NQaTA9NMaQC3mMpJXYg6NaJBHRMULmzNh5ZGLGPyPxvRwf5k4AZ/W8emaNRBIGvzdE3wWRuNhyb7vuGnELZ35jxMcS5CySdpTNcsxuoctoaTxC0pH6n8fTAllcxCpEmKvxKB123X5Az3DE3nS1LPdAAAAAElFTkSuQmCC)'
         + '}}';
    var sss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService);
    var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
    sss.loadAndRegisterSheet(ios.newURI("data:text/css;base64," + btoa(cssStr), null, null), sss.USER_SHEET);
})();
 
// 三道杠添加重启按钮
(function()
{
    var quitBtn = document.getElementById("appMenu-quit-button");
    if (!quitBtn) return;
 
    var restartBtn = document.createElement("toolbarbutton");
    restartBtn.setAttribute("label", "\u91CD\u65B0\u542F\u52A8");
    restartBtn.setAttribute("class", "subviewbutton subviewbutton-iconic");
    restartBtn.setAttribute("id", "restart-button");
 
    restartBtn.addEventListener("command", function()
    {
        const APP_START = Components.classes['@mozilla.org/toolkit/app-startup;1']
            .getService(Components.interfaces.nsIAppStartup);
        APP_START.quit(APP_START.eRestart | APP_START.eAttemptQuit);
    }, false);
    quitBtn.parentNode.insertBefore(restartBtn, quitBtn);
})();
 
// 三道杠添加配置文件夹
(function()
{
    var customizeBtn = document.getElementById("appMenu-customize-button");
    if (!customizeBtn) return;
 
    var ChromeBtn = document.createElement("toolbarbutton");
    ChromeBtn.setAttribute("label", "\u914D\u7F6E\u6587\u4EF6\u5939");
    ChromeBtn.setAttribute("class", "subviewbutton subviewbutton-iconic");
    ChromeBtn.setAttribute("id", "Chrome-button");
 
    ChromeBtn.addEventListener("command", function()
    {
        var canvas = Components.classes["@mozilla.org/file/directory_service;1"].getService(Components.interfaces.nsIProperties).get("UChrm", Components.interfaces.nsIFile).reveal();
    }, false);
    customizeBtn.parentNode.insertBefore(ChromeBtn, customizeBtn);
})();
 
// 自动恢复地址栏地址显示
{if (location == "chrome://browser/content/browser.xul") {
    var ub = document.getElementById("urlbar");
    ub.addEventListener("blur", function () {
        this.handleRevert();
    }, false);
}
};
 
// 刷新按钮移动到地址栏
(function() {
    function moveReloadIntoURL() {
        try {
            var btn0 = document.getElementById("pageActionButton");
            var btn1 = document.getElementById("reload-button");
            if (!btn0 || !btn1) return;
 
            var btn = document.createElement("toolbarbutton");
            btn.style.margin = '0px';
            btn.setAttribute("id", "stop_reload_button");
            btn.setAttribute("class", btn1.getAttribute("class"));
 
            btn.addEventListener("command", function(e) {
                var btn = document.getElementById("reload-button");
                if (btn && btn.getAttribute('displaystop'))
                    BrowserStop();
                else
                    BrowserReload();
            }, false);
            btn0.parentNode.insertBefore(btn, btn0);
 
            btn1.addEventListener('DOMAttrModified', reloadBtnAttr);
            reloadBtnAttr(); btn1.parentNode.hidden = true;
        }catch(e){ alert(e) }
    }
 
    function reloadBtnAttr(e) {
        btn = document.getElementById("stop_reload_button");
        if (btn && (!e || e.attrName=='displaystop')) {
            var newVal = e ? e.newValue : document.getElementById(
                "reload-button").getAttribute('displaystop');
           if (newVal)
                btn.style.listStyleImage = "url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAP0lEQVQ4jWNgGHbgEAMDgwEeeQOoGoIKsBmCT46gQqI1Y9NAsmZ0Q8jSTLEBFHmBokCkOBqpkpAIAbJihHYAABx5FYnbHFdNAAAAAElFTkSuQmCC')";
            else
                btn.style.listStyleImage = "url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAlElEQVQ4jcWSyw0DIQxEtwJaSCVbAwW4Ar/pYmujFOpAubDShiR8EkWxxAEh3ng83rZfl6TbV5+B4u77xxB334EiKa4oR0kJKPXk6U6AA8iSopkFSbFCjillIJtZqPe1GUhKrdelFIByqndE3gNHADMLQOnRnyw071FS6gEehvhCPQ/3oY3xEmWeivLa6rlII2v/rTsjEWmUYkMVDAAAAABJRU5ErkJggg==')";
        }
    }
 
    moveReloadIntoURL();
})();
 
// 右键地址栏刷新按钮强制刷新
    (function() {
        var UndoClosedTabs = document.getElementById('stop_reload_button');
        if (!UndoClosedTabs) return;
        UndoClosedTabs.addEventListener("click", function(event) {
            if (event.button == 2) {
                event.preventDefault();
                BrowserReloadSkipCache();
            }
        }, false);
    })();
麻烦大神帮忙看下,隔壁RC的貌似正常,不知道是不是我的userChrome不对
根据https://github.com/Endor8/userChrome.js/tree/master/userChrome配置的
游客

返回顶部