-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.js
140 lines (128 loc) · 4.99 KB
/
main.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
const uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
const lowercase = 'abcdefghijklmnop';
const number = '0123456789';
let settingLength = 3;
let content = '';
function generateString(length, link, extension) {
let result = '';
const uppercaseLength = uppercase.length;
const lowercaseLength = lowercase.length;
const numberLength = number.length;
for ( let i = 0; i < length; i++ ) {
result += link;
for ( let i = 0; i < extension; i++ ) {
let randInt = Math.floor(Math.random() * 3);
if (randInt === 0) {
result += uppercase.charAt(Math.floor(Math.random() * uppercaseLength));
} else {
if (randInt === 1) {
result += lowercase.charAt(Math.floor(Math.random() * lowercaseLength));
} else {
if (randInt === 2) {
result += number.charAt(Math.floor(Math.random() * numberLength));
}
}
}
}
result += ' \n';
}
return result;
}
function start(lengthsetting, linksetting, extensionsetting) {
const raw = (generateString(lengthsetting, linksetting, extensionsetting));
const str = raw;
const text = document.querySelector(".text");
const input = document.querySelector(".input");
content = str;
function populateText(str) {
let span = document.createElement("span");
span.setAttribute("id", "result");
span.innerText = str;
text.appendChild(span);
}
populateText(str);
}
function updateSettings() {
if (document.getElementById("lengthInput").value.length === 0) {
window.alert('You didn\'t provide any valid length input in the box, so I\'ve defaulted to generating you 3 links.');
start(3);
} else {
let settingLength = document.getElementById("lengthInput").value;
let settingLink = document.getElementById("urlInput").value;
let settingExtension = document.getElementById("extensionInput").value;
start(settingLength, settingLink, settingExtension);
}
}
function viewRaw() {
content = document.getElementById("result").innerText;
let rawWindow = window.open("","");
rawWindow.document.write(content);
}
function copyResult() {
const copyText = document.getElementById("result").innerText;
navigator.clipboard.writeText(copyText);
}
function loadPremade() {
selectElement = document.querySelector('#premadeModes');
output = selectElement.value;
if (output == "none") {
document.getElementById("lengthInput").value = none[0];
document.getElementById("urlInput").value = none[1];
document.getElementById("extensionInput").value = none[2];
}
if (output == "hypixelDaily") {
document.getElementById("lengthInput").value = hypixelDaily[0];
document.getElementById("urlInput").value = hypixelDaily[1];
document.getElementById("extensionInput").value = hypixelDaily[2];
}
if (output == "discordNitro") {
document.getElementById("lengthInput").value = discordNitro[0];
document.getElementById("urlInput").value = discordNitro[1];
document.getElementById("extensionInput").value = discordNitro[2];
}
if (output == "discordInviteTemp") {
document.getElementById("lengthInput").value = discordInviteTemp[0];
document.getElementById("urlInput").value = discordInviteTemp[1];
document.getElementById("extensionInput").value = discordInviteTemp[2];
}
if (output == "discordInviteInf") {
document.getElementById("lengthInput").value = discordInviteInf[0];
document.getElementById("urlInput").value = discordInviteInf[1];
document.getElementById("extensionInput").value = discordInviteInf[2];
}
if (output == "pasteBin") {
document.getElementById("lengthInput").value = pasteBin[0];
document.getElementById("urlInput").value = pasteBin[1];
document.getElementById("extensionInput").value = pasteBin[2];
}
if (output == "ghostBin") {
document.getElementById("lengthInput").value = ghostBin[0];
document.getElementById("urlInput").value = ghostBin[1];
document.getElementById("extensionInput").value = ghostBin[2];
}
}
document.getElementById('premadeModes').addEventListener('change', function() {
loadPremade();
});
//-----PREMADE SETTINGS DEFAULTS-----//
const none = ["", "", ""];
const hypixelDaily = ["10", "https://rewards.hypixel.net/claim-reward/", "8"];
const discordNitro = ["10", "https://discord.gift/", "16"];
const discordInviteTemp = ["10", "https://discord.gg/", "8"];
const discordInviteInf = ["10", "https://discord.gg/", "10"];
const pasteBin = ["10", "https://pastebin.com/", "8"];
const ghostBin = ["10", "https://ghostbin.com/", "5"];
//-----PREMADE SETTINGS DEFAULTS-----//
let dark = 1;
function updateTheme() {
var r = document.querySelector(':root');
if (dark == 1) {
r.style.setProperty('--quietmidnight', '#DFDFFF');
r.style.setProperty('--raspberry', '#000');
dark = 0;
} else {
r.style.setProperty('--quietmidnight', '#12121F');
r.style.setProperty('--raspberry', '#E53B5E');
dark = 1;
}
}