// ==UserScript== // @name SleazyFork to GreasyFork Link Bridge // @name:de SleazyFork zu GreasyFork Link-Brücke // @name:fr SleazyFork to GreasyFork Link Bridge // @name:es Enlace entre SleazyFork y GreasyFork // @name:it SleazyFork to GreasyFork Link Bridge // @name:ru SleazyFork — GreasyFork Связующее звеno // @name:zh-CN SleazyFork 到 GreasyFork 链接桥接 // // @description Redirects unavailable links from SleazyFork to GreasyFork automatically. // @description:de Leitet nicht verfügbare Links von SleazyFork automatisch auf GreasyFork weiter. // @description:fr Redirige automatiquement les liens indisponibles de SleazyFork vers GreasyFork. // @description:es Redirige automáticamente los enlaces no disponibles de SleazyFork a GreasyFork. // @description:it Reindirizza automaticamente i link non disponibili da SleazyFork a GreasyFork. // @description:ru Автоматически перенаправляет недоступные ссылки из SleazyFork в GreasyFork. // @description:zh-CN 自动将 SleazyFork 上不可用的链接重定向到 GreasyFork/ // // @version 0.0.8 // @author Wack.3gp (https://greasyfork.org/users/4792) // @copyright 2026+, Wack.3gp // @namespace https://greasyfork.org/users/4792 // @license CC BY-NC-SA-4.0; https://creativecommons.org/licenses/by-nc-sa/4.0/ // @icon https://sleazyfork.org/vite/assets/blacklogo16-DftkYuVe.png // // @match https://sleazyfork.org/*users/* // // @grant GM_xmlhttpRequest // @grant GM_info // @grant GM_notification // @connect sleazyfork.org // // @supportURL https://greasyfork.org/scripts/576108/feedback // @compatible Chrome tested with Tampermonkey // @contributionURL https://www.paypal.com/donate?hosted_button_id=BYW9D395KJWZ2 // @contributionAmount €1.00 // @downloadURL https://update.greasyfork.icu/scripts/576108/SleazyFork%20to%20GreasyFork%20Link%20Bridge.user.js // @updateURL https://update.greasyfork.icu/scripts/576108/SleazyFork%20to%20GreasyFork%20Link%20Bridge.meta.js // ==/UserScript== (function() { 'use strict'; const handleCoffeeDonation = () => { let runs = parseInt(localStorage.getItem('bridge_click_runs') || '0'); runs++; localStorage.setItem('bridge_click_runs', runs); if (runs % 50 === 0) { const donationUrl = (typeof GM_info !== 'undefined') ? GM_info.script.header.match(/@contributionURL\s+(.+)/)[1] : "https://www.paypal.com/donate?hosted_button_id=BYW9D395KJWZ2"; GM_notification({ title: '☕ Support Wack.3gp', text: `You've used the "Link Bridge" ${runs} times! Helpful? Click here to buy me a coffee.`, image: 'https://sleazyfork.org/vite/assets/blacklogo96-CxYTSM_T.png', timeout: 10000, onclick: function() { window.open(donationUrl, "_blank"); } }); } }; const scriptItems = document.querySelectorAll('li[data-script-id]'); scriptItems.forEach(item => { const link = item.querySelector('.script-link'); if (!link) return; const fullUrl = link.href; GM_xmlhttpRequest({ method: "HEAD", url: fullUrl, onload: function(response) { if (response.status === 404) { const allLinksInItem = item.querySelectorAll('a'); allLinksInItem.forEach(a => { const currentHref = a.getAttribute('href'); if (currentHref) { if (currentHref.startsWith('/')) { a.href = "https://greasyfork.org" + currentHref; } else if (currentHref.includes('sleazyfork.org')) { a.href = currentHref.replace('sleazyfork.org', 'greasyfork.org'); } a.addEventListener('click', handleCoffeeDonation); } }); } } }); }); })();