padding: 0;
border-color: var(--dark);
}
-img {
+#img {
position: fixed;
width: 100vw;
left: 0;
top: calc(95vh - 2em);
-
+ transition: top 2s;
+}
+#img.sold {
+ top: 101vh;
}
#buy {
position: fixed;
line-height: 2em;
border: none;
background-color: transparent;
+ transition: bottom 2s;
+}
+#buy.sold {
+ bottom: -3em;
}
.white {
color: rgba(0,0,0,0);
}
+.sigil {
+ position: fixed;
+ height: 90vh;
+ top: 50vh;
+ left: 50vw;
+ transform: translate(-50%, -50%);
+ opacity: 0;
+}
+.sigil.fade {
+ transition: opacity 5s;
+}
+.sigil.show {
+ opacity: 1;
+}
+
</style>
<script src="https://extension-files.twitch.tv/helper/v1/twitch-ext.min.js"></script>
<script src="./pricing.js"></script>
<hr>
- <h3 class="black">Now Only: <span id="price"></span></h3>
+ <h3 class="black">Now Only: <span id="price"><em>Loading...</em></span></h3>
</div>
<div>
- <img src="https://shopping.ozva.co.uk/static/assets/fringe.svg"></img>
- <input type="button" onclick="buy();" id="buy" value="Buy Now!"></input>
+ <img class="sold" id="img" src="https://shopping.ozva.co.uk/static/assets/fringe.svg"></img>
+ <input class="sold" type="button" id="buy" value="Click to Buy!"></input>
</div>
<img class="sigil" id="1" src="https://shopping.ozva.co.uk/static/assets/sigil1.svg">
<img class="sigil" id="2" src="https://shopping.ozva.co.uk/static/assets/sigil2.svg">
let pastId = 0;
function update() {
-
// setup and hide the main element & the image element
const main = document.getElementById("main");
const price = document.getElementById("price");
+ const button = document.getElementById("buy");
+ const img = document.getElementById("img");
+
+ button.onclick = function(){buy()};
fetch("https://shopping.ozva.co.uk/api/items", {cache: "default"})
.then(data => data.json())
// change the data if the id is different
if (id != pastId) {
main.classList.add("hide");
+ button.classList.remove("sold");
+ img.classList.remove("sold");
const items = dataStatic.items;
const item = items[id];
setInterval(update, 5000);
function buy() {
- fetch("http://127.0.0.1:8000/api/buy")
+ const sigil1 = document.getElementById("1");
+ const sigil2 = document.getElementById("2");
+ const sigil3 = document.getElementById("3");
+ const sigil4 = document.getElementById("4");
+ const sigil5 = document.getElementById("5");
+
+ const speed = 100;
+
+ fetch("https://shopping.ozva.co.uk/api/buy")
+
+ document.getElementById("buy").classList.add("sold");
+ document.getElementById("img").classList.add("sold");
+ sigil5.classList.remove("fade")
+ sigil1.classList.add("show")
+ setTimeout(function () {
+ sigil1.classList.remove("show")
+ sigil2.classList.add("show")
+
+ setTimeout(function () {
+ sigil2.classList.remove("show")
+ sigil3.classList.add("show")
+
+ setTimeout(function () {
+ sigil3.classList.remove("show")
+ sigil4.classList.add("show")
+
+ setTimeout(function () {
+ sigil4.classList.remove("show")
+ sigil5.classList.add("show")
+
+ setTimeout(function () {
+ sigil5.classList.add("fade")
+ sigil5.classList.remove("show")
+
+ }, 4*speed);
+ }, speed);
+ }, speed);
+ }, speed);
+ }, speed);
}