Compare commits

..

22 Commits
2.3 ... master

Author SHA1 Message Date
b4c444769c fix toString if we get a blob 2023-01-29 17:57:30 +01:00
16bdb4e4f8 Merge branch 'master' of https://github.com/cracker0dks/Familienduell 2022-12-09 13:36:11 +01:00
5d8d4d9eae dont crash on split 2022-12-09 13:36:06 +01:00
80f4d7d152
Update README.md 2022-08-18 17:26:51 +02:00
925d04da85 add an other .toString() 2022-08-11 22:43:46 +02:00
b50c359f70 add to string function to be save 2022-01-09 23:30:27 +01:00
8919fa4f9a fix final score and connected position 2020-09-07 13:45:43 +02:00
raphael
b6d9313c23 update README 2019-08-26 14:14:49 +02:00
Alexander Hüllmandel
74b98ec8f4
Adapt description even more 2019-08-25 20:55:24 +02:00
Alexander Hüllmandel
cbb7a709c1
Remove unnecessary sound options. Reorder intro controls to represent correct order of execution 2019-08-25 15:10:17 +02:00
Alexander Hüllmandel
645c69512b
Adjust description for final mode 2019-08-25 15:02:11 +02:00
Alexander Hüllmandel
005e98345d
Default alternative answers to 0 2019-08-25 15:01:41 +02:00
Alexander Hüllmandel
573aa2e41e
Show questions in final mode for controller 2019-08-25 14:56:46 +02:00
Alexander Hüllmandel
197d35718b
Easier start of final mode 2019-08-25 14:36:49 +02:00
Alexander Hüllmandel
646d5ef89e
Show final scores feature 2019-08-25 12:01:10 +02:00
Alexander Hüllmandel
874367e398
Nicer formatting for sum scores in final. Better animation for 2nd player answers 2019-08-25 03:10:02 +02:00
Alexander Hüllmandel
a9f140a097
Change normal round description (3 instead of 4) in Ablaufplan 2019-08-25 03:09:18 +02:00
Alexander Hüllmandel
f703856b59
Somewhat responsive 2019-08-24 23:52:56 +02:00
Alexander Hüllmandel
c6bbeb2b46
Fix pig not hidden when cancelling animation 2019-08-24 21:11:13 +02:00
Alexander Hüllmandel
9cebb7f6f0
Add blind animations for pigs and questions (more authentic) 2019-08-21 15:13:48 +02:00
Alexander Hüllmandel
2c954b3477
Use high res images for pigs, adapt size to container 2019-08-21 14:25:06 +02:00
Alexander Hüllmandel
ff4287d3cd
Update jQuery UI 2019-08-21 14:24:33 +02:00
15 changed files with 211 additions and 107 deletions

View File

