From: Max Value Date: Sat, 19 Apr 2025 09:13:06 +0000 (+0100) Subject: Added redacting the number 7 in the display panel X-Git-Url: https://git.ozva.co.uk/?a=commitdiff_plain;h=55be75e96dd22dc2e887d09c7de5fa64f00dfb2b;p=shopping-channel Added redacting the number 7 in the display panel --- diff --git a/.gitignore b/.gitignore index 5fd2490..6620d0b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.wsgi *.db +*.zip docs/* diff --git a/templates/display.html b/templates/display.html index f03eedb..7474dfd 100644 --- a/templates/display.html +++ b/templates/display.html @@ -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, "█"); + document.getElementById("stock").innerHTML = String(items[id].stock_count).replaceAll(rep, "█"); // 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, "█") } // 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, "█"); + document.getElementById("gallery").innerHTML = String(items[id].gallery_price * 100).replaceAll(rep, "█"); + document.getElementById("cost").innerHTML = String(items[id].cost_price * 100).replaceAll(rep, "█"); 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, "█")}`; + currentPrice.innerHTML = `${items[id].currency}${String(Math.round(items[id].origional_price * data.discount) / 100).replaceAll(rep, "█")}`; } 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, "█")}${items[id].currency}`; + currentPrice.innerHTML = `${String(Math.round(items[id].origional_price * data.discount) / 100).replaceAll(rep, "█")}${items[id].currency}`; } }) });