diff options
author | Minteck <contact@minteck.org> | 2022-08-31 22:03:07 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-08-31 22:03:07 +0200 |
commit | b5f589c323f415bb42ea7069cb4d1a8a2233dd69 (patch) | |
tree | c3b80234ab7f463a2e7b8b672ceff57422b3496b /app | |
parent | 09bd0164ebc020a54b944b7326dcba496fb5d82c (diff) | |
download | pluralconnect-b5f589c323f415bb42ea7069cb4d1a8a2233dd69.tar.gz pluralconnect-b5f589c323f415bb42ea7069cb4d1a8a2233dd69.tar.bz2 pluralconnect-b5f589c323f415bb42ea7069cb4d1a8a2233dd69.zip |
Update I guess - Stuffie
Diffstat (limited to 'app')
-rw-r--r-- | app/banner.js | 17 | ||||
-rw-r--r-- | app/emergency/index.php | 2 | ||||
-rw-r--r-- | app/fronters/style.css | 4 | ||||
-rw-r--r-- | app/index.html | 107 | ||||
-rw-r--r-- | app/load.js | 58 | ||||
-rw-r--r-- | app/planner/index.php | 2 |
6 files changed, 139 insertions, 51 deletions
diff --git a/app/banner.js b/app/banner.js index 8dd42a4..81991e9 100644 --- a/app/banner.js +++ b/app/banner.js @@ -107,17 +107,20 @@ async function refreshBanner(offline, french) { document.getElementById("member-banner").innerHTML = ` <div id="system-info" style="border:1px solid #${data['color']};background:rgba(255, 255, 255, .1);border-radius:10px;display:grid;grid-template-columns: 128px 1fr;"> - <div style="margin:10px;width:100%;display:flex;align-items: center;justify-content: center;"> + <div style="margin:10px;width:100%;display:flex;align-items: center;justify-content: center;" id="member-icon-outer"> <img id="member-icon" src="${offline ? JSON.parse(await localforage.getItem("images")).profile[data['icon']['offline'].split(".")[0].split("-")[1]][data['icon']['offline'].split(".")[0].split("-")[2]] : (data['icon']['online'] ?? (data['id'] === "fusion" ? '/assets/logo/logo.png' : data['system']['icon']))}" alt="" style="background-color:rgba(255, 255, 255, .125);width:128px;height:128px;border-radius:5px;"> </div> <div style="padding:10px 10px 10px 20px;text-align:center;"> <h3 style="margin-bottom:0;"> - ${data['id'] === "unknown" ? ` - <span class="text-muted">Unknown member (${data['system']['name']} System)</span> - ` : data['id'] === "fusion" ? (data['name'] === "fusion" ? ` - <span class="text-muted">Multiple merged members</span> - ` : data['name']) : data['name']} + <img id="member-icon-mobile" src="${offline ? JSON.parse(await localforage.getItem("images")).profile[data['icon']['offline'].split(".")[0].split("-")[1]][data['icon']['offline'].split(".")[0].split("-")[2]] : (data['icon']['online'] ?? (data['id'] === "fusion" ? '/assets/logo/logo.png' : data['system']['icon']))}" alt="" style="background-color:rgba(255, 255, 255, .125);width:36px;height:36px;border-radius:999px;display:none;margin-right:5px;"> + <span style="vertical-align: middle;"> + ${data['id'] === "unknown" ? ` + <span class="text-muted">Unknown member (${data['system']['name']} System)</span> + ` : data['id'] === "fusion" ? (data['name'] === "fusion" ? ` + <span class="text-muted">Multiple merged members</span> + ` : data['name']) : data['name']} + </span> </h3> <div style="margin-bottom:0.5rem;"> @@ -176,7 +179,7 @@ async function refreshBanner(offline, french) { ` : ''} </div> ${data['id'] !== "unknown" && data['id'] !== "fusion" ? ` - <div style="display:grid;grid-template-columns: repeat(${data["little"] ? "3" : "2"}, 1fr);margin-top:5px;"> + <div style="display:grid;grid-template-columns: repeat(${data["little"] ? "3" : "2"}, 1fr);margin-top:5px;" id="member-relations"> <span> <b>${french ? (data['relations']['marefriends'].length > 1 ? 'Partenaires ' : 'Partenaire ') : `Marefriend${data['relations']['marefriends'].length > 1 ? 's' : ''}`}: </b>${data['relations']['marefriends'].length > 1 ? '<span class="list-separator-mobile"><br></span>' : ''} ${data['relations']['marefriends'].map(relation => ` diff --git a/app/emergency/index.php b/app/emergency/index.php index 395f0d9..d8cfedf 100644 --- a/app/emergency/index.php +++ b/app/emergency/index.php @@ -1,4 +1,4 @@ -<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; if (!$isLoggedIn) header("Location: /login") and die(); ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; if (!$isLoggedIn) header("Location: /-/login") and die(); ?> <!DOCTYPE html> <html lang="en"> diff --git a/app/fronters/style.css b/app/fronters/style.css index 135500a..cc3a8cb 100644 --- a/app/fronters/style.css +++ b/app/fronters/style.css @@ -8,10 +8,6 @@ grid-template-columns: repeat(6, 1fr) !important; } -@media (max-width: 1399px) { - -} - @media (max-width: 1199px) { .wiaf-grid { grid-template-columns: repeat(4, 1fr) !important; diff --git a/app/index.html b/app/index.html index decc6b7..22ee9a9 100644 --- a/app/index.html +++ b/app/index.html @@ -201,6 +201,29 @@ } } + .list-group-item { + color: #fff; + background-color: #222; + border: 1px solid rgba(255, 255, 255, .125); + } + + .list-group-item.disabled { + color: #fff; + background-color: #222; + border-color: rgba(255, 255, 255, .125); + opacity: .75; + } + + .list-group-item-action:hover { + background-color: #252525; + color: #ddd; + } + + .list-group-item-action:active, .list-group-item-action:focus { + background-color: #272727; + color: #bbb; + } + #member-banner a { color: white; } @@ -220,6 +243,23 @@ grid-template-columns: 1fr !important; text-align: left; } + + #member-icon-mobile { + display: inline-block !important; + } + + #system-info { + grid-template-columns: 1fr !important; + } + + #member-icon, #member-icon-outer { + display: none !important; + } + + #member-relations { + grid-template-columns: 1fr !important; + text-align: left; + } } .tooltip.show { @@ -230,6 +270,10 @@ background: #151515; box-shadow: 3px 4px 10px #ffffff26; } + + html, body, #app { + height: 100%; + } </style> </head> <body style="background:black;"> @@ -242,43 +286,38 @@ </div> </div> - <div id="app"> - <div class="header" style="background-color:#111;border-bottom:1px solid #252525;"> - <div class="container"> - <br><br> - <h2 style="text-align: center;"><img id="home-avatar" alt="" src="" style="width: 48px;height: 48px;border-radius: 999px;vertical-align: middle;"> <span style="vertical-align: middle;"><span id="home-greeting">Greetings</span> <span id="home-name">Name</span>!</span></h2> - - <br> - <div id="home-apps"> - <a class="home-item" id="home-app-fronters" onclick="openApps.fronters();"> - <img alt="" class="home-item-icon" src="icons/fronters.svg"> - <span class="home-item-name">Fronters</span> - </a> - <a class="home-item" id="home-app-bits" onclick="openApps.bits();"> - <img alt="" class="home-item-icon" src="icons/bits.svg"> - <span class="home-item-name">Bits</span> - </a> - <a class="home-item" id="home-app-planner" onclick="openApps.planner();"> - <img alt="" class="home-item-icon" src="icons/planner.svg"> - <span class="home-item-name">Planner</span> - </a> - <a class="home-item" id="home-app-emergency" onclick="openApps.emergency();"> - <img alt="" class="home-item-icon" src="icons/emergency.svg"> - <span class="home-item-name">Emergency</span> - </a> + <div id="app" style="display:grid;grid-template-rows: 1fr max-content;"> + <div class="header" style="height:100%;background-color:#111;border-bottom:1px solid #252525;display:flex;align-items: center;justify-content: center;"> + <div style="width:100%;"> + <div class="container"> + <br><br> + <h2 style="text-align: center;"><img id="home-avatar" alt="" src="" style="width: 48px;height: 48px;border-radius: 999px;vertical-align: middle;"> <span style="vertical-align: middle;"><span id="home-greeting">Greetings</span> <span id="home-name">Name</span>!</span></h2> + + <br> + <div id="home-apps"> + <a class="home-item" id="home-app-fronters" onclick="openApps.fronters();"> + <img alt="" class="home-item-icon" src="icons/fronters.svg"> + <span class="home-item-name">Fronters</span> + </a> + <a class="home-item" id="home-app-bits" onclick="openApps.bits();"> + <img alt="" class="home-item-icon" src="icons/bits.svg"> + <span class="home-item-name">Bits</span> + </a> + <a class="home-item" id="home-app-planner" onclick="openApps.planner();"> + <img alt="" class="home-item-icon" src="icons/planner.svg"> + <span class="home-item-name">Planner</span> + </a> + <a class="home-item" id="home-app-emergency" onclick="openApps.emergency();"> + <img alt="" class="home-item-icon" src="icons/emergency.svg"> + <span class="home-item-name">Emergency</span> + </a> + </div> </div> + <p style="text-align: center;margin-top:15px;"><b style="vertical-align: middle;">In the <span id="home-other-system">other system</span>:</b> <img id="home-other-img" alt="" src="" style="vertical-align:middle;width:24px;height:24px;border-radius:999px;background:#333;"> <span id="home-other-name" style="vertical-align: middle;">Some member</span></p> </div> - <br><br> </div> - - <p style="text-align: center;"> - <br> - <a href="#" onclick='document.body.innerHTML = `<iframe src="/app/demo/index.php" style="position: fixed;inset: 0;height: 100%;width: 100%;">`;'>Demo mode (for Raindrops' therapist)</a> - </p> - - <div class="container"> - <br> - + <div> + <p style="margin-top:15px;text-align: center;" class="text-muted">© <span id="copyright-year"></span> Equestria.dev Developers · Data updated <span id="update-date"></span></p> </div> </div> diff --git a/app/load.js b/app/load.js index 9e4d3b9..1be0b57 100644 --- a/app/load.js +++ b/app/load.js @@ -46,6 +46,21 @@ let valuesToGet = { limited: false, name: "Switches at Raindrops...", }, + "actions": { + url: "/api/data?f=actions.json", + limited: false, + name: "Actions...", + }, + "rules": { + url: "/api/data?f=rules.json", + limited: false, + name: "Systems rules...", + }, + "nicknames": { + url: "/api/data?f=nicknames.json", + limited: false, + name: "Relations nicknames...", + }, "peh-cloudburst-data": { url: "/api/cloudburst-data", limited: false, @@ -56,6 +71,16 @@ let valuesToGet = { limited: false, name: "Raindrops data...", }, + "peh-cloudburst-scored": { + url: "/api/cloudburst-scored", + limited: false, + name: "Cloudburst ordered members...", + }, + "peh-raindrops-scored": { + url: "/api/raindrops-scored", + limited: false, + name: "Raindrops ordered members...", + }, "peh-cloudburst-banners": { url: "/api/cloudburst-banners", limited: false, @@ -138,13 +163,27 @@ async function getNewValue() { } try { - if (valuesToGet[keys[0]].condition && !(await valuesToGet[keys[0]].condition())) throw new Error(); + if (valuesToGet[keys[0]].condition && !(await valuesToGet[keys[0]].condition())) { + keys.shift(); + + if (!keys[0]) { + await localforage.setItem("refresh", new Date().toISOString()); + await postLoad(); + return; + } + + document.getElementById("progress-inner").style.width = ((index / Object.keys(valuesToGet).length) * 100) + "%"; + index++; + await getNewValue(); + return; + } document.getElementById("loader-message").innerText = valuesToGet[keys[0]].name; await localforage.setItem(keys[0], (await (await fetchPlus(valuesToGet[keys[0]]["url"], { timeout: 3000 })).text())); keys.shift(); if (!keys[0]) { + await localforage.setItem("refresh", new Date().toISOString()); await postLoad(); return; } @@ -155,6 +194,9 @@ async function getNewValue() { await getNewValue(); }, valuesToGet[keys[0]]["limited"] ? 550 : 0); } catch (e) { + console.log("Error while fetching", keys[0]); + console.error(e); + for (let key of Object.keys(valuesToGet)) { if (await localforage.getItem(key) === null) { throw new Error("App requested key '" + key + "' but it can't be retrieved at the moment"); @@ -181,6 +223,8 @@ async function postLoad() { if (key !== "images") localStorage.setItem(key, await localforage.getItem(key)) } + window.images = JSON.parse(await localforage.getItem("images")); + localStorage.setItem("pluralkit-0", localStorage.getItem("pluralkit-raindrops-members")); localStorage.setItem("pluralkit-1", localStorage.getItem("pluralkit-cloudburst-members")); @@ -242,6 +286,13 @@ async function postLoad() { break; } + 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.connected) { document.getElementById("home-app-planner").classList.add("disabled"); document.getElementById("home-app-emergency").classList.add("disabled"); @@ -261,9 +312,8 @@ async function postLoad() { } } - window.currentMemberData = JSON.parse(localStorage.getItem("peh-" + JSON.parse(localStorage.getItem("identity")).id + "-banners"))[JSON.parse(localStorage.getItem("pluralkit-" + JSON.parse(localStorage.getItem("identity")).id + "-fronters")).members[0].name]; - - //await refreshBanner(true); refreshTooltips(); + document.getElementById("copyright-year").innerText = new Date().getFullYear().toString(); + document.getElementById("update-date").innerText = timeAgo(await localforage.getItem("refresh")); setInterval(async () => { Array.from(document.getElementsByClassName("relative-time")).forEach((el) => { diff --git a/app/planner/index.php b/app/planner/index.php index 30f09dd..b2070da 100644 --- a/app/planner/index.php +++ b/app/planner/index.php @@ -1,4 +1,4 @@ -<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; if (!$isLoggedIn) header("Location: /login") and die(); ?> +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; if (!$isLoggedIn) header("Location: /-/login") and die(); ?> <!DOCTYPE html> <html lang="en"> |