-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
225 lines (209 loc) · 10.3 KB
/
index.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
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Twitch Farts Bot</title>
<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;
}
.img-thumbnail {
padding: 0.25rem;
background-color: transparent;
border: none;
border-radius: none;
max-width: 100%;
height: auto;
}
</style>
<body>
<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 Chat Farts Bot</h1>
</div>
<div class="col-2 text-center">
<img src="assets/images/robot.gif" style="width: 60px;" alt="">
</div>
</div>
<br>
<div class="form-label-group mb-2">
<label for="mainAccount">Twitch Account</label>
<input type="text" id="mainAccount" class="form-control">
</div>
<div class="form-label-group mb-2">
<label for="command">Custom Command <small>(optional)</small></label>
<input type="text" id="command" class="form-control">
</div>
<div class="form-label-group mb-2 range-slider">
<label for="coolDown">Cool Down</label>
<input type="range" max="3600" min="1" step="1" class="form-control range-slider-range" id="coolDown"
value="5" 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">
<label for="animation">Animated GIF</label>
<select class="form-control" id="animation">
<option value="0" selected>None</option>
<option value="1">Cartoon Green 1</option>
<option value="2">Cartoon Green 2</option>
<option value="3">Comic Blast</option>
<option value="4">Fast Smoke</option>
<option value="5">Smoke Plume</option>
<option value="6">Dark Cloud</option>
<option value="7">Green Vapor</option>
<option value="8">Grey Cloud</option>
<option value="9">Cartoon Grey 2</option>
<option value="10">Toot Swoop</option>
</select>
</div>
<div class="form-label-group mb-2 range-slider">
<label for="size">Image Size</label>
<input type="range" max="1000" min="0" step="1" class="form-control range-slider-range" id="size"
value="0" style="height: 0;" disabled>
<small class="text-muted range-slider-value size-value"></small><small class="text-muted range-slider-value"> Pixels</small>
</div>
<div class="form-label-group mb-2 range-slider" style="z-index: 99;">
<label for="rotation">Image Rotation</label>
<input type="range" max="360" min="0" step="1" class="form-control range-slider-range" id="rotation"
value="0" style="height: 0;" disabled>
<small class="text-muted range-slider-value rotation-value"></small><small class="text-muted range-slider-value"> degrees</small>
</div>
<div class="form-group text-center">
<img id="img-preview" style="width: 100px; margin: 8px; display: none; transform: rotate(0deg); z-index: -1;" src="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D" alt="">
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="modsonly">
<label class="form-check-label" for="modsonly">
Mods Only
</label>
</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>
$(document).ready(function () {
// Check if any input fields have changed
$(":text,textarea,:checkbox,input[type=range],select").on('change', function (e) {
$("#overlaylink").addClass("hide");
});
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();
$("#animation").on('change', function() {
if ($(this).val() !== "0") {
$("#size").removeAttr("disabled");
$("#rotation").removeAttr("disabled");
$("#img-preview").css("display","inline");
$("#img-preview").attr("src","./media/fart" + $(this).val() + "a.gif");
} else {
$("#img-preview").css("width", "100px");
$("#size").attr("disabled","disabled");
$("#size").val("0");
$(".size-value").text("0");
$("#rotation").attr("disabled","disabled");
$("#rotation").val("0");
$(".rotation-value").text("0");
$("#img-preview").css("display","none");
$("#img-preview").attr("src","data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs%3D");
}
})
$("#rotation").on('change', function() {
if ($(this).val() !== "0") {
$("#img-preview").css("display","inline");
$("#img-preview").css("transform", "rotate(" + $(this).val() + "deg)");
$("#img-preview").attr("src","./media/fart" + $("#animation").val() + "a.gif");
} else {
$("#img-preview").css("display","inline");
$("#img-preview").css("transform", "rotate(0deg)");
}
})
$("#size").on('change', function() {
if ($(this).val() !== "0") {
$("#img-preview").css("display","inline");
$("#img-preview").css("width", $(this).val() + "px");
} else {
$("#img-preview").css("display","inline");
$("#img-preview").css("width", "100px");
}
})
document.getElementById("generate_button").addEventListener("click", function (e) {
let mainAccount = document.getElementById("mainAccount").value;
let coolDown = document.getElementById("coolDown").value;
let animation = document.getElementById("animation").value;
let rotation = document.getElementById("rotation").value;
let size = document.getElementById("size").value;
let command = document.getElementById("command").value;
command = command.replace("!", "").trim();
let modsonly = document.getElementById("modsonly").checked;
if (!mainAccount) {
alert('Twitch username is not set');
}
//build overlay url
if (mainAccount) {
let srcURL = window.location.protocol + "//" + window.location.host + window.location.pathname;
let fullUrl = srcURL + "farts.html?channel=" + mainAccount.toLowerCase() + "&modsonly=" + modsonly + "&cooldown=" + coolDown + "&animation=" + animation+ "&rotation=" + rotation + "&size=" + size + "&command=" + command;
fullUrl = fullUrl.replace("index.htmlfarts.html", "farts.html");
document.getElementById("overlaylink").classList.remove("hide");
document.getElementById("overlaylink").innerHTML = "<p>Add this link as a browser source in OBS.<br>" +
"<a href='" + fullUrl + "' target='_blank'>" + fullUrl + "</a></p>";
}
});
});
</script>
<div class="text-right m-4"><a class="btn btn-link" href="https://github.com/teklynk/twitch_fart_bot/blob/main/README.md" target="_blank">Help</a><a class="btn btn-link" href="https://github.com/teklynk/twitch_fart_bot" target="_blank">Github</a><a class="btn btn-link" href="https://github.com/teklynk/twitch_fart_bot/archive/refs/heads/main.zip" target="_self">Download</a></div>
<script>
// 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>
</body>
</html>