oe7drt-website/assets/js/link-interaction.js

48 lines
1 KiB
JavaScript
Raw Normal View History

"use strict";
document.addEventListener("DOMContentLoaded", function () {
const listener = new Listener();
listener.decode = function () {
const a = document.getElementById("link-interaction");
a.setAttribute(
"href",
a
.getAttribute("href")
.replace("o", "qual.luck1288")
.replace("-", "@")
.replaceAll("R-", "j")
.replace("/", "tunjyf.com")
.replace("t", "mailto:e"),
);
};
listener.on();
});
// Listener
function Listener() {}
Listener.prototype.decode = null;
Listener.prototype.on = function () {
this.listener = this.__onInteraction.bind(this);
document.addEventListener("mouseenter", this.listener, true);
document.addEventListener("focus", this.listener, true);
};
Listener.prototype.off = function () {
document.removeEventListener("mouseenter", this.listener, true);
document.removeEventListener("focus", this.listener, true);
delete this.listener;
};
Listener.prototype.__onInteraction = function () {
this.off();
this.decode();
};