CleanAff

clean hostloc aff

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

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

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         CleanAff
// @namespace    http://tampermonkey.net/
// @version      1.0.2
// @description  clean hostloc aff
// @author       Golang
// @include      /https://www.hostloc.com/thread/
// @require       https://cdn.jsdelivr.net/npm/jquery/dist/jquery.min.js
// @license      MIT
// ==/UserScript==

(function () {
    'use strict';

    $('a').each((i, e) => {
        let href = $(e).attr('href')
        if (href) {
            if (href.indexOf('aff=') > -1) {
                $(e).attr('href', href.replace(/(aff=)\d+/, '$1-1'))
                $(e).text(href.replace(/(aff=)\d+/, '$1-1'))
            } else if (href.indexOf('ref=') > -1) {
                $(e).attr('href', href.replace(/(ref=)\d+/, '$1-1'))
                $(e).text(href.replace(/(ref=)\d+/, '$1-1'))
            }

        }

    })
})();