diff options
Diffstat (limited to 'includes/components')
-rw-r--r-- | includes/components/footer.inc | 7 | ||||
-rw-r--r-- | includes/components/navigation.inc | 8 | ||||
-rw-r--r-- | includes/components/planner.inc | 1117 |
3 files changed, 7 insertions, 1125 deletions
diff --git a/includes/components/footer.inc b/includes/components/footer.inc index 78c3148..51e35d1 100644 --- a/includes/components/footer.inc +++ b/includes/components/footer.inc @@ -39,6 +39,13 @@ global $pageFile; }); window.fetch("/api/rename?name=" + encodeURIComponent("Cold Haze Web (" + UAParser().browser.name + " on " + UAParser().os.name + ")")); + + if (document.createElement("canvas").getContext("webgl") === null) { + let style = document.createElement("style"); + style.innerText = "* { backdrop-filter: none !important; }"; + document.head.appendChild(style); + try { document.getElementById("gpuWarning").style.display = ""; } catch (e) {} + } </script> <?php if (isset($_GET["performance"])): ?> diff --git a/includes/components/navigation.inc b/includes/components/navigation.inc index 4d0cc5e..1761937 100644 --- a/includes/components/navigation.inc +++ b/includes/components/navigation.inc @@ -166,14 +166,6 @@ $navigation_admin = [ "private" => false ], [ - "name" => $pages["toys"]["name"][$lang["_name"]], - "icon" => "/assets/icons/toys.svg", - "invert" => true, - "link" => "/-/toys", - "stepped" => null, - "private" => true - ], - [ "name" => $pages["docs"]["name"][$lang["_name"]], "icon" => "/assets/icons/docs.svg", "invert" => true, diff --git a/includes/components/planner.inc b/includes/components/planner.inc deleted file mode 100644 index 9385b67..0000000 --- a/includes/components/planner.inc +++ /dev/null @@ -1,1117 +0,0 @@ -<div id="ch-front-planner"> - <?php - - require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/travelling.inc"; global $travelling; - require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/score.inc"; - require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/pronouns.inc"; - require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/util/bitset.inc"; - require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isUserLoggedIn; global $isLowerLoggedIn; - require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/banner.inc"; - require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/rainbow.inc"; - require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; - global $_PROFILE; - - $cloudburst = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/ynmuc.json"), true); - $raindrops = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/gdapd.json"), true); - - function fronterBadges($id) { - global $isLowerLoggedIn; - - $metadata = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $id . ".json"), true)); - - if (isset($metadata["pacifier"]) && $metadata["pacifier"] && !$isLowerLoggedIn) { - return "<img title='This pony likes to sleep with a pacifier.' data-bs-toggle='tooltip' src='/assets/logo/pacifier.png' style='margin-left:auto;float: right;opacity:.75;width:24px;height:24px;vertical-align: middle; filter: invert(1);'>"; - } - - if (isset($metadata["sleep_plush"]) && $metadata["sleep_plush"] && !$isLowerLoggedIn) { - return "<img title='This pony likes to sleep with a plush.' data-bs-toggle='tooltip' src='/assets/logo/plush.png' style='margin-left:auto;float: right;opacity:.75;width:24px;height:24px;vertical-align: middle; filter: invert(1);'>"; - } - - return ""; - } - - foreach ($cloudburst as $id => $day) { - foreach ($day as $index => $fronter) { - if (is_string($fronter)) { - $cloudburst[$id][$index] = [$fronter]; - } else if (is_array($fronter)) { - if (count($fronter) < 2) { - if (!isset($cloudburst[$id][$index][0])) $cloudburst[$id][$index][0] = null; - $cloudburst[$id][$index][1] = null; - } else if (count($fronter) > 2) { - $array = []; - - if (isset($cloudburst[$id][$index][0])) { - $array[0] = $cloudburst[$id][$index][0]; - } else { - $array[0] = null; - } - - if (isset($cloudburst[$id][$index][1])) { - $array[1] = $cloudburst[$id][$index][1]; - } else { - $array[1] = null; - } - - $cloudburst[$id][$index] = $array; - } - } - } - } - - foreach ($raindrops as $id => $day) { - foreach ($day as $index => $fronter) { - if (is_string($fronter)) { - $raindrops[$id][$index] = [$fronter]; - } else if (is_array($fronter)) { - if (count($fronter) < 2) { - if (!isset($raindrops[$id][$index][0])) $raindrops[$id][$index][0] = null; - $raindrops[$id][$index][1] = null; - } else if (count($fronter) > 2) { - $array = []; - - if (isset($raindrops[$id][$index][0])) { - $array[0] = $raindrops[$id][$index][0]; - } else { - $array[0] = null; - } - - if (isset($raindrops[$id][$index][1])) { - $array[1] = $raindrops[$id][$index][1]; - } else { - $array[1] = null; - } - - $raindrops[$id][$index] = $array; - } - } - } - } - - $school = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/school.json"), true); - - function formatTime($time) { - if ($time === "0:00") return "midnight"; - if ($time === "12:00") return "noon"; - - $parts = explode(":", $time); - $hours = (int)$parts[0]; - $ampm = ""; - - if ($hours === 0 || $hours === 12) { - $ampm = ($hours === 0 ? "am" : "pm"); - $hours = 12; - } else { - if ($hours > 12) { - $ampm = "pm"; - $hours = $hours - 12; - } else { - $ampm = "am"; - } - } - - if ((int)$parts[1] > 0) { - return $hours . ":" . $parts[1] . $ampm; - } else { - return $hours . $ampm; - } - } - - function school($time, $first = false) { - global $school; - global $_PROFILE; - global $isLowerLoggedIn; - - $day = date('Y-m-d', $time); - $parts = []; - - if (isset($school[$day])) { - if (isset($school[$day]["wakeUp"]["timestamp"])) { - $parts[] = "waking up at " . formatTime($school[$day]["wakeUp"][$_PROFILE["login"]]); - } - - if (isset($school[$day]["sleep"]["timestamp"])) { - $parts[] = "sleeping at " . formatTime($school[$day]["sleep"][$_PROFILE["login"]]); - } - } - - if ($isLowerLoggedIn) $parts = []; - - if (count($parts) > 0) { - if ($first) { - return ucfirst(implode(", ", $parts)); - } else { - return "<br>" . ucfirst(implode(", ", $parts)); - } - } else { - if ($first) { - return "-"; - } else { - return ""; - } - } - } - - function day($display, $diff): void { if ($diff < 0) $disabled = true; else $disabled = false; global $cloudburst; global $raindrops; global $isLowerLoggedIn; ?> - <?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" style="border:none;padding:0;"> - <div style="padding:5px 10px;margin:-0.5px;border-top:1px solid #404040;border-left:1px solid #404040;border-right:1px solid #404040;border-top-left-radius: 10px; border-top-right-radius: 10px;"><?= $display ?></div> - </td> - <?php - - if (!isset($cloudburst[date('Y-m-d', time() + (86400 * $diff))])) $cloudburst[date('Y-m-d', time() + (86400 * $diff))] = []; - $dayCloudburst = $cloudburst[date('Y-m-d', time() + (86400 * $diff))]; - if (!isset($raindrops[date('Y-m-d', time() + (86400 * $diff))])) $raindrops[date('Y-m-d', time() + (86400 * $diff))] = []; - $dayRaindrops = $raindrops[date('Y-m-d', time() + (86400 * $diff))]; - - $index = 0; - $lengthCloudburst = count($dayCloudburst); - $lengthRaindrops = count($dayRaindrops); - $biggest = max($lengthCloudburst, $lengthRaindrops); - - ?> - </tr> - <tr class="planner-header" <?php if ($disabled): ?>style="opacity: .75; pointer-events: none;"<?php endif; ?>> - <td colspan="5" style="border-top-color:transparent;border-right-color: transparent;">Cloudburst System</td> - <td colspan="5" style="border-top-color:transparent;border-left-color: transparent;">Raindrops System</td> - </tr> - <?php for ($i = 0; $i <= $biggest; $i++): ?> - <tr class="planner-member" <?php if ($disabled): ?>style="opacity: .75; pointer-events: none;"<?php endif; ?>> - <?php if (isset($dayCloudburst[$index])): ?> - <td class="planner-member-id" style="border-right-color: transparent;border-bottom-color: transparent;"> - <?= $index + 1 ?> - </td> - <td class="planner-link" style="width:50vw;border-right-color: transparent;border-bottom-color: transparent;" <?php if (!isset($dayCloudburst[$index][1])): ?>colspan="3" <?php else: ?>colspan="2"<?php endif; ?>> - <?php $member = getMemberWithoutSystem($dayCloudburst[$index][0]); ?> - <?php if ($member["name"] === "fusion"): ?> - <a class="member-link" onclick="openEditFronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Multiple merged members</span></span></span></a> - <?php elseif ($member["name"] === "unknown"): ?> - <a class="member-link" onclick="openEditFronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Other/unknown/fallback pony</span></span></span></a> - <?php else: ?> - <a class="member-link" onclick="openEditFronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <span class="member-link-text"><?= !isset($dayCloudburst[$index][1]) ? $member["display_name"] ?? $member["name"] : getMiniName($member["display_name"] ?? $member["name"]) ?></span><?= $index === count($dayCloudburst) - 1 ? fronterBadges($member["id"]) : "" ?></span></a> - <?php endif; ?> - </td> - <?php if (!isset($dayCloudburst[$index][1])): ?> - <td class="planner-cofronter-inner planner-link" style="width:5%;text-align:center;border-left-color: transparent;border-bottom-color: transparent;"><?php if (!$isLowerLoggedIn): ?> - <a onclick="addCofronter('cloudburst', <?= $diff ?>, <?= $index ?>);" class="planner-add-link planner-add-link-cofronter"> - <span class="planner-add-link-cofronter-inner"><img src="/assets/icons/add.svg" alt="" class="planner-add-icon"></span> - </a><?php endif; ?> - </td> - <?php else: ?> - <td class="planner-link" style="border-bottom-color: transparent;width:41.35vw;" colspan="2"> - <?php $member = getMemberWithoutSystem($dayCloudburst[$index][1]); ?> - <?php if ($member["name"] === "fusion"): ?> - <a class="member-link" onclick="openEditCofronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Multiple merged members</span></span></span></a> - <?php elseif ($member["name"] === "unknown"): ?> - <a class="member-link" onclick="openEditCofronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Other/unknown/fallback pony</span></span></span></a> - <?php else: ?> - <a class="member-link" onclick="openEditCofronter('cloudburst', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <span class="member-link-text"><?= !isset($dayCloudburst[$index][1]) ? $member["display_name"] ?? $member["name"] : getMiniName($member["display_name"] ?? $member["name"]) ?></span><?= $index === count($dayCloudburst) - 1 ? fronterBadges($member["id"]) : "" ?></span></a> - <?php endif; ?> - </td> - <?php endif; ?> - <?php elseif ($index === count($dayCloudburst)): if (!$isLowerLoggedIn): ?> - <td class="planner-add-inner planner-link" colspan="5" style="border-top-color: transparent;border-bottom-color: transparent;"> - <a onclick="addFronter('cloudburst', <?= $diff ?>, <?= $index ?>);" id="planner-add-link-cloudburst-<?= $diff ?>" class="planner-add-link"> - <div class="planner-add-link-inner"> - <img src="/assets/icons/add.svg" alt="" class="planner-add-icon"> - <span class="planner-add-text">Add new fronter</span> - </div> - </a> - </td> - <?php endif; else: ?> - <td colspan="5" class="planner-empty" style="border-top-color:transparent;border-bottom-color:transparent;"></td> - <?php endif; ?> - <?php if (isset($dayRaindrops[$index])): ?> - <td class="planner-member-id" style="border-bottom-color: transparent;border-right-color: transparent;"> - <?= $index + 1 ?> - </td> - <?php $member = getMemberWithoutSystem($dayRaindrops[$index][0]); ?> - <td class="planner-link" style="border-right-color:transparent;border-bottom-color: transparent;width:50vw;" <?php if (!isset($dayRaindrops[$index][1])): ?>colspan="3" <?php else: ?>colspan="2"<?php endif; ?>> - <?php if ($member["name"] === "fusion"): ?> - <a class="member-link" onclick="openEditFronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Multiple merged members</span></span></span></a> - <?php elseif ($member["name"] === "unknown"): ?> - <a class="member-link" onclick="openEditFronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Other/unknown/fallback pony</span></span></span></a> - <?php else: ?> - <a class="member-link" onclick="openEditFronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <span class="member-link-text"><?= !isset($dayRaindrops[$index][1]) ? $member["display_name"] ?? $member["name"] : getMiniName($member["display_name"] ?? $member["name"]) ?></span><?= $index === count($dayRaindrops) - 1 ? fronterBadges($member["id"]) : "" ?></span></a> - <?php endif; ?> - </td> - <?php if (!isset($dayRaindrops[$index][1])): ?> - <td class="planner-cofronter-inner planner-link" style="border-bottom-color: transparent;border-left-color: transparent;width:5%;text-align:center;"><?php if (!$isLowerLoggedIn): ?> - <a onclick="addCofronter('raindrops', <?= $diff ?>, <?= $index ?>);" class="planner-add-link planner-add-link-cofronter"> - <span class="planner-add-link-cofronter-inner"><img src="/assets/icons/add.svg" alt="" class="planner-add-icon"></span> - </a><?php endif; ?> - </td> - <?php else: ?> - <td class="planner-link" style="border-bottom-color:transparent;width:41.35vw;" colspan="2"> - <?php $member = getMemberWithoutSystem($dayRaindrops[$index][1]); ?> - <?php if ($member["name"] === "fusion"): ?> - <a class="member-link" onclick="openEditCofronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Multiple merged members</span></span></span></a> - <?php elseif ($member["name"] === "unknown"): ?> - <a class="member-link" onclick="openEditCofronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="/assets/logo/newlogo.png" style="filter:grayscale(1);width:24px;"> <span class="member-link-text"><span class="merge-desktop" style="opacity:.75;">Other/unknown/fallback pony</span></span></span></a> - <?php else: ?> - <a class="member-link" onclick="openEditCofronter('raindrops', <?= $index ?>, '<?= date('Y-m-d', time() + (86400 * $diff)) ?>')"><span class="member-link-inner"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <span class="member-link-text"><?= !isset($dayRaindrops[$index][1]) ? $member["display_name"] ?? $member["name"] : getMiniName($member["display_name"] ?? $member["name"]) ?></span><?= $index === count($dayRaindrops) - 1 ? fronterBadges($member["id"]) : "" ?></span></a> - <?php endif; ?> - </td> - <?php endif; ?> - <?php elseif ($index === count($dayRaindrops)): if (!$isLowerLoggedIn): ?> - <td class="planner-add-inner planner-link" colspan="5" style="border-top-color: transparent;border-bottom-color: transparent;"> - <a onclick="addFronter('raindrops', <?= $diff ?>, <?= $index ?>);" id="planner-add-link-raindrops-<?= $diff ?>" class="planner-add-link"> - <div class="planner-add-link-inner"> - <img src="/assets/icons/add.svg" alt="" class="planner-add-icon"> - <span class="planner-add-text">Add new fronter</span> - </div> - </a> - </td> - <?php endif; else: ?> - <td colspan="5" class="planner-empty" style="border-top-color:transparent;border-bottom-color:transparent;"></td> - <?php endif; ?> - </tr> - <?php $index++; endfor; ?> - <tr class="planner-day planner-end-of-day" <?php if ($disabled): ?>style="opacity: .75; pointer-events: none;"<?php endif; ?>> - <td colspan="10" style="padding: 0;border:none;"> - <div style="padding: 5px 10px;border: 1px solid #404040;margin:-1px;border-bottom-left-radius: 10px;border-bottom-right-radius: 10px;"> - <?php if (count($dayCloudburst) > 0 && count($dayRaindrops) > 0): ?> - <?= getMemberWithoutSystem($dayCloudburst[count($dayCloudburst) - 1][0])["display_name"] ?? getMemberWithoutSystem($dayCloudburst[count($dayCloudburst) - 1][0])["name"] ?><?php if (isset($dayCloudburst[count($dayCloudburst) - 1][1])): echo(" and " . getMemberWithoutSystem($dayCloudburst[count($dayCloudburst) - 1][1])["display_name"] ?? getMemberWithoutSystem($dayCloudburst[count($dayCloudburst) - 1][1])["name"]); endif; ?> will sleep with <?= getMemberWithoutSystem($dayRaindrops[count($dayRaindrops) - 1][0])["display_name"] ?? getMemberWithoutSystem($dayRaindrops[count($dayRaindrops) - 1][0])["name"] ?><?php if (isset($dayRaindrops[count($dayRaindrops) - 1][1])): echo(" and " . getMemberWithoutSystem($dayRaindrops[count($dayRaindrops) - 1][1])["display_name"] ?? getMemberWithoutSystem($dayRaindrops[count($dayRaindrops) - 1][1])["name"]); endif; ?> - <?php else: ?> - <?= school(time() + 86400 * $diff, true) ?> - <?php endif; ?> - </div> - </td> - </tr> - <tr class="planner-separator"></tr> - <?php - } - - if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/planner.json")) file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/planner.json", "{}"); - $cache = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/planner.json"), true); - - if (!isset($cache["content"]) || date('Y-m-d') !== $cache["day"]) { - ob_start(); ?> - - <style> - #ch-front-planner img { - border-radius: 5px; - } - - #planner { - margin-top: 10px; - border-collapse: collapse; - width: 100%; - } - - .planner-header { - font-weight: bold; - text-align: center; - } - - .planner-header td { - width: 50%; - } - - td { - border: 1px solid #404040; - padding: 5px 10px; - } - - .planner-day { - text-align: center; - color: rgba(255, 255, 255, .5); - font-weight: bold; - } - - .planner-end-of-day { - font-weight: normal; - } - - .planner-end-of-day td { - border-bottom-left-radius: 10px; - } - - .planner-separator { - height: 20px; - } - - .planner-member-id { - width: 10%; - text-align: right; - } - - .planner-link { - padding: 0; - } - - .planner-link a { - padding: 5px 10px; - display: block; - } - - .planner-add-link { - color: rgba(255, 255, 255, .75); - text-decoration: none; - cursor: pointer; - } - - .planner-add-link:hover { - color: rgba(255, 255, 255, .75); - } - - .planner-link:hover { - background-color: rgba(255, 255, 255, .125); - } - - .planner-link:active { - background-color: rgba(255, 255, 255, .25); - } - - .planner-add-icon { - filter: invert(1); - width: 24px; - vertical-align: middle; - opacity: .75; - } - - .planner-add-text { - vertical-align: middle; - } - - .modal-header { - border-bottom: 1px solid #353738; - } - - .modal-content { - border: 1px solid rgba(255, 255, 255, .2); - background-color: #111; - } - - .btn-close { - filter: invert(1); - } - - .list-group-item { - color: #fff; - background-color: #222; - border: 1px solid rgba(255, 255, 255, .125); - } - - .list-group-item.disabled { - color: #fff; - background-color: #222; - border-color: rgba(255, 255, 255, .125); - opacity: .75; - } - - .list-group-item:hover { - background-color: #252525; - color: #ddd; - } - - .list-group-item:active, .list-group-item:focus { - background-color: #272727; - color: #bbb; - } - - .member-link, .list-group-item-action { - cursor: pointer !important; - } - - .merge-mobile { - display: none; - } - - @media (max-width: 768px) { - .merge-desktop { - display: none; - } - - .merge-mobile { - display: inline; - } - } - - @media (max-width: 991px) { - .member-link-text { - display: none; - } - - .planner-link .member-link { - text-align: center; - } - } - - .member-link, .planner-link { - background-color: transparent !important; - } - - .member-link-inner, .planner-add-link-inner, .planner-add-link-cofronter-inner { - display: block; - padding: 3px 7px; - border-radius: 5px; - } - - .planner-add-link-cofronter-inner { - border-radius: 100%; - width: max-content; - margin-left: auto; - margin-right: auto; - } - - .planner-add-link-cofronter-inner .planner-add-icon { - margin-top: -2px; - } - - .member-link, .planner-add-link-inner, .planner-add-link-cofronter-inner { - padding: 2px 3px !important; - } - - .member-link:hover .member-link-inner, .planner-add-link:hover .planner-add-link-inner, .planner-add-link-cofronter:hover .planner-add-link-cofronter-inner { - background-color: rgba(255, 255, 255, .125); - } - - </style> - - <h2>Front planner</h2> - - <div class="alert alert-warning"> - <b>The fronting schedule will be removed on June 15<sup>th</sup>.</b> Due to internal discussion, we have decided to remove the fronting schedule as it is causing a lot of trouble inside the respective systems. Archives will be kept in the database. - </div> - - <table id="planner"> - <tbody> - <?php - - if (time() - 86400 < 1686787200) day("Yesterday", -1); - if (time() < 1686787200) day("Today", 0); - if (time() + 86400 < 1686787200) day("Tomorrow", 1); - if (time() + 86400 * 2 < 1686787200) day(date('l j', time() + 86400 * 2), 2); - if (time() + 86400 * 3 < 1686787200) day(date('l j', time() + 86400 * 3), 3); - if (time() + 86400 * 4 < 1686787200) day(date('l j', time() + 86400 * 4), 4); - if (time() + 86400 * 5 < 1686787200) day(date('l j', time() + 86400 * 5), 5); - if (time() + 86400 * 6 < 1686787200) day(date('l j', time() + 86400 * 6), 6); - if (time() + 86400 * 7 < 1686787200) day(date('l j', time() + 86400 * 7), 7); - if (time() + 86400 * 8 < 1686787200) day(date('l j', time() + 86400 * 8), 8); - if (time() + 86400 * 9 < 1686787200) day(date('l j', time() + 86400 * 9), 9); - if (time() + 86400 * 10 < 1686787200) day(date('l j', time() + 86400 * 10), 10); - if (time() + 86400 * 12 < 1686787200) day(date('l j', time() + 86400 * 11), 11); - if (time() + 86400 * 12 < 1686787200) day(date('l j', time() + 86400 * 12), 12); - - ?> - </tbody> - </table> - - <!--suppress JSUnresolvedVariable, JSUnresolvedFunction --> - <script> - window.currentWorkingDate; - window.fronting = JSON.parse(window.atob(`<?= base64_encode(json_encode([ - "raindrops" => $raindrops, - "cloudburst" => $cloudburst - ])) ?>`)); - window.names = JSON.parse(window.atob(`<?php - - $names = []; - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true) as $member) { - $names[$member['id']] = $member['display_name'] ?? $member['name']; - } - foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc/members.json"), true) as $member) { - $names[$member['id']] = $member['display_name'] ?? $member['name']; - } - - echo(base64_encode(json_encode($names))) ?>`)); - window.relations = JSON.parse(window.atob(`<?php - - $relations = []; - foreach (scoreOrderGlobal() as $member) { - $relations[$member['id']] = array_values(array_unique(array_map(function ($i) { - return explode("/", $i)[1]; - }, [...($member["_metadata"]["marefriends"] ?? []), ...($member["_metadata"]["sisters"] ?? []), ...($member["_metadata"]["caretakers"] ?? []), ...($member["_metadata"]["friends"] ?? []), ...($member["_metadata"]["sexfriends"] ?? [])]))); - } - - echo(base64_encode(json_encode($relations))) ?>`)); - - function getSuggestedPonies() { - if (window.fronting[window.addSystem === "gdapd" ? "cloudburst" : "raindrops"][window.currentWorkingDate][window.addIndex]) { - let otherPony = window.fronting[window.addSystem === "gdapd" ? "cloudburst" : "raindrops"][window.currentWorkingDate][window.addIndex][0]; - let availablePonies = window.relations[window.fronting[window.addSystem === "gdapd" ? "cloudburst" : "raindrops"][window.currentWorkingDate][window.addIndex][0]]; - - if (availablePonies) { - document.getElementById("associated-results").innerHTML = ""; - - for (let pony of availablePonies) { - if (document.getElementById("list-pony-" + pony)) { - document.getElementById("associated-results").innerHTML += document.getElementById("list-pony-" + pony).outerHTML; - } - } - - document.getElementById("list").style.display = "none"; - document.getElementById("associated-results").style.display = ""; - } - } - } - - function ordinal(n) { - let s = ["th", "st", "nd", "rd"]; - let v = n % 100; - return n + (s[(v - 20) % 10] || s[v] || s[0]); - } - - function openEditFronter(system, id, date) { - let display = formatDate(date).display; - - window.selectedFronting = { - system: system === "cloudburst" ? "ynmuc" : "gdapd", - date: date, - index: id - } - - if (fronting[system][date][id][0] === "lzlaq" || fronting[system][date][id][0] === "irxyh") { - document.getElementById("edit-fronter-name").innerText = "merged members"; - } else { - document.getElementById("edit-fronter-name").innerText = names[fronting[system][date][id][0]] ?? fronting[system][date][id][0] + " [" + fronting[system][date][id][0] + "]"; - } - - document.getElementById("edit-fronter-date").innerText = display; - document.getElementById("edit-fronter-pos").innerText = ordinal(id + 1); - document.getElementById("edit-fronter-system").innerText = system === "cloudburst" ? "Cloudburst System" : "Raindrops System"; - - let modal = new bootstrap.Modal(document.getElementById('edit-fronter')); - modal.show(); - } - - function openEditCofronter(system, id, date) { - let display = formatDate(date).display; - - window.selectedFronting = { - system: system === "cloudburst" ? "ynmuc" : "gdapd", - date: date, - index: id - } - - document.getElementById("edit-cofronter-name").innerText = names[fronting[system][date][id][1]] ?? fronting[system][date][id][1]; - document.getElementById("edit-cofronter-name2").innerText = names[fronting[system][date][id][0]] ?? fronting[system][date][id][0]; - - document.getElementById("edit-cofronter-date").innerText = display; - document.getElementById("edit-cofronter-pos").innerText = ordinal(id + 1); - document.getElementById("edit-cofronter-system").innerText = system === "cloudburst" ? "Cloudburst System" : "Raindrops System"; - - let modal = new bootstrap.Modal(document.getElementById('edit-cofronter')); - modal.show(); - } - - 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, - index: index - } - - window.currentWorkingDate = date; - document.getElementById("new-cofronter-date").innerText = display; - document.getElementById("new-cofronter-system").innerText = system === "cloudburst" ? "Cloudburst System" : "Raindrops System"; - window.addSystem = system === "raindrops" ? "gdapd" : "ynmuc"; - - if (fronting[system][date][index][0] === "lzlaq" || fronting[system][date][index][0] === "irxyh") { - document.getElementById("new-cofronter-main").innerText = "merged members"; - } else { - document.getElementById("new-cofronter-main").innerText = names[fronting[system][date][index][0]] ?? fronting[system][date][index][0]; - } - - document.getElementById("list2").style.display = "block"; - document.getElementById("search2-results").style.display = "none"; - document.getElementById("search2").value = ""; - - let modal = new bootstrap.Modal(document.getElementById('new-cofronter')); - modal.show(); - document.getElementById("search2").focus(); - } - - function addFronter(system, offset, index) { - let date = formatDate(offset).date; - let display = formatDate(offset).display; - - window.currentWorkingDate = date; - window.addIndex = index; - document.getElementById("new-fronter-date").innerText = display; - document.getElementById("new-fronter-system").innerText = system === "cloudburst" ? "Cloudburst System" : "Raindrops System"; - window.addSystem = system === "raindrops" ? "gdapd" : "ynmuc"; - - document.getElementById("list").style.display = "block"; - getSuggestedPonies(); - document.getElementById("search-results").style.display = "none"; - document.getElementById("search").value = ""; - - let modal = new bootstrap.Modal(document.getElementById('new-fronter')); - modal.show(); - document.getElementById("search").focus(); - } - - function confirmFronterAdd(system, id) { - Array.from(document.getElementsByClassName("new-fronter-link")).forEach((i) => { - i.classList.add("disabled"); - }); - - document.getElementById("new-fronter-close").classList.add("disabled"); - - window.fetch("/api/fronter?t=add&d=" + window.currentWorkingDate + "&m=" + id + "&s=" + system).then(() => { - location.reload(); - }); - } - - function confirmCofronterAdd(system, id) { - Array.from(document.getElementsByClassName("new-cofronter-link")).forEach((i) => { - i.classList.add("disabled"); - }); - - document.getElementById("new-cofronter-close").classList.add("disabled"); - - window.fetch("/api/fronter?t=cofront&d=" + window.selectedFronting["date"] + "&m=" + id + "&s=" + system + "&i=" + window.selectedFronting["index"]).then(() => { - location.reload(); - }); - } - - function deleteFronter() { - Array.from(document.getElementsByClassName("edit-fronter-link")).forEach((i) => { - i.classList.add("disabled"); - }); - - document.getElementById("edit-fronter-close").classList.add("disabled"); - - window.fetch("/api/fronter?t=delete&d=" + window.selectedFronting["date"] + "&i=" + window.selectedFronting["index"] + "&s=" + window.selectedFronting["system"]).then(() => { - location.reload(); - }); - } - - function deleteCofronter() { - Array.from(document.getElementsByClassName("edit-cofronter-link")).forEach((i) => { - i.classList.add("disabled"); - }); - - document.getElementById("edit-cofronter-close").classList.add("disabled"); - - window.fetch("/api/fronter?t=codelete&d=" + window.selectedFronting["date"] + "&i=" + window.selectedFronting["index"] + "&s=" + window.selectedFronting["system"]).then(() => { - location.reload(); - }); - } - - function moveFronterDown() { - Array.from(document.getElementsByClassName("edit-fronter-link")).forEach((i) => { - i.classList.add("disabled"); - }); - - document.getElementById("edit-fronter-close").classList.add("disabled"); - - window.fetch("/api/fronter?t=down&d=" + window.selectedFronting["date"] + "&i=" + window.selectedFronting["index"] + "&s=" + window.selectedFronting["system"]).then(() => { - location.reload(); - }); - } - - function moveFronterBottom() { - Array.from(document.getElementsByClassName("edit-fronter-link")).forEach((i) => { - i.classList.add("disabled"); - }); - - document.getElementById("edit-fronter-close").classList.add("disabled"); - - window.fetch("/api/fronter?t=bottom&d=" + window.selectedFronting["date"] + "&i=" + window.selectedFronting["index"] + "&s=" + window.selectedFronting["system"]).then(() => { - location.reload(); - }); - } - - function viewFronterPage() { - let id = fronting[window.selectedFronting["system"] === "ynmuc" ? "cloudburst" : "raindrops"][window.selectedFronting["date"]][window.selectedFronting["index"]][0]; - location.href = "/" + id; - } - - function viewCofronterPage() { - let id = fronting[window.selectedFronting["system"] === "ynmuc" ? "cloudburst" : "raindrops"][window.selectedFronting["date"]][window.selectedFronting["index"]][1]; - location.href = "/" + id; - } - - function moveFronterUp() { - Array.from(document.getElementsByClassName("edit-fronter-link")).forEach((i) => { - i.classList.add("disabled"); - }); - - document.getElementById("edit-fronter-close").classList.add("disabled"); - - window.fetch("/api/fronter?t=up&d=" + window.selectedFronting["date"] + "&i=" + window.selectedFronting["index"] + "&s=" + window.selectedFronting["system"]).then(() => { - location.reload(); - }); - } - - function moveFronterTop() { - Array.from(document.getElementsByClassName("edit-fronter-link")).forEach((i) => { - i.classList.add("disabled"); - }); - - document.getElementById("edit-fronter-close").classList.add("disabled"); - - window.fetch("/api/fronter?t=top&d=" + window.selectedFronting["date"] + "&i=" + window.selectedFronting["index"] + "&s=" + window.selectedFronting["system"]).then(() => { - location.reload(); - }); - } - </script> - - <div class="modal" id="new-fronter" data-bs-backdrop="static" data-bs-keyboard="false"> - <div class="modal-dialog"> - <div class="modal-content"> - - <div class="modal-header"> - <h4 class="modal-title">Add new fronter <span id="new-fronter-date">n/a</span></h4> - <button id="new-fronter-close" type="button" class="btn-close" data-bs-dismiss="modal"></button> - </div> - - <div class="modal-body"> - <p class="text-muted">Adding for the <span id="new-fronter-system">n/a</span></p> - - <input type="text" placeholder="Search for a pony..." class="form-control" style="margin-bottom:15px;color:white;background:#111;border-color:#222;" id="search"> - - <div id="list"> - <div class="list-group"> - <?php foreach (array_filter(scoreOrderGlobal(), function ($i) { return $i["system"] === "gdapd" || $i["system"] === "ynmuc"; }) as $member): ?> - <a id="list-pony-<?= $member['id'] ?>" onclick="confirmFronterAdd(window.addSystem, '<?= $member['id'] ?>');" class="new-fronter-link list-group-item list-group-item-action"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?> [<?= $member["id"] ?>]<peh-schedule-add></peh-schedule-add></a> - <?php endforeach; $member = getSystemMember("gdapd", "irxyh") ?> - <a id="list-pony-irxyh" onclick="confirmFronterAdd(window.addSystem, 'irxyh');" class="new-fronter-link list-group-item list-group-item-action"><img src="/assets/logo/newlogo3.png" style="filter:grayscale(1);width:24px;"> <span style="opacity:.75">Multiple merged members</span></a> - <a id="list-pony-zdtsg" onclick="confirmFronterAdd(window.addSystem, 'zdtsg');" class="new-fronter-link list-group-item list-group-item-action"><img src="/assets/logo/newlogo3.png" style="filter:grayscale(1);width:24px;"> <span style="opacity:.75">Other/unknown</span></a> - </div> - </div> - - <div id="search-results" class="list-group"></div> - <div id="associated-results" class="list-group"></div> - </div> - - </div> - </div> - </div> - - <div class="modal" id="new-cofronter" data-bs-backdrop="static" data-bs-keyboard="false"> - <div class="modal-dialog"> - <div class="modal-content"> - - <div class="modal-header"> - <h4 class="modal-title">Add new co-fronter <span id="new-cofronter-date">n/a</span> with <span id="new-cofronter-main">n/a</span></h4> - <button id="new-cofronter-close" type="button" class="btn-close" data-bs-dismiss="modal"></button> - </div> - - <div class="modal-body"> - <p class="text-muted">Adding for the <span id="new-cofronter-system">n/a</span></p> - - <input type="text" placeholder="Search for a pony..." class="form-control" style="margin-bottom:15px;color:white;background:#111;border-color:#222;" id="search2"> - - <div id="list2"> - <div class="list-group"> - <?php foreach (array_filter(scoreOrderGlobal(), function ($i) { return $i["system"] === "gdapd" || $i["system"] === "ynmuc"; }) as $member): ?> - <a id="list2-pony-<?= $member['id'] ?>" onclick="confirmCofronterAdd(window.addSystem, '<?= $member['id'] ?>');" class="new-cofronter-link list-group-item list-group-item-action"><img src="<?= getAsset($member["system"], $member["id"], "heads") ?>" style="width:24px;"> <?= $member["display_name"] ?? $member["name"] ?><peh-schedule-add></peh-schedule-add></a> - <?php endforeach; $member = getSystemMember("gdapd", "irxyh") ?> - </div> - </div> - - <div id="search2-results" class="list-group"></div> - </div> - - </div> - </div> - </div> - - <div class="modal" id="edit-fronter" data-bs-backdrop="static" data-bs-keyboard="false"> - <div class="modal-dialog"> - <div class="modal-content"> - - <div class="modal-header"> - <h4 class="modal-title">Edit <span id="edit-fronter-name">n/a</span> fronting in <span id="edit-fronter-pos">n/a</span> <span id="edit-fronter-date">n/a</span></h4> - <button id="edit-fronter-close" type="button" class="btn-close" data-bs-dismiss="modal"></button> - </div> - - <div class="modal-body"> - <p class="text-muted">Editing for the <span id="edit-fronter-system">n/a</span></p> - - <div class="list-group" id="list-cloudburst"> - <a class="list-group-item list-group-item-action edit-fronter-link <?= $isLowerLoggedIn ? "disabled" : "" ?>" onclick="deleteFronter();"> - <img src="/assets/icons/delete.svg" style="width:24px;filter:invert(1);vertical-align: middle;"> - <span style="vertical-align: middle;">Delete</span> - </a> - <a class="list-group-item list-group-item-action edit-fronter-link <?= $isLowerLoggedIn ? "disabled" : "" ?>" onclick="moveFronterTop();"> - <img src="/assets/icons/top.svg" style="width:24px;filter:invert(1);vertical-align: middle;"> - <span style="vertical-align: middle;">Move to the top</span> - </a> - <a class="list-group-item list-group-item-action edit-fronter-link <?= $isLowerLoggedIn ? "disabled" : "" ?>" onclick="moveFronterUp();"> - <img src="/assets/icons/up.svg" style="width:24px;filter:invert(1);vertical-align: middle;"> - <span style="vertical-align: middle;">Move up</span> - </a> - <a class="list-group-item list-group-item-action edit-fronter-link <?= $isLowerLoggedIn ? "disabled" : "" ?>" onclick="moveFronterDown();"> - <img src="/assets/icons/down.svg" style="width:24px;filter:invert(1);vertical-align: middle;"> - <span style="vertical-align: middle;">Move down</span> - </a> - <a class="list-group-item list-group-item-action edit-fronter-link <?= $isLowerLoggedIn ? "disabled" : "" ?>" onclick="moveFronterBottom();"> - <img src="/assets/icons/bottom.svg" style="width:24px;filter:invert(1);vertical-align: middle;"> - <span style="vertical-align: middle;">Move to the bottom</span> - </a> - <a class="list-group-item list-group-item-action edit-fronter-link" onclick="viewFronterPage();"> - <img src="/assets/icons/page.svg" style="width:24px;filter:invert(1);vertical-align: middle;"> - <span style="vertical-align: middle;">View page</span> - </a> - </div> - </div> - - </div> - </div> - </div> - - <div class="modal" id="edit-cofronter" data-bs-backdrop="static" data-bs-keyboard="false"> - <div class="modal-dialog"> - <div class="modal-content"> - - <div class="modal-header"> - <h4 class="modal-title">Edit <span id="edit-cofronter-name">n/a</span> fronting with <span id="edit-cofronter-name2">n/a</span> in <span id="edit-cofronter-pos">n/a</span> <span id="edit-cofronter-date">n/a</span></h4> - <button id="edit-cofronter-close" type="button" class="btn-close" data-bs-dismiss="modal"></button> - </div> - - <div class="modal-body"> - <p class="text-muted">Editing for the <span id="edit-cofronter-system">n/a</span></p> - - <div class="list-group" id="list-cloudburst"> - <a class="list-group-item list-group-item-action edit-cofronter-link <?= $isLowerLoggedIn ? "disabled" : "" ?>" onclick="deleteCofronter();"> - <img src="/assets/icons/delete.svg" style="width:24px;filter:invert(1);vertical-align: middle;"> - <span style="vertical-align: middle;">Delete</span> - </a> - <a class="list-group-item list-group-item-action edit-cofronter-link" onclick="viewCofronterPage();"> - <img src="/assets/icons/page.svg" style="width:24px;filter:invert(1);vertical-align: middle;"> - <span style="vertical-align: middle;">View page</span> - </a> - </div> - </div> - - </div> - </div> - </div> - - <script src="/assets/editor/fuse.js"></script> - <!--suppress JSUnresolvedFunction --> - <script> - window.poniesList = JSON.parse(atob(`<?= base64_encode(json_encode(array_values(scoreOrderGlobal()))) ?>`)); - - const fuse = new Fuse(window.poniesList, { - includeScore: true, - keys: [ - { - name: 'name', - weight: 1 - }, - { - name: 'display_name', - weight: 1 - }, - { - name: 'id', - weight: 0.7 - }, - { - name: 'species', - weight: 0.5 - } - ] - }) - - function search(event) { - if (event.key === "Enter") { - return; - } - - let query = document.getElementById("search").value; - let results = fuse.search(query).map((i) => { - return { - id: i.item.id, - score: i.score - }; - }); - - let unfiltered = results; - - results = results.filter((i) => { - return i.score < 0.7; - }); - - console.log("Before:", unfiltered, "After:", results); - - document.getElementById("list").style.display = "none"; - document.getElementById("search-results").style.display = "block"; - document.getElementById("search-results").innerHTML = ""; - - for (let result of results) { - if (document.getElementById("list-pony-" + result.id)) document.getElementById("search-results").innerHTML += document.getElementById("list-pony-" + result.id).outerHTML; - } - - console.log(results); - - if (query.trim() === "") { - document.getElementById("list").style.display = "block"; - getSuggestedPonies(); - document.getElementById("search-results").style.display = "none"; - } - } - - document.getElementById("search").onchange = document.getElementById("search").onkeyup = document.getElementById("search").onkeydown = search; - - document.getElementById("search").addEventListener("keydown", (event) => { - if (event.key === "Enter") { - document.querySelector("#search-results .new-fronter-link").click(); - event.preventDefault(); - } - }); - - function search2(event) { - if (event.key === "Enter") { - return; - } - - let query = document.getElementById("search2").value; - let results = fuse.search(query).map((i) => { - return { - id: i.item.id, - score: i.score - }; - }); - - let unfiltered = results; - - results = results.filter((i) => { - return i.score < 0.7; - }); - - console.log("Before:", unfiltered, "After:", results); - - document.getElementById("list2").style.display = "none"; - document.getElementById("search2-results").style.display = "block"; - document.getElementById("search2-results").innerHTML = ""; - - for (let result of results) { - document.getElementById("search2-results").innerHTML += document.getElementById("list2-pony-" + result.id).outerHTML; - } - - console.log(results); - - if (query.trim() === "") { - document.getElementById("list2").style.display = "block"; - document.getElementById("search2-results").style.display = "none"; - } - } - - document.getElementById("search2").onchange = document.getElementById("search2").onkeyup = document.getElementById("search2").onkeydown = search2; - - document.getElementById("search2").addEventListener("keydown", (event) => { - if (event.key === "Enter") { - document.querySelector("#search2-results .new-cofronter-link").click(); - event.preventDefault(); - } - }); - </script> - - <?php - - $cache["content"] = ob_get_contents(); - $cache["day"] = date('Y-m-d'); - ob_end_clean(); - } - - echo($cache["content"]); - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/planner.json", json_encode($cache)); - - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/ynmuc.json", json_encode($cloudburst)); - file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/planner/gdapd.json", json_encode($raindrops)); - - ?> -</div>
\ No newline at end of file |