-
Notifications
You must be signed in to change notification settings - Fork 3
/
slider.html
351 lines (325 loc) · 15.3 KB
/
slider.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
<!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</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.js"></script>
<link rel="stylesheet" href="assets/css/bootstrap452.min.css">
<link rel="stylesheet" href="assets/css/dark.min.css">
<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>
.hide {
display: none;
}
</style>
<body onload="onInit()">
<div class="container">
<div class="row pt-md-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="row">
<div class="col-10">
<h1 class="h3 pt-4 pl-lg-4 text-center">Twitch Shout-out</h1>
</div>
<div class="col-2 text-center">
<img src="assets/images/robot.gif" style="width: 60px;" alt="tekbot_v1" title="Hi, I'm tekbot_v1" id="tekbotImg" onmouseover="onHover();" onmouseout="offHover();">
</div>
</div>
<ul class="nav nav-tabs" id="mainNav" role="tablist">
<li class="nav-item">
<a class="nav-link" id="home-tab" href="index.html" role="tab">Clips</a>
</li>
<li class="nav-item">
<a class="nav-link active" id="profile-tab" href="slider.html" role="tab">Slider</a>
</li>
</ul>
<br>
<div class="card">
<div class="card-body">
<h2>Shout-Out Slider Overlay</h2>
<p>Displays the channel name, channel avatar and message of the channel that is shouted out.</p>
</div>
</div>
<br>
<div class="form-label-group mb-2">
<label for="mainAccount">Twitch Account</label>
<input type="text" id="mainAccount" class="form-control" placeholder="MrCoolStreamer">
</div>
<h2>Options</h2>
<div class="form-label-group mb-2">
<label for="command">Custom Command
<small>(so, soclip, playclip. No need to include the ! symbol)</small>
</label>
<input type="text" id="command" class="form-control" value="so" placeholder="so" size="50">
</div>
<div class="form-label-group mb-2">
<label for="msg">Message</label>
<input type="text" id="msg" class="form-control" value="Go Check Out" placeholder="Go Check Out" size="250">
</div>
<br>
<div class="form-group range-slider">
<label for="timeOut">Max Duration Time (How long the overlay stays on screen)</label>
<input type="range" max="120" min="1" step="1" class="form-control range-slider-range" id="timeOut"
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-check">
<input class="form-check-input" type="checkbox" value="" id="raided">
<label class="form-check-label" for="raided">
Automatically shoutout a creator when they raid you. <small class="text-info">* NEW *</small>
</label>
</div>
<div class="form-group range-slider hide ml-4 mr-4 mt-2" id="so_count">
<label for="delay">Max raid party size
</label>
<input type="range" max="30" min="0" step="1" class="form-control range-slider-range" 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" 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-check">
<input class="form-check-input" type="checkbox" value="" id="showMsg">
<label class="form-check-label" for="showMsg">
Show chat message: "Go check out {channel}! - They were playing: {game} - {title} -
https://twitch.tv/channelname"
<small class="text-warning">* Requires Twitch Access Token</small>
</label>
<div class="form-label-group mb-4 mt-2 hide" id="access_token">
<div class="mb-2">
<a href="https://id.twitch.tv/oauth2/authorize?response_type=token&client_id=gl1cjo1kdgsmj7lwjajhnb2lireyus&redirect_uri=https://twitch-shoutout.pages.dev/slider.html&scope=chat:read+chat:edit&force_verify=true"
target="_self"><img src="assets/images/connect.png"></a>
</div>
<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 class="form-check">
<input class="form-check-input" type="checkbox" value="" id="modsOnly" checked>
<label class="form-check-label" for="modsOnly">
Mods only
</label>
</div>
<br/>
<div class="form-group purple-border">
<label for="customCss">Custom CSS
<small>(Copy and paste into the OBS browser source Custom CSS section and modify as needed. <a
href="https://www.w3schools.com/Css/" target="_blank">CSS Tutorial</a>)
</small>
</label>
<textarea class="form-control" id="customCss" rows="3" style="height: 200px;" readonly>
#userImage img {
width: 10vw;
border-radius: 100%;
border: solid 4px #760a99;
}
#userMsg p {
text-transform: uppercase;
color: #ffffff;
font-size: 4vw;
font-weight: bold;
text-shadow: 1px 1px #000000;
}
#userName p {
text-transform: uppercase;
color: #760a99;
font-size: 5vw;
font-weight: bold;
text-shadow: 1px 1px #000000;
}
/*Cool Glow Effect(disabled) - Uncomment the CSS*/
/*
#userMsg p, #userName p {
font-size: 24px;
padding: 80px;
text-align: center;
animation: glow 1s ease-in-out infinite alternate
}
@-webkit-keyframes glow {
from {
text-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #e60073, 0 0 40px #e60073, 0 0 50px #e60073, 0 0 60px #e60073, 0 0 70px #e60073;
}
to {
text-shadow: 0 0 20px #fff, 0 0 30px #ff4da6, 0 0 40px #ff4da6, 0 0 50px #ff4da6, 0 0 60px #ff4da6, 0 0 70px #ff4da6, 0 0 80px #ff4da6;
}
}
*/
</textarea>
</div>
<br>
<button class="btn btn-lg btn-success btn-block" id="generate_button" type="button">Generate Overlay Link</button>
<br>
<div id="overlaylink" class="hide"></div>
</div>
<script>
function onInit() {
let url = window.location.href;
if (url.indexOf('#access_token') !== -1) {
let access_token = new URL(url).hash.split('&').filter(function (el) {
if (el.match('access_token') !== null) return true;
})[0].split('=')[1];
document.getElementById("ref").value = access_token;
localStorage.setItem("TwitchSORef", access_token);
} 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("TwitchSOSliderMainAccount");
document.getElementById("msg").value = localStorage.getItem("TwitchSOSliderMsg");
document.getElementById("command").value = localStorage.getItem("TwitchSOSliderCmd");
}
// Check if any input fields have changed
$(":text,:password,textarea,:checkbox,input[type=range]").on('change', function (e) {
$("#overlaylink").addClass("hide");
localStorage.setItem("TwitchSORef", document.getElementById("ref").value.trim());
localStorage.setItem("TwitchSOSliderMsg", document.getElementById("msg").value.trim());
localStorage.setItem("TwitchSOSliderCmd", document.getElementById("command").value.trim());
});
//show chat message
document.getElementById("showMsg").addEventListener("click", function (e) {
document.getElementById("access_token").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("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 msg = document.getElementById("msg").value.trim();
let timeOut = document.getElementById("timeOut").value.trim();
let modsOnly = document.getElementById("modsOnly").checked;
let command = document.getElementById("command").value.trim();
let showMsg = document.getElementById("showMsg").checked;
let raided = document.getElementById("raided").checked;
let delay = document.getElementById("delay").value.trim();
let raidCount = document.getElementById("raidCount").value.trim();
if (!showMsg) {
ref = '';
}
if (!mainAccount) {
alert('Twitch username is not set');
}
if (document.getElementById("timeOut").getAttribute('disabled')) {
timeOut = '';
}
localStorage.setItem("TwitchSOSliderMainAccount", mainAccount);
localStorage.setItem("TwitchSORef", ref);
//build overlay url
if (mainAccount) {
let srcURL = window.location.protocol + "//" + window.location.host + window.location.pathname;
let fullUrl = srcURL + "shoutoutslider.html?channel=" + mainAccount.toLowerCase() + "&msg=" + encodeURIComponent(msg) + "&showMsg=" + showMsg + "&modsOnly=" + modsOnly + "&raided=" + raided + "&delay=" + delay + "&raidCount=" + raidCount + "&command=" + command + "&timeOut=" + timeOut + "&ref=" + btoa(ref);
fullUrl = fullUrl.replace("slider.htmlshoutoutslider.html", "shoutoutslider.html");
fullUrl = fullUrl.replace("slidershoutoutslider.html", "shoutoutslider.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'>* Never share this url with anyone or show it on stream!</span></p>";
}
});
</script>
<div class="text-right m-4">
<a class="btn btn-link" href="https://github.com/teklynk/twitch_shoutout/blob/main/README.md"
target="_blank">Help</a>
<a class="btn btn-link" href="https://github.com/teklynk/twitch_shoutout" target="_blank">Github</a>
<script type='text/javascript' src='https://storage.ko-fi.com/cdn/widget/Widget_2.js'></script>
<script type='text/javascript'>kofiwidget2.init('Donate', '#191d21', 'O4O0BWF2E');kofiwidget2.draw();</script>
</div>
<script>
// tekbot_v1 mouse hover action
function onHover() {
$("#tekbotImg").attr('src', 'assets/images/robot_loop.gif');
}
function offHover() {
$("#tekbotImg").attr('src', 'assets/images/robot.gif');
}
// Json data - Ajax call
let nav_json = JSON.parse($.getJSON({
'url': "https://twitchapi.teklynk.com/getnav.php",
'async': false
}).responseText);
$.each(nav_json, function (i, val) {
$('<a class="dropdown-item" href="' + val.url + '">' + val.name + '</a>').appendTo('#main-nav');
});
</script>
<style>
.btn-container {
min-width: auto !important;
padding-left: 20px;
}
span.kofitext {
color: #adb5bd !important;
}
a.kofi-button {
border-radius: none;
box-shadow: none !important;
min-width: auto !important;
padding: 0 !important;
line-height: unset !important;
}
</style>
</body>
</html>