-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindx.js
23 lines (19 loc) · 791 Bytes
/
indx.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const { hash } = window.location;
let msg = atob(hash.replace("#", ""));
if (msg) {
document.getElementById("msg-form").classList.add("hide");
document.getElementById("message-show").classList.remove("hide");
document.getElementById("msgtext").innerHTML = msg;
}
let form = document.querySelector("form");
let cardInput = document.getElementsByClassName("card-input");
let input = document.getElementById("msg-input");
let linkInput = document.getElementById("link-input");
form.addEventListener("submit", (e) => {
e.preventDefault();
document.querySelector("#msg-form").classList.add("hide");
document.querySelector("#link-form").classList.remove("hide");
let encrypted = btoa(input.value);
linkInput.value = `${window.location}#${encrypted}`;
linkInput.select();
});