nixx's magnet link tool for pantsu.cat

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

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

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

})();