Convert typescript files to javascript files
This commit is contained in:
parent
9ee59632c2
commit
812f9ac74c
4 changed files with 12 additions and 36 deletions
|
@ -1,15 +1,17 @@
|
|||
// This code de-obfuscates my email and displays it on screen when the button is clicked
|
||||
// It's not a perfect solution, but it should stop be enough to stop email scraping
|
||||
|
||||
// Email encoded in base64. This might be changed in the future to prevent scraping targeting base64 strings
|
||||
var email = "Y29udGFjdEBvd2Vucnlhbi51cwo=";
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const email = "Y29udGFjdEBvd2Vucnlhbi51cwo=";
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
// Get document elements
|
||||
var button = document.querySelector("#emailButton");
|
||||
var emailDiv = document.querySelector("#email");
|
||||
const button = document.querySelector("#emailButton");
|
||||
const emailDiv = document.querySelector("#email");
|
||||
|
||||
// Decode the email string and insert a mailto link into the DOM, then disable the button
|
||||
button.addEventListener("click", function () {
|
||||
var decodedEmail = atob(email);
|
||||
emailDiv.insertAdjacentHTML("beforeend", "<div class=\"col\"><a href=\"mailto:".concat(decodedEmail, "\"><strong>").concat(decodedEmail, "</strong></a></div>"));
|
||||
button.addEventListener("click", () => {
|
||||
const decodedEmail = atob(email);
|
||||
emailDiv.insertAdjacentHTML("beforeend", `<div class="col"><a href="mailto:${decodedEmail}"><strong>${decodedEmail}</strong></a></div>`);
|
||||
button.disabled = true;
|
||||
});
|
||||
});
|
|
@ -1,17 +0,0 @@
|
|||
// This code de-obfuscates my email and displays it on screen when the button is clicked
|
||||
// It's not a perfect solution, but it should stop be enough to stop email scraping
|
||||
|
||||
// Email encoded in base64. This might be changed in the future to prevent scraping targeting base64 strings
|
||||
const email: string = "Y29udGFjdEBvd2Vucnlhbi51cwo=";
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
// Get document elements
|
||||
const button: HTMLButtonElement = document.querySelector("#emailButton");
|
||||
const emailDiv: HTMLDivElement = document.querySelector("#email");
|
||||
|
||||
// Decode the email string and insert a mailto link into the DOM, then disable the button
|
||||
button.addEventListener("click", () => {
|
||||
const decodedEmail: string = atob(email);
|
||||
emailDiv.insertAdjacentHTML("beforeend", `<div class="col"><a href="mailto:${decodedEmail}"><strong>${decodedEmail}</strong></a></div>`);
|
||||
button.disabled = true;
|
||||
})
|
||||
});
|
|
@ -1,7 +1,8 @@
|
|||
// Some useful functions used throughout my code
|
||||
|
||||
// Based on this SO answer https://stackoverflow.com/a/35880730/9523246
|
||||
function lazyLoadCSS(url) {
|
||||
var css = document.createElement('link');
|
||||
const css = document.createElement('link');
|
||||
css.href = url;
|
||||
css.rel = 'stylesheet';
|
||||
css.type = 'text/css';
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
// Some useful functions used throughout my code
|
||||
|
||||
// Based on this SO answer https://stackoverflow.com/a/35880730/9523246
|
||||
function lazyLoadCSS(url: string): void {
|
||||
const css: HTMLLinkElement = document.createElement('link');
|
||||
css.href = url;
|
||||
css.rel = 'stylesheet';
|
||||
css.type = 'text/css';
|
||||
document.getElementsByTagName('head')[0].appendChild(css);
|
||||
}
|
Loading…
Reference in a new issue