diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/banner.inc | 6 | ||||
-rw-r--r-- | includes/bitset.inc | 1 | ||||
-rw-r--r-- | includes/days.json | 5 | ||||
-rw-r--r-- | includes/details.inc | 10 | ||||
-rw-r--r-- | includes/metadata.inc | 6 | ||||
-rw-r--r-- | includes/planner.inc | 209 | ||||
-rw-r--r-- | includes/system/compare.inc | 13 |
7 files changed, 98 insertions, 152 deletions
diff --git a/includes/banner.inc b/includes/banner.inc index 4678a5a..1d33b43 100644 --- a/includes/banner.inc +++ b/includes/banner.inc @@ -66,7 +66,11 @@ function getMemberBannerData(string $id, string $system, bool $french = false) { $prefixes = []; foreach ($member['proxy_tags'] as $proxy) { if ($travelling[$member['id']]["travelling"]) { - $prefixes[] = "+" . $proxy["prefix"] . ($proxy["suffix"] !== "" && $proxy["suffix"] !== null ? "..." . $proxy["suffix"] : ""); + if (isset($travelling[$member['id']]['equestria']) && $travelling[$member['id']]['equestria']) { + $prefixes[] = null; + } else { + $prefixes[] = "+" . $proxy["prefix"] . ($proxy["suffix"] !== "" && $proxy["suffix"] !== null ? "..." . $proxy["suffix"] : ""); + } } else { $prefixes[] = $proxy["prefix"] . ($proxy["suffix"] !== "" && $proxy["suffix"] !== null ? "..." . $proxy["suffix"] : ""); } diff --git a/includes/bitset.inc b/includes/bitset.inc index 7d5a963..96c6bfd 100644 --- a/includes/bitset.inc +++ b/includes/bitset.inc @@ -106,6 +106,7 @@ function parseMetadata ($metadata) { $m["median"] = $metadata["median"] ?? null; $m["birth"] = $metadata["birth"] ?? null; $m["heat"] = $metadata["heat"] ?? null; + $m["code"] = $metadata["code"] ?? null; } else { $m = $metadata; } diff --git a/includes/days.json b/includes/days.json new file mode 100644 index 0000000..bfbcefa --- /dev/null +++ b/includes/days.json @@ -0,0 +1,5 @@ +{ + "2022-12-24": "Christmas Eve", + "2022-12-25": "Christmas Day", + "2022-12-31": "New Year's Eve" +}
\ No newline at end of file diff --git a/includes/details.inc b/includes/details.inc index e4ee519..8fee082 100644 --- a/includes/details.inc +++ b/includes/details.inc @@ -1,5 +1,5 @@ <?php global $isLoggedIn; global $metadata; global $memberData; global $lang; global $pages; ?> -<div id="member-details" class="<?= $isLoggedIn ? 'member-details-loggedIn' : '' ?>" style="<?php if (!$isLoggedIn): ?>grid-template-columns: repeat(2, 1fr);<?php endif; ?> background-color: <?= isset($memberData["color"]) ? '#' . $memberData["color"] . "33" : "transparent" ?>; margin-left: -20px; margin-right: -20px;"> +<div id="member-details" class="<?= $isLoggedIn ? 'member-details-loggedIn' : '' ?>" style="<?php if (!$isLoggedIn): ?>grid-template-columns: repeat(3, 1fr);<?php endif; ?> background-color: <?= isset($memberData["color"]) ? '#' . $memberData["color"] . "33" : "transparent" ?>; margin-left: -20px; margin-right: -20px;"> <div> <b><?= $lang["details"]["food"] ?></b><span class="member-small-separator"><br></span> <?= match ($metadata["food"]) { @@ -68,4 +68,12 @@ <?php endif; ?> </div> <?php endif; ?> + <div> + <b><?= $lang["details"]["code"] ?></b><span class="member-small-separator"><br></span> + <?php if (isset($metadata["code"]) && trim($metadata["code"]) !== ""): ?> + <code style="color: white;"><?= strtoupper(substr($metadata["code"], 0, 3)) ?></code> + <?php else: ?> + - + <?php endif; ?> + </div> </div>
\ No newline at end of file diff --git a/includes/metadata.inc b/includes/metadata.inc index 1aa7329..04b6a9e 100644 --- a/includes/metadata.inc +++ b/includes/metadata.inc @@ -8,7 +8,7 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member <br> <div class="container" id="page-content"> - <h2><?= $memberData["display_name"] ?? $memberData["name"] ?></h2> + <h2><a href="/<?= $memberData["name"] ?>"><?= $memberData["display_name"] ?? $memberData["name"] ?></a></h2> <?php if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $memberID . ".json")): ?> <form> <input name="submit" type="hidden"> @@ -45,6 +45,10 @@ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $member <b>Age (for ponies with fixed age):</b><br> <input name="age" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="number" value="<?= $metadata["birth"]["age"] ?? "" ?>"> </p> + <p> + <b>Member code:</b><br> + <input name="membc" class="form-control" style="filter: invert(1) hue-rotate(180deg);" type="text" value="<?= $metadata["code"] ?? "" ?>"> + </p> <input name="submit" class="btn btn-outline-primary" value="Save and quit" type="submit"> </form> <?php else: ?> diff --git a/includes/planner.inc b/includes/planner.inc index 72c82a5..c537d17 100644 --- a/includes/planner.inc +++ b/includes/planner.inc @@ -73,9 +73,18 @@ foreach ($raindrops as $id => $day) { function day($display, $diff): void { if ($diff < 0) $disabled = true; else $disabled = false; global $cloudburst; global $raindrops; ?> <?php if (!isset($display)) { $display = date('l', time() + (86400 * $diff)); - }?> + } + + $d = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/days.json"), true); + $t = date('Y-m-d', time() + (86400 * $diff)); + + if (isset($d[$t])) { + $display = "$display ($d[$t])"; + } + + ?> <tr class="planner-day" id="planner-header-<?= $diff ?>" <?php if ($disabled): ?>style="opacity: .75; pointer-events: none;"<?php endif; ?>> - <td colspan="10"><?= $display ?></td> + <td colspan="10" contenteditable="true"><?= $display ?></td> <?php if (!isset($cloudburst[date('Y-m-d', time() + (86400 * $diff))])) $cloudburst[date('Y-m-d', time() + (86400 * $diff))] = []; @@ -403,57 +412,7 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis } function openEditFronter(system, id, date) { - let display; - - switch (date) { - case "<?= date('Y-m-d') ?>": - display = "today"; - break; - - case "<?= date('Y-m-d', time() + 86400) ?>": - display = "tomorrow"; - break; - - case "<?= date('Y-m-d', time() + (86400 * 2)) ?>": - display = "on <?= date('l', time() + (86400 * 2)) ?>"; - break; - - case "<?= date('Y-m-d', time() + (86400 * 3)) ?>": - display = "on <?= date('l', time() + (86400 * 3)) ?>"; - break; - - case "<?= date('Y-m-d', time() + (86400 * 4)) ?>": - display = "on <?= date('l', time() + (86400 * 4)) ?>"; - break; - - case "<?= date('Y-m-d', time() + (86400 * 5)) ?>": - display = "on <?= date('l', time() + (86400 * 5)) ?>"; - break; - - case "<?= date('Y-m-d', time() + (86400 * 6)) ?>": - display = "on <?= date('l', time() + (86400 * 6)) ?>"; - break; - - case "<?= date('Y-m-d', time() + (86400 * 7)) ?>": - display = "on <?= date('l', time() + (86400 * 7)) ?>"; - break; - - case "<?= date('Y-m-d', time() + (86400 * 8)) ?>": - display = "on <?= date('l', time() + (86400 * 8)) ?>"; - break; - - case "<?= date('Y-m-d', time() + (86400 * 9)) ?>": - display = "on <?= date('l', time() + (86400 * 9)) ?>"; - break; - - case "<?= date('Y-m-d', time() + (86400 * 10)) ?>": - display = "on <?= date('l', time() + (86400 * 10)) ?>"; - break; - - case "<?= date('Y-m-d', time() + (86400 * 11)) ?>": - display = "on <?= date('l', time() + (86400 * 11)) ?>"; - break; - } + let display = formatDate(date).display; window.selectedFronting = { system: system === "cloudburst" ? "ynmuc" : "gdapd", @@ -476,37 +435,7 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis } function openEditCofronter(system, id, date) { - let display; - - switch (date) { - case "<?= date('Y-m-d') ?>": - display = "today"; - break; - - case "<?= date('Y-m-d', time() + 86400) ?>": - display = "tomorrow"; - break; - - case "<?= date('Y-m-d', time() + (86400 * 2)) ?>": - display = "on <?= date('l', time() + (86400 * 2)) ?>"; - break; - - case "<?= date('Y-m-d', time() + (86400 * 3)) ?>": - display = "on <?= date('l', time() + (86400 * 3)) ?>"; - break; - - case "<?= date('Y-m-d', time() + (86400 * 4)) ?>": - display = "on <?= date('l', time() + (86400 * 4)) ?>"; - break; - - case "<?= date('Y-m-d', time() + (86400 * 5)) ?>": - display = "on <?= date('l', time() + (86400 * 5)) ?>"; - break; - - case "<?= date('Y-m-d', time() + (86400 * 6)) ?>": - display = "on <?= date('l', time() + (86400 * 6)) ?>"; - break; - } + let display = formatDate(offset).display; window.selectedFronting = { system: system === "cloudburst" ? "ynmuc" : "gdapd", @@ -525,47 +454,91 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis modal.show(); } - function addCofronter(system, offset, index) { + function formatDate(offset) { let date; let display; switch (offset) { case 0: + case "<?= date('Y-m-d', time()) ?>": date = "<?= date('Y-m-d') ?>"; display = "today"; break; case 1: + case "<?= date('Y-m-d', time() + (86400)) ?>": date = "<?= date('Y-m-d', time() + 86400) ?>"; display = "tomorrow"; break; case 2: + case "<?= date('Y-m-d', time() + (86400 * 2)) ?>": date = "<?= date('Y-m-d', time() + (86400 * 2)) ?>"; display = "on <?= date('l', time() + (86400 * 2)) ?>"; break; case 3: + case "<?= date('Y-m-d', time() + (86400 * 3)) ?>": date = "<?= date('Y-m-d', time() + (86400 * 3)) ?>"; display = "on <?= date('l', time() + (86400 * 3)) ?>"; break; case 4: + case "<?= date('Y-m-d', time() + (86400 * 4)) ?>": date = "<?= date('Y-m-d', time() + (86400 * 4)) ?>"; display = "on <?= date('l', time() + (86400 * 4)) ?>"; break; case 5: + case "<?= date('Y-m-d', time() + (86400 * 5)) ?>": date = "<?= date('Y-m-d', time() + (86400 * 5)) ?>"; display = "on <?= date('l', time() + (86400 * 5)) ?>"; break; case 6: + case "<?= date('Y-m-d', time() + (86400 * 6)) ?>": date = "<?= date('Y-m-d', time() + (86400 * 6)) ?>"; display = "on <?= date('l', time() + (86400 * 6)) ?>"; break; + + case 7: + case "<?= date('Y-m-d', time() + (86400 * 7)) ?>": + date = "<?= date('Y-m-d', time() + (86400 * 7)) ?>"; + display = "on <?= date('l', time() + (86400 * 7)) ?>"; + break; + + case 8: + case "<?= date('Y-m-d', time() + (86400 * 8)) ?>": + date = "<?= date('Y-m-d', time() + (86400 * 8)) ?>"; + display = "on <?= date('l', time() + (86400 * 8)) ?>"; + break; + + case 9: + case "<?= date('Y-m-d', time() + (86400 * 9)) ?>": + date = "<?= date('Y-m-d', time() + (86400 * 9)) ?>"; + display = "on <?= date('l', time() + (86400 * 9)) ?>"; + break; + + case 10: + case "<?= date('Y-m-d', time() + (86400 * 10)) ?>": + date = "<?= date('Y-m-d', time() + (86400 * 10)) ?>"; + display = "on <?= date('l', time() + (86400 * 10)) ?>"; + break; + + case 11: + case "<?= date('Y-m-d', time() + (86400 * 11)) ?>": + date = "<?= date('Y-m-d', time() + (86400 * 11)) ?>"; + display = "on <?= date('l', time() + (86400 * 11)) ?>"; + break; } + return {date, display}; + } + + function addCofronter(system, offset, index) { + let date = formatDate(offset).date; + let display = formatDate(offset).display; + window.selectedFronting = { system: system === "cloudburst" ? "ynmuc" : "gdapd", date: date, @@ -593,70 +566,8 @@ function day($display, $diff): void { if ($diff < 0) $disabled = true; else $dis } function addFronter(system, offset, index) { - let date; - let display; - - switch (offset) { - case 0: - date = "<?= date('Y-m-d') ?>"; - display = "today"; - break; - - case 1: - date = "<?= date('Y-m-d', time() + 86400) ?>"; - display = "tomorrow"; - break; - - case 2: - date = "<?= date('Y-m-d', time() + (86400 * 2)) ?>"; - display = "on <?= date('l', time() + (86400 * 2)) ?>"; - break; - - case 3: - date = "<?= date('Y-m-d', time() + (86400 * 3)) ?>"; - display = "on <?= date('l', time() + (86400 * 3)) ?>"; - break; - - case 4: - date = "<?= date('Y-m-d', time() + (86400 * 4)) ?>"; - display = "on <?= date('l', time() + (86400 * 4)) ?>"; - break; - - case 5: - date = "<?= date('Y-m-d', time() + (86400 * 5)) ?>"; - display = "on <?= date('l', time() + (86400 * 5)) ?>"; - break; - - case 6: - date = "<?= date('Y-m-d', time() + (86400 * 6)) ?>"; - display = "on <?= date('l', time() + (86400 * 6)) ?>"; - break; - - case 7: - date = "<?= date('Y-m-d', time() + (86400 * 7)) ?>"; - display = "on <?= date('l', time() + (86400 * 7)) ?>"; - break; - - case 8: - date = "<?= date('Y-m-d', time() + (86400 * 8)) ?>"; - display = "on <?= date('l', time() + (86400 * 8)) ?>"; - break; - - case 9: - date = "<?= date('Y-m-d', time() + (86400 * 9)) ?>"; - display = "on <?= date('l', time() + (86400 * 9)) ?>"; - break; - - case 10: - date = "<?= date('Y-m-d', time() + (86400 * 10)) ?>"; - display = "on <?= date('l', time() + (86400 * 10)) ?>"; - break; - - case 11: - date = "<?= date('Y-m-d', time() + (86400 * 11)) ?>"; - display = "on <?= date('l', time() + (86400 * 11)) ?>"; - break; - } + let date = formatDate(offset).date; + let display = formatDate(offset).display; window.currentWorkingDate = date; window.addIndex = index; diff --git a/includes/system/compare.inc b/includes/system/compare.inc index 4f9711d..ea12582 100644 --- a/includes/system/compare.inc +++ b/includes/system/compare.inc @@ -38,6 +38,14 @@ function getMember(string $id) { <span class="comparison-header-l5"><abbr title="<?= $lang["compare"]["species"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["species"][5] ?></abbr></span> </span> <span class="comparison-header comparison-item"> + <span class="comparison-header-l0"><abbr title="Code" data-bs-toggle="tooltip">Code</abbr></span> + <span class="comparison-header-l1"><abbr title="Code" data-bs-toggle="tooltip">Code</abbr></span> + <span class="comparison-header-l2"><abbr title="Code" data-bs-toggle="tooltip">Code</abbr></span> + <span class="comparison-header-l3"><abbr title="Code" data-bs-toggle="tooltip">Code</abbr></span> + <span class="comparison-header-l4"><abbr title="Code" data-bs-toggle="tooltip">Code</abbr></span> + <span class="comparison-header-l5"><abbr title="Code" data-bs-toggle="tooltip">Code</abbr></span> + </span> + <span class="comparison-header comparison-item"> <span class="comparison-header-l0"><abbr title="<?= $lang["compare"]["relations"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["relations"][0] ?></abbr></span> <span class="comparison-header-l1"><abbr title="<?= $lang["compare"]["relations"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["relations"][1] ?></abbr></span> <span class="comparison-header-l2"><abbr title="<?= $lang["compare"]["relations"][0] ?>" data-bs-toggle="tooltip"><?= $lang["compare"]["relations"][2] ?></abbr></span> @@ -121,6 +129,11 @@ function getMember(string $id) { <?php endforeach; ?> </span> <span class="comparison-item"> + <?php if (isset($metadata["code"]) && trim($metadata["code"]) !== ""): ?> + <code style="color: white;"><?= strtoupper(substr($metadata["code"], 0, 3)) ?></code> + <?php else: ?>-<?php endif; ?> + </span> + <span class="comparison-item"> <?= count($metadata["marefriends"]) + count($metadata["sisters"]) + count($metadata["caretakers"]) === 0 ? "-" : "" ?> <span class="comparison-relations-count"> <?= count($metadata["marefriends"]) + count($metadata["sisters"]) > 0 ? count($metadata["marefriends"]) + count($metadata["sisters"]) : "" ?> |