FCC Popup Fixer (Make All Links Open in Tabs)

Converts javascript:openWindow(...) to standard links that open in new tabs

当前为 2025-06-15 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         FCC Popup Fixer (Make All Links Open in Tabs)
// @version      1.0
// @description  Converts javascript:openWindow(...) to standard links that open in new tabs
// @match        *://apps.fcc.gov/*
// @grant        none
// @namespace https://greasyfork.org/users/1484279
// ==/UserScript==

(function () {
  'use strict';

  const fixLinks = () => {
    document.querySelectorAll('a[href^="javascript:openWindow("]').forEach(a => {
      const match = a.getAttribute('href').match(/openWindow\('([^']+)'\)/);
      if (match && match[1]) {
        const realUrl = new URL(match[1], location.origin).href;
        a.setAttribute('href', realUrl);
        a.setAttribute('target', '_blank');
        a.removeAttribute('onclick'); // in case there's an extra click handler
      }
    });
  };

  // Run once after DOM is ready
  if (document.readyState === 'loading') {
    document.addEventListener('DOMContentLoaded', fixLinks);
  } else {
    fixLinks();
  }
})();