nixx's magnet link tool for pantsu.cat

turns the magnet links on pantsu.cat's nyaa backup into nixx's shit tool

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         nixx's magnet link tool for pantsu.cat
// @namespace    https://greasyfork.org/en/users/3372-nixxquality
// @version      1.0
// @description  turns the magnet links on pantsu.cat's nyaa backup into nixx's shit tool
// @author       nixx <[email protected]>
// @match        https://nyaa.pantsu.cat/*
// @match        https://sukebei.pantsu.cat/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var xtregex = /xt=([^&]+)/;
    var dnregex = /dn=([^&]+)/;

    [].forEach.call(document.getElementsByTagName("a"), function(item) {
        if (item.href.startsWith("magnet")) {
            var xtmatch = item.href.match(xtregex);
            var dnmatch = item.href.match(dnregex);

            if (xtmatch !== null) {
                item.href = "https://nixx.is-fantabulo.us/magnet_with_trackers.html#" + xtmatch[1] + "#" + dnmatch[1];
            }
        }
    });

})();