-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseed.js
More file actions
36 lines (29 loc) · 1.16 KB
/
Copy pathseed.js
File metadata and controls
36 lines (29 loc) · 1.16 KB
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
const seedLength = 16;
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
export let gizzSeed = '';
for (let i = 0; i < seedLength; i++) {
const randomIndex = Math.floor(Math.random() * characters.length);
gizzSeed += characters.charAt(randomIndex);
}
const seedInput = document.querySelector("#seedInput")
seedInput.value = gizzSeed
const addSeedSwitchEvent = (id, param) => {
const element = document.querySelector(id);
const seedInput = document.querySelector("#seedInput");
element.addEventListener("click", () => {
element.checked
? seedInput.value += param
: seedInput.value = seedInput.value.replace(param, "");
});
};
addSeedSwitchEvent("#includeLive", "/L")
addSeedSwitchEvent("#includeCompilations", "/C")
addSeedSwitchEvent("#includeEps", "/E")
addSeedSwitchEvent("#includeRemix", "/R")
/*
const isOptionChecked = (id) => document.querySelector(id).checked;
if (isOptionChecked("#includeLive")) gizzSeed += "/L"
if (isOptionChecked("#includeCompilations")) gizzSeed += "/C"
if (isOptionChecked("#includeEps")) gizzSeed += "/E"
if (isOptionChecked("#includeRemix")) gizzSeed += "/R"
*/