</style>
<script src="https://extension-files.twitch.tv/helper/v1/twitch-ext.min.js"></script>
+ <script src="./product.js"></script>
</head>
- <body onload="setInterval(update, 20000);">
+ <body>
<img id="image" src="https://shopping.ozva.co.uk/api/img/0"></img>
<div id="nameContainer" class="hide">
<div id="nameBadgeContainer">
<h1 id="name" style="top: 0">Product Name!</h1>
</div>
</div>
-
- <script>
-
-let pastId = 0;
-
-function update() {
-
- // setup and hide the name element & the image element
- const name = document.getElementById("nameContainer");
- const image = document.getElementById("image");
- name.classList.add("hide")
-
- 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;
- const items = dataStatic.items
- const item = items[id];
-
- // hide the image if the item has changed
- if (id != pastId) { image.classList.add("hide"); }
-
- // change the image if the item has changed as soon as ftb
- if (id != pastId) {
- setTimeout(function () {
- image.src = `https://shopping.ozva.co.uk/api/img/${id}`;
- }, 3000);
- }
-
-
- // regester the function to update the name and show the badge
- setTimeout(function () {
- document.getElementById("name").innerHTML = item.subtext;
-
- pastId = id;
-
- image.classList.remove("hide");
- name.classList.remove("hide");
- }, 10000);
- });
- });
-}
-
- </script>
</body>
</html>
--- /dev/null
+let pastId = 0;
+
+function update() {
+
+ // setup and hide the name element & the image element
+ const name = document.getElementById("nameContainer");
+ const image = document.getElementById("image");
+ name.classList.add("hide")
+
+ 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;
+ const items = dataStatic.items
+ const item = items[id];
+
+ // hide the image if the item has changed
+ if (id != pastId) { image.classList.add("hide"); }
+
+ // change the image if the item has changed as soon as ftb
+ if (id != pastId) {
+ setTimeout(function () {
+ image.src = `https://shopping.ozva.co.uk/api/img/${id}`;
+ }, 3000);
+ }
+
+
+ // regester the function to update the name and show the badge
+ setTimeout(function () {
+ document.getElementById("name").innerHTML = item.subtext;
+
+ pastId = id;
+
+ image.classList.remove("hide");
+ name.classList.remove("hide");
+ }, 10000);
+ });
+ });
+}
+
+setInterval(update, 20000);
from math import radians, cos, sin
from markupsafe import escape
from ast import literal_eval
+from flask_cors import CORS
import sqlite3
import json
INCREMENT = 18
app = Flask(__name__)
+CORS(app)
+
auth = HTTPBasicAuth()
try:
app.root_path = environ["SHOPPING_PATH"]