-
Notifications
You must be signed in to change notification settings - Fork 0
/
bingomaster.html
477 lines (400 loc) · 15.7 KB
/
bingomaster.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
471
472
473
474
475
476
477
<!DOCTYPE html>
<html>
<head>
<title>BingoMaster</title>
<!-- jQuery -->
<script src="libs/jquery.js"></script>
<!-- Bootstrap -->
<script src="libs/popper.js"></script>
<script src="libs/bootstrap.js"></script>
<link rel="stylesheet" href="libs/bootstrap.css">
<style>
#myBtn{
padding-top: 0 !important;
}
//.btn-danger { border-color: black; }
//.btn-success { border-color: black; }
//.btn-danger { background-color: blue; border-color: black; }
//.btn-success { background-color: pink; border-color: black; }
// button override (failed due to bootstrap shit...
.myBtn {
display: table-cell;
vertical-align: middle;
padding-top: 0px;
padding-bottom: 0px;
height: 35px;
line-height: 35px;
//padding: 0;
//margin: 0;
}
</style>
<meta charset="utf-8">
</head>
<body style="background-color: black; color: white;">
<div style="width:100%; margin-top: 1em;">
<div style="width: 75%; margin: 0 auto;">
<!-- AUDIO ELEMENT FOR PLAYBACK -->
<audio id="myAudio" hidden controls>
<source id="audioSource" src="" type="audio/mpeg">
</audio>
<!-- VIDEO ELEMENT FOR PLAYBACK -->
<dialog id="dialog" width="100%" style="padding: 0px; margin-top: 0.5em">
<video height="400px" id="myVideo">
<source id="videoSource" src="" type="video/mp4">
</video>
</dialog>
<!-- HEADLINE -->
<h2 style="background-color: black; text-align: center; opacity:1; border-radius: 25px; padding: 5px;"><strong>Bingo Master - </strong>Anzahl Zahlen: <span id="myAnz" style="font-weight: bold;">0</span> - Letzte Gezogene: <span id="myLast" style="font-weight: bold;"></span></h2> <!-- - <span id="mySearch">Gesucht wird <b>eine volle Reihe!</b></span> -->
<!-- PAST NUMBERS ARRAY -->
<!-- <h2 style="background-color: black; opacity:1;border-radius: 5px; padding: 5px;"><small>Gezogene Zahlen: <span id="myNumb"></span></small></h2> --> <!-- SORTED ARRAY -->
<h2 style="background-color: black; opacity:1;border-radius: 5px; padding: 5px;"><small>Gezogene Zahlen: <strong><span id="myNumbUnsort" style="font-size: 32px"></span></strong></small></h2> <!-- UNSORTED ARRAY -->
<hr style="border-color:white;">
<div id="buttonList" style="text-align: center; background-color: black;"> <!-- margin: 0 auto; background-color: black; opacity:0.75; -->
<!-- EMPTY DIV TO BE FILLED ON DOCUMENT READY WITH BUTTON ARRAY -->
</div>
<hr style="border-color:white;">
</div>
</div>
<marquee id="marquee" scrollamount="7" direction="left"><strong id="innermarquee" style="font-size: 24px; cursor: none;"></strong></marquee>
<!-- <marquee id=marquee" scrollamount="15" behavior="alternate"><strong>+ + + TERMINE + + + sadfsdaf + + +</strong></marquee> -->
<script>
// ================================================
// ======================= DECLARATION OF VARIABLES
// ================================================
var counter = 0;
var numberArray = [];
var numberArrayUnsort = [];
var state = 0;
var textarray = [];
document.body.style.cursor = "default"; // cell, grab, grabbing, wait, pointer
// ================================================
// ================================== POLLING STUFF
// ================================================
setMarqueeText();
setInterval(setMarqueeText, 22500); //usage: 22500 debug: 1000
function setMarqueeText() {
if (textarray.length < 1) {
//textarray = [" hier debug text einfügen "];
textarray = [
"WER DAS LIEST IST DOOF",
"HALLO ECHOOO + + + HALLO LAMPEEE",
"MARIO HAT GEPUPST",
"WIE HEISST DIE MUTTER VON NIKI LAUDA? + + + MAMA LAUDAAA + + + MAMA LAUDAAA",
"LISA IST AUCH DA",
"MARIO BRAUCHT TALENT",
"HIER BLÖDSIN EINFÜGEN",
"IST DAS KUNST ODER KANN DAS WEG?",
"<table><tbody><tr><td style='text-align:right'>FUTTERN BEI MUTTERN - Essen von Mutti im \"Wirtshaus am Bächle\" <br>Leonie-Fürst-Straße 11, 88048 FN <br>Es ist sehr gut!</td><td><img src='pics\/wh.png' height='100px'></td></tr></tbody></table>",
"<img src='pics\/meck.png' height='120'>",
"<img src='pics\/bo.png' height='80'>",
"<img src='pics\/farny.png' height='100px'>",
"<img src='pics\/flasch.png' height='100px'>",
"<img src='pics\/jacky.png' height='100px'>",
"<img src='pics\/acdc.png' height='100px'>",
"<img src='pics\/dart.png' height='100px'>",
"<img src='pics\/emplong.png' height='80'>",
"<img src='pics\/uni.png' height='100px'>",
"<img src='pics\/weizi.png' height='100px'>",
"HIER KÖNNTE IHRE WERBUNG STEHEN!"
]; // "<img src='pics\/emp.png' height='100px'>",
}
var x = document.getElementById("innermarquee");
var myrand = getRandomInt(textarray.length);
x.innerHTML = "+ + + " + textarray[myrand] + " + + +";
textarray.splice(myrand, 1);
}
//setInterval(doReq, 5000);
function doReq() {
$.ajax({
url: 'https://baconipsum.com/api/?type=meat-and-filler¶s=&format=text',
dataType: 'text',
type: 'GET',
success: function(data){
console.log(data);
},
error: function(jqXhr, textStatus, errorThrown){
console.log(errorThrown);
}
});
}
// ================================================
// ================================== RANDOMIZATION
// ================================================
/* var lfrandom = getRandomInt(3) + 2;
var lsrandom = getRandomInt(3) + 2;
var frandom = getRandomInt(20) + 5;
var efrandom = frandom + lfrandom;
var srandom = getRandomInt(10) + frandom + 5;
var esrandom = srandom + lsrandom;
console.log("First change: " + frandom);
console.log("First length: " + lfrandom);
console.log("Second change: " + srandom);
console.log("Second length: " + lsrandom); */
// ================================================
// ====================== BUILD NUMBER BUTTON ARRAY
// ================================================
$(document).ready(function(){
// button var 1
for (var i = 1; i <= 90; i++) {
$("#buttonList").append("<input id='myBtn" + i + "' class='btn btn-danger m-1' style='width: 4%; cursor: pointer; line-height: 0; padding: 0px; height: 35px; font-weight: bold; font-size: 26px;' onclick='lol(" + i + ")' value='" + i + "' type='button'/>");
//how many buttons per row
if (i % 20 == 0) {
$("#buttonList").append("<br>");
}
}
});
// ================================================
// ================================ BUTTON HANDLING
// ================================================
function lol(myVar) {
// if not clicked
if($('#myBtn' + myVar).hasClass("btn btn-danger m-1")) {
//playMusic("stechvieh", 0, 2256, 1);
//playMusic("fuck", 0, 6054, 0.9);
// select song if matching number
switch(myVar) {
case 1:
playMusic("uno" , 0, 1755, 0.5);
break;
case 3:
if (Math.random() >= 0.5) {
playMusic("drei" , 0, 1620, 1);
} else {
playMusic("3" , 0, 888, 1);
}
break;
case 5:
playMusic("mambo" , 0, 8072, 1);
break;
case 6:
playMusic("sexbomb", 0, 5878, 1);
break;
case 7:
playMusic("zwerge", 0, 5068, 0.8);
break;
case 8:
playMusic("lacht", 0, 8963, 0.8);
break;
case 9:
playMusic("pipilang", 0, 9874, 0.9);
//playMusic("pipikurz", 0, 5538, 0.9);
break;
case 10:
playMusic("tuedelue", 0, 9729, 0.3);
break;
case 12:
playMusic("mg", 0, 8150, 0.6);
break;
case 17:
playMusic("uj", 0, 4075, 0.9);
break;
case 20:
playMusic("bird", 0, 6296, 0.7);
break;
case 22:
playMusic("bells", 0, 10038, 0.9);
break;
case 25:
playMusic("25", 0, 8359, 0.8);
break;
case 28:
playMusic("neindochoh", 0, 2684, 0.8);
break;
case 30:
playMusic("stechvieh", 0, 2256, 1);
break;
case 32:
//playMusic("cantina", 0, 3654, 0.9);
break;
case 42:
//playMusic("ft", 0, 1160, 1);
//playMusic("grundkurz", 0, 4049, 1);
//playMusic("grundlang", 0, 9561, 2.0);
break;
case 43:
playMusic("whooo", 0, 1698, 0.7);
break;
case 47:
//playMusic("bongo", 0, 5005, 0.8);
break;
case 49:
playMusic("heiho", 0, 4571, 1.2);
break;
case 50:
if (Math.random() >= 0.5) {
playMusic("bing", 0, 1388, 0.8);
}
break;
case 51:
playMusic("jaichweiß", 0, 866, 1);
break;
case 55:
//playMusic("jodel", 0, 6381, 1);
playMusic("jagi", 0, 7367, 0.6);
break;
case 60:
playMusic("60", 0, 4841, 0.6);
break;
case 63:
playMusic("depp", 0, 7680, 0.3);
break;
case 66:
playMusic("sechs", 0, 7419, 1);
break;
case 69:
playMusic("joe", 0, 10867, 0.4);
break;
case 72:
//playMusic("egal", 0, 4151, 0.4);
break;
case 77:
playMusic("siebenstein", 0, 1778, 1.2);
break;
case 78:
playMusic("ficken", 0, 7988, 0.4);
break;
case 80:
playMusic("chess", 0, 2273, 1);
break;
case 83:
playMusic("pimml", 0, 575, 0.8);
break;
case 85:
playMusic("gummigkurz", 0, 5118, 0.8);
//playMusic("gummilang", 0, 14756, 0.8);
//playMusic("gummikurz", 0, 8120, 0.8);
//playMusic("gummiskurz", 0, 13330, 0.8);
//playMusic("gummislang", 0, 14641, 0.8);
break;
case 88:
playMusic("icq", 0, 523, 1);
break;
default:
//playMusic("pingpong", 0, 549, 2.0);
break;
}
// select video if matching number
switch(myVar) {
case 9:
playVideo("pipi", 0, 9800, 0);
break;
case 20:
playVideo("bird", 0, 6296, 0);
break;
case 28:
playVideo("neindochoh", 0, 2684, 0);
break;
case 32:
playVideo("cantina", 0, 6754, 0.9);
break;
case 42:
playVideo("deepthought", 0.15, 1330, 1);
break;
case 47:
playVideo("bongo", 0, 5500, 0.8);
break;
case 72:
playVideo("egal", 0, 4500, 0.4);
break;
default:
// NOTHING
break;
}
counter++;
numberArray.push(myVar);
numberArrayUnsort.push(myVar);
$('#myBtn' + myVar).removeClass('btn btn-danger m-1');
$('#myBtn' + myVar).addClass('btn btn-success m-1');
$('#myAnz').html(counter);
$('#myLast').html(numberArrayUnsort[numberArrayUnsort.length - 1]);
$('#myNumb').html(numberArray.sort(function(a, b){return a - b}).join(" - "));
$('#myNumbUnsort').html(numberArrayUnsort.join(" - "));
// if already clicked
} else {
counter--;
// stop music/video if number was wrong
pauseMusic();
pauseVideo();
numberArray = arrayRemove(numberArray, myVar);
numberArrayUnsort = arrayRemove(numberArrayUnsort, myVar);
$('#myBtn' + myVar).removeClass('btn btn-success m-1');
$('#myBtn' + myVar).addClass('btn btn-danger m-1');
$('#myAnz').html(counter);
$('#myLast').html(numberArrayUnsort[numberArrayUnsort.length - 1]);
$('#myNumb').html(numberArray.sort(function(a, b){return a - b}).join(" - "));
$('#myNumbUnsort').html(numberArrayUnsort.join(" - "));
}
// if no number was fetched, no display of last number
if (counter == 0) {
$('#myLast').html("");
}
// color change mode (always)
/* if (counter >= frandom && counter <= efrandom) {
$(document.body).css("background-color","purple");
$("#buttonList").css("background-color","purple");
} else if (counter >= srandom && counter <= esrandom){
$(document.body).css("background-color","#EA0A8E");
$("#buttonList").css("background-color","#EA0A8E");
} else {
$(document.body).css("background-color","black");
$("#buttonList").css("background-color","black");
} */
}
// ================================================
// ================================= MUSIC HANDLING
// ================================================
function playMusic(mySong, myStartTime, myLength, myVol) {
console.log("play: " + mySong + " from: " + myStartTime + " for: " + myLength/1000 + " seconds!");
var x = document.getElementById("myAudio");
var source = document.getElementById('audioSource');
var newSource = "music\/" + mySong + ".mp3";
source.src = newSource;
x.load();
x.volume = myVol * 0.5;
x.currentTime = myStartTime;
x.play();
// play mySong for myLength seconds from myStartTime at point of pressing given number
setTimeout(pauseMusic, myLength);
}
function pauseMusic() {
var x = document.getElementById("myAudio");
x.pause();
}
// ================================================
// ================================= VIDEO HANDLING
// ================================================
function playVideo(myVideo, myStartTime, myLength, myVol) {
console.log("play: " + myVideo + " from: " + myStartTime + " for: " + myLength/1000 + " seconds!");
var x = document.getElementById("myVideo");
var source = document.getElementById('videoSource');
var newSource = "video\/" + myVideo + ".mp4";
source.src = newSource;
document.getElementById('dialog').showModal();
document.getElementById("marquee").style.display = "none";
x.load();
x.volume = myVol * 0.5;
x.currentTime = myStartTime;
x.play();
// play mySong for myLength seconds from myStartTime at point of pressing given number
setTimeout(pauseVideo, myLength);
}
function pauseVideo() {
var x = document.getElementById("myVideo");
x.pause();
document.getElementById("dialog").close();
document.getElementById("marquee").style.display = "block";
}
// ================================================
// =============================== HELPER FUNCTIONS
// ================================================
function arrayRemove(arr, value) {
return arr.filter(function(ele){
return ele != value;
});
}
function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}
</script>
</body>
</html>