Greasy Fork

Greasy Fork is available in English.

禁止打开新标签

强制所有顽固跳转的链接都在当前标签页打开

// ==UserScript==
// @name         禁止打开新标签
// @description  强制所有顽固跳转的链接都在当前标签页打开
// @version      1.1
// @author       WJ
// @match        *://*/*
// @license      MIT
// @grant        none
// @run-at       document-end
// @namespace http://greasyfork.icu/users/914996
// ==/UserScript==

(() => {
  'use strict';
  document.addEventListener('click', e => {
    const a = e.target.closest('a');
    if (a?.href) { e.preventDefault(); location = a.href; }
  }, true);
})();