From: will Date: Wed, 28 Aug 2024 13:02:58 +0000 (+0100) Subject: Sigil changes X-Git-Url: https://git.ozva.co.uk/?a=commitdiff_plain;h=eea36a5955a9695d526512e2d76f96c495154a6f;p=shopping-channel Sigil changes + freeze frame if all sigils no longer showing + "All on/off" buttons on the control pannel to minimize clicks --- diff --git a/auth/index.php b/auth/index.php index d836153..259d585 100644 --- a/auth/index.php +++ b/auth/index.php @@ -53,6 +53,15 @@ if (!empty($_POST['update'])) { ]; $data['round'] = var_export(!empty($_POST['round']), true); + if (!empty($_POST['allChange'])) { + if ($_POST['allChange'] == "on") { + $data['showingSigil'] = ["true", "true", "true", "true"]; + } + else if ($_POST['allChange'] == "off") { + $data['showingSigil'] = ["false", "false", "false", "false"]; + } + } + $clock['movementSpeed'] = (int)$_POST['movementSpeed']; $clock['currentPosition'] = (int)$_POST["doomsday"]; $data['timerOffset'] = (int)$_POST['timerOffset']; @@ -330,6 +339,10 @@ if ($data['showingSigil'][2] == "true") { } echo ""; echo "
"; + +echo ""; +echo "
"; + echo "
"; $checked = ""; if ($data['showingSigil'][0] == "true") { @@ -341,9 +354,12 @@ $checked = ""; if ($data['showingSigil'][1] == "true") { $checked = " checked='checked' "; } +echo ">"; +echo "
"; + +echo ""; +echo "
"; ?> - > -
diff --git a/index.html b/index.html index eed82d8..c72fbcd 100644 --- a/index.html +++ b/index.html @@ -289,6 +289,8 @@ var discount = 1; var newDiscount = 1; var priceChange = 0; +var showingSigils = true; + // helper function for creating price strings function makePrice(price) { if (round == "true") {price = Math.round(price * 100) / 100;} @@ -445,6 +447,12 @@ function update() { priceChange = data.priceChange / 100; newDiscount = data.discount / 100; + + if (data.showingSigil.every(i => i == "false")) { + showingSigils = false; + } else { + showingSigils = true; + } }); // get the requested item data @@ -522,6 +530,7 @@ function frame() { } // function handles the periodic drawing of the sigils (2 per second) function draw() { + if (showingSigils == false) {return;} // break if the sigils are not being shown to save resources fetch("./sigil.json", {cache: "no-store"}) .then(data => data.json()) .then(data => {