-
-
Notifications
You must be signed in to change notification settings - Fork 163
/
Copy pathscripts-old.js
136 lines (80 loc) · 5.22 KB
/
scripts-old.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
let rawStatePathRoutes = [
'do-you-know-which-license-you-need/yes/which-license-do-you-need/cc-0/waive-your-copyright+waive+read/attribution-details&license=cc-0',
'do-you-know-which-license-you-need/yes/which-license-do-you-need/cc-by/attribution-details&license=cc-by',
'do-you-know-which-license-you-need/yes/which-license-do-you-need/cc-by-sa/attribution-details&license=cc-by-sa',
'do-you-know-which-license-you-need/yes/which-license-do-you-need/cc-by-nd/attribution-details&license=cc-by-nd',
'do-you-know-which-license-you-need/yes/which-license-do-you-need/cc-by-nc/attribution-details&license=cc-by-nc',
'do-you-know-which-license-you-need/yes/which-license-do-you-need/cc-by-nc-sa/attribution-details&license=cc-by-nc-sa',
'do-you-know-which-license-you-need/yes/which-license-do-you-need/cc-by-nc-nd/attribution-details&license=cc-by-nc-nd',
'do-you-know-which-license-you-need/no/require-attribution/yes/allow-commerical-use/yes/allow-derivatives/yes/share-alike/yes/confirmation+ownership+read+revocation/attribution-details&license=cc-by',
'do-you-know-which-license-you-need/no/require-attribution/yes/allow-commerical-use/yes/allow-derivatives/yes/share-alike/no/confirmation+ownership+read+revocation/attribution-details&license=cc-by-sa',
'do-you-know-which-license-you-need/no/require-attribution/yes/allow-commerical-use/yes/allow-derivatives/no/confirmation+ownership+read+revocation/attribution-details&license=cc-by-nd',
'do-you-know-which-license-you-need/no/require-attribution/yes/allow-commerical-use/no/allow-derivatives/yes/share-alike/yes/confirmation+ownership+read+revocation/attribution-details&license=cc-by-nc',
'do-you-know-which-license-you-need/no/require-attribution/yes/allow-commerical-use/no/allow-derivatives/yes/share-alike/no/confirmation+ownership+read+revocation/attribution-details&license=cc-by-nc-sa',
'do-you-know-which-license-you-need/no/require-attribution/yes/allow-commerical-use/no/allow-derivatives/no/confirmation+ownership+read+revocation/attribution-details&license=cc-by-nc-nd',
'do-you-know-which-license-you-need/no/require-attribution/no/waive-your-copyright+waive+read/attribution-details&license=cc-0'
];
let rawStatePath = rawStatePathRoutes[13];
let statePath = rawStatePath.split("/");
let last = statePath[statePath.length - 1].split("&")
let license = last[1].split("=");
console.log(statePath[0]);
console.log(statePath[1]);
console.log(statePath[2]);
console.log(statePath[3]);
console.log(statePath[4]);
console.log(statePath[5]);
console.log(statePath[6]);
console.log(statePath[7]);
console.log(statePath[8]);
console.log(statePath[9]);
console.log(statePath[10]);
console.log(statePath[11]);
console.log(last[0]);
console.log(license[1]);
document.querySelector('#require-attribution').classList.toggle('disable');
document.querySelector('#allow-commercial-use').classList.toggle('disable');
document.querySelector('#allow-derivatives').classList.toggle('disable');
document.querySelector('#share-alike').classList.toggle('disable');
document.querySelector('#waive-your-copyright').classList.toggle('disable');
document.querySelector('#confirmation').classList.toggle('disable');
// Get the form
const form = document.forms[0];
// Get the form's radio buttons
const helpChoice = form.elements["choose"];
// Choose the "red" option
console.log(helpChoice.value);
const selectElement = document.querySelector("#do-you-know-which-license-you-need");
selectElement.addEventListener("change", (event) => {
console.log(helpChoice.value);
if (helpChoice.value == 'no') {
document.querySelector('#which-license-do-you-need').classList.toggle('disable');
} else {
document.querySelector('#which-license-do-you-need').classList.remove('disable');
}
document.querySelector('#require-attribution').classList.toggle('disable');
document.querySelector('#allow-commercial-use').classList.toggle('disable');
document.querySelector('#allow-derivatives').classList.toggle('disable');
document.querySelector('#share-alike').classList.toggle('disable');
document.querySelector('#confirmation').classList.toggle('disable');
});
const licenseElement = document.querySelector("#which-license-do-you-need");
const licenseChoice = form.elements["license"];
licenseElement.addEventListener("change", (event) => {
console.log(licenseChoice.value);
if (licenseChoice.value == 'cc-0') {
document.querySelector('#waive-your-copyright').classList.toggle('disable');
} else {
document.querySelector('#waive-your-copyright').classList.add('disable');
}
});
const attributionElement = document.querySelector("#require-attribution");
const attributionChoice = form.elements["attribution"];
attributionElement.addEventListener("change", (event) => {
console.log(attributionChoice.value);
document.querySelector('#allow-commercial-use').classList.toggle('disable');
document.querySelector('#allow-derivatives').classList.toggle('disable');
document.querySelector('#share-alike').classList.toggle('disable');
document.querySelector('#waive-your-copyright').classList.remove('disable');
document.querySelector('#confirmation').classList.toggle('disable');
});