Greasy Fork

来自缓存

Greasy Fork is available in English.

Replace "available" with "securable" in trade links

Replaces "available" with "securable" ONLY in trade button hrefs on poe.ninja

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Replace "available" with "securable" in trade links
// @namespace    http://tampermonkey.net/
// @version      1.3
// @description  Replaces "available" with "securable" ONLY in trade button hrefs on poe.ninja
// @author       deepseek
// @match        https://poe.ninja/*
// @match        http://poe.ninja/*
// @grant        none
// @run-at       document-end
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    function fixTradeLinks() {
        // Find all trade buttons/links (they have hrefs containing pathofexile.com/trade)
        const tradeLinks = document.querySelectorAll('a[href*="pathofexile.com/trade"]');
        let fixedCount = 0;

        tradeLinks.forEach(link => {
            let href = link.getAttribute('href');
            if (href && href.includes('available')) {
                const newHref = href.replace(/available/g, 'securable');
                if (newHref !== href) {
                    link.setAttribute('href', newHref);
                    fixedCount++;
                }
            }
        });

        if (fixedCount > 0) {
            console.log(`✅ Fixed ${fixedCount} trade links: replaced "available" with "securable"`);
        }
    }

    // Run initially
    fixTradeLinks();

    // Run after short delays for dynamically loaded content
    setTimeout(fixTradeLinks, 1000);
    setTimeout(fixTradeLinks, 2000);
    setTimeout(fixTradeLinks, 3000);
    setTimeout(fixTradeLinks, 5000);

    // Watch for new trade links being added
    const observer = new MutationObserver(function(mutations) {
        let shouldCheck = false;
        mutations.forEach(function(mutation) {
            if (mutation.addedNodes.length > 0) {
                mutation.addedNodes.forEach(node => {
                    if (node.nodeType === Node.ELEMENT_NODE) {
                        if (node.tagName === 'A' || node.querySelectorAll) {
                            shouldCheck = true;
                        }
                    }
                });
            }
        });
        if (shouldCheck) {
            fixTradeLinks();
        }
    });

    if (document.body) {
        observer.observe(document.body, {
            childList: true,
            subtree: true
        });
    }

    console.log('🔄 Trade link fixer active on poe.ninja');
})();