From 09bd0164ebc020a54b944b7326dcba496fb5d82c Mon Sep 17 00:00:00 2001 From: Minteck Date: Fri, 26 Aug 2022 22:29:23 +0200 Subject: idk when was the last commit so I'm making a new one - Violet Dawn --- app/banner.js | 97 ++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 70 insertions(+), 27 deletions(-) (limited to 'app/banner.js') 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) {
- +

- ${data['name']} + ${data['id'] === "unknown" ? ` + Unknown member (${data['system']['name']} System) + ` : data['id'] === "fusion" ? (data['name'] === "fusion" ? ` + Multiple merged members + ` : data['name']) : data['name']}

@@ -97,65 +125,80 @@ async function refreshBanner(offline) { ${data['badges'].length === 0 ? " " : ""}
-
+
- Prefix${data['prefixes'].length > 1 ? 'es' : ''}: + ${french ? `Préfixe${data['prefixes'].length > 1 ? 's' : ''} ` : `Prefix${data['prefixes'].length > 1 ? 'es' : ''}`}: ${data['prefixes'].join(', ')} - Pronouns: - ${data['pronouns']} + ${french ? "Pronoms :" : "Pronouns:"} + ${data['id'] === "fusion" ? "she/her" : data['pronouns']} - ${!data['median'] ? ` + ${!data['median'] && data['id'] !== "unknown" ? ` - Last fronted: + ${data["id"] === "fusion" ? ` + Fronting since : ${data['last_fronted'] ? ` ${data['last_fronted']['now'] ? ` - Right now
- (started ${data['last_fronted']['relative']}) + ${data['last_fronted']['relative']}
  + ` : ` + Not fronting
  + `} + ` : `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']}
- (for ${data['last_fronted']['duration']['pretty']}) + (${french ? "pendant" : "for"} ${data['last_fronted']['duration']['pretty']}) `} - ` : "A long time ago
 "} + ` : `${french ? "Il y a très longtemps" : "A long time ago"}
 `}`}
` : ''} + ${data['id'] !== "fusion" ? ` - Species: + ${data['id'] === "unknown" ? "Species: best to ask" : ` + ${french ? (data['species'].length > 1 ? "Espèces : " : "Espèce : ") : "Species: "} ${data['species'].map(species => ` ${species['name']} - `).join("")} - + `).join("")}`} + ` : ''} + ${data['id'] !== "fusion" ? ` - System: + ${french ? "Système : " : "System: "} ${data['system']['name']} ${data['system']['subsystem'] ? ` -
Subsystem: ${data['system']['subsystem']['name']} +
${french ? "Sous-système : " : "Subsystem: "} ${data['system']['subsystem']['name']} ` : data['system']['temporary'] ? '
(temporary)' : ''}
+ ` : ''}
+ ${data['id'] !== "unknown" && data['id'] !== "fusion" ? `
- Marefriend${data['relations']['sisters'].length > 1 ? 's' : ''}: ${data['relations']['marefriends'].length > 1 ? '
' : ''} + ${french ? (data['relations']['marefriends'].length > 1 ? 'Partenaires ' : 'Partenaire ') : `Marefriend${data['relations']['marefriends'].length > 1 ? 's' : ''}`}: ${data['relations']['marefriends'].length > 1 ? '
' : ''} ${data['relations']['marefriends'].map(relation => ` ${relation['name']}`).join(`,
`)} ${data['relations']['marefriends'].length === 0 ? '-' : ''}
- Sister${data['relations']['sisters'].length > 1 ? 's' : ''}: ${data['relations']['sisters'].length > 1 ? '
' : ''} + ${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 => ` ${relation['name']}`).join(`,
`)} ${data['relations']['sisters'].length === 0 ? '-' : ''}
${data['little'] ? ` - Caretaker${data['relations']['sisters'].length > 1 ? 's' : ''}: ${data['relations']['caretakers'].length > 1 ? '
' : ''} + ${french ? (data['relations']['sisters'].length > 1 ? 'Caretakers ' : 'Caretaker ') : `Caretakers${data['relations']['caretakers'].length > 1 ? 's' : ''}`}: ${data['relations']['caretakers'].length > 1 ? '
' : ''} ${data['relations']['caretakers'].map(relation => ` ${relation['name']}`).join(`,
`)} ${data['relations']['caretakers'].length === 0 ? '-' : ''}
` : ''}
+ ` : '
 
'}
-- cgit