GreasyFork++ Install Button Fixer

Fixes GreasyFork++ install buttons by hijacking their broken modal logic and forcing them to behave like actual install links again. No popups. No blank tabs. Just install, damn it.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         GreasyFork++ Install Button Fixer
// @namespace    ScriptKiddyMonkey
// @version      1
// @license      MIT
// @description  Fixes GreasyFork++ install buttons by hijacking their broken modal logic and forcing them to behave like actual install links again. No popups. No blank tabs. Just install, damn it.
// @author       ScriptKiddyMonkey & MonkeyGPT
// @match        https://greasyfork.org/*
// @grant        none
// @run-at       document-idle
// ==/UserScript==

(function () {
  'use strict';

  const MAX_RETRIES = 30;
  let attempt = 0;

  const hijackInstallButtons = () => {
    const links = document.querySelectorAll('a.install-link');
    if (!links.length) {
      if (attempt++ < MAX_RETRIES) return setTimeout(hijackInstallButtons, 200);
      console.warn('[MonkeyGPT] No install links found after waiting.');
      return;
    }

    console.log(`[MonkeyGPT] Hijacking ${links.length} install button(s)...`);

    links.forEach(link => {
      const newLink = link.cloneNode(true);
      link.replaceWith(newLink);

      newLink.addEventListener('click', function (e) {
        e.preventDefault();
        console.log('[MonkeyGPT] ⚡ Triggering inline install:', newLink.href);
        // Directly navigate to the script URL in the current tab
        window.location.href = newLink.href;
      });
    });
  };

  setTimeout(hijackInstallButtons, 1000);

})();