summaryrefslogtreecommitdiff
path: root/app/load.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-10-10 20:51:39 +0200
committerMinteck <contact@minteck.org>2022-10-10 20:51:39 +0200
commit108525534c28013cfe1897c30e4565f9893f3766 (patch)
treedd3e5132971f96ab5f05e7f3f8f6dbbf379a19bd /app/load.js
parent2162eaa06f7e4764eb3dcfe130ec2c711d0c62ab (diff)
downloadpluralconnect-108525534c28013cfe1897c30e4565f9893f3766.tar.gz
pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.tar.bz2
pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.zip
Update
Diffstat (limited to 'app/load.js')
-rw-r--r--app/load.js105
1 files changed, 57 insertions, 48 deletions
diff --git a/app/load.js b/app/load.js
index 1be0b57..97b030a 100644
--- a/app/load.js
+++ b/app/load.js
@@ -17,32 +17,32 @@ window.connected = false;
let valuesToGet = {
"pluralkit-cloudburst-members": {
- url: "/api/data?f=ynmuc-members.json",
+ url: "/api/data?f=ynmuc/members.json",
limited: false,
name: "Members at Cloudburst...",
},
"pluralkit-cloudburst-fronters": {
- url: "/api/data?f=ynmuc-fronters.json",
+ url: "/api/data?f=ynmuc/fronters.json",
limited: false,
name: "Fronters at Cloudburst...",
},
"pluralkit-cloudburst-switches": {
- url: "/api/data?f=ynmuc-switches.json",
+ url: "/api/data?f=ynmuc/switches.json",
limited: false,
name: "Switches at Cloudburst...",
},
"pluralkit-raindrops-members": {
- url: "/api/data?f=gdapd-members.json",
+ url: "/api/data?f=gdapd/members.json",
limited: false,
name: "Members at Raindrops...",
},
"pluralkit-raindrops-fronters": {
- url: "/api/data?f=gdapd-fronters.json",
+ url: "/api/data?f=gdapd/fronters.json",
limited: false,
name: "Fronters at Raindrops...",
},
"pluralkit-raindrops-switches": {
- url: "/api/data?f=gdapd-switches.json",
+ url: "/api/data?f=gdapd/switches.json",
limited: false,
name: "Switches at Raindrops...",
},
@@ -243,55 +243,64 @@ async function postLoad() {
try {
let member = window.currentFronter;
await (await window.fetch("/bits/Application/SetCurrentIdentity/index.php?Name=" + btoa(member['display_name'] ?? member['name']).replaceAll("+", "-").replaceAll("/", "_") + "&Picture=" + btoa(member['avatar_url'] ?? "./assets/default.png").replaceAll("+", "-").replaceAll("/", "_"))).text();
- } catch (e) {}
+ } catch (e) {
+ try {
+ await (await window.fetch("/bits/Application/SetCurrentIdentity/index.php?Name=" + btoa(window.data['pluralkit-' + window.data['identity'].id + '-members'].filter(i => i.name === "unknown")[0]['display_name']).replaceAll("+", "-").replaceAll("/", "_") + "&Picture=" + btoa(window.data['pluralkit-' + window.data['identity'].id + '-members'].filter(i => i.name === "unknown")[0]['avatar_url']).replaceAll("+", "-").replaceAll("/", "_"))).text();
+ } catch (e) {}
+ }
- document.getElementById("home-name").innerText = getMiniName(window.currentFronter['display_name'] ?? window.currentFronter['name']);
- document.getElementById("home-avatar").src = window.data['image-me'];
-
- switch (new Date().getHours()) {
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- document.getElementById("home-greeting").innerText = "Good night";
- break;
-
- case 6:
- case 7:
- case 8:
- case 9:
- case 10:
- case 11:
- document.getElementById("home-greeting").innerText = "Good morning";
- break;
-
- case 12:
- case 13:
- case 14:
- case 15:
- case 16:
- case 17:
- document.getElementById("home-greeting").innerText = "Good afternoon";
- break;
-
- case 18:
- case 19:
- case 20:
- case 21:
- case 22:
- case 23:
- document.getElementById("home-greeting").innerText = "Good evening";
- break;
+ try {
+ document.getElementById("home-name").innerText = getMiniName(window.currentFronter['display_name'] ?? window.currentFronter['name']);
+ document.getElementById("home-avatar").src = window.data['image-me'];
+
+ switch (new Date().getHours()) {
+ case 0:
+ case 1:
+ case 2:
+ case 3:
+ case 4:
+ case 5:
+ document.getElementById("home-greeting").innerText = "Good night";
+ break;
+
+ case 6:
+ case 7:
+ case 8:
+ case 9:
+ case 10:
+ case 11:
+ document.getElementById("home-greeting").innerText = "Good morning";
+ break;
+
+ case 12:
+ case 13:
+ case 14:
+ case 15:
+ case 16:
+ case 17:
+ document.getElementById("home-greeting").innerText = "Good afternoon";
+ break;
+
+ case 18:
+ case 19:
+ case 20:
+ case 21:
+ case 22:
+ case 23:
+ document.getElementById("home-greeting").innerText = "Good evening";
+ break;
+ }
+ } catch (e) {
+ document.getElementById("home-front").style.display = "none";
}
window.otherSystem = window.data.identity.id === "raindrops" ? "cloudburst" : "raindrops";
window.otherFronters = window.data["pluralkit-" + otherSystem + "-fronters"];
document.getElementById("home-other-system").innerText = otherSystem === "raindrops" ? "Raindrops System" : "Cloudburst System";
- document.getElementById("home-other-name").innerText = window.otherFronters.members[0].display_name ?? window.otherFronters.members[0].name;
- document.getElementById("home-other-img").src = window.images.profile[otherSystem === "raindrops" ? "gdapd" : "ynmuc"][window.otherFronters.members[0].id];
+ if (window.otherFronters.members[0]) document.getElementById("home-other-name").innerText = window.otherFronters.members[0].display_name ?? window.otherFronters.members[0].name;
+ if (window.otherFronters.members[0]) document.getElementById("home-other-img").src = window.images.profile[otherSystem === "raindrops" ? "gdapd" : "ynmuc"][window.otherFronters.members[0].id];
+ if (!window.otherFronters.members[0]) document.getElementById("home-other").style.display = "none";
if (!window.connected) {
document.getElementById("home-app-planner").classList.add("disabled");