Mandiner comments' URL fixer

Userscript for fixing URLs in mandiner.hu's comments

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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