]> OzVa Git service - shopping-channel/commitdiff
Implemented 2 more clocks
authorwill <greenwoodw50@gmail.com>
Tue, 27 Aug 2024 00:55:54 +0000 (01:55 +0100)
committerwill <greenwoodw50@gmail.com>
Tue, 27 Aug 2024 00:55:54 +0000 (01:55 +0100)
Note: Not yet implemented in the GFX display

auth/index.php
autocue/index.html
clock.json
data.json

index eb226405428231c457e765ba865472565cbfc8b7..9d6b1ee389c8662cba6ac9a9c21c302dd11dffa6 100644 (file)
@@ -40,7 +40,9 @@ if (!empty($_POST['update'])) {
        $data['showingMain'] = var_export(!empty($_POST['main']), true);
        $data['showingAll'] = var_export(!empty($_POST['all']), true);
        $data['showingExtra'] = var_export(!empty($_POST['extra']), true);
-       $data['showingTimer'] = var_export(!empty($_POST['timer']), true);
+       $data['showingTimer1'] = var_export(!empty($_POST['timer1']), true);
+       $data['showingTimer2'] = var_export(!empty($_POST['timer2']), true);
+       $data['showingTimer3'] = var_export(!empty($_POST['timer3']), true);
        $data['showingBanner'] = var_export(!empty($_POST['banner']), true);
        $data['showingSigil'] = [
                var_export(!empty($_POST['sigilNE']), true),
@@ -52,7 +54,9 @@ if (!empty($_POST['update'])) {
 
        $clock['movementSpeed'] = (int)$_POST['movementSpeed'];
        $clock['currentPosition'] = (int)$_POST["doomsday"];
-       $data['timerOffset'] = (int)$_POST['timerOffset'];
+       $data['timer1Offset'] = (int)$_POST['timer1Offset'];
+       $data['timer2Offset'] = (int)$_POST['timer2Offset'];
+       $data['timer3Offset'] = (int)$_POST['timer3Offset'];
        $data['priceChange'] = (int)$_POST['priceChange'];
        $data['discount'] = (int)$_POST['discount'];
        $data['itemId'] = (int)$_POST['item'];
@@ -78,10 +82,20 @@ if (!empty($_POST['update'])) {
 
        $data['bannerText'] = $text['bannerText'][(int)$_POST['bannerText']];
 
-       if (!empty($_POST['addTime'])) {
-               $minutes = (int)substr($_POST['addTime'], 0, 2);
-               $seconds = (int)substr($_POST['addTime'], 2, 4) + ($minutes * 60);
-               $data['timerEnd'] = time() + $seconds;
+       if (!empty($_POST['addTime1'])) {
+               $minutes = (int)substr($_POST['addTime1'], 0, 2);
+               $seconds = (int)substr($_POST['addTime1'], 2, 4) + ($minutes * 60);
+               $data['timer1End'] = time() + $seconds;
+       }
+       if (!empty($_POST['addTime2'])) {
+               $minutes = (int)substr($_POST['addTime2'], 0, 2);
+               $seconds = (int)substr($_POST['addTime2'], 2, 4) + ($minutes * 60);
+               $data['timer2End'] = time() + $seconds;
+       }
+       if (!empty($_POST['addTime3'])) {
+               $minutes = (int)substr($_POST['addTime3'], 0, 2);
+               $seconds = (int)substr($_POST['addTime3'], 2, 4) + ($minutes * 60);
+               $data['timer3End'] = time() + $seconds;
        }
 
        $json = json_encode($data);
@@ -107,6 +121,12 @@ h1 {
        margin: 10px;
        vertical-align: top;
 }
+.third {
+       display: inline-block;
+       width: calc((100% / 3) - 20px);
+       margin: 10px;
+       vertical-align: top;
+}
 .entry {
        width: 50%;
        margin: 0;
@@ -328,30 +348,76 @@ if ($data['showingSigil'][1] == "true") {
                        </fieldset>
                        <fieldset>
                                <legend>Timer</legend>
-                               <div class="split entry"><input type='radio' id='0000' value='0000' name='addTime'>
-                               <label for='0000'> Reset</label></div>
-                               <div class="split entry"><input type='radio' id='0030' value='0030' name='addTime'>
-                               <label for='0030'> +00:30</label></div>
-                               <div class="split entry"><input type='radio' id='0100' value='0100' name='addTime'>
-                               <label for='0100'> +01:00</label></div>
-                               <div class="split entry"><input type='radio' id='0200' value='0200' name='addTime'>
-                               <label for='0200'> +02:00</label></div>
-                               <div class="split entry"><input type='radio' id='0500' value='0500' name='addTime'>
-                               <label for='0500'> +05:00</label></div>
-                               <div class="split entry"><input type='radio' id='1000' value='1000' name='addTime'>
-                               <label for='1000'> +10:00</label></div>
 <?php
-$checked = "";
-if ($data['showingTimer'] == "true") {
-       $checked = " checked='checked' ";       
-}
-$timerOffset = $data["timerOffset"];
-echo "<input type='number' id='timerOffset' name='timerOffset' min='-5000' max='5000' step='1' value='$timerOffset'>";
-echo "<label for='timerOffset'> Timer offset (ms)</label>";
-echo "<br><input type='checkbox' id='timer' name='timer' value='true'$checked>";
-echo "<label for='timer'> Showing timer</label>";
-echo "</fieldset>";
+$timer1Checked = "";
+if ($data['showingTimer1'] == "true") {
+       $timer1Checked = " checked='checked' ";
+}
+$timer1Offset = $data["timer1Offset"];
+$timer2Checked = "";
+if ($data['showingTimer2'] == "true") {
+       $timer2Checked = " checked='checked' ";
+}
+$timer2Offset = $data["timer2Offset"];
+$timer3Checked = "";
+if ($data['showingTimer3'] == "true") {
+       $timer3Checked = " checked='checked' ";
+}
+$timer3Offset = $data["timer3Offset"];
 ?>
+                               <div class="third">
+                                       <input type='radio' id='0000' value='0000' name='addTime1'>
+                                       <label for='0000'> Reset</label><br>
+                                       <input type='radio' id='0030' value='0030' name='addTime1'>
+                                       <label for='0030'> +00:30</label><br>
+                                       <input type='radio' id='0100' value='0100' name='addTime1'>
+                                       <label for='0100'> +01:00</label><br>
+                                       <input type='radio' id='0200' value='0200' name='addTime1'>
+                                       <label for='0200'> +02:00</label><br>
+                                       <input type='radio' id='0500' value='0500' name='addTime1'>
+                                       <label for='0500'> +05:00</label><br>
+                                       <input type='radio' id='1000' value='1000' name='addTime1'>
+                                       <label for='1000'> +10:00</label><br>
+                                       <input type='number' id='timer1Offset' name='timer1Offset' min='-5000' max='5000' step='1' value='<?php echo $timer1Offset; ?>'>
+                                       <label for='timer1Offset'> Timer 1 offset (ms)</label>
+                                       <br><input type='checkbox' id='timer1' name='timer1' value='true'<?php echo $timer1Checked; ?>>
+                                       <label for='timer1'> Showing timer</label>
+                               </div><div class="third">
+                                       <input type='radio' id='0000' value='0000' name='addTime2'>
+                                       <label for='0000'> Reset</label><br>
+                                       <input type='radio' id='0030' value='0030' name='addTime2'>
+                                       <label for='0030'> +00:30</label><br>
+                                       <input type='radio' id='0100' value='0100' name='addTime2'>
+                                       <label for='0100'> +01:00</label><br>
+                                       <input type='radio' id='0200' value='0200' name='addTime2'>
+                                       <label for='0200'> +02:00</label><br>
+                                       <input type='radio' id='0500' value='0500' name='addTime2'>
+                                       <label for='0500'> +05:00</label><br>
+                                       <input type='radio' id='1000' value='1000' name='addTime2'>
+                                       <label for='1000'> +10:00</label><br>
+                                       <input type='number' id='timer2Offset' name='timer2Offset' min='-5000' max='5000' step='1' value='<?php echo $timer2Offset; ?>'>
+                                       <label for='timer2Offset'> Timer 2 offset (ms)</label>
+                                       <br><input type='checkbox' id='timer2' name='timer2' value='true'<?php echo $timer2Checked; ?>>
+                                       <label for='timer2'> Showing timer</label>
+                               </div><div class="third">
+                                       <input type='radio' id='0000' value='0000' name='addTime3'>
+                                       <label for='0000'> Reset</label><br>
+                                       <input type='radio' id='0030' value='0030' name='addTime3'>
+                                       <label for='0030'> +00:30</label><br>
+                                       <input type='radio' id='0100' value='0100' name='addTime3'>
+                                       <label for='0100'> +01:00</label><br>
+                                       <input type='radio' id='0200' value='0200' name='addTime3'>
+                                       <label for='0200'> +02:00</label><br>
+                                       <input type='radio' id='0500' value='0500' name='addTime3'>
+                                       <label for='0500'> +05:00</label><br>
+                                       <input type='radio' id='1000' value='1000' name='addTime3'>
+                                       <label for='1000'> +10:00</label><br>
+                                       <input type='number' id='timer3Offset' name='timer3Offset' min='-5000' max='5000' step='1' value='<?php echo $timer3Offset; ?>'>
+                                       <label for='timer3Offset'> Timer 3 offset (ms)</label>
+                                       <br><input type='checkbox' id='timer3' name='timer3' value='true'<?php echo $timer3Checked; ?>>
+                                       <label for='timer3'> Showing timer</label>
+                               </div>
+                       </fieldset>
                </div><div class="split">
 <?php
 echo "<fieldset><legend>Doomsday clock <em>(Incr. $clockIncrement deg)</em></legend>";
index f7a2e6ebb082fd6f989075b6e6f6d010bd04dec0..2ea8df4950d0e2d6baa14ebe4bbb22ab30285ac6 100644 (file)
@@ -13,16 +13,38 @@ body {
 }
 #notes {
        margin: 40px;
+}
+#timer {
+       position: absolute;
+       bottom: 0;
+       left: 0;
 }
                </style>
                <script>
 var itemId = 0;
 
+function makeTime(t, o) {
+                       let current = Math.round((Date.now() + o) / 1000);
+                       var time = t - current;
+                       if (Math.sign(time) == -1) {time = 0;}
+                       var minutes = Math.floor(time / 60);
+                       var seconds = (time - (minutes * 60));
+
+                       var minutesString = minutes.toString();
+                       var secondsString = seconds.toString();
+                       minutesString = minutesString.padStart(2, "0");
+                       secondsString = secondsString.padStart(2, "0");
+
+                       return `${minutesString}:${secondsString}`;
+}
+
 function frame() {
        var slider = document.getElementById("slider");
        var notes = document.getElementById("notes");
+       var timers = document.getElementById("timer");
 
-       notes.style.fontSize = `${slider.value}px`
+       notes.style.fontSize = `${slider.value}px`;
+       timers.style.fontSize = `${slider.value}px`;
 }
 
 function update() {
@@ -30,6 +52,10 @@ function update() {
                 .then(data => data.json())
                 .then(data => {
                        itemId = data.itemId;
+                       var timers = document.getElementsByClassName("time");
+                       timers[0].innerHTML = makeTime(data.timer1End, data.timer1Offset);
+                       timers[1].innerHTML = makeTime(data.timer2End, data.timer2Offset);
+                       timers[2].innerHTML = makeTime(data.timer3End, data.timer3Offset);
                })
        fetch("../items.json", {cache: "no-store"})
                 .then(data => data.json())
@@ -46,5 +72,10 @@ setInterval(update, 1000);
        <body>
                <input type="range" min="30" max="100" value="45" id="slider">
                <div style="font-size: 50px;" id="notes">some test text!</div>
+               <div id="timer">
+                       T1: <span style="background-color: red;" class="time"></span> -
+                       T2: <span style="background-color: green;" class="time"></span> -
+                       T3: <span style="background-color: blue;" class="time"></span>
+               </div>
        </body>
 </html>
index 3c56d26d9b9722266916eb48803141315440de54..cee5f6d6366b96c104b6ba9922119a2d9643feb6 100755 (executable)
@@ -1 +1 @@
-{"currentPosition":230,"movementSpeed":30,"function":"ease","lightingCues":["false","false","true","false","false","true","false","true","false","true"]}
\ No newline at end of file
+{"currentPosition":230,"movementSpeed":30,"function":"ease","lightingCues":["false","false","false","true","false","true","false","true","false","true"]}
\ No newline at end of file
index 7d876927ddae489f92de90f3eddb842dc18b4b15..29d6d5047b32f811053e6b0afc13ccb38c7f3bba 100755 (executable)
--- a/data.json
+++ b/data.json
@@ -1 +1 @@
-{"topText":["It's here!"],"bottomText":["It's here!"],"bannerText":"The quant we created!","itemId":1,"currency":{"prefix":"$","postfix":" hairs"},"discount":70,"prefix":"false","round":"true","priceChange":50,"showingMain":"true","showingAll":"true","showingExtra":"true","showingTimer":"true","showingBanner":"true","showingSigil":["false","false","false","false"],"timerEnd":1722808645,"timerOffset":-500}
\ No newline at end of file
+{"topText":["It's here!"],"bottomText":["It's here!"],"bannerText":"The quant we created!","itemId":1,"currency":{"prefix":"$","postfix":" hairs"},"discount":70,"prefix":"false","round":"true","priceChange":50,"showingMain":"true","showingAll":"true","showingExtra":"true","showingTimer1":"true","showingTimer2":"true","showingTimer3":"false","showingBanner":"true","showingSigil":["false","false","false","false"],"timer1End":1724720136,"timer1Offset":0,"timer2End":1724720211,"timer2Offset":0,"timer3End":1724720386,"timer3Offset":0}
\ No newline at end of file