}
#subtext {
color: white;
- font-family: "Pacifico";
background-color: var(--blue);
}
#banner {
font-weight: bold;
text-align: center;
}
-#origionalPrice {
+#currentPrice {
color: var(--red);
font-size: 2em;
}
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;
</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>
<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>
</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>
else {origionalString = `${origionalPrice}${item.currency}`};
origional.innerHTML = `<s><em>WAS:</em> ${origionalString}</s>`.replaceAll(rep, "█");
} else {
- origional.innerHTML = `<em>NOW:</em> ${priceString}`.replaceAll(rep, "█");
+ origional.innerHTML = "<em>Amazing offer!<em>";
}
if (data.percent_remaining == 0) {
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() {
}
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, "█");
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
}
}
document.getElementById(`sigil${sigilCounter}`).classList.add("show");
}
-setInterval(frame, 5);
+
setInterval(sigil, 100);
setInterval(update, 500);
+setInterval(frame, 5);
</script>
</body>
{% 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() {