diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/banner.js | 97 | ||||
-rw-r--r-- | app/build.js | 15 | ||||
-rw-r--r-- | app/demo/index.php | 3 | ||||
-rwxr-xr-x | app/fronters/dl.js | 2 | ||||
-rw-r--r-- | app/fronters/index.html | 6 | ||||
-rw-r--r-- | app/fronters/ponies/qbzxm.png | bin | 23979 -> 27713 bytes | |||
-rw-r--r-- | app/fronters/profiles/erefx.png | bin | 826530 -> 826530 bytes | |||
-rw-r--r-- | app/fronters/profiles/erknz.png | bin | 56915 -> 56915 bytes | |||
-rw-r--r-- | app/fronters/profiles/gevde.png | bin | 100880 -> 100880 bytes | |||
-rw-r--r-- | app/fronters/profiles/gfhsr.png | bin | 1642044 -> 1642044 bytes | |||
-rw-r--r-- | app/fronters/profiles/ghuln.png | bin | 370233 -> 370233 bytes | |||
-rw-r--r-- | app/fronters/profiles/hpwyq.png | bin | 2770 -> 2770 bytes | |||
-rw-r--r-- | app/fronters/profiles/jnbae.png | bin | 60223 -> 60223 bytes | |||
-rw-r--r-- | app/fronters/profiles/khsbb.png | bin | 249236 -> 249236 bytes | |||
-rw-r--r-- | app/fronters/profiles/kkhbw.png | bin | 40300 -> 40300 bytes | |||
-rw-r--r-- | app/fronters/profiles/kzfjn.png | bin | 0 -> 825561 bytes | |||
-rw-r--r-- | app/fronters/profiles/lllfw.png | bin | 973226 -> 745786 bytes | |||
-rw-r--r-- | app/fronters/profiles/lzlaq.png | bin | 0 -> 26543 bytes | |||
-rw-r--r-- | app/fronters/profiles/mglyq.png | bin | 91476 -> 91476 bytes | |||
-rw-r--r-- | app/fronters/profiles/mhnqy.png | bin | 27452 -> 27452 bytes | |||
-rw-r--r-- | app/fronters/profiles/pabmo.png | bin | 124750 -> 124750 bytes | |||
-rw-r--r-- | app/fronters/profiles/qbzxm.png | bin | 71995 -> 2843 bytes | |||
-rw-r--r-- | app/fronters/profiles/qraku.png | bin | 45898 -> 45898 bytes | |||
-rw-r--r-- | app/fronters/profiles/rdstg.png | bin | 16881 -> 16881 bytes | |||
-rw-r--r-- | app/fronters/profiles/rirgf.png | bin | 825561 -> 825561 bytes | |||
-rw-r--r-- | app/fronters/profiles/rpjok.png | bin | 1542918 -> 1542918 bytes | |||
-rw-r--r-- | app/fronters/profiles/sehke.png | bin | 1947 -> 1947 bytes | |||
-rw-r--r-- | app/fronters/profiles/tfbob.png | bin | 14049 -> 14049 bytes | |||
-rw-r--r-- | app/fronters/profiles/tmgiu.png | bin | 260760 -> 260760 bytes | |||
-rw-r--r-- | app/fronters/profiles/vncoa.png | bin | 46475 -> 46475 bytes | |||
-rw-r--r-- | app/fronters/profiles/vvsxf.png | bin | 61010 -> 61010 bytes | |||
-rw-r--r-- | app/fronters/profiles/xbvwt.png | bin | 70342 -> 70342 bytes | |||
-rw-r--r-- | app/fronters/profiles/xcjhj.png | bin | 107053 -> 107053 bytes | |||
-rw-r--r-- | app/fronters/profiles/zajrk.png | bin | 2097 -> 2097 bytes | |||
-rw-r--r-- | app/fronters/profiles/zdtsg.png | bin | 2817 -> 3046 bytes | |||
-rw-r--r-- | app/fronters/profiles/zhtzs.png | bin | 673763 -> 673763 bytes | |||
-rw-r--r-- | app/fronters/profiles/ztfjz.png | bin | 184686 -> 184686 bytes | |||
-rw-r--r-- | app/fronters/profiles/zzise.png | bin | 69145 -> 69145 bytes | |||
-rwxr-xr-x | app/fronters/script.js | 12 | ||||
-rw-r--r-- | app/index.html | 16 | ||||
-rw-r--r-- | app/load.js | 105 | ||||
-rw-r--r-- | app/sw.js | 47 | ||||
-rwxr-xr-x | app/update.sh | 7 |
43 files changed, 239 insertions, 71 deletions
diff --git a/app/banner.js b/app/banner.js index 6daa2b7..8dd42a4 100644 --- a/app/banner.js +++ b/app/banner.js @@ -1,4 +1,5 @@ // noinspection JSUnresolvedVariable +window.bannerFrench = false; function timeAgo(time) { if (!isNaN(parseInt(time))) { @@ -6,6 +7,11 @@ function timeAgo(time) { } let periods = ["second", "minute", "hour", "day", "week", "month", "year", "age"]; + + if (bannerFrench) { + periods = ["seconde", "minute", "heure", "jour", "semaine", "mois", "an", "des année"]; + } + let lengths = ["60", "60", "24", "7", "4.35", "12", "100"]; let now = new Date().getTime(); @@ -14,12 +20,22 @@ function timeAgo(time) { let tense; let period; - if (difference <= 10 && difference >= 0) { - return tense = "now"; - } else if (difference > 0) { - tense = "ago"; + if (bannerFrench) { + if (difference <= 10 && difference >= 0) { + return "à l'instant"; + } else if (difference > 0) { + tense = "il y a"; + } else { + tense = "dans"; + } } else { - tense = "later"; + if (difference <= 10 && difference >= 0) { + return "now"; + } else if (difference > 0) { + tense = "ago"; + } else { + tense = "later"; + } } let j; @@ -31,11 +47,19 @@ function timeAgo(time) { difference = Math.round(difference); period = periods[j] + (difference > 1 ? "s" : ''); - return `${difference} ${period} ${tense}`; + + if (bannerFrench) { + return `${tense} ${difference} ${period}`; + } else { + return `${difference} ${period} ${tense}`; + } } -async function refreshBanner(offline) { +async function refreshBanner(offline, french) { if (!offline) offline = false; + if (!french) french = false; + + window.bannerFrench = french; let data = window.currentMemberData; let index; @@ -84,12 +108,16 @@ async function refreshBanner(offline) { <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;"> - <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']}" alt="" style="background-color:rgba(255, 255, 255, .125);width:128px;height:128px;border-radius:5px;"> + <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['name']} + ${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']} </h3> <div style="margin-bottom:0.5rem;"> @@ -97,65 +125,80 @@ async function refreshBanner(offline) { ${data['badges'].length === 0 ? " " : ""} </div> - <div style="display:grid;grid-template-columns: repeat(${data['median'] ? 4 : 5}, 1fr);" id="member-card"> + <div style="display:grid;grid-template-columns: repeat(${data['median'] || data['id'] === "unknown" ? 4 : data['id'] === "fusion" ? 3 : 5}, 1fr);" id="member-card"> <span> - <b>Prefix${data['prefixes'].length > 1 ? 'es' : ''}: </b> + <b>${french ? `Préfixe${data['prefixes'].length > 1 ? 's' : ''} ` : `Prefix${data['prefixes'].length > 1 ? 'es' : ''}`}: </b> <code style="color: white;">${data['prefixes'].join('</code>, <code style="color: white;">')}</code> </span> <span> - <b>Pronouns: </b> - ${data['pronouns']} + <b>${french ? "Pronoms :" : "Pronouns:"} </b> + ${data['id'] === "fusion" ? "she/her" : data['pronouns']} </span> - ${!data['median'] ? ` + ${!data['median'] && data['id'] !== "unknown" ? ` <span> - <b>Last fronted: </b> + ${data["id"] === "fusion" ? ` + <b>Fronting since : </b> ${data['last_fronted'] ? ` ${data['last_fronted']['now'] ? ` - Right now<br> - (started <span class="relative-time" data-relative-timestamp="${data['last_fronted']['timestamp']}">${data['last_fronted']['relative']}</span>) + <span class="relative-time" data-relative-timestamp="${data['last_fronted']['timestamp']}">${data['last_fronted']['relative']}</span><br> + ` : ` + <span class="text-muted">Not fronting</span><br> + `} + ` : `<span class="text-muted">Not fronting</span><br> `}` : ` + <b>${french ? "Front :" : "Last fronted:"} </b> + ${data['last_fronted'] ? ` + ${data['last_fronted']['now'] ? ` + ${french ? "En ce moment" : "Right now"}<br> + (${french ? "commencé" : "started"} <span class="relative-time" data-relative-timestamp="${data['last_fronted']['timestamp']}">${data['last_fronted']['relative']}</span>) ` : ` <span class="relative-time" data-relative-timestamp="${data['last_fronted']['timestamp']}">${data['last_fronted']['relative']}</span><br> - (for ${data['last_fronted']['duration']['pretty']}) + (${french ? "pendant" : "for"} ${data['last_fronted']['duration']['pretty']}) `} - ` : "A long time ago<br> "} + ` : `${french ? "Il y a très longtemps" : "A long time ago"}<br> `}`} </span> ` : ''} + ${data['id'] !== "fusion" ? ` <span> - <span style="vertical-align: middle;position:relative;top:-5px;"><b>Species: </b></span> + ${data['id'] === "unknown" ? "<b>Species: </b> best to ask" : ` + <span style="vertical-align: middle;position:relative;top:-5px;"><b>${french ? (data['species'].length > 1 ? "Espèces : " : "Espèce : ") : "Species: "}</b></span> ${data['species'].map(species => ` <img data-bs-toggle="tooltip" title="${species['name']}" style="width:32px;vertical-align: middle;position:relative;top:-5px;" src="${offline ? species['icon_offline'] : `/assets/species/${species['icon']}`}" alt="${species['name']}"> - `).join("")} - </span> + `).join("")}`} + </span>` : ''} + ${data['id'] !== "fusion" ? ` <span> - <b>System: </b> + <b>${french ? "Système : " : "System: "}</b> <a class="member-link" href="${data['system']['page']}"><img style="width:24px;border-radius:5px;" src="${offline ? data['system']['icon_offline'] : `/assets/uploads/${data['system']['icon']}`}"> ${data['system']['name']}</a> ${data['system']['subsystem'] ? ` - <br><b>Subsystem: </b><a class="member-link" href="${data['system']['subsystem']['page']}"><img style="width:24px;border-radius:5px;" src="/assets/uploads/${data['system']['subsystem']['icon']}"> ${data['system']['subsystem']['name']}</a> + <br><b>${french ? "Sous-système : " : "Subsystem: "} </b><a class="member-link" href="${data['system']['subsystem']['page']}"><img style="width:24px;border-radius:5px;" src="/assets/uploads/${data['system']['subsystem']['icon']}"> ${data['system']['subsystem']['name']}</a> ` : data['system']['temporary'] ? '<br>(temporary)' : ''} </span> + ` : ''} </div> + ${data['id'] !== "unknown" && data['id'] !== "fusion" ? ` <div style="display:grid;grid-template-columns: repeat(${data["little"] ? "3" : "2"}, 1fr);margin-top:5px;"> <span> - <b>Marefriend${data['relations']['sisters'].length > 1 ? 's' : ''}: </b>${data['relations']['marefriends'].length > 1 ? '<span class="list-separator-mobile"><br></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 => ` <a class="member-link" href="${relation['link']}"><img src="${offline ? relation['icon_offline'] : `/assets/uploads/${relation['icon']}`}" style="width:24px;"> ${relation['name']}</a>`).join(`<span class="list-separator-desktop">, </span><span class="list-separator-mobile"><br></span>`)} ${data['relations']['marefriends'].length === 0 ? '-' : ''} </span> <span> - <b>Sister${data['relations']['sisters'].length > 1 ? 's' : ''}: </b>${data['relations']['sisters'].length > 1 ? '<span class="list-separator-mobile"><br></span>' : ''} + <b>${french ? (data['relations']['sisters'].length > 1 ? 'Sœurs ' : 'Sœur ') : `Sister${data['relations']['sisters'].length > 1 ? 's' : ''}`}: </b>${data['relations']['sisters'].length > 1 ? '<span class="list-separator-mobile"><br></span>' : ''} ${data['relations']['sisters'].map(relation => ` <a class="member-link" href="${relation['link']}"><img src="${offline ? relation['icon_offline'] : `/assets/uploads/${relation['icon']}`}" style="width:24px;"> ${relation['name']}</a>`).join(`<span class="list-separator-desktop">, </span><span class="list-separator-mobile"><br></span>`)} ${data['relations']['sisters'].length === 0 ? '-' : ''} </span> ${data['little'] ? ` <span> - <b>Caretaker${data['relations']['sisters'].length > 1 ? 's' : ''}: </b>${data['relations']['caretakers'].length > 1 ? '<span class="list-separator-mobile"><br></span>' : ''} + <b>${french ? (data['relations']['sisters'].length > 1 ? 'Caretakers ' : 'Caretaker ') : `Caretakers${data['relations']['caretakers'].length > 1 ? 's' : ''}`}: </b>${data['relations']['caretakers'].length > 1 ? '<span class="list-separator-mobile"><br></span>' : ''} ${data['relations']['caretakers'].map(relation => ` <a class="member-link" href="${relation['link']}"><img src="${offline ? relation['icon_offline'] : `/assets/uploads/${relation['icon']}`}" style="width:24px;"> ${relation['name']}</a>`).join(`<span class="list-separator-desktop">, </span><span class="list-separator-mobile"><br></span>`)} ${data['relations']['caretakers'].length === 0 ? '-' : ''} </span> ` : ''} </div> + ` : '<div style="margin-top:5px;"> </div>'} </div> </div> diff --git a/app/build.js b/app/build.js index f31e572..9d9b8fc 100644 --- a/app/build.js +++ b/app/build.js @@ -2,7 +2,12 @@ const fs = require('fs'); let original = fs.readFileSync("./sw.src.js").toString(); let fileList = [ - "/app/" + "/app/", + "/-/demo", + "https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css", + "https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js", + "/assets/logo/logo.png", + "/assets/icons/right.svg" ]; function files(dir, sdir) { for (let file of fs.readdirSync(dir)) { @@ -20,7 +25,13 @@ function files(dir, sdir) { files(".", "/app"); console.log(JSON.stringify(fileList, null, 2)); +let fileList1 = fileList; -original = original.replace('[["%CacheData%"]]', JSON.stringify(fileList, null, 4)); +fileList = []; +files("../assets/uploads", "/assets/uploads"); +console.log(JSON.stringify(fileList, null, 2)); +let fileList2 = fileList; + +original = original.replace('[["%CacheData%"]]', JSON.stringify([...fileList1, ...fileList2], null, 4)); fs.writeFileSync("./sw.js", fs.readFileSync("./localforage.js") + "\n\n" + original);
\ No newline at end of file diff --git a/app/demo/index.php b/app/demo/index.php new file mode 100644 index 0000000..154f099 --- /dev/null +++ b/app/demo/index.php @@ -0,0 +1,3 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/demo.php";
\ No newline at end of file diff --git a/app/fronters/dl.js b/app/fronters/dl.js index 61f7e31..7e04a0b 100755 --- a/app/fronters/dl.js +++ b/app/fronters/dl.js @@ -6,7 +6,7 @@ for (let system of ["gdapd", "ynmuc"]) { let data = JSON.parse(fs.readFileSync("data.json").toString()); for (let member of data) { - cp.execSync("convert " + member['avatar_url'] + " ./profiles/" + member['id'] + ".png"); + if (member['avatar_url']) cp.execSync("convert " + member['avatar_url'] + " ./profiles/" + member['id'] + ".png"); } fs.unlinkSync("data.json"); diff --git a/app/fronters/index.html b/app/fronters/index.html index ede5911..7a032c1 100644 --- a/app/fronters/index.html +++ b/app/fronters/index.html @@ -10,7 +10,7 @@ system: "gdapd", name: "raindrops", samples: { - qbzxm: "m. hi i'm here again", + qbzxm: "l. hi i'm here again", zajrk: "t. I kinda want to switch out now hehe, I'm really really tired", rirgf: "Good morning sweetie!", lllfw: "z. Okay she is done, sorry for the wait. We can talk now!", @@ -202,7 +202,7 @@ </ul> <div class="btn-group"> - <a type="button" href="#" id="final-precise-link1" target="_blank" class="btn btn-primary">Open Cuties and Plurality page</a> + <a type="button" href="#" id="final-precise-link1" target="_blank" class="btn btn-primary">Open Cold Haze page</a> <a type="button" href="#" id="final-precise-link2" target="_blank" class="btn btn-primary">View on PluralKit</a> </div> </div> @@ -219,7 +219,7 @@ <div class="btn-group"> <div class="btn-group"> - <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown">Open Cuties and Plurality page</button> + <button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown">Open Cold Haze page</button> <div class="dropdown-menu"> <a class="dropdown-item" href="" id="final-blur-m1-link1">Member 1</a> <a class="dropdown-item" href="" id="final-blur-m2-link1">Member 2</a> diff --git a/app/fronters/ponies/qbzxm.png b/app/fronters/ponies/qbzxm.png Binary files differindex 65626ad..36ba1ad 100644 --- a/app/fronters/ponies/qbzxm.png +++ b/app/fronters/ponies/qbzxm.png diff --git a/app/fronters/profiles/erefx.png b/app/fronters/profiles/erefx.png Binary files differindex cdabb97..a65c876 100644 --- a/app/fronters/profiles/erefx.png +++ b/app/fronters/profiles/erefx.png diff --git a/app/fronters/profiles/erknz.png b/app/fronters/profiles/erknz.png Binary files differindex 146538a..856533e 100644 --- a/app/fronters/profiles/erknz.png +++ b/app/fronters/profiles/erknz.png diff --git a/app/fronters/profiles/gevde.png b/app/fronters/profiles/gevde.png Binary files differindex 70dadf4..414a13d 100644 --- a/app/fronters/profiles/gevde.png +++ b/app/fronters/profiles/gevde.png diff --git a/app/fronters/profiles/gfhsr.png b/app/fronters/profiles/gfhsr.png Binary files differindex 3ecc7a2..6ea3317 100644 --- a/app/fronters/profiles/gfhsr.png +++ b/app/fronters/profiles/gfhsr.png diff --git a/app/fronters/profiles/ghuln.png b/app/fronters/profiles/ghuln.png Binary files differindex 1bad991..cfec882 100644 --- a/app/fronters/profiles/ghuln.png +++ b/app/fronters/profiles/ghuln.png diff --git a/app/fronters/profiles/hpwyq.png b/app/fronters/profiles/hpwyq.png Binary files differindex 2e65f91..47be11f 100644 --- a/app/fronters/profiles/hpwyq.png +++ b/app/fronters/profiles/hpwyq.png diff --git a/app/fronters/profiles/jnbae.png b/app/fronters/profiles/jnbae.png Binary files differindex 30e35f5..c2a0f15 100644 --- a/app/fronters/profiles/jnbae.png +++ b/app/fronters/profiles/jnbae.png diff --git a/app/fronters/profiles/khsbb.png b/app/fronters/profiles/khsbb.png Binary files differindex f7eba93..baefbe4 100644 --- a/app/fronters/profiles/khsbb.png +++ b/app/fronters/profiles/khsbb.png diff --git a/app/fronters/profiles/kkhbw.png b/app/fronters/profiles/kkhbw.png Binary files differindex 9206f02..140f080 100644 --- a/app/fronters/profiles/kkhbw.png +++ b/app/fronters/profiles/kkhbw.png diff --git a/app/fronters/profiles/kzfjn.png b/app/fronters/profiles/kzfjn.png Binary files differnew file mode 100644 index 0000000..cc5efbd --- /dev/null +++ b/app/fronters/profiles/kzfjn.png diff --git a/app/fronters/profiles/lllfw.png b/app/fronters/profiles/lllfw.png Binary files differindex 785bdf5..aabc5c1 100644 --- a/app/fronters/profiles/lllfw.png +++ b/app/fronters/profiles/lllfw.png diff --git a/app/fronters/profiles/lzlaq.png b/app/fronters/profiles/lzlaq.png Binary files differnew file mode 100644 index 0000000..c3c02d6 --- /dev/null +++ b/app/fronters/profiles/lzlaq.png diff --git a/app/fronters/profiles/mglyq.png b/app/fronters/profiles/mglyq.png Binary files differindex 1210099..91bce03 100644 --- a/app/fronters/profiles/mglyq.png +++ b/app/fronters/profiles/mglyq.png diff --git a/app/fronters/profiles/mhnqy.png b/app/fronters/profiles/mhnqy.png Binary files differindex 5eb0186..9d69ef8 100644 --- a/app/fronters/profiles/mhnqy.png +++ b/app/fronters/profiles/mhnqy.png diff --git a/app/fronters/profiles/pabmo.png b/app/fronters/profiles/pabmo.png Binary files differindex 5480a79..9ffe1b6 100644 --- a/app/fronters/profiles/pabmo.png +++ b/app/fronters/profiles/pabmo.png diff --git a/app/fronters/profiles/qbzxm.png b/app/fronters/profiles/qbzxm.png Binary files differindex b7957e2..c48dcfa 100644 --- a/app/fronters/profiles/qbzxm.png +++ b/app/fronters/profiles/qbzxm.png diff --git a/app/fronters/profiles/qraku.png b/app/fronters/profiles/qraku.png Binary files differindex cc0970b..37873ca 100644 --- a/app/fronters/profiles/qraku.png +++ b/app/fronters/profiles/qraku.png diff --git a/app/fronters/profiles/rdstg.png b/app/fronters/profiles/rdstg.png Binary files differindex 6809b58..6525f2f 100644 --- a/app/fronters/profiles/rdstg.png +++ b/app/fronters/profiles/rdstg.png diff --git a/app/fronters/profiles/rirgf.png b/app/fronters/profiles/rirgf.png Binary files differindex 628d2b7..2f31b54 100644 --- a/app/fronters/profiles/rirgf.png +++ b/app/fronters/profiles/rirgf.png diff --git a/app/fronters/profiles/rpjok.png b/app/fronters/profiles/rpjok.png Binary files differindex dec775c..87c9092 100644 --- a/app/fronters/profiles/rpjok.png +++ b/app/fronters/profiles/rpjok.png diff --git a/app/fronters/profiles/sehke.png b/app/fronters/profiles/sehke.png Binary files differindex eb08b61..ef80383 100644 --- a/app/fronters/profiles/sehke.png +++ b/app/fronters/profiles/sehke.png diff --git a/app/fronters/profiles/tfbob.png b/app/fronters/profiles/tfbob.png Binary files differindex 830c5d0..eb27d16 100644 --- a/app/fronters/profiles/tfbob.png +++ b/app/fronters/profiles/tfbob.png diff --git a/app/fronters/profiles/tmgiu.png b/app/fronters/profiles/tmgiu.png Binary files differindex 9e97e4d..f81b22d 100644 --- a/app/fronters/profiles/tmgiu.png +++ b/app/fronters/profiles/tmgiu.png diff --git a/app/fronters/profiles/vncoa.png b/app/fronters/profiles/vncoa.png Binary files differindex 540f667..3dd8fc3 100644 --- a/app/fronters/profiles/vncoa.png +++ b/app/fronters/profiles/vncoa.png diff --git a/app/fronters/profiles/vvsxf.png b/app/fronters/profiles/vvsxf.png Binary files differindex 21803e3..f762204 100644 --- a/app/fronters/profiles/vvsxf.png +++ b/app/fronters/profiles/vvsxf.png diff --git a/app/fronters/profiles/xbvwt.png b/app/fronters/profiles/xbvwt.png Binary files differindex 301e82b..763bb2c 100644 --- a/app/fronters/profiles/xbvwt.png +++ b/app/fronters/profiles/xbvwt.png diff --git a/app/fronters/profiles/xcjhj.png b/app/fronters/profiles/xcjhj.png Binary files differindex 91e810e..56eaee9 100644 --- a/app/fronters/profiles/xcjhj.png +++ b/app/fronters/profiles/xcjhj.png diff --git a/app/fronters/profiles/zajrk.png b/app/fronters/profiles/zajrk.png Binary files differindex 0fdf503..aa1c3a9 100644 --- a/app/fronters/profiles/zajrk.png +++ b/app/fronters/profiles/zajrk.png diff --git a/app/fronters/profiles/zdtsg.png b/app/fronters/profiles/zdtsg.png Binary files differindex 026cdaf..7872104 100644 --- a/app/fronters/profiles/zdtsg.png +++ b/app/fronters/profiles/zdtsg.png diff --git a/app/fronters/profiles/zhtzs.png b/app/fronters/profiles/zhtzs.png Binary files differindex 31c52ad..ec6aa1e 100644 --- a/app/fronters/profiles/zhtzs.png +++ b/app/fronters/profiles/zhtzs.png diff --git a/app/fronters/profiles/ztfjz.png b/app/fronters/profiles/ztfjz.png Binary files differindex d650fd0..eb39fdc 100644 --- a/app/fronters/profiles/ztfjz.png +++ b/app/fronters/profiles/ztfjz.png diff --git a/app/fronters/profiles/zzise.png b/app/fronters/profiles/zzise.png Binary files differindex 516a795..8334450 100644 --- a/app/fronters/profiles/zzise.png +++ b/app/fronters/profiles/zzise.png diff --git a/app/fronters/script.js b/app/fronters/script.js index d76b702..b85dbd8 100755 --- a/app/fronters/script.js +++ b/app/fronters/script.js @@ -86,14 +86,14 @@ function loadApp() { document.getElementById("selector-profiles").innerHTML += "<li><a href='#" + slot + "' onclick='localStorage.setItem(`default-slot`, slot);location.reload();'>" + slotData["name"] + "</a></li>"; } - window.members = JSON.parse(localStorage.getItem("pluralkit-" + configSlot)).filter(i => i.name !== "unknown" && i.name !== "smolscoots" && i.name !== "smoltwi").sort(() => Math.random() - 0.5); + window.members = JSON.parse(localStorage.getItem("pluralkit-" + configSlot)).filter(i => i.name !== "unknown" && i.name !== "fusion" && i.name !== "smolscoots" && i.name !== "smoltwi").sort(() => Math.random() - 0.5); document.getElementById("loader").innerHTML = "Starting application..."; let dc; let dcName; // Step 1 - window.members = JSON.parse(localStorage.getItem("pluralkit-" + configSlot)).filter(i => i.name !== "unknown" && i.name !== "smolscoots" && i.name !== "smoltwi").sort(() => Math.random() - 0.5); + window.members = JSON.parse(localStorage.getItem("pluralkit-" + configSlot)).filter(i => i.name !== "unknown" && i.name !== "fusion" && i.name !== "smolscoots" && i.name !== "smoltwi").sort(() => Math.random() - 0.5); dc = document.getElementById("s1-default-card"); dcName = document.getElementById("s1-default-card-name"); @@ -120,7 +120,7 @@ function loadApp() { } // Step 2 - window.members = JSON.parse(localStorage.getItem("pluralkit-" + configSlot)).filter(i => i.name !== "unknown" && i.name !== "smolscoots" && i.name !== "smoltwi").sort(() => Math.random() - 0.5); + window.members = JSON.parse(localStorage.getItem("pluralkit-" + configSlot)).filter(i => i.name !== "unknown" && i.name !== "fusion" && i.name !== "smolscoots" && i.name !== "smoltwi").sort(() => Math.random() - 0.5); dc = document.getElementById("s2-default-card"); dcName = document.getElementById("s2-default-card-name"); @@ -147,7 +147,7 @@ function loadApp() { } // Step 3 - window.members = JSON.parse(localStorage.getItem("pluralkit-" + configSlot)).filter(i => i.name !== "unknown" && i.name !== "smolscoots" && i.name !== "smoltwi").sort(() => Math.random() - 0.5); + window.members = JSON.parse(localStorage.getItem("pluralkit-" + configSlot)).filter(i => i.name !== "unknown" && i.name !== "fusion" && i.name !== "smolscoots" && i.name !== "smoltwi").sort(() => Math.random() - 0.5); dc = document.getElementById("s3-default-card"); dcName = document.getElementById("s3-default-card-img"); @@ -174,7 +174,7 @@ function loadApp() { } // Step 4 - window.members = JSON.parse(localStorage.getItem("pluralkit-" + configSlot)).filter(i => i.name !== "unknown" && i.name !== "smolscoots" && i.name !== "smoltwi").sort(() => Math.random() - 0.5); + window.members = JSON.parse(localStorage.getItem("pluralkit-" + configSlot)).filter(i => i.name !== "unknown" && i.name !== "fusion" && i.name !== "smolscoots" && i.name !== "smoltwi").sort(() => Math.random() - 0.5); dc = document.getElementById("s4-default-card"); dcName = document.getElementById("s4-default-card-img"); @@ -201,7 +201,7 @@ function loadApp() { } // Step 5 - window.members = JSON.parse(localStorage.getItem("pluralkit-" + configSlot)).filter(i => i.name !== "unknown" && i.name !== "smolscoots" && i.name !== "smoltwi").sort(() => Math.random() - 0.5); + window.members = JSON.parse(localStorage.getItem("pluralkit-" + configSlot)).filter(i => i.name !== "unknown" && i.name !== "fusion" && i.name !== "smolscoots" && i.name !== "smoltwi").sort(() => Math.random() - 0.5); dc = document.getElementById("s5-default-card"); dcName = document.getElementById("s5-default-card-name"); diff --git a/app/index.html b/app/index.html index 03006d6..decc6b7 100644 --- a/app/index.html +++ b/app/index.html @@ -234,8 +234,11 @@ </head> <body style="background:black;"> <div id="loader" style="position:fixed;z-index:999;background:#111;inset:0;display:flex;align-items:center;justify-content: center;"> - <div id="progress"> - <div id="progress-inner" style="width:0;"></div> + <div> + <div id="progress"> + <div id="progress-inner" style="width:0;"></div> + </div> + <p id="loader-message" style="text-align: center;margin-top:5px;">Loading...</p> </div> </div> @@ -268,9 +271,14 @@ <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 id="member-banner"></div> + </div> </div> @@ -316,7 +324,7 @@ } } - if ('serviceWorker' in navigator) { + if ('serviceWorker' in navigator && location.search !== "?nocache") { console.log("Creating service worker..."); navigator.serviceWorker.register('/app/sw.js').then(function() { return navigator.serviceWorker.ready diff --git a/app/load.js b/app/load.js index 9efff3c..9e4d3b9 100644 --- a/app/load.js +++ b/app/load.js @@ -18,73 +18,119 @@ window.connected = false; let valuesToGet = { "pluralkit-cloudburst-members": { url: "/api/data?f=ynmuc-members.json", - limited: false + limited: false, + name: "Members at Cloudburst...", }, "pluralkit-cloudburst-fronters": { url: "/api/data?f=ynmuc-fronters.json", - limited: false + limited: false, + name: "Fronters at Cloudburst...", }, "pluralkit-cloudburst-switches": { url: "/api/data?f=ynmuc-switches.json", - limited: false + limited: false, + name: "Switches at Cloudburst...", }, "pluralkit-raindrops-members": { url: "/api/data?f=gdapd-members.json", - limited: false + limited: false, + name: "Members at Raindrops...", }, "pluralkit-raindrops-fronters": { url: "/api/data?f=gdapd-fronters.json", - limited: false + limited: false, + name: "Fronters at Raindrops...", }, "pluralkit-raindrops-switches": { url: "/api/data?f=gdapd-switches.json", - limited: false + limited: false, + name: "Switches at Raindrops...", }, "peh-cloudburst-data": { url: "/api/cloudburst-data", - limited: false + limited: false, + name: "Cloudburst data...", }, "peh-raindrops-data": { url: "/api/raindrops-data", - limited: false + limited: false, + name: "Raindrops data...", }, "peh-cloudburst-banners": { url: "/api/cloudburst-banners", - limited: false + limited: false, + name: "Cloudburst banner data...", }, "peh-raindrops-banners": { url: "/api/raindrops-banners", - limited: false + limited: false, + name: "Raindrops banner data...", }, "identity": { url: "/api/me", - limited: false + limited: false, + name: "Identity...", }, "images": { url: "/api/app-images", - limited: false + limited: false, + name: "Images...", + condition: async () => { + let known = await localforage.getItem("images-refresh"); + let currentKnown; + + try { + currentKnown = btoa(Object.keys(JSON.parse(await localforage.getItem("peh-cloudburst-data")).members).join("") + Object.keys(JSON.parse(await localforage.getItem("peh-raindrops-data")).members).join("") + new Date().toDateString()); + } catch (e) { + return true; + } + + localforage.setItem("images-refresh", currentKnown); + + if (known) { + return known !== currentKnown; + } else { + return true; + } + } }, "image-me": { url: "/api/me-picture", - limited: false + limited: false, + name: "Identity avatar...", }, "bits-transactions": { url: "/bits/Application/TransactionsList/index.php", - limited: false + limited: false, + name: "Bits transactions...", }, "bits-goal": { url: "/bits/Application/GetGoal/index.php", - limited: false + limited: false, + name: "Bits goal...", }, "bits-username": { url: "/bits/Authentication/Username/index.php", - limited: false + limited: false, + name: "Bits user info...", } } let keys = Object.keys(valuesToGet); let index = 2; +window.onerror = (event, source, lineno, colno, error) => { + console.log(event, source, lineno, colno, error); + document.getElementById("loader-message").classList.add("text-danger"); + document.getElementById("loader-message").innerText = "An error occurred."; +} + +window.onunhandledrejection = (handler, event) => { + console.log(handler, event); + document.getElementById("loader-message").classList.add("text-danger"); + document.getElementById("loader-message").innerText = "An error occurred."; +} + async function getNewValue() { if (!keys[0]) { await postLoad(); @@ -92,6 +138,9 @@ async function getNewValue() { } try { + if (valuesToGet[keys[0]].condition && !(await valuesToGet[keys[0]].condition())) throw new Error(); + + 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(); @@ -198,21 +247,23 @@ async function postLoad() { document.getElementById("home-app-emergency").classList.add("disabled"); } - if (window.serviceWorkerRegistration.sync) { - window.serviceWorkerRegistration.sync.register('data-sync') - .catch(function(err) { - return err; - }) - .then(() => { - console.log("Scheduled background sync for the next time connection is available"); - }) - } else { - console.log("Background sync not possible on this platform"); + if (window.serviceWorkerRegistration) { + if (window.serviceWorkerRegistration.sync) { + window.serviceWorkerRegistration.sync.register('data-sync') + .catch(function(err) { + return err; + }) + .then(() => { + console.log("Scheduled background sync for the next time connection is available"); + }) + } else { + console.log("Background sync not possible on this platform"); + } } 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(); + //await refreshBanner(true); refreshTooltips(); setInterval(async () => { Array.from(document.getElementsByClassName("relative-time")).forEach((el) => { @@ -11,7 +11,13 @@ let cacheName = 'peh-pluralponies-pwa'; let filesToCache = [ "/app/", + "/-/demo", + "https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css", + "https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js", + "/assets/logo/logo.png", + "/assets/icons/right.svg", "/app/apps.js", + "/app/banner.js", "/app/bits/assets/black.css", "/app/bits/assets/chart.js", "/app/bits/assets/create.js", @@ -87,7 +93,9 @@ let filesToCache = [ "/app/fronters/profiles/jnbae.png", "/app/fronters/profiles/khsbb.png", "/app/fronters/profiles/kkhbw.png", + "/app/fronters/profiles/kzfjn.png", "/app/fronters/profiles/lllfw.png", + "/app/fronters/profiles/lzlaq.png", "/app/fronters/profiles/mglyq.png", "/app/fronters/profiles/mhnqy.png", "/app/fronters/profiles/nabky.png", @@ -130,7 +138,44 @@ let filesToCache = [ "/app/logo/logo.svg", "/app/logo/maskable.png", "/app/manifest.json", - "/app/sw.js" + "/app/sw.js", + "/app/tooltip.js", + "/app/update.sh", + "/assets/uploads/cloudburst.png", + "/assets/uploads/logo.jpg", + "/assets/uploads/pt-babs.png", + "/assets/uploads/pt-blueberrycloud.png", + "/assets/uploads/pt-cloudy.png", + "/assets/uploads/pt-duskrainbow.png", + "/assets/uploads/pt-fluttershy.png", + "/assets/uploads/pt-frost.png", + "/assets/uploads/pt-fusion.png", + "/assets/uploads/pt-izzymoonbow.png", + "/assets/uploads/pt-lavender.png", + "/assets/uploads/pt-lyra.png", + "/assets/uploads/pt-mintygrape.png", + "/assets/uploads/pt-mistycloud.png", + "/assets/uploads/pt-mossystorm.png", + "/assets/uploads/pt-pipppetals.png", + "/assets/uploads/pt-plushie.png", + "/assets/uploads/pt-poseybloom.png", + "/assets/uploads/pt-scootaloo.png", + "/assets/uploads/pt-skydream.png", + "/assets/uploads/pt-smolscoots.png", + "/assets/uploads/pt-smoltwi.png", + "/assets/uploads/pt-starrynight.png", + "/assets/uploads/pt-stuffie.png", + "/assets/uploads/pt-sunnystarscout.png", + "/assets/uploads/pt-sweetiebelle.png", + "/assets/uploads/pt-sweetiebot.png", + "/assets/uploads/pt-twilight.png", + "/assets/uploads/pt-velvet.png", + "/assets/uploads/pt-violet.png", + "/assets/uploads/pt-windyleaves.png", + "/assets/uploads/pt-zipp.png", + "/assets/uploads/pt.png", + "/assets/uploads/raindrops.png", + "/assets/uploads/ss-sparkles.png" ]; self.addEventListener('install', function(e) { diff --git a/app/update.sh b/app/update.sh new file mode 100755 index 0000000..731e32a --- /dev/null +++ b/app/update.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +cd fronters +node dl.js + +cd .. +node build.js
\ No newline at end of file |