warb
非常火狐
非常火狐
  • UID51578
  • 注册日期2015-10-28
  • 最后登录2019-05-04
  • 发帖数639
  • 经验666枚
  • 威望0点
  • 贡献值816点
  • 好评度27点
阅读:1091回复:8

求修改脚本

楼主#
更多 发布于:2017-11-18 13:35
每夜版58能用的右键点击后台新标签打开链接脚本,升级到59后不能使用了


(function() {
    var x = true;  // false: 前台 | true: 后台
    
    function $(id) document.getElementById(id);

    gBrowser.mPanelContainer.addEventListener('click', function(e) {
        if (e.button == 2 && !e.ctrlKey) {
            var onlink = XULBrowserWindow.overLink;
            var href = e.target.href || e.target.parentNode.href || onlink;  
            if (href && onlink !== "") {
                if (/^javascript:/i.test(onlink.toString())) return;
                //e.preventDefault();
                e.stopPropagation();
                $("contentAreaContextMenu").hidePopup();
                gBrowser.moveTabTo(gBrowser.loadOneTab(href, {inBackground: x}), gBrowser.mCurrentTab._tPos + 1);
            }
        }
    }, false);
    gBrowser.mPanelContainer.addEventListener('contextmenu', function(e) {
        if (e.button == 2 && !e.ctrlKey) {
            var onlink = XULBrowserWindow.overLink;
            var href = e.target.href || e.target.parentNode.href || onlink;  
            if (href && onlink !== "") {
                if (/^javascript:/i.test(onlink.toString())) return;
                e.preventDefault();
                //e.stopPropagation();
            }
        }
    }, false);
})();
warb
非常火狐
非常火狐
  • UID51578
  • 注册日期2015-10-28
  • 最后登录2019-05-04
  • 发帖数639
  • 经验666枚
  • 威望0点
  • 贡献值816点
  • 好评度27点
1楼#
发布于:2017-11-18 18:11
lonely_8
非常火狐
非常火狐
  • UID30273
  • 注册日期2009-09-03
  • 最后登录2022-08-09
  • 发帖数733
  • 经验469枚
  • 威望0点
  • 贡献值86点
  • 好评度147点
  • 社区居民
  • 忠实会员
2楼#
发布于:2017-11-18 18:47
试试将
function $(id) document.getElementById(id);
改为
function $(id) {return document.getElementById(id)};
warb
非常火狐
非常火狐
  • UID51578
  • 注册日期2015-10-28
  • 最后登录2019-05-04
  • 发帖数639
  • 经验666枚
  • 威望0点
  • 贡献值816点
  • 好评度27点
3楼#
发布于:2017-11-19 08:31
谢谢成功了
要是总结个新旧参数不同的对比列表就好了。
warb
非常火狐
非常火狐
  • UID51578
  • 注册日期2015-10-28
  • 最后登录2019-05-04
  • 发帖数639
  • 经验666枚
  • 威望0点
  • 贡献值816点
  • 好评度27点
4楼#
发布于:2017-11-19 08:51
lonely_8:试试将
function $(id) document.getElementById(id);
改为
function $(id) {return document.getElementById(id)};
回到原帖
谢谢。在看看这个脚本
 //总在当前标签页打开小书签
        eval("openLinkIn = " + openLinkIn.toString()
          .replace(/(?=if \(where == "save"\))/, 'if (url.substr(0, 11) == "javascript:") where = "current";')
          .replace(/(?=var loadInBackground)/, 'if (w.gBrowser.currentURI.spec == "about:blank" && !w.gBrowser.mCurrentTab.hasAttribute("busy")) where = "current";')
        );

})();
warb
非常火狐
非常火狐
  • UID51578
  • 注册日期2015-10-28
  • 最后登录2019-05-04
  • 发帖数639
  • 经验666枚
  • 威望0点
  • 贡献值816点
  • 好评度27点
5楼#
发布于:2017-11-19 08:52
这个脚本也失效了。除了这个脚本其他的所有脚本在59都运行正常了。帮忙一下

 //总在当前标签页打开小书签
        eval("openLinkIn = " + openLinkIn.toString()
          .replace(/(?=if \(where == "save"\))/, 'if (url.substr(0, 11) == "javascript:") where = "current";')
          .replace(/(?=var loadInBackground)/, 'if (w.gBrowser.currentURI.spec == "about:blank" && !w.gBrowser.mCurrentTab.hasAttribute("busy")) where = "current";')
        );

})();//没有发表相同内容哦
warb
非常火狐
非常火狐
  • UID51578
  • 注册日期2015-10-28
  • 最后登录2019-05-04
  • 发帖数639
  • 经验666枚
  • 威望0点
  • 贡献值816点
  • 好评度27点
6楼#
发布于:2017-11-19 16:25
warb
非常火狐
非常火狐
  • UID51578
  • 注册日期2015-10-28
  • 最后登录2019-05-04
  • 发帖数639
  • 经验666枚
  • 威望0点
  • 贡献值816点
  • 好评度27点
7楼#
发布于:2017-11-20 10:42
warb
非常火狐
非常火狐
  • UID51578
  • 注册日期2015-10-28
  • 最后登录2019-05-04
  • 发帖数639
  • 经验666枚
  • 威望0点
  • 贡献值816点
  • 好评度27点
8楼#
发布于:2017-11-22 09:54
//总在当前标签页打开Bookmarklet
eval("openLinkIn = " + openLinkIn.toString()
  .replace(/(?=if \(where == "save"\))/, 'if (url.substr(0, 11) == "javascript:") where = "current";')
  .replace(/(?=var loadInBackground)/, 'if (w.gBrowser.currentURI.spec == "about:blank" && !w.gBrowser.mCurrentTab.hasAttribute("busy")) where = "current";')
);
游客

返回顶部