333ywb
火狐狸
火狐狸
  • UID27284
  • 注册日期2008-12-03
  • 最后登录2024-03-15
  • 发帖数119
  • 经验134枚
  • 威望0点
  • 贡献值140点
  • 好评度4点
  • 社区居民
  • 忠实会员
阅读:4070回复:9

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

楼主#
更多 发布于:2021-10-11 13:44
在Firefox 94.0 beta版本中


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

图片:2021-10-11_13292325.jpg

msky
千年狐狸
千年狐狸
  • UID14649
  • 注册日期2006-09-21
  • 最后登录2023-04-03
  • 发帖数2959
  • 经验166枚
  • 威望0点
  • 贡献值12点
  • 好评度9点
  • 社区居民
1楼#
发布于:2021-10-12 16:16
browser.tabs.loadInBackground   改为   false
lonely_8
非常火狐
非常火狐
  • UID30273
  • 注册日期2009-09-03
  • 最后登录2022-08-09
  • 发帖数733
  • 经验469枚
  • 威望0点
  • 贡献值86点
  • 好评度147点
  • 社区居民
  • 忠实会员
2楼#
发布于:2021-10-13 23:30
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 脚本,左键为前台标签打开,中键、右键则为后台标签打开。
333ywb
火狐狸
火狐狸
  • UID27284
  • 注册日期2008-12-03
  • 最后登录2024-03-15
  • 发帖数119
  • 经验134枚
  • 威望0点
  • 贡献值140点
  • 好评度4点
  • 社区居民
  • 忠实会员
3楼#
发布于:2021-10-14 08:03
lonely_8:location.href == 'chrome://browser/content/browser.xhtml' && setTimeout(function() {
const viewImage = document.getElem...
回到原帖
再次谢谢大神,问题完美解决,谢谢!
333ywb
火狐狸
火狐狸
  • UID27284
  • 注册日期2008-12-03
  • 最后登录2024-03-15
  • 发帖数119
  • 经验134枚
  • 威望0点
  • 贡献值140点
  • 好评度4点
  • 社区居民
  • 忠实会员
4楼#
发布于:2021-10-24 11:15
lonely_8:location.href == 'chrome://browser/content/browser.xhtml' && setTimeout(function() {
const viewImage = document.getElem...
回到原帖
大佬,此脚本在 Firefox Nightly 95.0a1中失效了,左键还是在后台打开图片
lonely_8
非常火狐
非常火狐
  • UID30273
  • 注册日期2009-09-03
  • 最后登录2022-08-09
  • 发帖数733
  • 经验469枚
  • 威望0点
  • 贡献值86点
  • 好评度147点
  • 社区居民
  • 忠实会员
5楼#
发布于:2021-10-24 14:55
333ywb:大佬,此脚本在 Firefox Nightly 95.0a1中失效了,左键还是在后台打开图片回到原帖
测试并没有问题。
333ywb
火狐狸
火狐狸
  • UID27284
  • 注册日期2008-12-03
  • 最后登录2024-03-15
  • 发帖数119
  • 经验134枚
  • 威望0点
  • 贡献值140点
  • 好评度4点
  • 社区居民
  • 忠实会员
6楼#
发布于:2021-10-24 16:45
lonely_8:测试并没有问题。回到原帖
我这里是94版正常,95版不正常
333ywb
火狐狸
火狐狸
  • UID27284
  • 注册日期2008-12-03
  • 最后登录2024-03-15
  • 发帖数119
  • 经验134枚
  • 威望0点
  • 贡献值140点
  • 好评度4点
  • 社区居民
  • 忠实会员
7楼#
发布于:2021-10-24 16:52
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);
})();
lonely_8
非常火狐
非常火狐
  • UID30273
  • 注册日期2009-09-03
  • 最后登录2022-08-09
  • 发帖数733
  • 经验469枚
  • 威望0点
  • 贡献值86点
  • 好评度147点
  • 社区居民
  • 忠实会员
8楼#
发布于:2021-10-24 20:50
都没问题,我怀疑你都没正常加载脚本。
333ywb
火狐狸
火狐狸
  • UID27284
  • 注册日期2008-12-03
  • 最后登录2024-03-15
  • 发帖数119
  • 经验134枚
  • 威望0点
  • 贡献值140点
  • 好评度4点
  • 社区居民
  • 忠实会员
9楼#
发布于:2021-10-24 20:59
lonely_8:都没问题,我怀疑你都没正常加载脚本。回到原帖
啊,那就奇怪了,我的94版脚本配置和95的配置一模一样。94下正常,95就不行
游客

返回顶部