-
Notifications
You must be signed in to change notification settings - Fork 23
/
devScripts.js
54 lines (43 loc) · 1.42 KB
/
devScripts.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
// [Dev Scripts for testing & development] //
// Defines document root, body as default
const appRoot = () => {
return document.getElementsByTagName('body')[0];
}
// Creates a new button Submit
function createButtonSubmit(label) {
const button = document.createElement('button');
button.innerText = label || `Submit`
button.addEventListener('click', () => {
console.warn(`Clicked ${button.innerText} `)
})
return button
}
// Creates a new button Max
function createButtonMax(label) {
const button = document.createElement('div');
button.innerText = label || `Max`
button.addEventListener('click', () => {
console.warn(`Clicked ${button.innerText} `)
})
return button
}
// Creates a new button buy
function createButtonBuy(label) {
const button = document.createElement('button');
button.innerText = label || `Buy`
button.addEventListener('click', () => {
console.warn(`Clicked ${button.innerText} `)
})
return button
}
// Function to append buttons into document root
function appendButtons() {
const appendButton = (button) => {
appRoot().append(button);
console.log(`Done for "${button.innerText.toString()}"`);
}
setTimeout(() => {appendButton(createButtonMax())}, 10);
setTimeout(() => {appendButton(createButtonBuy())}, 60);
setTimeout(() => {appendButton(createButtonSubmit())}, 95);
return 'Working...'
}