【已解决】在Firefox 94.0 beta版本中,如何设置右键图片“新建标签页打开图像”为前台打开

阅读:4190回复:9
2021-10-11 13:44
写私信
楼主#
在Firefox 94.0 beta版本中


如何设置右键图片“新建标签页打开图像”为前台打开,现在默认是后台打开
请大神@lonely_8 帮忙,万分感谢!

图片:2021-10-11_13292325.jpg

2021-10-12 16:16
写私信
1楼#
browser.tabs.loadInBackground   改为   false
2021-10-13 23:30
写私信
2楼#
location.href == 'chrome://browser/content/browser.xhtml' && setTimeout(function() {
const viewImage = document.getElementById('context-viewimage');
if(!viewImage) return;
viewImage.removeAttribute('oncommand');
viewImage.addEventListener('command',  function (e) {
  let where = whereToOpenLink(e, false, false);
  if (where == "current") {
    where = "tab";
  }
  let referrerInfo = gContextMenu.contentData.referrerInfo;
  let systemPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
  if (gContextMenu.onCanvas) {
    gContextMenu._canvasToBlobURL(gContextMenu.targetIdentifier).then(function(blobURL) {
      openLinkIn(blobURL, where, {
        referrerInfo,
        triggeringPrincipal: systemPrincipal,
        inBackground: e.button !== 0
      });
    }, Cu.reportError);
  } else {
    urlSecurityCheck(
      gContextMenu.mediaURL,
      gContextMenu.principal,
      Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT
    );
 
    // Default to opening in a new tab.
    openLinkIn(gContextMenu.mediaURL, where, {
      referrerInfo,
      forceAllowDataURI: true,
      triggeringPrincipal: gContextMenu.principal,
      csp: gContextMenu.csp,
      inBackground: e.button !== 0
    });
  }
});
}, 1000);
UC 脚本,左键为前台标签打开,中键、右键则为后台标签打开。
2021-10-14 08:03
写私信
3楼#
lonely_8:location.href == 'chrome://browser/content/browser.xhtml' && setTimeout(function() {
const viewImage = document.getElem...
回到原帖
再次谢谢大神,问题完美解决,谢谢!
2021-10-24 11:15
写私信
4楼#
lonely_8:location.href == 'chrome://browser/content/browser.xhtml' && setTimeout(function() {
const viewImage = document.getElem...
回到原帖
大佬,此脚本在 Firefox Nightly 95.0a1中失效了,左键还是在后台打开图片
2021-10-24 14:55
写私信
5楼#
333ywb:大佬,此脚本在 Firefox Nightly 95.0a1中失效了,左键还是在后台打开图片回到原帖
测试并没有问题。
2021-10-24 16:45
写私信
6楼#
lonely_8:测试并没有问题。回到原帖
我这里是94版正常,95版不正常
2021-10-24 16:52
写私信
7楼#
lonely_8:测试并没有问题。回到原帖
在95版下这两个脚本也失效了,可以修复?谢谢!!!
// 03. 主页按钮在新标签打开
 
(function() {
       
    // 新标签打开:主页按钮(排除about:blank和about:newtab)
    try {
        eval("BrowserHome = " + BrowserHome.toString()
            .replace(/switch \(where\) {/, "where = (gBrowser.currentURI.spec!="+"'about:blank' && gBrowser.currentURI.spec!="+"'about:newtab' || gBrowser.webProgress.isLoadingDocument"+") ? 'tab' : 'current'; $&"));
    }catch(e){}
})();
// 05. 重新载入全部标签页
 
location.href.startsWith('chrome://browser/content/browser.x') && (() => {
    const reloadTab = document.getElementById('context_reloadTab');
    if(!reloadTab) return;
    const menuitem = document.createXULElement('menuitem');
    menuitem.setAttribute('accesskey', 'A');
    menuitem.setAttribute('label', reloadTab.getAttribute('label')
        .startsWith('Reload') ? 'Reload All Tabs' : '重新载入全部标签页'
    );
    menuitem.addEventListener('command', () => {
        gBrowser.visibleTabs.forEach(tab => {
            try {
                gBrowser.getBrowserForTab(tab).reload();
            } catch (e) {}
        });
    });
    reloadTab.after(menuitem);
})();
2021-10-24 20:50
写私信
8楼#
都没问题,我怀疑你都没正常加载脚本。
2021-10-24 20:59
写私信
9楼#
lonely_8:都没问题,我怀疑你都没正常加载脚本。回到原帖
啊,那就奇怪了,我的94版脚本配置和95的配置一模一样。94下正常,95就不行