🎉 欢迎访问GreasyFork.Org 镜像站!本镜像站由公众号【爱吃馍】搭建,用于分享脚本。联系邮箱📮

Greasy fork 爱吃馍镜像

Greasy Fork is available in English.

📂 缓存分发状态(共享加速已生效)
🕒 页面同步时间:2026/01/05 20:39:44
🔄 下次更新时间:2026/01/05 21:39:44
手动刷新缓存

noopener-everywhere

open any hyperlinks with a noopener attribute

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

You will need to install an extension such as Tampermonkey to install this script.

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

🚀 安装遇到问题?关注公众号获取帮助

公众号二维码

扫码关注【爱吃馍】

回复【脚本】获取最新教程和防失联地址

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         noopener-everywhere
// @name:zh-CN   全员noopener
// @name:zh-TW   全員noopener
// @namespace    https://github.com/li-zyang
// @version      1.0.0
// @description  open any hyperlinks with a noopener attribute
// @description:zh-CN  使用 noopener 方式打开任何新窗口的链接
// @description:zh-TW  使用 noopener 方式打開任何外部錨
// @author       阿昭
// @include      *://*
// @exclude      none
// @require      https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        GM_deleteValue
// @grant        GM_addStyle
// @grant        GM_setClipboard
// @grant        GM_xmlhttpRequest
// @grant        GM_registerMenuCommand
// @connect      *
// @noframes
// @run-at       document-end
// @note         v0.1.0      2020-03-24  On testing
// @note         v1.0.0      2020-03-27  First published
// ==/UserScript==

// => More metadata:
// @contributor  the contributors of this script
// @homepageURL  the homepage of this script (commonly <sth>.io)
// @supportURL   Defines the URL where the user can report issues and get personal support. (such as https://greasyfork.org/scripts/41537)
// @icon         url of the icon for this script, data64 is okay
// @license      license of this script
// @compatible   descript compatibility, just a human-readable message
// @match

// See https://www.tampermonkey.net/documentation.php for full documention

(function(window, $) {
  'use strict';
  $('a[href]')
    .not('[href=""]')
    .not('[href^="#"]')
    .not('[href^="javascript:"]')
  .each(function(element_index) {
    if (! $(this).attr('rel') ) {
      $(this).attr('rel', 'noopener');
    } else if (! /(\s|^)noopener(\s|$)/.test($(this).attr('rel')) ) {
      $(this).attr('rel', $(this).attr('rel') + ' noopener');
    }
  });
  let observer = new MutationObserver(function(mulist) {
    for (var mutation of mulist) {
      if (mutation.type == 'childList') {
        let jq_target = $(mutation.target);
        jq_target.find('a[href]')
          .not('[href=""]')
          .not('[href^="#"]')
          .not('[href^="javascript:"]')
        .each(function(element_index) {
          if (! $(this).attr('rel') ) {
            $(this).attr('rel', 'noopener');
          } else if (! /(\s|^)noopener(\s|$)/.test($(this).attr('rel')) ) {
            $(this).attr('rel', $(this).attr('rel') + ' noopener');
          }
        });
      }
    }
  });
  observer.observe($('body')[0], {
    childList: true,
    subtree: true
  });
})(window.unsafeWindow, $);