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 ------------------------------------ assets/logo/banner.js | 185 ++++++++++++++++++++++++++++++++ assets/uploads/pt-opaline.png | Bin 4472 -> 0 bytes assets/uploads/pt-opalinearcana.png | Bin 0 -> 4472 bytes includes/banner.inc | 25 +++++ includes/bitset.inc | 3 + includes/details.inc | 4 +- includes/fullbanner.inc | 2 +- includes/metadata.inc | 4 + pages/bitset.inc | 13 ++- pages/metadata.inc | 7 ++ 11 files changed, 237 insertions(+), 211 deletions(-) delete mode 100644 app/banner.js create mode 100644 assets/logo/banner.js delete mode 100644 assets/uploads/pt-opaline.png create mode 100644 assets/uploads/pt-opalinearcana.png 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 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 diff --git a/includes/banner.inc b/includes/banner.inc index cbae0b2..341b4e7 100644 --- a/includes/banner.inc +++ b/includes/banner.inc @@ -59,6 +59,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { "regression" => null, "median" => null, "marefriends" => [], + "sexfriends" => [], "sisters" => [], "caretakers" => [] ]); @@ -235,6 +236,29 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { ]; } + $sexfriends = null; + + if ($isLoggedIn) { + $sexfriends = []; + foreach ($metadata["sexfriends"] as $marefriend) { + $mfSystem = explode("/", $marefriend)[0]; + $mfMemberID = explode("/", $marefriend)[1]; + $mfMember = array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$mfSystem/members.json"), true), function ($item) use ($mfMemberID) { + return $item["id"] === $mfMemberID; + }); + sort($mfMember); + $mfMember = $mfMember[0]; + + $sexfriends[] = [ + "id" => $marefriend, + "link" => "/" . ($mfMember["name"]), + "icon" => getAsset($mfSystem, $mfMemberID, "heads"), + "name" => getMiniName($mfMember["display_name"] ?? $mfMember["name"]), + "full_name" => $mfMember["display_name"] ?? $mfMember["name"] + ]; + } + } + $sisters = []; foreach ($metadata["sisters"] as $marefriend) { $mfSystem = explode("/", $marefriend)[0]; @@ -488,6 +512,7 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { 'system' => $systemData, 'relations' => [ 'marefriends' => $marefriends ?? [], + 'sexfriends' => $sexfriends ?? null, 'sisters' => $sisters ?? [], 'caretakers' => $caretakers ?? [] ] diff --git a/includes/bitset.inc b/includes/bitset.inc index 955d953..f8ac366 100644 --- a/includes/bitset.inc +++ b/includes/bitset.inc @@ -10,6 +10,7 @@ function parseBitset ($bitset) { $lessFrequent = substr($bin, 14, 1) !== "0"; $sexuallyActive = substr($bin, 13, 1) !== "0"; $leader = substr($bin, 11, 1) !== "0"; + $sexualFeatures = substr($bin, 12, 1) !== "0"; $persecutor = substr($bin, 10, 1) !== "0"; $protector = substr($bin, 29, 1) !== "0"; $fictive = substr($bin, 30, 1) !== "0"; @@ -71,6 +72,7 @@ function parseBitset ($bitset) { 'fictive' => $fictive, 'little' => $little, 'not_talking' => false, + 'sexual_features' => $sexualFeatures, 'host' => false, 'robot' => $robot, 'magic' => 0, @@ -105,6 +107,7 @@ function parseMetadata ($metadata) { if (isset($metadata)) { if ($metadata["bitset"]) { $m = parseBitset($metadata["bitset"]); + $m["sexfriends"] = $metadata["sexfriends"] ?? []; $m["marefriends"] = $metadata["marefriends"] ?? []; $m["bitset"] = $metadata["bitset"] ?? 0; $m["sisters"] = $metadata["sisters"] ?? []; diff --git a/includes/details.inc b/includes/details.inc index 6002acd..985f2b0 100644 --- a/includes/details.inc +++ b/includes/details.inc @@ -72,7 +72,7 @@
; margin-left: -20px; margin-right: -20px;"> - = 16 && $metadata["little"] === 0) || (!isset($age) && $metadata["little"] === 0)): ?> + = 16 && $metadata["little"] === 0) || (!isset($age) && $metadata["little"] === 0)) || $metadata["sexual_features"]): ?>
Sexual consent:
@@ -108,7 +108,7 @@ grid-template-columns: 2fr 1fr 1fr; } -
This member is too young to have a sexual relationship.
+
This member is too young to be in a sexual relationship.
diff --git a/includes/fullbanner.inc b/includes/fullbanner.inc index c50ad5f..30bdf3e 100644 --- a/includes/fullbanner.inc +++ b/includes/fullbanner.inc @@ -11,7 +11,7 @@
- +
diff --git a/includes/metadata.inc b/includes/metadata.inc index 078984d..7bc82ef 100644 --- a/includes/metadata.inc +++ b/includes/metadata.inc @@ -21,6 +21,10 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member · Edit... ">

+

+ Sexfriends (full IDs, comma-separated):
+ "> +

Marefriends (full IDs, comma-separated):
"> diff --git a/pages/bitset.inc b/pages/bitset.inc index a777b60..309bab8 100644 --- a/pages/bitset.inc +++ b/pages/bitset.inc @@ -46,7 +46,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';

0
0
0
-
0
+
0
0
0
0
@@ -164,6 +164,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; let polyamorous2 = binString.substring(19, 20) !== "0"; let alignment1 = binString.substring(20, 24); let alignment2 = binString.substring(25 + 16, 29 + 16); + let sexualFeatures = binString.substring(12, 13) !== "0"; document.getElementById("value-0").value = sharedMemory; document.getElementById("value-1").value = little; @@ -183,6 +184,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; document.getElementById("value-23").checked = polyamorous2; document.getElementById("value-24").value = alignment1; document.getElementById("value-25").value = alignment2; + document.getElementById("value-26").checked = sexualFeatures; setColors(); } @@ -242,6 +244,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; let val23 = document.getElementById("value-23").checked; let val24 = document.getElementById("value-24").value; let val25 = document.getElementById("value-25").value; + let val26 = document.getElementById("value-26").checked; let val0bin = parseInt(val0).toString(2); val0bin = val0bin.length === 1 ? "0" + val0bin : val0bin; @@ -261,7 +264,6 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; let val7bin = "0"; let val8bin = "0"; let val15bin = "0"; - let val19bin = "0"; let val5bin = val5 ? "1" : "0"; let val6bin = val6 ? "1" : "0"; @@ -274,8 +276,9 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; let val21bin = val21 ? "1" : "0"; let val22bin = val22 ? "1" : "0"; let val23bin = val23 ? "1" : "0"; + let val26bin = val26 ? "1" : "0"; - let bin = "0000000000" + val21bin + val20bin + val19bin + val18bin + val17bin + val16bin + val11bin + val22bin + val23bin + val24bin + val0bin + val4bin + val1bin + val5bin + val6bin + val7bin + val8bin + val2bin + val3bin + val25bin + val9bin + val10bin + val15bin; + let bin = "0000000000" + val21bin + val20bin + val26bin + val18bin + val17bin + val16bin + val11bin + val22bin + val23bin + val24bin + val0bin + val4bin + val1bin + val5bin + val6bin + val7bin + val8bin + val2bin + val3bin + val25bin + val9bin + val10bin + val15bin; console.log(bin, parseInt(bin, 2)); @@ -403,6 +406,10 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc'; Fictive
+