diff options
author | RaindropsSys <raindrops@equestria.dev> | 2024-03-30 23:40:33 +0100 |
---|---|---|
committer | RaindropsSys <raindrops@equestria.dev> | 2024-03-30 23:40:33 +0100 |
commit | 6b796258d413f00e498ce7f80f73a9f6c061f29c (patch) | |
tree | 49e64a5dd4cde2acff7f0a93ed3f8e20e1cb2dc8 /assets/logo/banner.js | |
parent | 5860551daa0f60103ad24e93da29f401a653f144 (diff) | |
download | pluralconnect-6b796258d413f00e498ce7f80f73a9f6c061f29c.tar.gz pluralconnect-6b796258d413f00e498ce7f80f73a9f6c061f29c.tar.bz2 pluralconnect-6b796258d413f00e498ce7f80f73a9f6c061f29c.zip |
Updated 5 files, added 2 files, deleted 495 files and renamed 7 files (automated)
Diffstat (limited to 'assets/logo/banner.js')
-rw-r--r-- | assets/logo/banner.js | 174 |
1 files changed, 0 insertions, 174 deletions
diff --git a/assets/logo/banner.js b/assets/logo/banner.js deleted file mode 100644 index d092c62..0000000 --- a/assets/logo/banner.js +++ /dev/null @@ -1,174 +0,0 @@ -// noinspection JSUnresolvedVariable -window.bannerFrench = false; - -function timeAgo(time) { - if (!isNaN(parseInt(time))) { - time = new Date(time).getTime(); - } - - let periods = ["sec", "min", "hr", "d", "wk", "mo", "y", "ages"]; - - let lengths = ["60", "60", "24", "7", "4.35", "12", "100"]; - - let now = new Date().getTime(); - - let difference = Math.round((now - time) / 1000); - let tense; - let period; - - if (difference <= 10 && difference >= 0) { - return "now"; - } else if (difference > 0) { - tense = "ago"; - } else { - tense = "later"; - } - - let j; - - for (j = 0; difference >= lengths[j] && j < lengths.length - 1; j++) { - difference /= lengths[j]; - } - - difference = Math.round(difference); - - period = periods[j]; - - return `${difference} ${period} ${tense}`; -} - -async function refreshBanner(_, french) { - offline = false; - if (!french) french = false; - - window.bannerFrench = french; - - let data = window.currentMemberData; - let index; - - if (data['last_fronted'] && data['last_fronted']['timestamp']) { - data['last_fronted']['relative'] = timeAgo(currentMemberData.last_fronted.timestamp * 1000); - } - - let active = 0; - if (data['relations']['marefriends'] && data['relations']['marefriends'].length > 0) active++; - if (data['relations']['caretakers'] && data['relations']['caretakers'].length > 0) active++; - if (data['relations']['sexfriends'] && data['relations']['sexfriends'].length > 0) active++; - if (data['relations']['sisters'] && data['relations']['sisters'].length > 0) active++; - if (data['relations']['friends'] && data['relations']['friends'].length > 0) active++; - - document.getElementById("member-banner").innerHTML = ` - -<div id="system-info" style="background:#${data['color']}55;border-radius:10px;display:grid;grid-template-columns: 128px 1fr; margin-left:-20px;margin-right: -20px;margin-top: -20px; padding: 0 10px;"> - <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 id="mobile-left" style="padding:10px 10px 10px 20px;text-align:center;"> - <h3 style="margin-bottom:0;"> - <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">${french ? "Membre inconnu" : "Unknown member"} (${data['system']['name']})</span> - ` : data['id'] === "fusion" ? (data['name'] === "fusion" ? ` - <span class="text-muted">${french ? "Plusieurs membres fusionnés" : "Multiple merged members"}</span> - ` : data['name']) : data['name']} - </span><span id="mobile-species" style="float: right; display: none;"> - ${data['species'].filter(i => i && i['name'] !== "_").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> - </h3> - - <div style="margin-bottom:0.5rem;"> - ${data['badges'].map(i => i.html).join(" ")} - ${data['badges'].length === 0 ? " " : ""} - </div> - - <div style="display:grid;grid-template-columns: repeat(${data['median'] || data['id'] === "unknown" ? (french || data['gender'] === null ? 3 : 4) : data['id'] === "fusion" ? (french || data['gender'] === null ? 2 : 3) : (french || data['gender'] === null ? 4 : 5)}, 1fr);" id="member-card"> - ${french ? "" : `<span> - ${data['id'] === "fusion" ? "she/her" : data['pronouns']}${data['age'] !== "-" ? '<br>' + data['age'] : ''} - </span>`} - <span> - <b>${french ? `Préfixe${data['prefixes'].length > 1 ? 's' : ''} ` : `Prefix${data['prefixes'].length > 1 ? 'es' : ''}`}: </b><span class="member-small-separator"><br></span> - ${data['prefixes'].length > 0 && data['prefixes'][0] !== null ? `<code style="color: white;">${data['prefixes'].join('</code>, <code style="color: white;">')}</code>` : `-`} - </span> - ${!data['median'] && data['id'] !== "unknown" ? ` - <span> - ${data["id"] === "fusion" ? ` - <b>${french ? "Fronte depuis " : "Fronting since"}: </b><span class="member-small-separator"><br></span> - ${data['last_fronted'] ? ` - ${data['last_fronted']['now'] ? ` - <span class="relative-time" data-relative-timestamp="${data['last_fronted']['timestamp']}">${data['last_fronted']['relative']}</span><br> - ` : ` - <span class="text-muted">${french ? "Pas au front" : "Not fronting"}</span><br> - `} - ` : `<span class="text-muted">${french ? "Pas au front" : "Not fronting"}</span><br> `}` : ` - <b>${french ? "Front :" : "Last fronted:"} </b><span class="member-small-separator"><br></span> - ${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> - (${french ? "pendant" : "for"} ${data['last_fronted']['duration']['pretty']}) - `} - ` : `${french ? "Jamais" : "Never"}<br> `}`} - </span> - ` : ''} - ${data['id'] !== "fusion" && data['gender'] !== null ? ` - <span> - ${data['id'] === "unknown" ? (french ? "<b>Genre : </b><span class=\"member-small-separator\"><br></span> préférez demander" : "<b>Gender: </b><span class=\"member-small-separator\"><br></span> best to ask") : ` - <span><b>${french ? "Genre :" : "Gender:"} </b><span class="member-small-separator"><br></span></span> - ${data['gender']}`} - </span>` : ''} - ${data['id'] !== "fusion" ? ` - <span> - <span class="member-small-only"><b>${french ? "Position :" : "Location:"} </b></span> - ${data['system']['page'] ? `<a class="member-link" href="${data['system']['page']}"><img style="width:24px;" src="${offline ? data['system']['icon_offline'] : `${data['system']['icon']}`}"> ${data['system']['name']}</a>` : `<img style="width:24px;" src="${offline ? data['system']['icon_offline'] : `${data['system']['icon']}`}"> ${data['system']['name']}`}<span class="member-small-separator"><br> - ${data['species'].filter(i => i && i['name'] !== "_").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> - </span> - ` : ''} - </div> - ${data['id'] !== "unknown" && data['id'] !== "fusion" ? ` - <div style="display:grid;grid-template-columns: repeat(${active}, 1fr);margin-top:5px;" id="member-relations"> - ${data['relations']['sexfriends'] && data['relations']['sexfriends'].length > 0 ? `<span> - <b>${french ? (data['relations']['sexfriends'].length > 1 ? 'Rel. sexuelles ' : 'Rel. sexuelle ') : `Sexfriend${data['relations']['sexfriends'].length > 1 ? 's' : ''}`}: </b>${data['relations']['sexfriends'].length > 1 ? '<span class="list-separator-mobile"><br></span>' : ''} - ${data['relations']['sexfriends'].map(relation => ` - <a title="${relation['name']}" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="${relation['link']}"><img src="${offline ? relation['icon_offline'] : `${relation['icon']}`}" style="width:24px;"></a>`).join(``)} - ${data['relations']['sexfriends'].length === 0 ? '-' : ''} - </span>` : ``} - ${data['relations']['marefriends'] && data['relations']['marefriends'].length > 0 ? `<span> - <b>${french ? (data['relations']['marefriends'].length > 1 ? 'Copines ' : 'Copine ') : `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 title="${relation['name']}" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="${relation['link']}"><img src="${offline ? relation['icon_offline'] : `${relation['icon']}`}" style="width:24px;"></a>`).join(``)} - ${data['relations']['marefriends'].length === 0 ? '-' : ''} - </span>` : ``} - ${data['relations']['sisters'] && data['relations']['sisters'].length > 0 ? `<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 title="${relation['name']}" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="${relation['link']}"><img src="${offline ? relation['icon_offline'] : `${relation['icon']}`}" style="width:24px;"></a>`).join(``)} - ${data['relations']['sisters'].length === 0 ? '-' : ''} - </span>` : ``} - ${data['relations']['caretakers'] && data['relations']['caretakers'].length > 0 ? ` - <span> - <b>${french ? (data['relations']['caretakers'].length > 1 ? 'Gardiens ' : 'Gardien ') : `Caretaker${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 title="${relation['name']}" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="${relation['link']}"><img src="${offline ? relation['icon_offline'] : `${relation['icon']}`}" style="width:24px;"></a>`).join(``)} - ${data['relations']['caretakers'].length === 0 ? '-' : ''} - </span> - ` : ''} - ${data['relations']['friends'] && data['relations']['friends'].length > 0 ? `<span> - <b>${french ? (data['relations']['friends'].length > 1 ? 'Amies ' : 'Amie ') : `Friend${data['relations']['friends'].length > 1 ? 's' : ''}`}: </b>${data['relations']['sisters'].length > 1 ? '<span class="list-separator-mobile"><br></span>' : ''} - ${data['relations']['friends'].map(relation => ` - <a title="${relation['name']}" data-bs-toggle="tooltip" class="member-link tooltip-nohelp" href="${relation['link']}"><img src="${offline ? relation['icon_offline'] : `${relation['icon']}`}" style="width:24px;"></a>`).join(``)} - ${data['relations']['friends'].length === 0 ? '-' : ''} - </span>` : ``} - </div> - ` : '<div style="margin-top:5px;"> </div>'} - </div> -</div> - -`; -}
\ No newline at end of file |