@ -7,7 +7,6 @@ Familienduell Client / Server (NodeJs Javascript)
### -A- START DES SERVERS! ### -A- START DES SERVERS!
___Windows___ ___Windows___
1. Im Ordner "server" die Datei StartServer.bat doppelklicken. 1. Im Ordner "server" die Datei StartServer.bat doppelklicken.
* Im Fenster das jetzt erscheint sollte: "SERVER IS UP AND RUNNING" stehen. * Im Fenster das jetzt erscheint sollte: "SERVER IS UP AND RUNNING" stehen.
* Falls die Firewall fragt, solltest du die Anfrage zulassen da sonst der Client nicht verbinden kann. * Falls die Firewall fragt, solltest du die Anfrage zulassen da sonst der Client nicht verbinden kann.
@ -44,6 +43,9 @@ Q: Warum ist das Display zu Beginn schwarz, und wie kann ich das ändern?
A: Das Bild ist schwarz damit man die Intromusik starten kann und die Leute (Zuschauer) nicht schon vorher wissen was auf sie zukommt. A: Das Bild ist schwarz damit man die Intromusik starten kann und die Leute (Zuschauer) nicht schon vorher wissen was auf sie zukommt.
Dies kann (Im Controller) über die Checkbox "Blackscreen", im Bereich "Intro" kontrolliert werden. Dies kann (Im Controller) über die Checkbox "Blackscreen", im Bereich "Intro" kontrolliert werden.
Q: Warum bekomm ich die Fehlermeldung "node.exe wurde falsch geschrieben oder konnte nicht gefunden werden"?<br>
A: Die heruntergeladene zip Datei muss zunächst entpack werden. Rechtsklick auf die Datei -> Alles etpacken.
Q: Wie funktioniert das mit 2 oder mehr Geräten? Q: Wie funktioniert das mit 2 oder mehr Geräten?
A: Alle Geräte müssen im gleichen Netzwerk sein. Dann verwende einfach eine Externe IP des Servers (aus dem Serverfenster) zum verbinden von einem anderen Gerät aus. A: Alle Geräte müssen im gleichen Netzwerk sein. Dann verwende einfach eine Externe IP des Servers (aus dem Serverfenster) zum verbinden von einem anderen Gerät aus.
@ -69,4 +71,5 @@ Unterstützt durch: DiggerTigger, Anni & Naseile
Danke auch an: Danke auch an:
* [flbe](https://github.com/flbe) für den Python Server * [flbe](https://github.com/flbe) für den Python Server
* [susgo](https://github.com/susgo) für den Finalmodus * [susgo](https://github.com/susgo) für den Finalmodus
* [ConvalAtGit](https://github.com/ConvalAtGit) für viele Verbesserungen, Redesign und zusätzliche Word und Excel Dokumente * [ConvalAtGit](https://github.com/ConvalAtGit) für viele Verbesserungen, Redesign und zusätzliche Word und Excel Dokumente
* [fruitcoder](https://github.com/fruitcoder/) Design verbesserungen

Binary file not shown.

File diff suppressed because one or more lines are too long

View File

@ -49,7 +49,7 @@ wss.on('connection', function(ws) {
console.log("~~~~~~~~ WELCOME TO SERVER ~~~~~~ s:"+subscribers.length); console.log("~~~~~~~~ WELCOME TO SERVER ~~~~~~ s:"+subscribers.length);
ws.on('message', function(message) { ws.on('message', function(message) {
console.log('msg: ' + message); console.log('msg: ' + message);
var parts = message.split("###"); var parts = message.toString().split("###");
if(parts[0] != "fileOp") { if(parts[0] != "fileOp") {
broadcastMessage(getClientId(), message); broadcastMessage(getClientId(), message);
} else { } else {
@ -89,7 +89,7 @@ wss.on('connection', function(ws) {
}); });
function broadcastMessage(clientId, msg) { function broadcastMessage(clientId, msg) {
console.log("broadcast:"+msg.split("###")[0]+" length:"+subscribers.length); console.log("broadcast:", msg.toString().split("###")[0], "length:", subscribers.length);
for(var i=0;i<subscribers.length;i++) { for(var i=0;i<subscribers.length;i++) {
if(subscribers[i] != null) if(subscribers[i] != null)
subscribers[i].send(msg); subscribers[i].send(msg);

View File

@ -81,8 +81,10 @@ body {
.mainHeight { .mainHeight {
position: relative; position: relative;
width: 1020px; width: 80vw;
height: 520px; height: 40vw;
min-height: 520px;
min-width: 1020px;
margin: auto; margin: auto;
margin-bottom: 50px; margin-bottom: 50px;
z-index: 5; z-index: 5;
@ -109,26 +111,46 @@ body {
} }
#answers { #answers {
font-family: monospace; overflow: hidden;
padding-top: 58px; font-family: monospace;
padding-left: 18px; font-size: 2.5vw;
font-size: 1.5em;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis;
} }
.answer { .answer {
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis;
} }
#displayQuestions { #displayQuestions {
position:absolute;
top:10px;
left:20px;
width: 970px;
overflow: hidden; overflow: hidden;
white-space: nowrap; font-size: 2.5vw;
text-overflow: ellipsis; white-space: unset;
} text-overflow: unset;
}
#resultFinal {
font-size: 2.5vw;
}
.questionAnswerContainer {
padding-top: 20px;
padding-left: 20px;
width: calc(100% - 20px);
}
@media (max-width: 1275px) {
#answers {
font-size: 1.5em;
}
#resultFinal {
font-size: 1.5em;
}
#displayQuestions {
white-space: nowrap;
text-overflow: ellipsis;
font-size: 1.5em;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

BIN
web/img/schweinchen1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

BIN
web/img/schweinchen2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 62 KiB

BIN
web/img/schweinchen3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

View File

@ -7,7 +7,6 @@
<script type="text/javascript" src="./js/typed.js"></script> <script type="text/javascript" src="./js/typed.js"></script>
<script type="text/javascript" src="./js/main.js"></script> <script type="text/javascript" src="./js/main.js"></script>
<script type="text/javascript" src="./js/components.js"></script> <script type="text/javascript" src="./js/components.js"></script>
<link rel="stylesheet" type="text/css" href="./css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="./css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="./css/jquery.dataTables.css"> <link rel="stylesheet" type="text/css" href="./css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css"> <link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css">
@ -16,19 +15,22 @@
</head> </head>
<body style="padding:10px;"> <body style="padding:10px;">
<div id="allContent"> <div id="allContent">
<!-- Select between display and controller -->
<div id="startDiv" style="width: 500px; margin: auto;"> <div id="startDiv" style="width: 500px; margin: auto;">
<h1 style="font-size: 5em;">Familienduell</h1> <h1 style="font-size: 5em;">Familienduell</h1>
<button id="displayBtn" style="font-size: 2em; width:500px;"><i class="fa fa-desktop"></i> DISPLAY</button><br> <button id="displayBtn" style="font-size: 2em; width:500px;"><i class="fa fa-desktop"></i> DISPLAY</button><br>
<button id="controllerBtn" style="font-size: 2em; width:500px; margin-top:2px;"><i class="fa fa-keyboard-o"></i> CONTROLLER</button> <button id="controllerBtn" style="font-size: 2em; width:500px; margin-top:2px;"><i class="fa fa-keyboard-o"></i> CONTROLLER</button>
</div> </div>
<div class="bgColor textColor mainHeight" style="display:none" id="display"> <!-- container with all questions, answers, pigs, countdown, intro image, points-->
<img id="schweinchenImg" style="margin-left: 200px; margin-top: 70px; display: none;" src="./img/schweinchen.jpg"> <div class="topContainer bgColor textColor mainHeight" style="display:none" id="display">
<img id="schweinchen1Img" style="margin-left: 200px; margin-top: 70px; display: none;" src="./img/schweinchen1.jpg"> <img id="schweinchen1Img" style="height: 75%; top: 12.5%; position: absolute; left:0; right:0; margin-left: auto; margin-right: auto; display: none; overflow: hidden;" src="./img/schweinchen1.png">
<img id="schweinchen2Img" style="margin-left: 200px; margin-top: 70px; display: none;" src="./img/schweinchen2.jpg"> <img id="schweinchen2Img" style="height: 75%; top: 12.5%; position: absolute; left:0; right:0; margin-left: auto; margin-right: auto; display: none;" src="./img/schweinchen2.png">
<div id="displayQuestions" class="textColor"> <img id="schweinchen3Img" style="height: 75%; top: 12.5%; position: absolute; left:0; right:0; margin-left: auto; margin-right: auto; display: none;" src="./img/schweinchen3.png">
</div> <!-- question text is injected in `loadQuestionToGui(index:)` (server.js) -->
<div id="answers"> <div id="displayQuestions" class="textColor questionAnswerContainer">
</div>
<!-- answer divs are injected in `loadQuestionToGui(index:)` (server.js) -->
<div id="answers" class="questionAnswerContainer">
</div> </div>
<div id="result" style="position:absolute; bottom:65px; right:38px; font-size: 1.5em;"> <div id="result" style="position:absolute; bottom:65px; right:38px; font-size: 1.5em;">
<div style="float:left; padding-right: 20px;" class="header_summe">SUMME</div> <div style="float:left; padding-right: 20px;" class="header_summe">SUMME</div>
@ -36,12 +38,13 @@
<div class="noIntro" style="width:50px; float: left; text-align:right;" id="SumRes">0</div> <div class="noIntro" style="width:50px; float: left; text-align:right;" id="SumRes">0</div>
<div style="float:left; font-size: 0.8em; position: relative; top: 12; color: red; cursor:pointer;" class="controller" id="pointsToTheRight"><i class="fa fa-chevron-right"></i></div> <div style="float:left; font-size: 0.8em; position: relative; top: 12; color: red; cursor:pointer;" class="controller" id="pointsToTheRight"><i class="fa fa-chevron-right"></i></div>
</div> </div>
<div id="resultFinal" style="position:absolute; bottom:95px; right:444px; font-size: 1.5em; display: none;"> <div id="resultFinal" style="position:absolute; bottom:95px; width:100%; font-size: 1.5em; display: none;">
<div style="float:left" class="header_summe">SUMME</div> <div style="display: flex;justify-content: center;">
<div class="noIntro" style="width:80px; float: left; text-align:right;" id="SumRes_player1"></div> <div class="noIntro" style="width:6%; float: left; text-align:center;" id="SumRes_player1">0</div>
<div class="noIntro" style="width:80px; float: left; text-align:right;" id="SumRes_player2"></div> <div class="noIntro" style="width:6%; float: right; text-align:center;" id="SumRes_player2">0</div>
</div>
</div> </div>
<div id="timer" style="position:absolute; top: 65px; left: 50%; width: 400px; margin-left: -200px; text-align: center; padding: 0px 30px 10px 30px; font-size: 200px; display: none;"> <div id="timer" style="position:absolute; top: 50%; left: 50%; width: 400px; margin-left: -200px; margin-top: -143px; text-align: center; padding: 0px 30px 10px 30px; font-size: 200px; display: none;">
20 20
</div> </div>
<div class="noIntro footer" id="footer1" style="position:absolute; bottom:0px; width:100%; height:50px; font-size: 2em;"> <div class="noIntro footer" id="footer1" style="position:absolute; bottom:0px; width:100%; height:50px; font-size: 2em;">
@ -52,29 +55,28 @@
<!--<div class="noIntro footer" id="footer2" style="position:absolute; bottom:108px; width:100%; height:5px;"></div>--> <!--<div class="noIntro footer" id="footer2" style="position:absolute; bottom:108px; width:100%; height:5px;"></div>-->
<div class="xmarker noIntro" style="position: absolute; bottom: -64px; left: 34px" ></div> <div class="xmarker noIntro" style="position: absolute; bottom: -64px; left: 34px" ></div>
<div class="xmarker noIntro" style="position: absolute; bottom: -64px; right: 34px" ></div> <div class="xmarker noIntro" style="position: absolute; bottom: -64px; right: 34px" ></div>
<img style="position: absolute; top: 0px;" class="intro" src="./img/logo.png"> <img style="position: absolute; top: 0px; width: 100%; height: 100%;" class="intro" src="./img/logo.png">
</div> </div>
<!-- controller container -->
<div style="display:none;" class="controller"> <div style="display:none;" class="controller">
<div id="buttonsDownUnder"> <div id="buttonsDownUnder">
<table border="1"> <table border="1">
<tr> <tr>
<td><b>Global</b></td> <!-- <td><b>Global</b></td>
<td><b>Server</b></td> <td><b>Server</b></td> -->
<td><b>Intro</b></td> <td><b>Intro</b></td>
<td><b>Schweinchen</b></td> <td><b>Schweinchen</b></td>
<td><b>Optionen</b></td> <td><b>Optionen</b></td>
<td><b><label for="modeFinal">Finalmodus</b> </label><input id="modeFinal" type="checkbox" style="vertical-align: text-bottom" /> <button style="float:right;" id="finalmodusInfoBtn">Info</button></td> <td><b><label for="modeFinal">Finalmodus</b> </label><input id="modeFinal" type="checkbox" style="vertical-align: text-bottom" /> <button style="float:right;" id="finalmodusInfoBtn">Info</button></td>
<td><b>Spielende</b></td>
</tr> </tr>
<tr> <tr>
<td><img id="toggleSoundImg" style="cursor:pointer;" width="35px;" src="./img/soundOn.png"></td> <!-- <td><img id="toggleSoundImg" style="cursor:pointer;" width="35px;" src="./img/soundOn.png"></td>
<td><img id="serverSoundImg" style="cursor:pointer;" width="35px;" src="./img/noSound.png"></td> <td><img id="serverSoundImg" style="cursor:pointer;" width="35px;" src="./img/soundOn.png"></td> -->
<td> <td>
<button id="startIntroBtn"><i class="fa fa-play"></i> Intro!</button><br> <button style=" display: block" id="startIntroBtn"><i class="fa fa-play"></i> Intro!</button><br>
<button id="stopIntroBtn"><i class="fa fa-stop"></i> Intro!</button><br>
<img width="20px;" src="./img/noSound.png">
<input id="introVolume" style="width: 50px;" type="range" value="10" name="points" min="0" max="10">
<img width="20px;" src="./img/soundOn.png"><br>
<label for="blackScreenCheck">Blackscreen:</label> <input id="blackScreenCheck" checked="checked" type="checkbox" style="vertical-align: text-bottom" /> <label for="blackScreenCheck">Blackscreen:</label> <input id="blackScreenCheck" checked="checked" type="checkbox" style="vertical-align: text-bottom" />
<button style="margin-top: 12px; display: block" id="stopIntroBtn"><i class="fa fa-stop"></i> Intro!</button><br>
</td> </td>
<td> <td>
Multiplikator: <input id="pointMultiplicator" type="number" name="" value="1" style="width: 50px;"><br> Multiplikator: <input id="pointMultiplicator" type="number" name="" value="1" style="width: 50px;"><br>
@ -82,12 +84,8 @@
<button id="startScheinchenbtn2" value="2"><i class="fa fa-play"></i> Schweinchen (2x)</button><br> <button id="startScheinchenbtn2" value="2"><i class="fa fa-play"></i> Schweinchen (2x)</button><br>
<button id="startScheinchenbtn3" value="3"><i class="fa fa-play"></i> Schweinchen (3x)</button><br> <button id="startScheinchenbtn3" value="3"><i class="fa fa-play"></i> Schweinchen (3x)</button><br>
<button id="stopScheinchenbtn"><i class="fa fa-stop"></i> Schweinchen</button><br> <button id="stopScheinchenbtn"><i class="fa fa-stop"></i> Schweinchen</button><br>
<img width="20px;" src="./img/noSound.png">
<input id="schweinchenVolume" style="width: 50px;" type="range" value="10" name="points" min="0" max="10">
<img width="20px;" src="./img/soundOn.png">
</td> </td>
<td> <td>
<button id="startAnswerFailBtn"><i class="fa fa-play"></i> Antwort nicht vorhanden</button><br>
<button id="clearAllFailsBtn">Clear all Fails!</button><br><br> <button id="clearAllFailsBtn">Clear all Fails!</button><br><br>
<table> <table>
<tr> <tr>
@ -96,13 +94,16 @@
<tr> <tr>
<td>Punkte Rechts: </td> <td><input style="width:50px;" id="mPunkteRight" type="number" value="0"></td><td><button id="newRightPoints">ok</button></td> <td>Punkte Rechts: </td> <td><input style="width:50px;" id="mPunkteRight" type="number" value="0"></td><td><button id="newRightPoints">ok</button></td>
</tr> </tr>
<tr>
<td>Punkte Summe: </td> <td><input style="width:50px;" id="mPunkteSum" type="number" value="0"></td><td><button id="newSumRes">ok</button></td>
</tr>
</table> </table>
</td> </td>
<td> <td>
<button id="startAnswerDuplicateBtn"><i class="fa fa-play"></i> Antwort doppelt</button><br> <!-- <button id="startAnswerDuplicateBtn"><i class="fa fa-play"></i> Antwort doppelt</button><br>
<img width="20px;" src="./img/noSound.png"> <img width="20px;" src="./img/noSound.png">
<input id="answerFailVolume" style="width: 50px;" type="range" value="10" name="points" min="0" max="10"> <input id="answerFailVolume" style="width: 50px;" type="range" value="10" name="points" min="0" max="10">
<img width="20px;" src="./img/soundOn.png"> <img width="20px;" src="./img/soundOn.png"> -->
<div> <div>
<label for="spieler1">Spieler 1:</label> <input class="playerTgl finalElement" disabled="true" checked="true" type="radio" value="1" name="fmod" id="spieler1" style="vertical-align: text-bottom" /> <button id="showTimerBtn" disabled="true" class="finalElement">Timer anzeigen</button><br> <label for="spieler1">Spieler 1:</label> <input class="playerTgl finalElement" disabled="true" checked="true" type="radio" value="1" name="fmod" id="spieler1" style="vertical-align: text-bottom" /> <button id="showTimerBtn" disabled="true" class="finalElement">Timer anzeigen</button><br>
<label for="spieler2">Spieler 2:</label> <input class="playerTgl finalElement" disabled="true" type="radio" value="2" name="fmod" id="spieler2" style="vertical-align: text-bottom" /> <button id="startTimerBtn" disabled="true" class="finalElement"><i class="fa fa-play"></i> Timer starten</button><br> <label for="spieler2">Spieler 2:</label> <input class="playerTgl finalElement" disabled="true" type="radio" value="2" name="fmod" id="spieler2" style="vertical-align: text-bottom" /> <button id="startTimerBtn" disabled="true" class="finalElement"><i class="fa fa-play"></i> Timer starten</button><br>
@ -113,9 +114,12 @@
<option value="3"> 4</option> <option value="3"> 4</option>
<option value="4"> 5</option> <option value="4"> 5</option>
</select> <button id="stopTimerBtn" disabled="true" class="finalElement"><i class="fa fa-stop"></i> Timer stoppen</button><br> </select> <button id="stopTimerBtn" disabled="true" class="finalElement"><i class="fa fa-stop"></i> Timer stoppen</button><br>
Alternative Antwort:<br> <input class="finalElement" id="alternateAnswer" maxlength="20" disabled="true" type="text" name=""><button class="finalElement" id="alternateAnswerBtn" disabled="true">setzen</button><br><input type="number" class="finalElement" id="altPointsFinal" disabled="true" placeholder="Alt. Punkte" value=""><button class="finalElement" id="alternateAnswerPBtn" disabled="true">setzen</button> Alternative Antwort:<br> <input class="finalElement" id="alternateAnswer" maxlength="20" disabled="true" type="text" name=""><button class="finalElement" id="alternateAnswerBtn" disabled="true">setzen</button><br><input type="number" class="finalElement" id="altPointsFinal" disabled="true" placeholder="Alt. Punkte" value="0"><button class="finalElement" id="alternateAnswerPBtn" disabled="true">setzen</button>
</div> </div>
</td> </td>
<td>
<button id="showFinalScores">Show Final Scores</button><br><br>
</td>
</tr> </tr>
</table> </table>
<table> <table>
@ -150,7 +154,7 @@
<!-- <i id="closeFragenEditorIcon" style="position: fixed; right: 30px; top: 10px; font-size: 1.2em; cursor:pointer;" class="fa fa-caret-square-o-down"></i> --> <!-- <i id="closeFragenEditorIcon" style="position: fixed; right: 30px; top: 10px; font-size: 1.2em; cursor:pointer;" class="fa fa-caret-square-o-down"></i> -->
</div> </div>
</div> </div>
<div id="connected" style="position:absolute; left:0px; top:0px; padding:5px; display:none;"></div> <div id="connected" style="position:fixed; left:0px; top:0px; padding:5px; display:none;"></div>
</div> </div>
<div id="printScreen" style="display:none; position:absolute; left:0px; top:0px; width:100%; height:100%; background:white;"> <div id="printScreen" style="display:none; position:absolute; left:0px; top:0px; width:100%; height:100%; background:white;">
<div id="printDiv"></div> <div id="printDiv"></div>

File diff suppressed because one or more lines are too long

View File

@ -5,6 +5,9 @@ var answerFail = null;
var schweinchenVolume = 1; var schweinchenVolume = 1;
var answerFailVolume = 1; var answerFailVolume = 1;
var schweinchen = null; var schweinchen = null;
// when the points for a round are assigned, we still want to show the other answers but no points should be calculated by that time
// reset when changing a question
var currentRoundPointsResolved = false;
$(document).ready(function() { $(document).ready(function() {
$( "#fragenListe" ).sortable(); $( "#fragenListe" ).sortable();
@ -105,12 +108,15 @@ $(document).ready(function() {
var questionSelected = $("#finalFragenSelect").val(); var questionSelected = $("#finalFragenSelect").val();
questionSelected--; questionSelected--;
if (questionSelected < 0) { if (questionSelected < 0) {
$("#finalFragenSelect").val(4); // $("#finalFragenSelect").val(0);
} else { } else {
$("#finalFragenSelect").val(questionSelected) $("#finalFragenSelect").val(questionSelected)
} }
} }
setFrageIndex(index);
if (index > 0) {
setFrageIndex(index);
}
}); });
$("#downQicon").click(function() { $("#downQicon").click(function() {
@ -120,12 +126,15 @@ $(document).ready(function() {
var questionSelected = $("#finalFragenSelect").val(); var questionSelected = $("#finalFragenSelect").val();
questionSelected++; questionSelected++;
if (questionSelected > 4) { if (questionSelected > 4) {
$("#finalFragenSelect").val(0); // $("#finalFragenSelect").val(0);
} else { } else {
$("#finalFragenSelect").val(questionSelected) $("#finalFragenSelect").val(questionSelected)
} }
} }
setFrageIndex(index);
if (index < 8) {
setFrageIndex(index);
}
}); });
$("#questionsSelect").on("change", function() { $("#questionsSelect").on("change", function() {
@ -168,6 +177,10 @@ $(document).ready(function() {
wsSend("setRightPoints", $("#mPunkteRight").val()); wsSend("setRightPoints", $("#mPunkteRight").val());
}); });
$("#newSumRes").click(function() {
wsSend("setSumRes", $("#mPunkteSum").val());
});
$("#alternateAnswerBtn").click(function(){ $("#alternateAnswerBtn").click(function(){
var is = $("#finalFragenSelect").val(); var is = $("#finalFragenSelect").val();
var answer = $("#alternateAnswer").val(); var answer = $("#alternateAnswer").val();
@ -191,7 +204,24 @@ function setFinalMode(status){
var index = $("#questionsSelect>option:selected").index(); var index = $("#questionsSelect>option:selected").index();
index = index > 0 ? index : 0; index = index > 0 ? index : 0;
$("#answers").empty(); $("#answers").empty();
// automatically select first of the final questions (index 3)
if (isFinalMode < 3) {
index = 3;
}
loadQuestionToGui(index); loadQuestionToGui(index);
// manually select option once final mode starts
if (isFinalMode) {
if (index >= 0 && index < $("#questionsSelect").find("option").length) {
$("#questionsSelect").find("option").removeAttr("selected");
$($("#questionsSelect").find("option")[index]).prop("selected", "true");
}
if ($("#questionsSelect>option:selected").index() == -1 && $("#questionsSelect").find("option")[0]) {
$($("#questionsSelect").find("option")[0]).prop("selected", "true");
}
}
} }
function setPlayer2(value){ function setPlayer2(value){
@ -234,6 +264,12 @@ function setRightPoints(newPoints) {
} }
} }
function setSumRes(newSumRes) {
$('#SumRes').text(newSumRes);
$("#mPunkteSum").val(newSumRes);
recalcSum(0);
}
function startAnswerFail() { function startAnswerFail() {
if (sounds && (display || serverSound)) { if (sounds && (display || serverSound)) {
answerFail = new Audio('./sounds/failOriginal.ogg'); answerFail = new Audio('./sounds/failOriginal.ogg');
@ -300,15 +336,17 @@ function stopTimer() {
function startSchweinchen() { function startSchweinchen() {
if (runde == 2){ if (runde == 2){
$("#schweinchen2Img").fadeIn(); $("#schweinchen2Img").show("blind", { direction: "left" }, 1500);
} else if (runde == 3){ } else if (runde == 3){
$("#schweinchenImg").fadeIn(); $("#schweinchen3Img").show("blind", { direction: "left" }, 1500);
} else { } else {
$("#schweinchen1Img").fadeIn(); $("#schweinchen1Img").show("blind", { direction: "left" }, 1500);
} }
$("#answers").hide(); $("#answers").hide();
$("#displayQuestions").hide(); $("#displayQuestions").hide();
$("#result").hide();
$(".footer").hide();
if(sounds && (display || serverSound)) { if(sounds && (display || serverSound)) {
schweinchen = new Audio('./sounds/schweinchen.ogg'); schweinchen = new Audio('./sounds/schweinchen.ogg');
@ -322,11 +360,11 @@ function stopSchweinchen() {
$("#questionsSelect").val(index+1); $("#questionsSelect").val(index+1);
changeFrage(); changeFrage();
$("#schweinchenImg").hide(); $("#schweinchen3Img").stop(true, true).hide();
$("#schweinchen1Img").hide(); $("#schweinchen1Img").stop(true, true).hide();
$("#schweinchen2Img").hide(); $("#schweinchen2Img").stop(true, true).hide();
$("#answers").show(); $("#result").show();
$("#displayQuestions").show(); $(".footer").show("blind", { direction: "left" }, 1500);
if(schweinchen) { if(schweinchen) {
schweinchen.pause(); schweinchen.pause();
} }
@ -372,10 +410,11 @@ function changeFrage() {
var index = $("#questionsSelect>option:selected").index(); var index = $("#questionsSelect>option:selected").index();
wsSend("loadQuestion", index); wsSend("loadQuestion", index);
wsSend("clearAllFailsBtn", ""); wsSend("clearAllFailsBtn", "");
wsSend("resetPointsResolvedFlag", "false");
} }
function loadQuestionToGui(index) { function loadQuestionToGui(index) {
$("#schweinchenImg").hide(); $("#schweinchen3Img").hide();
$("#schweinchen1Img").hide(); $("#schweinchen1Img").hide();
$("#schweinchen2Img").hide(); $("#schweinchen2Img").hide();
$("#answers").empty(); $("#answers").empty();
@ -386,7 +425,8 @@ function loadQuestionToGui(index) {
$("#ResSum_player1").toggle(isFinalMode); $("#ResSum_player1").toggle(isFinalMode);
$("#ResSum_player2").toggle(isFinalMode); $("#ResSum_player2").toggle(isFinalMode);
if (isFinalMode){ if (isFinalMode){
$("#resultFinal").show(); $("#resultFinal").show();
$(".footer").hide();
} else { } else {
$("#resultFinal").hide(); $("#resultFinal").hide();
} }
@ -394,10 +434,10 @@ function loadQuestionToGui(index) {
if(index > -1) { if(index > -1) {
$("#displayQuestions").html(fragen[index]["frage"]); $("#displayQuestions").html(fragen[index]["frage"]);
if (isFinalMode){ if (isFinalMode && display){
$("#displayQuestions").hide(); $("#displayQuestions").hide();
} else { } else {
$("#displayQuestions").show(); $("#displayQuestions").show("blind", { direction: "left" }, 1500);
} }
var anzahlFragen = fragen[index]["antworten"].length; var anzahlFragen = fragen[index]["antworten"].length;
if (isFinalMode) { if (isFinalMode) {
@ -406,31 +446,26 @@ function loadQuestionToGui(index) {
for (var i = 0; i < anzahlFragen; i++) { for (var i = 0; i < anzahlFragen; i++) {
if(isFinalMode || fragen[index]["antworten"][i]["antwort"] != "") { if(isFinalMode || fragen[index]["antworten"][i]["antwort"] != "") {
if (isFinalMode) { if (isFinalMode) {
var oneLine = $('<div style="height:55px">' + var oneLine = $('<div>' +
'<div style="width: 400px; float: left; text-align: right" class="answer"></div>' + '<div style="width: 44%; float: left; text-align: center" class="answer"></div>' +
'<div style="width: 40px; float: left; margin-left: 18px; margin-right: 20px; text-align: right" class="points"></div>' + '<div style="width: 6%; float: left; text-align: center" class="points"></div>' +
'<div style="width: 40px; float: left; margin-left: 20px; margin-right: 22px; text-align: right" class="points_player2"></div>' + '<div style="width: 6%; float: left; text-align: center" class="points_player2"></div>' +
'<div style="width: 400px; float: left;" class="answer_player2"></div>' + '<div style="width: 44%; float: left; text-align: center" class="answer_player2"></div>' +
'</div>'); '</div>');
} else { } else {
var oneLine = $('<div style="height:55px">' + var oneLine = $('<div>' +
'<div style="margin-left: 18px; width: 50px; float: left;" class="nr">' + (i + 1) + '.</div>' + '<div style="width: 5%; text-align: center; float: left;" class="nr">' + (i + 1) + '.</div>' +
'<div style="width: 824px; float: left" class="answer"></div>' + '<div style="width: 89%; text-align: center; float: left" class="answer"></div>' +
'<div style="width: 52px; float: left; text-align: right" class="points"></div>' + '<div style="width: 6%; float: left; text-align: right" class="points"></div>' +
'</div>'); '</div>');
} }
if(display && !player2) { if(display && !player2) {
if (isFinalMode) { oneLine.find(".answer").text("..............................................................................................................");
// oneLine.find(".answer").text("_ _ _ _ _ _ _ _ _ _ _"); oneLine.find(".points").text("--");
oneLine.find(".answer").text(".....................");
} else {
// oneLine.find(".answer").text("_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _");
oneLine.find(".answer").text("...............................................");
}
oneLine.find(".points").text("--");
if (isFinalMode){ if (isFinalMode){
oneLine.find(".points_player2").text("--"); oneLine.find(".points_player2").text("--");
oneLine.find(".answer_player2").text("....................."); oneLine.find(".answer_player2").text("..............................................................................................................");
// oneLine.find(".answer_player2").text("_ _ _ _ _ _ _ _ _ _ _"); // oneLine.find(".answer_player2").text("_ _ _ _ _ _ _ _ _ _ _");
} }
} else if (!display) { } else if (!display) {
@ -459,7 +494,8 @@ function loadQuestionToGui(index) {
} }
} }
if (!isFinalMode) { if (!isFinalMode) {
$("#SumRes").text("0"); $("#SumRes").text("0");
$("#answers").show("blind", { direction: "left" }, 1500);
} }
if(!display) if(!display)
$("#resultFinal").hide(); $("#resultFinal").hide();
@ -546,17 +582,30 @@ function recalcSum(s) {
} }
} }
// Add the scores from the final rounds to the current scores from previous rounds
function showFinalScores() {
$("#answers").hide();
$("#displayQuestions").hide();
$("#result").hide();
$("#resultFinal").hide();
$("#pointsCenter").hide();
$(".pointsLeft").show();
$(".pointsRight").show();
const leftFinalScore = parseFloat($("#SumRes_player1").text());
const rightFinalScore = parseFloat($("#SumRes_player2").text());
$(".pointsLeft").text(parseFloat($(".pointsLeft").text()) + leftFinalScore);
$(".pointsRight").text(parseFloat($(".pointsRight").text()) + rightFinalScore);
// show final scores with blinds
$(".footer").show("blind", { direction: "left" }, 1500);
}
function getAnswerString(str) { function getAnswerString(str) {
if (isFinalMode){ if (isFinalMode){
while(str.length < 21) { while(str.length < 24) {
if (player2){ str = " " + str;
str += " ";
} else {
str = " " + str;
}
}
if (player2){
str = str.replace(/ /g, "&nbsp;");
} }
} else { } else {
str += " "; str += " ";

View File

@ -8,7 +8,7 @@ var sounds = true;
var ws; var ws;
var display = true; var display = true;
var audio = null; var audio = null;
var serverSound = false; var serverSound = true;
var isFinalMode = false; var isFinalMode = false;
var player2 = false; var player2 = false;
var runde = 1; var runde = 1;
@ -40,12 +40,23 @@ $(document).ready(function() {
$("#display").show(); $("#display").show();
$(".controller").show(); $(".controller").show();
display = false; display = false;
// nice css manipulation 🤢#hack
$(".mainHeight").css("width", 1020);
$(".mainHeight").css("height", 520);
$(".mainHeight").css("padding-top", "");
$("#answers").css("font-size", "1.5em");
$("#displayQuestions").css("font-size", "1.5em");
}); });
$("#clearAllFailsBtn").click(function() { $("#clearAllFailsBtn").click(function() {
wsSend("clearAllFailsBtn", ""); wsSend("clearAllFailsBtn", "");
}); });
$("#showFinalScores").click(function() {
wsSend("showFinalScores", "");
});
$("#toggleSoundImg").click(function() { $("#toggleSoundImg").click(function() {
wsSend("toggleSound", ""); wsSend("toggleSound", "");
}); });
@ -93,9 +104,14 @@ var connectWs = function() {
return null; return null;
} }
ws.onmessage = function (event) { ws.onmessage = async function (event) {
console.log("msg: "+event.data) console.log("msg: "+event.data.toString())
messageParts_a = event.data.split("###"); let tempSt = event.data.toString();
if(typeof(tempSt) != "string") {
tempSt = await new Response(tempSt).text()
}
messageParts_a = tempSt.split("###");
var key = messageParts_a[0]; var key = messageParts_a[0];
var value = messageParts_a[1]; var value = messageParts_a[1];
if(key =="setFail") { if(key =="setFail") {
@ -122,6 +138,8 @@ var connectWs = function() {
$("#toggleSoundImg").attr("src", "./img/soundOn.png"); $("#toggleSoundImg").attr("src", "./img/soundOn.png");
sounds = true; sounds = true;
} }
} else if(key == "showFinalScores") {
showFinalScores()
} else if(key == "file") { } else if(key == "file") {
if(value == "fragen.txt") { if(value == "fragen.txt") {
try { try {
@ -152,6 +170,8 @@ var connectWs = function() {
setLeftPoints(value); setLeftPoints(value);
} else if(key == "setRightPoints") { } else if(key == "setRightPoints") {
setRightPoints(value); setRightPoints(value);
} else if(key == "setSumRes") {
setSumRes(value);
} else if(key == "startAnswerFail") { } else if(key == "startAnswerFail") {
startAnswerFail(); startAnswerFail();
} else if(key == "startAnswerDuplicate") { } else if(key == "startAnswerDuplicate") {