Mandiner comments' URL fixer

Userscript for fixing URLs in mandiner.hu's comments

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

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