]> OzVa Git service - shopping-channel/commitdiff
Added redacting the number 7 in the display panel
authorMax Value <greenwoodw50@gmail.com>
Sat, 19 Apr 2025 09:13:06 +0000 (10:13 +0100)
committerMax Value <greenwoodw50@gmail.com>
Sat, 19 Apr 2025 09:13:06 +0000 (10:13 +0100)
.gitignore
templates/display.html

index 5fd2490344d8be2089ebd5ce7989c34f3d84cddf..6620d0bd561f6a5b8026e7196f0fa7cc8be43025 100644 (file)
@@ -1,3 +1,4 @@
 *.wsgi
 *.db
+*.zip
 docs/*
index f03eedb5e64b44d6c232be20c19e9b322b93ecdd..7474dfde85ef067df1616c350f21e45bf853ec1c 100644 (file)
@@ -53,6 +53,8 @@ function resize() {
        document.getElementsByTagName("body")[0].style.fontSize = `${slider.value}px`;
 }
 
+let rep;
+
 function update () {
        // fetch the item manifest and chache it
        fetch("./api/items", {cache: "default"})
@@ -65,25 +67,28 @@ function update () {
                                        .then(data => {
                                                let id = data.item_id;
 
+                                               if (data.bool_number) { rep = "7"; }
+                                               else { rep = "#####"; }
+
                                                // update the total items and the items sold already
-                                               document.getElementById("left").innerHTML = Math.round(
+                                               document.getElementById("left").innerHTML = String(Math.round(
                                                        items[id].stock_count * (data.percent_remaining / 100)
-                                                       );
-                                               document.getElementById("stock").innerHTML = items[id].stock_count;
+                                                       )).replaceAll(rep, "&#9608;");
+                                               document.getElementById("stock").innerHTML = String(items[id].stock_count).replaceAll(rep, "&#9608;");
 
                                                // update the timers
                                                for (let t = 1; t <= 3; t++) {
-                                                       document.getElementById(`timer_${t}`).innerHTML = makeTime(
+                                                       document.getElementById(`timer_${t}`).innerHTML = String(makeTime(
                                                                data[`end_timer_${t}`],
                                                                data['timer_offset'],
                                                                data[`bool_timer_${t}`]
-                                                               )
+                                                               )).replaceAll(rep, "&#9608;")
                                                }
 
                                                // update the discount
-                                               document.getElementById("discount").innerHTML = data.discount;
-                                               document.getElementById("gallery").innerHTML = items[id].gallery_price * 100;
-                                               document.getElementById("cost").innerHTML = items[id].cost_price * 100;
+                                               document.getElementById("discount").innerHTML = String(data.discount).replaceAll(rep, "&#9608;");
+                                               document.getElementById("gallery").innerHTML = String(items[id].gallery_price * 100).replaceAll(rep, "&#9608;");
+                                               document.getElementById("cost").innerHTML = String(items[id].cost_price * 100).replaceAll(rep, "&#9608;");
                                                if (data.discount != 0) {
                                                        document.getElementById("discountBox").classList.add("show");
                                                } else {
@@ -94,11 +99,11 @@ function update () {
                                                const price = document.getElementById("price");
                                                const currentPrice = document.getElementById("currentPrice");
                                                if (items[id].prefix) {
-                                                       price.innerHTML = `${items[id].currency}${items[id].origional_price}`;
-                                                       currentPrice.innerHTML = `${items[id].currency}${Math.round(items[id].origional_price * data.discount) / 100}`;
+                                                       price.innerHTML = `${items[id].currency}${String(items[id].origional_price).replaceAll(rep, "&#9608;")}`;
+                                                       currentPrice.innerHTML = `${items[id].currency}${String(Math.round(items[id].origional_price * data.discount) / 100).replaceAll(rep, "&#9608;")}`;
                                                } else {
-                                                       price.innerHTML = `${items[id].origional_price}${items[id].currency}`;
-                                                       currentPrice.innerHTML = `${Math.round(items[id].origional_price * data.discount) / 100}${items[id].currency}`;
+                                                       price.innerHTML = `${String(items[id].origional_price).replaceAll(rep, "&#9608;")}${items[id].currency}`;
+                                                       currentPrice.innerHTML = `${String(Math.round(items[id].origional_price * data.discount) / 100).replaceAll(rep, "&#9608;")}${items[id].currency}`;
                                                }
                                        })
                                });