]> OzVa Git service - shopping-channel/commitdiff
Small tweaks and housekeeping
authorMax Value <greenwoodw50@gmail.com>
Sun, 20 Apr 2025 09:49:56 +0000 (10:49 +0100)
committerMax Value <greenwoodw50@gmail.com>
Sun, 20 Apr 2025 09:49:56 +0000 (10:49 +0100)
+ added submit on enter for the pricing form
~ reversed direction of the crawler
- removed pacifico font in monthy payments and description
- removed "remove shout" button (messes with sounds)

templates/gfx.html
templates/price.html
templates/timer.html

index b298261df16f425aedf288659ccb394317a5efc8..7efa9aac6e85e6064413bf2e231b4386736596bc 100644 (file)
@@ -159,7 +159,6 @@ body {
 }
 #subtext {
     color: white;
-    font-family: "Pacifico";
     background-color: var(--blue);
 }
 #banner {
@@ -213,7 +212,7 @@ body {
     font-weight: bold;
     text-align: center;
 }
-#origionalPrice {
+#currentPrice {
     color: var(--red);
     font-size: 2em;
 }
@@ -372,12 +371,11 @@ body {
     font-size: 10em;
     text-align: center;
 }
-#currentPrice {
+#origionalPrice {
     line-height: 0.5em;
 }
 #monthlyPrice {
     line-height: 1em;
-    font-family: "Pacifico";
 }
 .main > hr, .extra > hr {
     margin: 0 1vh;
@@ -511,7 +509,7 @@ body {
                </style>
                <link rel="stylesheet" href="./static/fonts.css">
        </head>
-       <body id="all" class="show" onload="frame(); update();">
+       <body id="all" class="show" onload="update();frame();">
 
                <canvas id="canvas" style="display: none;"></canvas>
 
@@ -522,7 +520,7 @@ body {
                                <h2 class="feature" id="subtext">Subtext</h2>
                                <h3 id="description">Description</h3>
                                <hr>
-                               <h4 id="origionalPrice">Origional Price</h4>
+                               <h4 id="currentPrice">Current Price</h4>
                                <div id="badge1Container">
                                        <img class="badge" src="./static/assets/star1.svg"></img>
                                        <h2 class="badge" id="badge1Text">Percent off</h2>
@@ -541,7 +539,7 @@ body {
                                </div>
                        </div>
                        <div class="box extra">
-                               <h2 style="margin-top: 1vh;" id="currentPrice">Current Price</h4>
+                               <h2 style="margin-top: 1vh;" id="origionalPrice">Origional Price</h4>
                                <p id="monthlyPrice">Monthly Price</p>
                                <div class="soldBox">
                                        <p style="font-size: 1.2em;">In stock: <span style="margin-right:10px;" id="stock"></span> Sold: <span id="sold"></span></p>
@@ -831,7 +829,7 @@ function update() {
                 else {origionalString = `${origionalPrice}${item.currency}`};
                 origional.innerHTML = `<s><em>WAS:</em> ${origionalString}</s>`.replaceAll(rep, "&#9608;");
             } else {
-                origional.innerHTML = `<em>NOW:</em> ${priceString}`.replaceAll(rep, "&#9608;");
+                origional.innerHTML = "<em>Amazing offer!<em>";
             }
 
             if (data.percent_remaining == 0) {
@@ -854,6 +852,7 @@ function update() {
 
 let marqueeOffset = 0;
 let bottomTextIndex = 0;
+let bottomTextWidth = 0;
 
 // function handles all animated events that are required to look smooth (marquee movement / price changes) (200 times per second)
 function frame() {
@@ -866,10 +865,11 @@ function frame() {
     }
 
     bottomTextElement.style.transform = `translateX(${marqueeOffset}px)`;
-    marqueeOffset += 0.2;
+    marqueeOffset -= 0.2;
 
     // only replace text where neccicary or where the page has just loaded
-    if (marqueeOffset >= marqueeContainer.offsetWidth || (topTextElement.innerHTML == "" && bottomTextElement.innerHTML == "")) {
+    if (marqueeOffset < -bottomTextWidth || (topTextElement.innerHTML == "" && bottomTextElement.innerHTML == "")) {
+        if (bottomText.length == 0) {return}
 
         topTextElement.innerHTML = topText.replaceAll(rep, "&#9608;");
 
@@ -889,7 +889,9 @@ function frame() {
         ctx.font = `bold ${fontSize}px sans-serif`;
         let text = ctx.measureText(bottomTextElement.innerHTML);
 
-        marqueeOffset = -1.1 * text.width; // place text just before its end-point
+        bottomTextWidth = text.width;
+
+        marqueeOffset = window.innerHeight ; // place text just before its end-point
     }
 }
 
@@ -903,9 +905,10 @@ function sigil () {
     document.getElementById(`sigil${sigilCounter}`).classList.add("show");
 }
 
-setInterval(frame, 5);
+
 setInterval(sigil, 100);
 setInterval(update, 500);
+setInterval(frame, 5);
 
                </script>
        </body>
index 6203b2d203d9e5b1208a77bf061ebd673300b81d..802413b7dc4e9eaa2a1d5b686a1227485c6842d8 100644 (file)
                                {% endfor %}
                        </div>
 
-                       <input type="button" value="Update" onclick="submitForm();">
+                       <input id="input" type="button" value="Update" onclick="submitForm();">
                </form>
 
                <script>
 
+const input = document.getElementsByTagName("input");
+for (e of input) {
+       e.addEventListener("keypress", function(event) {
+               if (event.key === "Enter") {
+                       event.preventDefault();
+                       document.getElementById("input").click();
+               }
+       });
+}
+
 const deviation = 0.05;
 
 async function submitForm() {
index e0187e9beed5aa852660a103c648907eeeec56cc..167c0fce60de22cadbc3fb2bf7cbefb9930f646b 100644 (file)
                        </fieldset>
                        <input type="submit" name="update" value="Shout">
                </form>
-
-               <br>
-
-               <form action="/admin/timer" method="POST">
-                       <input type="number" value="-1000000" name="end_timer_shout" style="display: none"></input>
-                       <input type="submit" name="update" value="Remove shout">
-               </form>
-
                <script>
 
 function update() {