-
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathindex.html
More file actions
653 lines (591 loc) · 35.1 KB
/
Copy pathindex.html
File metadata and controls
653 lines (591 loc) · 35.1 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
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
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Twitch Shout-out Clips Player</title>
<meta name="description"
content="Twitch Shout out clip player. !so channelname. This will display a random clip and say a shout out message in chat." />
<meta name="keywords" content="Twitch, shoutout, chat bot, overlay" />
<meta property="og:type" content="website" />
<meta property="og:title" content="Twitch Shout-out Clips Player" />
<meta property="og:description"
content="Twitch Shout out clip player. !so channelname. This will display a random clip and say a shout out message in chat." />
<meta property="og:url" content="" />
<meta property="og:site_name" content="Twitch Shout-out Clips Player" />
<script src="assets/js/jquery-3.6.0.min.js"></script>
<script src="assets/js/bootstrap.bundle.min.js"></script>
<link rel="stylesheet" href="assets/css/bootstrap452.min.css">
<link rel="stylesheet" href="assets/css/dark.min.css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.2/css/all.min.css" rel="stylesheet">
<link rel="apple-touch-icon" sizes="57x57" href="assets/images/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="assets/images/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="assets/images/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="assets/images/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="assets/images/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="assets/images/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="assets/images/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="assets/images/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="assets/images/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="assets/images/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="assets/images/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="assets/images/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicon-16x16.png">
</head>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Noto Sans, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
background-color: #181821;
color: #ddd9e8 !important;
}
a {
text-decoration: none !important;
color: #8c8dff !important;
}
a:hover, a:focus {
text-decoration: underline !important;
color: #a0a1ff !important;
}
.nav-pills a {
text-decoration: none !important;
color: #fff !important;
}
a i {
color: #ddd9e8;
}
a:hover i, a:focus i, a.active i {
color: #eef0f3;
}
.btn-link {
color: #ddd9e8 !important;
}
.muted {
color: #606085 !important;
}
.card,
.alert-dark {
background-color: #292938 !important;
border-color: #292938 !important;
color: #ddd9e8 !important;
}
.hide {
display: none;
}
.ml-0 {
margin-left: 0 !important;
}
.ml-4 {
margin-left: 1.5rem !important;
}
.pl-0 {
padding-left: 0 !important;
}
.pr-0 {
padding-right: 0 !important;
}
.dark-blue {
background-color: #1b2836 !important;
color: #fff !important;
}
.light-blue {
background-color: #354e69 !important;
color: #fff !important;
}
.btn-purple, .btn-purple:hover, .btn-purple:focus, .btn-purple:active {
background-color: #6441a5;
border-color: #523c7c;
}
</style>
<body onload="onInit()">
<div class="container">
<div class="row pt-md-4 mb-4">
<ul class="nav nav-pills">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle active" data-toggle="dropdown" href="#" role="button"
aria-haspopup="true" aria-expanded="false">Twitch Tools</a>
<div class="dropdown-menu" id="main-nav">
</div>
</li>
</ul>
</div>
<div class="alert alert-info alert-dismissible fade show mb-4" role="alert">
<p style="margin: 0;">If you enjoy some of these tools, please consider <a href="https://www.teklynk.com/support" target="_blank" style="color: #007bff;">donating</a>. It helps support the online infrastructure that powers these projects.</p>
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="card mb-4">
<div class="card-body shadow">
<h2>Shout-Out Clip Player Overlay</h2>
<p>Play a random clip from the streamers channel that is shouted out.</p>
<h3>Features:</h3>
<ul>
<li><strong>Multiple Shoutouts</strong> Shoutout's go into a queue. When one shoutout finishes
playing, it will play the next shoutout.</li>
<li><strong>!watchclip</strong> Play a clip that was posted into chat.</li>
<li><strong>!replayso, !soreplay, !clipreplay, !replayclip</strong> will replay the previous
shout-out clip. Maybe you just have to see that clip again :)</li>
<li><strong>!stopclip</strong> to stop/reload the browser source in case a clip is just way too
long, cringey or playing at an inappropriate time. Limited to Mods and Streamer. Can also use
(!sostop, !stopclip, !clipstop, !clipreload)</li>
<li><strong>Date Range option:</strong> This will try to grab a clip from within the last 5days,
10day,
30days... If no clips exist, then it will play a random "popular" clip.</li>
<li><strong>Prefer Featured Clips:</strong> This will try to grab featured clips. If no clips exist,
then it will play a random "popular" clip.</li>
<li>
<strong>Show clip details panel:</strong> This will display a panel in the lower third of the
overlay that contains details about the clip. This can use
variables:{channel},{title},{game},{creator_name},{created_at}.
</li>
<li><strong>Raid shoutout:</strong> Automatically do a shout-out on Raid events.</li>
</ul>
<p>Be sure to set "Shutdown source when not visible", "Control audio via OBS", "Refresh browser when
scene becomes active" on the OBS Browser Source properties. Set the browser source window size to 1920x1080 and then resize/scale the browser source window.</p>
<p>* NOTE: If you set `Date Range` AND `Prefer featured clips`, it will try to pull clips that are featured within the specified date range.</p>
<p>Join our <a href="https://github.com/teklynk/twitch_shoutout/discussions" target="_blank">GitHub Discussions</a> to get the latest on new features and updates, submit feature requests, report issues, and talk tech with the community.</p>
<div class="text-center p-2">
<a class="btn btn-link btn-lg" href="https://github.com/teklynk/twitch_shoutout/blob/main/README.md" target="_blank" title="README"><i class="fa-brands fa-readme"></i></a>
<a class="btn btn-link btn-lg" href="https://github.com/teklynk/twitch_shoutout" target="_blank" title="GitHub"><i class="fa-brands fa-github"></i></a>
<a class="btn btn-link btn-lg" href="https://github.com/teklynk/twitch_shoutout/discussions" target="_blank" title="GitHub Discussions"><i class="fa-solid fa-comment"></i></a>
<a class="btn btn-link btn-lg" href="https://github.com/sponsors/teklynk" target="_blank" title="Donate/Support"><i class="fa-solid fa-dollar-sign"></i></a>
</div>
</div>
</div>
<div class="alert alert-dark shadow" role="alert"><p>Access Token is required if you would like to post a shoutout message in chat.</p>
<div class="form-label-group">
<div>
<a class="btn btn-purple btn-lg text-white shadow-sm font-weight-bold" id="twitch-auth-link" href="#" target="_self" title="Sign in with your Twitch account"><i class="fa-brands fa-twitch"></i> Connect</a>
</div>
<div class="form-label-group mt-2">
<label for="ref">Access token</label>
<input type="password" id="ref" class="form-control">
<span id="show_ref"
style="cursor:pointer;text-align:left;display:inline-block;width:70px;margin-top: 4px;font-size:smaller;vertical-align:top;"
title="Show/Hide">show
</span>
</div>
</div>
</div>
<div class="form-label-group mb-4">
<label for="mainAccount">Twitch Account</label>
<input type="text" id="mainAccount" class="form-control validate shadow" placeholder="MrCoolStreamer">
</div>
<div class="form-label-group mb-4">
<label for="command">Custom Command (so, soclip, playclip. No need to include the ! symbol)</label>
<input type="text" id="command" class="form-control validate shadow" value="so" placeholder="so" size="50">
</div>
<div class="form-check">
<input class="form-check-input shadow" type="checkbox" value="" id="showClip" checked>
<label class="form-check-label" for="showClip">
Show clip
</label>
</div>
<div class="form-check">
<input class="form-check-input shadow" type="checkbox" value="" id="preferFeatured">
<label class="form-check-label" for="preferFeatured">
Prefer featured clips (Featured clips if found)
</label>
</div>
<div class="form-check">
<input class="form-check-input shadow" type="checkbox" value="" id="showImage">
<label class="form-check-label" for="showImage">
Show the user profile image if clips do not exist
</label>
</div>
<div class="form-check">
<input class="form-check-input shadow" type="checkbox" value="" id="raided">
<label class="form-check-label" for="raided">
Automatically shoutout a streamer when they raid you
</label>
</div>
<div class="form-group range-slider hide ml-4 mr-4 mt-2" id="so_count">
<label for="delay">Min raid party size</label>
<input type="range" max="30" min="0" step="1" class="form-control range-slider-range shadow" id="raidCount"
value="3" style="height: 0;">
<small class="text-muted range-slider-value"></small>
<small class="text-muted range-slider-value">Users</small>
</div>
<div class="form-group range-slider hide ml-4 mr-4" id="so_delay">
<label for="delay">Delay automatic shoutout</label>
<input type="range" max="30" min="1" step="1" class="form-control range-slider-range shadow" id="delay"
value="10" style="height: 0;">
<small class="text-muted range-slider-value"></small>
<small class="text-muted range-slider-value">Seconds</small>
</div>
<div class="form-group range-slider mt-2">
<label for="dateRange">Prefer clips from within a Date Range (Date range clips if found) <small class="text-warning">* 0 Day(s) = OFF</small>
</label>
<input type="range" max="365" min="0" step="10" class="form-control range-slider-range shadow" id="dateRange"
value="0" style="height: 0;">
<small class="text-muted range-slider-value" id="date-limit"></small>
<small class="text-muted range-slider-value">Day(s)</small>
</div>
<div class="form-group range-slider">
<label for="timeOut">Max Duration Time (How long should the clip play?)</label>
<input type="range" max="60" min="10" step="10" class="form-control range-slider-range shadow" id="timeOut"
value="60" style="height: 0;">
<small class="text-muted range-slider-value"></small>
<small class="text-muted range-slider-value">Seconds</small>
</div>
<div class="form-check">
<input class="form-check-input shadow" type="checkbox" value="" id="showText" checked>
<label class="form-check-label" for="showText">
Show: "Go check out {channel}" on top of the clip
</label>
<div class="form-label-group mb-4 hide" id="customTitle_block">
<div class="form-label-group mb-4 mt-2">
<label for="customTitle">Custom Title (Optional)</label>
<input type="text" id="customTitle" class="form-control shadow" value=""
placeholder="Go check out {channel} {url}" size="50">
</div>
</div>
</div>
<div class="form-check mb-2">
<input class="form-check-input shadow" type="checkbox" value="" id="showDetails">
<label class="form-check-label" for="showDetails">
Show clip details panel
</label>
</div>
<div class="form-label-group mt-2 mb-4 ml-4 hide" id="showDetailsText">
<label for="detailsText">Custom clip details panel text (Optional)
</label>
<textarea class="form-control shadow" id="detailsText" rows="4" placeholder="{title}
While streaming {game}
Clipped by {creator_name} {created_at}"></textarea>
</div>
<div class="form-check">
<input class="form-check-input shadow" type="checkbox" value="" id="showMsg">
<label class="form-check-label" for="showMsg">
Show chat message: "Go check out {channel}! - They were playing: {game} - {title} - {url}"
<small class="text-warning">* Requires Twitch Access Token</small>
</label>
<div class="form-label-group mb-4 hide" id="access_token">
<div class="form-label-group mb-4 mt-2">
<label for="customMsg">Custom Message (Optional)</label>
<input type="text" id="customMsg" class="form-control shadow" value=""
placeholder="Go check out {channel}! - They were playing: {game} - {title} - {url}" size="50">
</div>
</div>
</div>
<div class="form-group mt-4">
<label for="themeOption">Theme options</label>
<select class="form-control shadow" id="themeOption">
<option value="0">None</option>
<option value="1">Slide in fancy skewed</option>
<option value="2" selected>Slide in basic</option>
<option value="3">Outside the box</option>
<option value="4">Pink Comfortaa</option>
<option value="5">Cyber Orbitron</option>
<option value="6">Righteous 80s</option>
<option value="7">Comic Neue</option>
<option value="8">Terminal Slide</option>
<option value="9">Mega Retro</option>
</select>
<small class="text-muted"><a href="https://github.com/teklynk/twitch_shoutout/discussions/31" target="_blank">Screenshots of themes</a></small>
</div>
<div class="form-group mb-2">
<label>Force Video Size (Optional)</label>
<div class="form-row">
<div class="col"><input type="number" id="videoWidth" class="form-control shadow" placeholder="Width (e.g. 1920)"></div>
<div class="col"><input type="number" id="videoHeight" class="form-control shadow" placeholder="Height (e.g. 1080)"></div>
</div>
<small class="text-muted">Set specific width and height to force video scale</small>
</div>
<div class="form-check mb-2">
<input class="form-check-input shadow" type="checkbox" value="" id="profileBadge">
<label class="form-check-label" for="profileBadge">
Show profile badge
</label>
</div>
<div class="form-check mb-2">
<input class="form-check-input shadow" type="checkbox" value="" id="progressBar" checked>
<label class="form-check-label" for="progressBar">
Show progress bar
</label>
</div>
<div class="form-check mb-2 mt-4">
<input class="form-check-input shadow" type="checkbox" value="" id="modsOnly">
<label class="form-check-label" for="modsOnly">
Moderators only
</label>
</div>
<div class="form-check mb-2">
<input class="form-check-input shadow" type="checkbox" value="" id="vipsOnly">
<label class="form-check-label" for="vipsOnly">
VIPs only
</label>
</div>
<br>
<button class="btn btn-lg btn-success btn-block text-white shadow" id="generate_button" type="button">Generate
Overlay
Link</button>
<br>
<div id="overlaylink" class="hide"></div>
</div>
<div class="text-center p-2">
<a class="btn btn-link btn-lg" href="https://github.com/teklynk/twitch_shoutout/blob/main/README.md" target="_blank" title="README"><i class="fa-brands fa-readme"></i></a>
<a class="btn btn-link btn-lg" href="https://github.com/teklynk/twitch_shoutout" target="_blank" title="GitHub"><i class="fa-brands fa-github"></i></a>
<a class="btn btn-link btn-lg" href="https://github.com/teklynk/twitch_shoutout/discussions" target="_blank" title="GitHub Discussions"><i class="fa-solid fa-comment"></i></a>
<a class="btn btn-link btn-lg" href="https://github.com/sponsors/teklynk" target="_blank" title="Donate/Support"><i class="fa-solid fa-dollar-sign"></i></a>
</div>
<div class="container text-center p-4">
<small class="muted">Made with <i class="fa fa-heart vertical-middle"></i> by <a href="https://www.teklynk.com" target="_blank">Teklynk</a></small>
</div>
<script>
const TWITCH_CLIENT_ID = "gl1cjo1kdgsmj7lwjajhnb2lireyus";
function onInit() {
let url = window.location.href;
let redirectUrl = window.location.origin + window.location.pathname;
redirectUrl = redirectUrl.replace(/\/$/, "");
// Update auth link
let authLink = document.getElementById("twitch-auth-link");
let scope = "chat:read+chat:edit";
authLink.href = "https://id.twitch.tv/oauth2/authorize?response_type=token&client_id=" + TWITCH_CLIENT_ID + "&redirect_uri=" + redirectUrl + "&scope=" + scope + "&force_verify=true";
if (url.indexOf('#access_token') !== -1) {
// extract the access_token from the url
let access_token = new URL(url).hash.split('&').filter(function (el) {
if (el.match('access_token') !== null) return true;
})[0].split('=')[1];
// fill input with token value
document.getElementById("ref").value = access_token;
// Save token to localstorage
localStorage.setItem("TwitchSORef", access_token);
// Redirect to default page after getting token
window.location.href = redirectUrl;
} else {
document.getElementById("ref").value = localStorage.getItem("TwitchSORef");
}
let rangeSlider = function rangeSlider() {
let slider = $('.range-slider'),
range = $('.range-slider-range'),
value = $('.range-slider-value');
slider.each(function () {
value.each(function () {
let value = $(this).prev().attr('value');
$(this).html(value);
});
range.on('input', function () {
$(this).next(value).html(this.value);
});
});
};
rangeSlider();
document.getElementById("mainAccount").value = localStorage.getItem("TwitchSOMainAccount");
document.getElementById("customMsg").value = localStorage.getItem("TwitchSOCustomMsg");
document.getElementById("customTitle").value = localStorage.getItem("TwitchSOCustomTitle");
document.getElementById("ref").value = localStorage.getItem("TwitchSORef");
if (localStorage.getItem("TwitchSOCommand")) {
document.getElementById("command").value = localStorage.getItem("TwitchSOCommand");
}
if (localStorage.getItem("TwitchSOThemeOption")) {
document.getElementById("themeOption").value = localStorage.getItem("TwitchSOThemeOption");
}
if (localStorage.getItem("TwitchSORaidCount")) {
document.getElementById("raidCount").value = localStorage.getItem("TwitchSORaidCount");
$('#raidCount').trigger('input');
}
if (localStorage.getItem("TwitchSODelay")) {
document.getElementById("delay").value = localStorage.getItem("TwitchSODelay");
$('#delay').trigger('input');
}
if (localStorage.getItem("TwitchSODateRange")) {
document.getElementById("dateRange").value = localStorage.getItem("TwitchSODateRange");
$('#dateRange').trigger('input');
}
if (localStorage.getItem("TwitchSOTimeOut")) {
document.getElementById("timeOut").value = localStorage.getItem("TwitchSOTimeOut");
$('#timeOut').trigger('input');
}
if (localStorage.getItem("TwitchSOShowClip")) {
document.getElementById("showClip").checked = (localStorage.getItem("TwitchSOShowClip") === "true");
}
if (localStorage.getItem("TwitchSOPreferFeatured")) {
document.getElementById("preferFeatured").checked = (localStorage.getItem("TwitchSOPreferFeatured") === "true");
}
if (localStorage.getItem("TwitchClipsVideoWidth")) {
document.getElementById("videoWidth").value = localStorage.getItem("TwitchClipsVideoWidth");
}
if (localStorage.getItem("TwitchClipsVideoHeight")) {
document.getElementById("videoHeight").value = localStorage.getItem("TwitchClipsVideoHeight");
}
if (localStorage.getItem("TwitchSOShowImage")) {
document.getElementById("showImage").checked = (localStorage.getItem("TwitchSOShowImage") === "true");
}
if (localStorage.getItem("TwitchSORaided")) {
document.getElementById("raided").checked = (localStorage.getItem("TwitchSORaided") === "true");
}
if (localStorage.getItem("TwitchSOShowText")) {
document.getElementById("showText").checked = (localStorage.getItem("TwitchSOShowText") === "true");
}
if (localStorage.getItem("TwitchSOShowDetails")) {
document.getElementById("showDetails").checked = (localStorage.getItem("TwitchSOShowDetails") === "true");
}
if (localStorage.getItem("TwitchSOShowMsg")) {
document.getElementById("showMsg").checked = (localStorage.getItem("TwitchSOShowMsg") === "true");
}
if (localStorage.getItem("TwitchSOModsOnly")) {
document.getElementById("modsOnly").checked = (localStorage.getItem("TwitchSOModsOnly") === "true");
}
if (localStorage.getItem("TwitchSOVipsOnly")) {
document.getElementById("vipsOnly").checked = (localStorage.getItem("TwitchSOVipsOnly") === "true");
}
if (localStorage.getItem("TwitchSODetailsText")) {
document.getElementById("detailsText").value = localStorage.getItem("TwitchSODetailsText");
}
if (localStorage.getItem("TwitchClipsProgressBar")) {
let isChecked = (localStorage.getItem("TwitchClipsProgressBar") === 'true');
document.getElementById("progressBar").checked = isChecked;
}
if (localStorage.getItem("TwitchClipsProfileBadge")) {
let isChecked = (localStorage.getItem("TwitchClipsProfileBadge") === 'true');
document.getElementById("profileBadge").checked = isChecked;
}
if (document.getElementById("showText").checked) {
document.getElementById("customTitle_block").classList.toggle('hide');
}
// show custom details input
if (document.getElementById("showDetails").checked) {
document.getElementById("showDetailsText").classList.toggle('hide');
}
if (document.getElementById("showMsg").checked) {
document.getElementById("access_token").classList.toggle('hide');
}
if (document.getElementById("raided").checked) {
document.getElementById("so_delay").classList.toggle('hide');
document.getElementById("so_count").classList.toggle('hide');
}
}
// Check if any input fields have changed
$(":text,:password,textarea,:checkbox,input[type=range],select,input[type=number]").on('change', function (e) {
$("#overlaylink").addClass("hide");
// Save the state of changes to localstorage so that they are not lost
localStorage.setItem("TwitchSOMainAccount", document.getElementById("mainAccount").value.trim());
localStorage.setItem("TwitchSORef", document.getElementById("ref").value.trim());
localStorage.setItem("TwitchSOCustomMsg", document.getElementById("customMsg").value.trim());
localStorage.setItem("TwitchSOCustomTitle", document.getElementById("customTitle").value.trim());
localStorage.setItem("TwitchSOCommand", document.getElementById("command").value.trim());
localStorage.setItem("TwitchSOThemeOption", document.getElementById("themeOption").value);
localStorage.setItem("TwitchSOShowClip", document.getElementById("showClip").checked);
localStorage.setItem("TwitchSOPreferFeatured", document.getElementById("preferFeatured").checked);
localStorage.setItem("TwitchSOShowImage", document.getElementById("showImage").checked);
localStorage.setItem("TwitchSORaided", document.getElementById("raided").checked);
localStorage.setItem("TwitchSOShowText", document.getElementById("showText").checked);
localStorage.setItem("TwitchSOShowDetails", document.getElementById("showDetails").checked);
localStorage.setItem("TwitchSOShowMsg", document.getElementById("showMsg").checked);
localStorage.setItem("TwitchSOModsOnly", document.getElementById("modsOnly").checked);
localStorage.setItem("TwitchSOVipsOnly", document.getElementById("vipsOnly").checked);
localStorage.setItem("TwitchSORaidCount", document.getElementById("raidCount").value);
localStorage.setItem("TwitchSODelay", document.getElementById("delay").value);
localStorage.setItem("TwitchSODateRange", document.getElementById("dateRange").value);
localStorage.setItem("TwitchSOTimeOut", document.getElementById("timeOut").value);
localStorage.setItem("TwitchSODetailsText", document.getElementById("detailsText").value);
localStorage.setItem("TwitchClipsProgressBar", document.getElementById("progressBar").checked);
localStorage.setItem("TwitchClipsProfileBadge", document.getElementById("profileBadge").checked);
localStorage.setItem("TwitchClipsVideoWidth", document.getElementById("videoWidth").value.trim());
localStorage.setItem("TwitchClipsVideoHeight", document.getElementById("videoHeight").value.trim());
});
//show chat message
document.getElementById("showMsg").addEventListener("click", function (e) {
document.getElementById("access_token").classList.toggle('hide');
}, false);
document.getElementById("showText").addEventListener("click", function (e) {
document.getElementById("customTitle_block").classList.toggle('hide');
}, false);
document.getElementById("showDetails").addEventListener("click", function (e) {
document.getElementById("showDetailsText").classList.toggle('hide');
}, false);
document.getElementById("raided").addEventListener("click", function (e) {
document.getElementById("so_delay").classList.toggle('hide');
document.getElementById("so_count").classList.toggle('hide');
}, false);
document.getElementById("showClip").addEventListener("click", function (e) {
document.getElementById("dateRange").disabled = false;
}, false);
document.getElementById("show_ref").addEventListener("click", function (e) {
if (document.getElementById("show_ref").innerText === "hide") {
document.getElementById("show_ref").innerText = "show";
document.getElementById("ref").setAttribute('type', 'password');
} else {
document.getElementById("show_ref").innerText = "hide";
document.getElementById("ref").setAttribute('type', 'text');
}
}, false);
document.getElementById("generate_button").addEventListener("click", function (e) {
let mainAccount = document.getElementById("mainAccount").value.trim();
let ref = document.getElementById("ref").value.trim();
let customMsg = document.getElementById("customMsg").value.trim();
let customTitle = document.getElementById("customTitle").value.trim();
let showClip = document.getElementById("showClip").checked;
let modsOnly = document.getElementById("modsOnly").checked;
let vipsOnly = document.getElementById("vipsOnly").checked;
let showMsg = document.getElementById("showMsg").checked;
let showImage = document.getElementById("showImage").checked;
let showText = document.getElementById("showText").checked;
let showDetails = document.getElementById("showDetails").checked;
let detailsText = document.getElementById("detailsText").value.trim();
let timeOut = document.getElementById("timeOut").value.trim();
let command = document.getElementById("command").value.trim();
let dateRange = document.getElementById("dateRange").value.trim();
let raided = document.getElementById("raided").checked;
let raidCount = document.getElementById("raidCount").value.trim();
let delay = document.getElementById("delay").value.trim();
let themeOption = document.getElementById("themeOption").value;
let preferFeatured = document.getElementById("preferFeatured").checked;
let progressBar = document.getElementById("progressBar").checked;
let profileBadge = document.getElementById("profileBadge").checked;
let videoWidth = document.getElementById("videoWidth").value.trim();
let videoHeight = document.getElementById("videoHeight").value.trim();
let videoSize = (videoWidth && videoHeight) ? videoWidth + "x" + videoHeight : "";
let validationError = false;
if (!mainAccount) {
alert('Twitch username is not set');
}
if (!command) {
alert('Shout-out command is not set!');
}
if (!showMsg) {
ref = '';
}
if (showMsg && !ref) {
alert('Twitch access token is required if show chat message is checked!');
}
if (showDetails && !detailsText) {
detailsText = "{title}\nWhile streaming {game}\nClipped by {creator_name} {created_at}";
}
function validateForm() {
const mainChannelInput = document.getElementById('mainAccount');
const mainChannelValue = mainChannelInput.value;
const inputKeywords = ['http', 'https', 'twitch.tv'];
inputKeywords.forEach(keyword => {
if (mainChannelValue.includes(keyword)) {
alert(`Invalid input: Channel name cannot contain "${keyword}".`);
validationError = true;
return false;
}
});
return true;
}
validateForm();
//build overlay url
if (mainAccount && validationError == false) {
let srcURL = window.location.protocol + "//" + window.location.host + window.location.pathname;
let fullUrl = srcURL + "shoutout.html?channel=" + mainAccount.toLowerCase() + "&showClip=" + showClip + "&showMsg=" + encodeURIComponent(showMsg) + "&showText=" + showText + "&showImage=" + showImage + "&raided=" + raided + "&raidCount=" + raidCount + "&delay=" + delay + "&modsOnly=" + modsOnly + "&vipsOnly=" + vipsOnly + "&timeOut=" + timeOut + "&command=" + command + "&customMsg=" + encodeURIComponent(customMsg) + "&customTitle=" + encodeURIComponent(customTitle) + "&showDetails=" + showDetails + "&detailsText=" + encodeURIComponent(detailsText) + "&dateRange=" + dateRange + "&themeOption=" + themeOption + "&preferFeatured=" + preferFeatured + "&progressBar=" + progressBar + "&profileBadge=" + profileBadge + "&videoSize=" + videoSize + "&ref=" + btoa(ref);
fullUrl = fullUrl.replace("index.htmlshoutout.html", "shoutout.html");
document.getElementById("overlaylink").classList.remove("hide");
document.getElementById("overlaylink").innerHTML = "<p>Add this link as a browser source in OBS.<br>" +
"<a style='word-break:break-all;' href='" + fullUrl + "' target='_blank'>" + fullUrl + "</a><br><span class='text-warning'><small>* Never share this url with anyone or show it on stream!</small></span></p>";
}
});
// Json data - Ajax call
fetch("https://twitchapi.teklynk.com/getnav.php")
.then(response => response.json())
.then(nav_json => {
$.each(nav_json, function (i, val) {
$('<a class="dropdown-item" href="' + val.url + '">' + val.name + '</a>').appendTo('#main-nav');
});
})
.catch(error => console.error('Error loading navigation:', error));
</script>
</body>
</html>