From 089d94ff3a34ef022015bf28db0427497acc67ea Mon Sep 17 00:00:00 2001 From: Minteck Date: Sat, 28 Jan 2023 20:31:04 +0100 Subject: Updated 7 files and renamed 2 files (automated) --- assets/logo/banner.js | 185 ++++++++++++++++++++++++++++++++++++ assets/uploads/pt-opaline.png | Bin 4472 -> 0 bytes assets/uploads/pt-opalinearcana.png | Bin 0 -> 4472 bytes 3 files changed, 185 insertions(+) create mode 100644 assets/logo/banner.js delete mode 100644 assets/uploads/pt-opaline.png create mode 100644 assets/uploads/pt-opalinearcana.png (limited to 'assets') diff --git a/assets/logo/banner.js b/assets/logo/banner.js new file mode 100644 index 0000000..076e8ce --- /dev/null +++ b/assets/logo/banner.js @@ -0,0 +1,185 @@ +// noinspection JSUnresolvedVariable +window.bannerFrench = false; + +function timeAgo(time) { + if (!isNaN(parseInt(time))) { + time = new Date(time).getTime(); + } + + let periods = ["sec.", "mn.", "hr.", "d.", "wk.", "mo.", "y.", "ages"]; + + if (bannerFrench) { + periods = ["sec.", "min.", "h.", "j.", "sem.", "mois", "an.", "des années"]; + } + + 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 (bannerFrench) { + if (difference <= 10 && difference >= 0) { + return "à l'instant"; + } else if (difference > 0) { + tense = "il y a"; + } else { + tense = "dans"; + } + } else { + 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]; + + if (bannerFrench) { + return `${tense} ${difference} ${period}`; + } else { + 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++; + + document.getElementById("member-banner").innerHTML = ` + +
+
+ +
+ +
+

+ + + ${data['id'] === "unknown" ? ` + ${french ? "Membre inconnu" : "Unknown member"} (${data['system']['name']} System) + ` : data['id'] === "fusion" ? (data['name'] === "fusion" ? ` + ${french ? "Plusieurs membres fusionnés" : "Multiple merged members"} + ` : data['name']) : data['name']} + +

+ +
+ ${data['badges'].map(i => i.html).join(" ")} + ${data['badges'].length === 0 ? " " : ""} +
+ +
+ + ${french ? `Préfixe${data['prefixes'].length > 1 ? 's' : ''} ` : `Prefix${data['prefixes'].length > 1 ? 'es' : ''}`}:
+ ${data['prefixes'].length > 0 && data['prefixes'][0] !== null ? `${data['prefixes'].join(', ')}` : `-`} +
+ ${french ? "" : ` + ${french ? "Pronoms :" : "Pronouns:"}
+ ${data['id'] === "fusion" ? "she/her" : data['pronouns']} +
`} + ${!data['median'] && data['id'] !== "unknown" ? ` + + ${data["id"] === "fusion" ? ` + ${french ? "Fronte depuis " : "Fronting since"}:
+ ${data['last_fronted'] ? ` + ${data['last_fronted']['now'] ? ` + ${data['last_fronted']['relative']}
  + ` : ` + ${french ? "Pas au front" : "Not fronting"}
  + `} + ` : `${french ? "Pas au front" : "Not fronting"}
 `}` : ` + ${french ? "Front :" : "Last fronted:"}
+ ${data['last_fronted'] ? ` + ${data['last_fronted']['now'] ? ` + ${french ? "En ce moment" : "Right now"}
+ (${french ? "commencé" : "started"} ${data['last_fronted']['relative']}) + ` : ` + ${data['last_fronted']['relative']}
+ (${french ? "pendant" : "for"} ${data['last_fronted']['duration']['pretty']}) + `} + ` : `${french ? "Jamais" : "Never"}
 `}`} +
+ ` : ''} + ${data['id'] !== "fusion" ? ` + + ${data['id'] === "unknown" ? (french ? "Espèce : préférez demander" : "Species: best to ask") : ` + ${french ? "Espèce :" : "Species:"} + ${data['species'].map(species => ` + ${species['name']} + `).join("")}`} + ` : ''} + ${data['id'] !== "fusion" ? ` + + ${french ? "Position :" : "Location:"} + ${data['system']['page'] ? ` ${data['system']['name']}` : ` ${data['system']['name']}`} + ${data['system']['subsystem'] ? ` +
${french ? "Sous-système :" : "Subsystem:"} ${data['system']['subsystem']['name']} + ` : data['system']['temporary'] ? (french ? '
(temporaire)' : '
(temporary)') : ''} +
+ ` : ''} +
+ ${data['id'] !== "unknown" && data['id'] !== "fusion" ? ` +
+ ${data['relations']['sexfriends'] && data['relations']['sexfriends'].length > 0 ? ` + ${french ? (data['relations']['sexfriends'].length > 1 ? 'Rel. sexuelles ' : 'Rel. sexuelle ') : `Sexfriend${data['relations']['sexfriends'].length > 1 ? 's' : ''}`}: ${data['relations']['sexfriends'].length > 1 ? '
' : ''} + ${data['relations']['sexfriends'].map(relation => ` + `).join(``)} + ${data['relations']['sexfriends'].length === 0 ? '-' : ''} +
` : ``} + ${data['relations']['marefriends'] && data['relations']['marefriends'].length > 0 ? ` + ${french ? (data['relations']['marefriends'].length > 1 ? 'Copines ' : 'Copine ') : `Marefriend${data['relations']['marefriends'].length > 1 ? 's' : ''}`}: ${data['relations']['marefriends'].length > 1 ? '
' : ''} + ${data['relations']['marefriends'].map(relation => ` + `).join(``)} + ${data['relations']['marefriends'].length === 0 ? '-' : ''} +
` : ``} + ${data['relations']['sisters'] && data['relations']['sisters'].length > 0 ? ` + ${french ? (data['relations']['sisters'].length > 1 ? 'Sœurs ' : 'Sœur ') : `Sister${data['relations']['sisters'].length > 1 ? 's' : ''}`}: ${data['relations']['sisters'].length > 1 ? '
' : ''} + ${data['relations']['sisters'].map(relation => ` + `).join(``)} + ${data['relations']['sisters'].length === 0 ? '-' : ''} +
` : ``} + ${data['relations']['caretakers'] && data['relations']['caretakers'].length > 0 ? ` + + ${french ? (data['relations']['caretakers'].length > 1 ? 'Gardiens ' : 'Gardien ') : `Caretaker${data['relations']['caretakers'].length > 1 ? 's' : ''}`}: ${data['relations']['caretakers'].length > 1 ? '
' : ''} + ${data['relations']['caretakers'].map(relation => ` + `).join(``)} + ${data['relations']['caretakers'].length === 0 ? '-' : ''} +
+ ` : ''} +
+ ` : '
 
'} +
+
+ +`; +} \ No newline at end of file diff --git a/assets/uploads/pt-opaline.png b/assets/uploads/pt-opaline.png deleted file mode 100644 index 261f40d..0000000 Binary files a/assets/uploads/pt-opaline.png and /dev/null differ diff --git a/assets/uploads/pt-opalinearcana.png b/assets/uploads/pt-opalinearcana.png new file mode 100644 index 0000000..261f40d Binary files /dev/null and b/assets/uploads/pt-opalinearcana.png differ -- cgit