Mandiner comments' URL fixer

Userscript for fixing URLs in mandiner.hu's comments

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 Mandiner comments' URL fixer
// @name:hu Mandiner hozzászólás URL-javító
// @description	Userscript for fixing URLs in mandiner.hu's comments
// @description:hu	Felhasználói szkript a mandiner.hu hozzászólásaiban található URL-ek kijavításaira
// @icon	https://mandiner.hu/images/favicon.png
// @version	1.2
// @include	https://*mandiner.hu/cikk/*
// @include	https://*mandiner.hu/felhasznalo/*
// @grant   none
// @namespace https://greatest.deepsurf.us/users/412587
// ==/UserScript==

let actualURL = window.location.href,
	actualURLRegex = /https:\/\/(.*)mandiner.hu\/cikk\/(\d{6})\d{2}(.*)/,
	actualURLYearMonth = actualURL.replace(actualURLRegex,'$2'),
	commentURLs = document.querySelectorAll('.comment .text a'),
	commentURLRegex = new RegExp ('[\?&]utm_source=mandiner&utm_medium=link&utm_campaign=mandiner_' + actualURLYearMonth, 'gi');
for (let commentURL of commentURLs) {
	commentURL.setAttribute('href', commentURL.getAttribute('href').replace(commentURLRegex, ''));
}