Remove RetroAchievements Redirect

Remove the redirect part and replace google with duckduckgo

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Remove RetroAchievements Redirect
// @namespace    http://metalsnake.space/
// @version      1.0
// @description  Remove the redirect part and replace google with duckduckgo
// @author       MetalSnake
// @match        *://retroachievements.org/viewtopic*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // Alle Links auf der Seite abrufen
    const links = document.querySelectorAll('a');

    links.forEach(link => {
        // Überprüfen, ob der Link die Redirect-URL enthält
        if (link.href.startsWith('https://retroachievements.org/redirect?url=')) {
            // Den Redirect-Teil entfernen
            const newUrl = decodeURIComponent(link.href.replace('https://retroachievements.org/redirect?url=', ''));
            if (newUrl.startsWith('https://www.google.com/')) {
                const newUrlUnGoogle = newUrl.replace('https://www.google.com/search', 'https://duckduckgo.com/');
                link.href = newUrlUnGoogle; // Den Link aktualisieren
                console.log(newUrlUnGoogle);
            }
            else{
            link.href = newUrl; // Den Link aktualisieren
                console.log(newUrl);
            }

        }
    });
})();