-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.html
470 lines (417 loc) · 16.7 KB
/
settings.html
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
<html>
<head>
<title>BRB - Twitch Settings</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<style>
html {
height: 100%;
}
body {
background-color: #24282f;
}
/* Back Button */
.button {
background-color: #275EFE;
/* Green */
border: none;
color: white;
padding: 16px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
transition-duration: 0.4s;
cursor: pointer;
}
.button:hover {
background-color: #4CAF50;
/* Green */
color: white;
}
/* Form CSS */
.forms {
width: 500px !important;
padding: 10px 20px !important;
background: #f4f7f8 !important;
margin: 10px auto !important;
padding: 20px !important;
background: #464e5c !important;
border-radius: 8px !important;
font-family: Georgia, "Times New Roman", Times, serif !important;
}
form {
width: 100% !important;
}
.forms fieldset {
border: none !important;
}
.forms legend {
font-size: 1.4em !important;
margin-bottom: 10px !important;
}
.forms label {
display: block !important;
margin-bottom: 8px !important;
}
input[type="text"],
input[type="date"],
input[type="datetime"],
input[type="email"],
input[type="number"],
input[type="search"],
input[type="time"],
input[type="url"],
textarea,
select {
font-family: Georgia, "Times New Roman", Times, serif !important;
background: rgba(255, 255, 255, .1) !important;
border: none !important;
border-radius: 4px !important;
font-size: 16px !important;
margin: 0 !important;
outline: 0 !important;
padding: 7px !important;
width: 100% !important;
box-sizing: border-box !important;
-webkit-box-sizing: border-box !important;
-moz-box-sizing: border-box !important;
background-color: rgb(106, 116, 117) !important;
color: #ffffff !important;
-webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03) inset !important;
box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03) inset !important;
margin-bottom: 30px !important;
}
input[type="text"]:focus,
input[type="date"]:focus,
input[type="datetime"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="time"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
background: #d2d9dd !important;
}
.forms textarea {
max-width: 475px !important;
}
.forms select {
-webkit-appearance: menulist-button !important;
height: 35px !important;
}
.forms .number {
background: #275EFE !important;
color: #fff !important;
height: 30px !important;
width: 30px !important;
display: inline-block !important;
font-size: 0.8em !important;
margin-right: 4px !important;
line-height: 30px !important;
text-align: center !important;
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) !important;
border-radius: 15px 15px 15px 0px !important;
}
.forms input[type="submit"],
.forms input[type="button"] {
position: relative !important;
display: block !important;
padding: 19px 39px 18px 39px !important;
color: #FFF !important;
margin: 0 auto !important;
background: #275EFE !important;
font-size: 18px !important;
text-align: center !important;
font-style: normal !important;
width: 100% !important;
border: 1px solid #275EFE !important;
border-width: 1px 1px 3px !important;
margin-bottom: 10px !important;
}
.forms input[type="submit"]:hover,
.forms input[type="button"]:hover {
background: #275EFE !important;
}
@supports (-webkit-appearance: none) or (-moz-appearance: none) {
input[type=checkbox],
input[type=radio] {
--active: #275EFE !important;
--active-inner: #fff !important;
--focus: 2px rgba(39, 94, 254, .3) !important;
--border: #BBC1E1 !important;
--border-hover: #275EFE !important;
--background: #fff !important;
--disabled: #F6F8FF !important;
--disabled-inner: #E1E6F9 !important;
-webkit-appearance: none !important;
-moz-appearance: none !important;
height: 21px !important;
outline: none !important;
display: inline-block !important;
vertical-align: top !important;
position: relative !important;
margin: 0 !important;
cursor: pointer !important;
border: 1px solid var(--bc, var(--border)) !important;
background: var(--b, var(--background)) !important;
transition: background 0.3s, border-color 0.3s, box-shadow 0.2s !important;
}
input[type=checkbox]:after,
input[type=radio]:after {
content: "" !important;
display: block !important;
left: 0 !important;
top: 0 !important;
position: absolute !important;
transition: transform var(--d-t, 0.3s) var(--d-t-e, ease), opacity var(--d-o, 0.2s) !important;
}
input[type=checkbox]:checked,
input[type=radio]:checked {
--b: var(--active) !important;
--bc: var(--active) !important;
--d-o: .3s !important;
--d-t: .6s !important;
--d-t-e: cubic-bezier(.2, .85, .32, 1.2) !important;
}
input[type=checkbox]:focus,
input[type=radio]:focus {
box-shadow: 0 0 0 var(--focus) !important;
}
input[type=checkbox]:not(.switch),
input[type=radio]:not(.switch) {
width: 21px !important;
}
input[type=checkbox]:not(.switch):after,
input[type=radio]:not(.switch):after {
opacity: var(--o, 0) !important;
}
input[type=checkbox]:not(.switch):checked,
input[type=radio]:not(.switch):checked {
--o: 1 !important;
}
input[type=checkbox]+label,
input[type=radio]+label {
font-size: 14px !important;
line-height: 21px !important;
display: inline-block !important;
vertical-align: top !important;
cursor: pointer !important;
margin-left: 4px !important;
}
input[type=checkbox]:not(.switch) {
border-radius: 7px !important;
}
input[type=checkbox]:not(.switch):after {
width: 5px !important;
height: 9px !important;
border: 2px solid var(--active-inner) !important;
border-top: 0 !important;
border-left: 0 !important;
left: 7px !important;
top: 2px !important;
transform: rotate(var(--r, 20deg)) !important;
}
input[type=checkbox]:not(.switch):checked {
--r: 43deg !important;
}
input[type=checkbox].switch {
width: 38px !important;
border-radius: 11px !important;
}
input[type=checkbox].switch:after {
left: 2px !important;
top: 2px !important;
border-radius: 50% !important;
width: 15px !important;
height: 15px !important;
background: var(--ab, var(--border)) !important;
transform: translateX(var(--x, 0)) !important;
}
input[type=checkbox].switch:checked {
--ab: var(--active-inner) !important;
--x: 17px !important;
}
input[type=checkbox].switch:disabled:not(:checked):after {
opacity: 0.6 !important;
}
input[type=radio] {
border-radius: 50% !important;
}
input[type=radio]:after {
width: 19px !important;
height: 19px !important;
border-radius: 50% !important;
background: var(--active-inner) !important;
opacity: 0 !important;
transform: scale(var(--s, 0.7)) !important;
}
input[type=radio]:checked {
--s: .5 !important;
}
}
.forms ul {
margin: 12px !important;
padding: 0 !important;
list-style: none !important;
width: 100% !important;
max-width: 320px !important;
}
.forms ul li {
margin: 16px 0 !important;
position: relative !important;
}
</style>
</head>
<body>
<button class="button button" onclick="location.href = 'index.html';">
<-- Back</button>
<div class="forms">
<form id="Settings">
<legend><span class="number">1</span>BRB Twich Settings</legend>
<input type="text" id="Username" placeholder="Your Twich Username">
<input type="text" id="Channel" placeholder="Channel">
<input type="text" id="Reson" placeholder="Reason">
</select>
<ul>
<li>
<input id="Brodcast" type="checkbox">
<label for="Checkbox">Brodcast to Chat</label>
</li>
<li>
<input id="CoutDown" type="checkbox">
<label for="Checkbox">Coutdown</label>
</li>
<li>
<input id="HiddenMode" type="checkbox">
<label for="Checkbox">Stream hidden mode</label>
</li>
<li>
<input id="TimeoutWhileBan" type="checkbox">
<label for="Checkbox">Timeout user while ban countdown</label>
</li>
</ul>
<input type="number" id="CoutDownTime" placeholder="Countdown in seconds">
<input type="submit" value="Apply" />
</form>
<div id="result"></div>
<div id="output"></div>
</div>
<br> <br>
<div class="forms">
<form id="Chat">
<legend><span class="number">2</span>Twich Chat Guard</legend>
</select>
<ul>
<li>
<input id="EnableChat" type="checkbox">
<label for="Checkbox">Enable Chat</label>
</li>
<li>
<input id="LogChat" type="checkbox">
<label for="Checkbox">Log Chat</label>
</li>
<li>
<input id="DelBadMsg" type="checkbox">
<label for="Checkbox">Delete messages with bad words</label>
</li>
<li>
<input id="AutoHiddenMode" type="checkbox">
<label for="Checkbox">Auto toggle hidden mode</label>
</li>
</ul>
<textarea id="BadWordList" placeholder="Write all bad words, seperated by komma"></textarea>
<input type="submit" value="Apply" />
</form>
<div id="Chatresult"></div>
<div id="Chatoutput"></div>
</div>
</body>
</div>
</html>
<script>
sessionStorage.setItem("first_open", "false")
//Define RegEx
const URL_Regex = new RegExp(/[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)?/gi);
//Settings autofill from localstorage
$('#Username').val(localStorage.getItem("Username"))
$('#Channel').val(localStorage.getItem("Channel"))
$('#Reson').val(localStorage.getItem("Reson"))
$('#Brodcast').prop('checked', localStorage.getItem("Brodcast") == "true")
$('#CoutDown').prop('checked', localStorage.getItem("CoutDown") == "true")
$('#HiddenMode').prop('checked', localStorage.getItem("HiddenMode") == "true")
$('#TimeoutWhileBan').prop('checked', localStorage.getItem("TimeoutWhileBan") == "true")
$('#CoutDownTime').val(localStorage.getItem("CoutDownTime"))
//Chat autofill from localstorage
$('#EnableChat').prop('checked', localStorage.getItem("EnableChat") == "true")
$('#LogChat').prop('checked', localStorage.getItem("LogChat") == "true")
$('#AutoHiddenMode').prop('checked', localStorage.getItem("AHiddenMode") == "true")
$('#DelBadMsg').prop('checked', localStorage.getItem("DelBadMsg") == "true")
$('#BadWordList').val(localStorage.getItem("BadWordList"))
//Settings Submit Handler
$("#Settings").submit(function (event) {
event.preventDefault();
const Output = [];
if ($('#Username').val() !== "") {
localStorage.setItem("Username", $('#Username').val())
} else {
Output.push("<p>Username is empty</p>")
}
if ($('#Channel').val() !== "") {
if($('#Channel').val().match(URL_Regex)){
Output.push("<p>Channel must be a username, not URL</p>")
}else{
localStorage.setItem("Channel", $('#Channel').val())
}
} else {
Output.push("<p>Channel is empty</p>")
}
if ($('#Reson').val() !== "") {
localStorage.setItem("Reson", $('#Reson').val())
} else {
Output.push("<p>Reson is empty</p>")
}
if ($('#CoutDownTime').val() !== "" && $('#CoutDownTime').val() > 0) {
localStorage.setItem("CoutDownTime", $('#CoutDownTime').val())
} else {
Output.push("<p>Coutdown time is empty</p>")
}
if (Output.length > 0) {
$('#result').html("<h1>Error:</h1>")
$('#output').html(Output.join(""))
} else {
$('#result').html("<h1>Settings Saved</h1>")
$('#output').html(Output.join(""))
}
localStorage.setItem("Brodcast", $('#Brodcast').is(':checked'))
localStorage.setItem("CoutDown", $('#CoutDown').is(':checked'))
localStorage.setItem("HiddenMode", $('#HiddenMode').is(':checked'))
localStorage.setItem("TimeoutWhileBan", $('#TimeoutWhileBan').is(':checked'))
});
//Chat Submit Handler
$("#Chat").submit(function (event) {
event.preventDefault();
const Output = [];
if ($('#BadWordList').val() !== "") {
localStorage.setItem("BadWordList", $('#BadWordList').val())
} else {
Output.push("<p>BadWordList is empty</p>")
}
if (Output.length > 0) {
$('#Chatresult').html("<h1>Error:</h1>")
$('#Chatoutput').html(Output.join(""))
} else {
$('#Chatresult').html("<h1>Settings Saved</h1>")
$('#Chatoutput').html(Output.join(""))
}
localStorage.setItem("LogChat", $('#LogChat').is(':checked'))
localStorage.setItem("EnableChat", $('#EnableChat').is(':checked'))
localStorage.setItem("AHiddenMode", $('#AutoHiddenMode').is(':checked'))
localStorage.setItem("DelBadMsg", $('#DelBadMsg').is(':checked'))
});
</script>
<!-- Credits: -->
<!-- https://codepen.io/Thecoderboy/pen/mdrzGEz -->