-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
21 lines (16 loc) · 739 Bytes
/
script.js
File metadata and controls
21 lines (16 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const { hash } = window.location;
if (hash) {
document.querySelector('#message-form').classList.add('hide');
document.querySelector('#message-show').classList.remove('hide');
document.querySelector('h1').innerText = atob(hash.replace('#', ''));
}
document.querySelector('form').addEventListener('submit', event =>{
event.preventDefault();
document.querySelector('#message-form').classList.add('hide');
document.querySelector('#link-form').classList.remove('hide');
const input = document.querySelector('#message-input');
const encrypted = btoa(input.value);
const linkInput = document.querySelector('#link-input');
linkInput.value = `${window.location}#${encrypted}`;
linkInput.select();
})