diff --git a/src/pages/js/panel.js b/src/pages/js/panel.js index 49b7999..f4de824 100644 --- a/src/pages/js/panel.js +++ b/src/pages/js/panel.js @@ -16,8 +16,9 @@ if (getItem("usd")) { setInterval(function() { balance += 1; document.getElementById("bal").innerHTML = balance; + document.getElementById("usd").innerHTML = usd; localStorage.setItem("bal", balance); -}, 1000); +}, 500); function reset() { localStorage.setItem("usd", 0); @@ -26,8 +27,8 @@ function reset() { } function convert() { - usd = balance - balance = 0 + usd += Math.floor(balance / 3); + balance = 0; document.getElementById("usd").innerHTML = usd; document.getElementById("bal").innerHTML = balance; localStorage.setItem("usd", usd); diff --git a/src/pages/js/store.js b/src/pages/js/store.js new file mode 100644 index 0000000..9ed9b20 --- /dev/null +++ b/src/pages/js/store.js @@ -0,0 +1,20 @@ +var usd = getItem("usd") + +setTimeout(() => { + if (usd > 19) { + document.getElementById("amount").innerHTML = "We have these items in stock:" + document.getElementById("vukkybutton").style.display = "" + } else { + document.getElementById("amount").innerHTML = "We don't have anything in stock! Come back later." + } +}, 1000); + +function buy(name, price) { + alert("That feature isn't available right now.") +} + +function getItem(name) { + var value = localStorage.getItem(name); + if (value != null && !isNaN(Number(value))) return Number(value); + else return value; +} \ No newline at end of file diff --git a/src/pages/panel.html b/src/pages/panel.html index 6b00ef6..a3fa361 100644 --- a/src/pages/panel.html +++ b/src/pages/panel.html @@ -9,8 +9,8 @@