diff options
Diffstat (limited to 'includes/header.php')
-rw-r--r-- | includes/header.php | 719 |
1 files changed, 719 insertions, 0 deletions
diff --git a/includes/header.php b/includes/header.php new file mode 100644 index 0000000..af12bcb --- /dev/null +++ b/includes/header.php @@ -0,0 +1,719 @@ +<?php global $title; + +require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/score.php"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; + +function getMiniName(string $name) { + $parts = explode(" ", $name); + + if (strlen($parts[0]) > 3 && !str_ends_with($parts[0], "e") && $parts[0] !== "Filly") { + if (str_contains($parts[0], "/")) { + return explode("/", $parts[0])[0]; + } else { + return $parts[0]; + } + } else { + return $name; + } +} + +function getSystemMember(string $system, string $id) { + $systemID = $system; + + $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-members.json"), true); + $member = null; + + foreach ($members as $m) { + if ($m["id"] === $id) $member = $m; + } + + return $member; +} + +function getBrightness(string $hexCode) { + if (str_starts_with("#", $hexCode)) { + $hexCode = substr($hexCode, 1); + } + + $red = hexdec(substr($hexCode, 0, 2)); + $green = hexdec(substr($hexCode, 2, 2)); + $blue = hexdec(substr($hexCode, 4, 2)); + $brightness = $red + $green + $blue; + + return $brightness > 382; +} + +function showMembersFromList(array $list, string $id) { + foreach ($list as $member) { if ($member['name'] !== "unknown") { + echo('<!-- ' . ($member['display_name'] ?? $member['name']) . ' --> +<a href="/' . ($id === "gdapd" ? "raindrops" : "cloudburst") . '/' . $member['name'] . '" style="text-decoration:none !important;filter:none !important;"><div class="hpd-item-card" style="background-color:rgba(255, 255, 255, .1);border-radius:10px;text-align:center;display:flex;align-items:center;justify-content:center;padding:5px;"><div> +<img alt="" src="/assets/uploads/pt' . (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "") . '.png" style="height:48px;display:block;margin-left:auto;margin-right:auto;"> +<div style="text-decoration:none;color:white;margin-top:5px;">' . ($member['display_name'] ?? $member['name']) . '</div> +<div style="text-decoration:none !important;color:black !important;"><code style="text-decoration:none !important;color:white !important;">' . $member['proxy_tags'][0]['prefix'] . '</code></div> +</div></div></a>'); + }} +} + +function showSubsystem(array $data, string $parentSystem) { + $subsystemData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$parentSystem-subsystem-$data[source].json"), true); + + echo('<!-- ' . $subsystemData["name"] . ' --> +<div id="hpd-cloudburst" style="background:rgba(255, 255, 255, .1);border-radius:10px;padding:10px;display:grid;grid-template-columns: 1fr;margin-bottom:10px;">'); + echo(' <div style="display:grid;grid-template-columns:repeat(6, 1fr);grid-gap:10px;">'); + + showMembersFromList(scoreOrder(array_map(function ($i) use ($parentSystem) { + return getSystemMember($parentSystem, $i); + }, $data["members"]), $parentSystem), $parentSystem); + + echo('</div> + +</div>'); +} + +function showSystem(string $id, string $name, string $color, bool $hideTitle) { + if ($hideTitle) { + echo('<!-- ' . $name . ' --> +<div id="hpd-' . ($id === "gdapd" ? "raindrops" : "cloudburst") . '" style="background:rgba(255, 255, 255, .1);border-radius:10px;padding:10px;display:grid;grid-template-columns: 1fr;margin-bottom:10px;">'); + } else { + echo('<!-- ' . $name . ' --> +<div id="hpd-' . ($id === "gdapd" ? "raindrops" : "cloudburst") . '" style="background:rgba(255, 255, 255, .1);border-radius:10px;padding:10px 10px 10px 20px;display:grid;grid-template-columns: 128px 1fr;margin-bottom:10px;">'); + } + + if (!$hideTitle) echo('<!-- System Name --> +<a style="display:flex;margin: -10px -20px;align-items:center;justify-content:center;text-align:center;padding: 10px 20px;border-radius: 10px;background: ' . $color . ';width: 148px;text-decoration:none;color:white;filter:none !important;" href="/' . ($id === "gdapd" ? "raindrops" : "cloudburst") . '" class="hpd-system"> +' . $name . ' +</a>'); + + if ($hideTitle) { + echo(' <div style="display:grid;grid-template-columns:repeat(6, 1fr);grid-gap:10px;">'); + } else { + echo(' <div style="display:grid;grid-template-columns:repeat(6, 1fr);padding-left:10px;grid-gap:10px;">'); + } + + showMembersFromList(scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$id-members.json"), true), $id), $id); + + echo('</div> + +</div>'); +} + +function cloudburst(bool $hideTitle): void { + showSystem("ynmuc", "Cloudburst System", "#5f08a9a6", $hideTitle); +} + +function raindrops(bool $hideTitle): void { + showSystem("gdapd", "Raindrops System", "#a95f08a6", $hideTitle); +} + +?> +<!doctype html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"> + <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script> + <title><?= $title ? $title . " ยท " : "" ?>Cuties and Plurality</title> + <link rel="shortcut icon" href="/assets/uploads/logo.jpg" type="image/jpg"> + <style> + nav.navbar { + background-color: black !important; + border-bottom: 1px solid rgba(255, 255, 255, .25); + } + + body { + background-color: black !important; + color: white; + } + + .hpd-item-card:hover { + background-color: rgba(255, 255, 255, .15) !important; + } + + .hpd-item-card:active, .hpd-item-card:focus { + background-color: rgba(255, 255, 255, .2) !important; + } + + .hpd-system:hover { + opacity: .9 !important; + } + + .hpd-system:active, .hpd-system:focus { + opacity: .8 !important; + } + + .hpd-link:hover { + background-color: rgba(255, 255, 255, .15) !important; + } + + .hpd-link:active, .hpd-link:focus { + background-color: rgba(255, 255, 255, .2) !important; + } + + .list-separator-mobile { + display: none; + } + + @media (max-width: 991px) { + #hpd-cloudburst > div, #hpd-raindrops > div { + grid-template-columns: repeat(3, 1fr) !important; + } + + .list-separator-desktop { + display: none; + } + + span.list-separator-mobile { + display: inline; + } + } + + @media (max-width: 768px) { + #hpd-cloudburst > div, #hpd-raindrops > div { + grid-template-columns: repeat(2, 1fr) !important; + } + } + + @media (max-width: 575px) { + #hpd-cloudburst > div, #hpd-raindrops > div { + grid-template-columns: repeat(1, 1fr) !important; + } + + .hpd-item-card img { + display: inline-block !important; + margin-right: 5px !important; + height: 32px !important; + } + + #hpd-cloudburst > div, #hpd-raindrops > div { + grid-gap: 5px !important; + } + + .hpd-item-card div { + display: inline-block !important; + } + + .hpd-item-card div:nth-child(3)::before { + content: "("; + padding-left: 5px; + color: white !important; + } + + .hpd-item-card div:nth-child(3)::after { + content: ")"; + color: white !important; + } + } + + .dropdown-menu { + background-color: #222; + } + + .dropdown-item:hover { + background-color: rgba(255, 255, 255, .1); + } + + .dropdown-item:active, .dropdown-item:focus { + background-color: rgba(255, 255, 255, .2); + } + + .dropdown-item { + color: white !important; + } + + .dropdown-icon { + filter: invert(1); + } + + .dropdown-toggle .dropdown-icon { + opacity: .5; + transition: 200ms opacity; + } + + .dropdown-toggle:hover .dropdown-icon, .dropdown-toggle:active .dropdown-icon, .dropdown-toggle:focus .dropdown-icon { + opacity: .75; + } + + dd { + margin-left: 20px; + } + + #system-info a { + color: white; + } + + #system-info a:hover { + opacity: .75; + } + + #system-info a:active, #system-info a:focus { + opacity: .5; + } + + @media (max-width: 991px) { + #member-card { + grid-template-columns: repeat(3, 1fr) !important; + } + + .species-name { + display: none; + } + } + + @media (max-width: 767px) { + #member-card { + grid-template-columns: 1fr !important; + text-align: left; + } + } + + #page-content a { + color: #afd0ff; + } + + #page-content a:hover { + opacity: .75; + } + + #page-content a:active, #page-content a:focus { + opacity: .5; + } + + .tooltip.show { + opacity: 1; + } + + .tooltip-inner { + background: #151515; + box-shadow: 3px 4px 10px #ffffff26; + } + + .alert { + filter: invert(1) hue-rotate(180deg); + } + + .member-link { + color: white !important; + text-decoration: none !important; + } + + .system-action { + border-radius: 10px; + color: white !important; + text-decoration: none !important; + cursor: pointer; + } + + .system-action:hover { + background:rgba(255, 255, 255, .1); + } + + .table-dark { + --bs-table-bg: #000000; + } + + .comparison { + display: grid; + grid-template-columns: 3fr repeat(2, 2fr) repeat(5, 1fr); + } + + .comparison-header { + border-bottom: 2px solid rgba(255, 255, 255, .25); + font-weight: bold; + } + + .comparison-item { + padding: 5px 10px; + text-align: center; + } + + .comparison-item-clickable:hover { + background-color: rgba(255, 255, 255, .1); + } + + .comparison-item-clickable:active, .comparison-item-clickable:focus { + background-color: rgba(255, 255, 255, .25); + } + + @media (min-width: 1400px) { + .comparison-header-l0 { + display: inline; + } + .comparison-header-l1 { + display: none; + } + .comparison-header-l2 { + display: none; + } + .comparison-header-l3 { + display: none; + } + .comparison-header-l4 { + display: none; + } + .comparison-header-l5 { + display: none; + } + .comparison-name-full { + display: inline; + } + .comparison-name-small { + display: none; + } + .comparison-colors { + display: inline; + } + .comparison-relations-count { + display: none; + } + .comparison-relations-full { + display: inline; + } + } + + @media (max-width: 1399px) { + .comparison-header-l0 { + display: none; + } + .comparison-header-l1 { + display: inline; + } + .comparison-header-l2 { + display: none; + } + .comparison-header-l3 { + display: none; + } + .comparison-header-l4 { + display: none; + } + .comparison-header-l5 { + display: none; + } + .comparison-name-full { + display: inline; + } + .comparison-name-small { + display: none; + } + .comparison-colors { + display: inline; + } + .comparison-relations-count { + display: none; + } + .comparison-relations-full { + display: inline; + } + } + + @media (max-width: 1199px) { + .comparison-header-l0 { + display: none; + } + .comparison-header-l1 { + display: none; + } + .comparison-header-l2 { + display: initial; + } + .comparison-header-l3 { + display: none; + } + .comparison-header-l4 { + display: none; + } + .comparison-header-l5 { + display: none; + } + .comparison-name-full { + display: none; + } + .comparison-name-small { + display: inline; + } + .comparison-colors { + display: inline; + } + .comparison-relations-count { + display: inline; + } + .comparison-relations-full { + display: none; + } + } + + @media (max-width: 991px) { + .comparison-header-l0 { + display: none; + } + .comparison-header-l1 { + display: none; + } + .comparison-header-l2 { + display: none; + } + .comparison-header-l3 { + display: initial; + } + .comparison-header-l4 { + display: none; + } + .comparison-header-l5 { + display: none; + } + .comparison-name-full { + display: none; + } + .comparison-name-small { + display: inline; + } + .comparison-colors { + display: none !important; + } + .comparison-relations-count { + display: inline; + } + .comparison-relations-full { + display: none; + } + } + + @media (max-width: 767px) { + .comparison-header-l0 { + display: none; + } + .comparison-header-l1 { + display: none; + } + .comparison-header-l2 { + display: none; + } + .comparison-header-l3 { + display: none; + } + .comparison-header-l4 { + display: initial; + } + .comparison-header-l5 { + display: none; + } + .comparison-name-full { + display: none; + } + .comparison-name-small { + display: none; + } + .comparison-colors { + display: none !important; + } + .comparison-relations-count { + display: inline; + } + .comparison-relations-full { + display: none; + } + } + + @media (max-width: 575px) { + .comparison-header-l0 { + display: none; + } + .comparison-header-l1 { + display: none; + } + .comparison-header-l2 { + display: none; + } + .comparison-header-l3 { + display: none; + } + .comparison-header-l4 { + display: none; + } + .comparison-header-l5 { + display: initial; + } + .comparison-name-full { + display: none; + } + .comparison-name-small { + display: none; + } + .comparison-colors { + display: none !important; + } + .comparison { + grid-template-columns: repeat(3, 2fr) repeat(5, 1fr) !important; + } + .comparison-relations-count { + display: inline; + } + .comparison-relations-full { + display: none; + } + } + + .tree-first-separator { + height: 14px !important; + top: 0 !important; + } + + .tree-l0-separator { + display: inline-block; + width: 20px; + margin-left: 35px; + border-bottom: 1px solid white; + border-left: 1px solid white; + height: 26px; + position: relative; + top: -12px; + } + + .tree-l1 .tree-l0-separator { + border-bottom: none !important; + } + + .tree-l1-separator { + display: inline-block; + width: 20px; + margin-left: 35px; + border-bottom: 1px solid white; + border-left: 1px solid white; + height: 26px; + position: relative; + top: -12px; + left: -10px; + } + + .tree-l1 .tree-l0-separator { + width: 30px; + } + + .tree-l1 .tree-inner { + position: relative; + left: -10px; + } + + .tree-inner { + display: inline-block; + } + </style> +</head> +<body> + <nav class="navbar navbar-expand-md bg-dark navbar-dark"> + <div class="container-fluid"> + <a class="navbar-brand" href="/"><img src="/assets/uploads/logo.jpg" alt="" style="width:32px;vertical-align: middle;margin-right:5px;"> <span style="vertical-align: middle;">Cuties and Plurality</span><a> + <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#collapsibleNavbar"> + <span class="navbar-toggler-icon"></span> + </button> + <div class="collapse navbar-collapse" id="collapsibleNavbar"> + <ul class="navbar-nav"> + <li class="nav-item dropdown"> + <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"> + <img src="<?= $isLoggedIn ? "/assets/icons/loggedin.svg" : "/assets/icons/global.svg" ?>" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">Global</span> + </a> + <ul class="dropdown-menu"> + <?php if ($isLoggedIn): ?> + <li><a class="dropdown-item" href="/emergency"> + <img src="/assets/icons/emergency.svg" alt="" style="width:24px;vertical-align: middle;"> + <span class="text-danger" style="vertical-align: middle;">Emergency Alert</span> + </a></li> + <li><hr class="dropdown-divider"></li> + <?php endif; ?> + <li><a class="dropdown-item" href="/"> + <img src="/assets/icons/home.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">Home</span> + </a></li> + <li><a class="dropdown-item" href="/disclaimers"> + <img src="/assets/icons/disclaimers.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">Disclaimers</span> + </a></li> + <li><a class="dropdown-item" href="/relations"> + <img src="/assets/icons/relations.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">Relations</span> + </a></li> + <li><a class="dropdown-item" href="/terminology"> + <img src="/assets/icons/terminology.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">Terminology</span> + </a></li> + <li><hr class="dropdown-divider"></li> + <li><h5 class="dropdown-header">Tools</h5></li> + <li><a class="dropdown-item" href="/parser"> + <img src="/assets/icons/parser.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">Message Parser</span> + </a></li> + <li><a class="dropdown-item" href="/prefix"> + <img src="/assets/icons/prefix.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">Prefix Generator</span> + </a></li> + <li><hr class="dropdown-divider"></li> + <li><h5 class="dropdown-header">Administrator</h5></li> + <?php if ($isLoggedIn): ?> + <li><a class="dropdown-item" href="/fronting"> + <img src="/assets/icons/fronting.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">Front Planner</span> + </a></li> + <li><a class="dropdown-item" href="/score"> + <img src="/assets/icons/score.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">Score System Testing</span> + </a></li> + <li><a class="dropdown-item" href="/logout"> + <img src="/assets/icons/logout.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">Logout</span> + </a></li> + <?php else: ?> + <li><a class="dropdown-item" href="/login"> + <img src="/assets/icons/login.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">Login</span> + </a></li> + <?php endif; ?> + </ul> + </li> + <?php if (!isset($emergencyHeader) || !$emergencyHeader): ?> + <li class="nav-item dropdown"> + <a class="nav-link dropdown-toggle" href="/cloudburst" role="button" data-bs-toggle="dropdown"> + <img src="/assets/uploads/cloudburst.png" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">Cloudburst System</span> + </a> + <ul class="dropdown-menu"> + <li><a class="dropdown-item" href="/cloudburst"> + <img src="/assets/icons/about.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">About us</span> + </a></li> + <li><hr class="dropdown-divider"></li> + <li><h5 class="dropdown-header">Members (<?= count(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true)) - 1 ?>)</h5></li> + <?php foreach (scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true), "ynmuc") as $member): if ($member['name'] !== "unknown"): ?> + <li><a class="dropdown-item" href="/cloudburst/<?= $member['name'] ?>"> + <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;"><?= $member['display_name'] ?? $member['name'] ?></span> + </a></li> + <?php endif; endforeach; ?> + </ul> + </li> + <li class="nav-item dropdown"> + <a class="nav-link dropdown-toggle" href="/raindrops" role="button" data-bs-toggle="dropdown"> + <img src="/assets/uploads/raindrops.png" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">Raindrops System</span> + </a> + <ul class="dropdown-menu"> + <li><a class="dropdown-item" href="/raindrops"> + <img src="/assets/icons/about.svg" class="dropdown-icon" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;">About us</span> + </a></li> + <li><hr class="dropdown-divider"></li> + <li><h5 class="dropdown-header">Members (<?= count(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true)) - 1 ?>)</h5></li> + <?php foreach (scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true), "gdapd") as $member): if ($member['name'] !== "unknown"): ?> + <li><a class="dropdown-item" href="/raindrops/<?= $member['name'] ?>"> + <img src="/assets/uploads/pt<?= file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/uploads/pt-" . $member['name'] . ".png") ? "-" . $member['name'] : "" ?>.png" alt="" style="width:24px;vertical-align: middle;"> + <span style="vertical-align: middle;"><?= $member['display_name'] ?? $member['name'] ?></span> + </a></li> + <?php endif; endforeach; ?> + </ul> + </li> + <?php endif; ?> + </ul> + </div> + </div> + </nav>
\ No newline at end of file |