From: Max Value Date: Sat, 12 Apr 2025 15:37:10 +0000 (+0100) Subject: Small changes and pricing extension X-Git-Url: https://git.ozva.co.uk/?a=commitdiff_plain;h=059089ffc10b7455a678e94d349064d9909e10c4;p=shopping-channel Small changes and pricing extension + favicons to all pages + pricing extension - sigils other than one --- diff --git a/extensions/pricing.html b/extensions/pricing.html index 8404bfd..cbb5f35 100644 --- a/extensions/pricing.html +++ b/extensions/pricing.html @@ -3,12 +3,72 @@ XMDV + + + + + + -

This is some text

-

You are accesing the pricing version of this document.

- +
+

XMDV

+

★★★★★

+

Back soon!

+

Please wait... XMDV will be back soon!

+ +
+ +

Now Only:

+
+
+ +
diff --git a/extensions/pricing.js b/extensions/pricing.js new file mode 100644 index 0000000..1f17b46 --- /dev/null +++ b/extensions/pricing.js @@ -0,0 +1,62 @@ +let pastId = 0; + +function update() { + + // setup and hide the main element & the image element + const main = document.getElementById("main"); + + const code = document.getElementById("code"); + const rating = document.getElementById("rating"); + const subtext = document.getElementById("subtext"); + const description = document.getElementById("description"); + + const price = document.getElementById("price"); + + + fetch("https://shopping.ozva.co.uk/api/items", {cache: "default"}) + .then(data => data.json()) + .then(dataStatic => { + fetch("https://shopping.ozva.co.uk/api", {cache: "no-store"}) + .then(data => data.json()) + .then(data => { + + // some variable setup + let id = data.item_id; + + // change the data if the id is different + if (id != pastId) { + main.classList.add("hide"); + + const items = dataStatic.items; + const item = items[id]; + + // register function to change the data when the animation is done + setTimeout(function () { + + code.innerHTML = item.code; + rating.innerHTML = item.rating; + subtext.innerHTML = item.subtext; + description.innerHTML = item.description; + + let priceValue = item.origional_price * (data.discount / 100); + + if (data.bool_rounding) { + priceValue = Math.round(priceValue * 100) / 100; + } + + if (items[id].prefix) { + price.innerHTML = `${items[id].currency}${priceValue}`; + } else { + price.innerHTML = `${priceValue}${items[id].currency}`; + } + + main.classList.remove("hide"); + pastId = id; + + }, 1500); + } + }); + }); +} + +setInterval(update, 5000); diff --git a/extensions/product.html b/extensions/product.html index 823ad2d..f64f78c 100644 --- a/extensions/product.html +++ b/extensions/product.html @@ -3,6 +3,11 @@ XMDV + + + + + + + + + +
+ T1: 00:00 - + T2: 00:00 - + T3: 00:00
+ Left: 0 out of 0
+ Start price: 0.00 + ⤓00% + ⤈00%
+ Discount: 00% (Now 0.00) +
+ + diff --git a/templates/docs.html b/templates/docs.html index 42f867f..dfe405d 100644 --- a/templates/docs.html +++ b/templates/docs.html @@ -2,7 +2,8 @@ - XMDV + XMDV Docs + @@ -594,50 +568,7 @@ circle { -
- - - - - - - -
-
- - - - - - -
-
- - - - - - -
-
- - - - - - +