summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraltaf-creator <dev@altafcreator.com>2025-12-03 18:48:15 +0700
committeraltaf-creator <dev@altafcreator.com>2025-12-03 18:48:15 +0700
commit277296fb8e8e09ac843a8762d5dfa510bdedbeb0 (patch)
treec4a075163469d85e00a91d8337e02e2e04151ef4
parentfe4b2504760e0225cb581ed631a68d175e04e6f3 (diff)
rearrange
-rw-r--r--frontend/start.js66
1 files changed, 33 insertions, 33 deletions
diff --git a/frontend/start.js b/frontend/start.js
index d1ab247..098ff4b 100644
--- a/frontend/start.js
+++ b/frontend/start.js
@@ -1,3 +1,36 @@
+(async () => {
+ const timers = await fetchTimers();
+
+ console.log("timers: (start.js) " + timers);
+
+ const existingPanel = document.getElementById("existing-laundry-panel");
+ const existingText = document.getElementById("existing-laundry-text");
+
+ if (Array.isArray(timers[1]) && timers[1].length > 0) {
+ existingPanel.style.display = 'inherit';
+ if (timers.length == 1) {
+ existingText.innerText = "You currently have another ongoing laundry. You are creating a new timer.";
+ } else {
+ existingText.innerText = "You currently have other ongoing laundries. You are creating a new timer.";
+ }
+ }
+
+ const info = await information(data.machine_id);
+
+ const machine = await info["machine"];
+
+ console.log(`machine is ${machine}`);
+
+ const divs = [
+ document.getElementById("dryer1"),
+ document.getElementById("washer1"),
+ document.getElementById("dryer2"),
+ document.getElementById("washer2"),
+ ]
+
+ divs[machine - 1].classList.add("machine-selected");
+})();
+
const notif = document.getElementById("notif-panel");
const notbtn = document.getElementById("notbtn");
const startbtn = document.getElementById("startbtn");
@@ -35,36 +68,3 @@ async function requestPermission() {
startbtn.disabled = false;
}
}
-
-(async () => {
- const timers = await fetchTimers();
-
- console.log("timers: (start.js) " + timers);
-
- const existingPanel = document.getElementById("existing-laundry-panel");
- const existingText = document.getElementById("existing-laundry-text");
-
- if (Array.isArray(timers[1]) && timers[1].length > 0) {
- existingPanel.style.display = 'inherit';
- if (timers.length == 1) {
- existingText.innerText = "You currently have another ongoing laundry. You are creating a new timer.";
- } else {
- existingText.innerText = "You currently have other ongoing laundries. You are creating a new timer.";
- }
- }
-
- const info = await information(data.machine_id);
-
- const machine = await info["machine"];
-
- console.log(`machine is ${machine}`);
-
- const divs = [
- document.getElementById("dryer1"),
- document.getElementById("washer1"),
- document.getElementById("dryer2"),
- document.getElementById("washer2"),
- ]
-
- divs[machine - 1].classList.add("machine-selected");
-})();