Remove RetroAchievements Redirect

Remove the redirect part and replace google with duckduckgo

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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);
            }

        }
    });
})();