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) --- app/banner.js | 205 ---------------------------------------------------------- 1 file changed, 205 deletions(-) delete mode 100644 app/banner.js (limited to 'app') diff --git a/app/banner.js b/app/banner.js deleted file mode 100644 index 5ddb2d2..0000000 --- a/app/banner.js +++ /dev/null @@ -1,205 +0,0 @@ -// 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(offline, french) { - if (!offline) 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); - } - - if (offline) { - let images = JSON.parse(await localforage.getItem("images")); - - index = 0; - for (let species of data['species']) { - data['species'][index]["icon_offline"] = images.misc.species[species['id']]; - index++; - } - - index = 0; - for (let relation of data['relations']['marefriends']) { - data['relations']['marefriends'][index]["icon_offline"] = images.ponytown[relation['id'].split("/")[0]][relation['id'].split("/")[1]]; - index++; - } - - index = 0; - for (let relation of data['relations']['sisters']) { - data['relations']['sisters'][index]["icon_offline"] = images.ponytown[relation['id'].split("/")[0]][relation['id'].split("/")[1]]; - index++; - } - - if (data['relations']['caretakers']) { - index = 0; - for (let relation of data['relations']['caretakers']) { - data['relations']['caretakers'][index]["icon_offline"] = images.ponytown[relation['id'].split("/")[0]][relation['id'].split("/")[1]]; - index++; - } - } - - data['system']['icon_offline'] = images.misc.systems[data['system']['icon']]; - } - - 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" ? ` -
- - ${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 ? '-' : ''} -
- - ${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['little'] ? ` - - ${french ? (data['relations']['sisters'].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 -- cgit