-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathscript.js
37 lines (33 loc) · 1.14 KB
/
script.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
document.body.addEventListener('click', (e) => {
if (e.target.getAttribute('type') == 'checkbox') {
generate();
}
});
function generate() {
var force_verify = 'false';
var scopes = [];
var checks = document.getElementsByTagName('input');
for (var x=0;x<checks.length;x++) {
if (checks[x].getAttribute('type') == 'checkbox') {
console.log(x, checks[x].checked, checks[x].getAttribute('name'));
if (checks[x].checked) {
if (checks[x].getAttribute('name') == 'force_verify') {
force_verify = 'true';
} else {
scopes.push(checks[x].getAttribute('name'));
}
}
}
}
var url = 'https://id.twitch.tv/oauth2/authorize'
+ '?client_id=' + client_id
+ '&redirect_uri=' + redirect_uri
+ '&response_type=code'
+ '&force_verify=' + force_verify
+ '&state=' + state
+ '&scope=';
url += scopes.join('+');
document.getElementById('auth_url_preview').textContent = url;
document.getElementById('auth_url').setAttribute('href', url);
}
generate();