2020-11-26 22:02:41 +01:00
|
|
|
const obfuscates = document.getElementsByClassName("obfuscate");
|
2020-11-26 15:09:55 +01:00
|
|
|
for (const element of obfuscates) {
|
2020-11-26 22:02:41 +01:00
|
|
|
const link = document.createElement("a");
|
|
|
|
const separators = element.dataset.separators;
|
|
|
|
const protocol = element.dataset.param1.split("").reverse().join("");
|
|
|
|
let url = protocol;
|
2020-11-26 15:09:55 +01:00
|
|
|
for (let i = 0; i < separators.length; i++) {
|
2020-11-26 22:02:41 +01:00
|
|
|
url += separators[i] + element.dataset["param" + (i+2)].split("").reverse().join("");
|
2020-11-26 15:09:55 +01:00
|
|
|
}
|
2020-11-26 22:02:41 +01:00
|
|
|
let text = element.dataset.param2.split("").reverse().join("");
|
2020-11-26 15:09:55 +01:00
|
|
|
for (let i = 1; i < separators.length; i++) {
|
2020-11-26 22:02:41 +01:00
|
|
|
text += separators[i] + element.dataset["param" + (i+2)].split("").reverse().join("");
|
2020-11-26 15:09:55 +01:00
|
|
|
}
|
2020-11-26 22:02:41 +01:00
|
|
|
link.innerText = url.replace(new RegExp(element.dataset.regex, 'i'), element.dataset.replace);
|
|
|
|
link.href = url;
|
|
|
|
link.rel = "nofollow";
|
2020-11-26 15:09:55 +01:00
|
|
|
element.parentElement.insertBefore(link, element);
|
|
|
|
}
|
2020-11-26 22:02:41 +01:00
|
|
|
while (obfuscates.length > 0) obfuscates[0].remove();
|