This repository has been archived by the owner on Mar 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
33 lines (32 loc) · 1.2 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function copyStringToClipboard (str) {
// Create new element
var el = document.createElement('textarea');
// Set value (string to be copied)
el.value = str;
// Set non-editable to avoid focus and move outside of view
el.setAttribute('readonly', '');
el.style = {position: 'absolute', left: '-9999px'};
document.body.appendChild(el);
// Select text inside element
el.select();
// Copy text to clipboard
document.execCommand('copy');
// Remove temporary element
document.body.removeChild(el);
}
function sendForm() {
const sel = document.getElementById('platform');
const usr = document.getElementById('username').value;
const obj = sel.options[sel.selectedIndex];
if (obj.text === "Select Platform") {
swal("Something is off...", "You have to select platform...", "error");
return;
}
const fixed = obj.text.replace('D', 'd').replace('T', 't').replace('Y', 'y')
if (usr === "") {
swal("Something is off...", "You have to enter username...", "error");
return;
}
copyStringToClipboard(`https://app.statify.live/v1/${fixed}/${usr}`);
swal("Ayyy!", "Copied link to Clipboard, paste it to OBS", "success");
}