diff options
-rw-r--r-- | includes/components/timeline.inc | 14 | ||||
-rw-r--r-- | pages/api/violette.php | 23 |
2 files changed, 32 insertions, 5 deletions
diff --git a/includes/components/timeline.inc b/includes/components/timeline.inc index 0ec8870..1a34550 100644 --- a/includes/components/timeline.inc +++ b/includes/components/timeline.inc @@ -52,9 +52,13 @@ function displayTimeline($systems) { global $app; $showIcons = count($systems) > $correct = $switches[$index - 1]; $v = floor((strtotime($switch["timestamp"]) - $time) / 60); - echo('<td style="max-width: 100%; overflow: hidden; text-align: left; white-space: nowrap; padding: 0 15px; height: ' . 50 / count($systems) . 'px; background-color: #' . (getMemberWithoutSystem($correct["members"][0])["color"] ?? "000000") . '80;" colspan="' . ($v > $leftCols ? $leftCols : $v) . '"><a style="color: white; cursor: pointer; text-decoration: none; width: 100%; display: flex; height: ' . 50 / count($systems) . 'px; align-items: center; justify-content: left;" href="/' . getMemberWithoutSystem($correct["members"][0])["name"] . '">' . implode(", ", array_map(function ($i) { - return getMemberWithoutSystem($i)["display_name"] ?? getMemberWithoutSystem($i)["name"] ?? $i; - }, $correct["members"])) . '</a></td>'); + if (count($correct["members"]) > 0) { + echo('<td style="max-width: 100%; overflow: hidden; text-align: left; white-space: nowrap; padding: 0 15px; height: ' . 50 / count($systems) . 'px; background-color: #' . (getMemberWithoutSystem($correct["members"][0])["color"] ?? "000000") . '80;" colspan="' . ($v > $leftCols ? $leftCols : $v) . '"><a style="color: white; cursor: pointer; text-decoration: none; width: 100%; display: flex; height: ' . 50 / count($systems) . 'px; align-items: center; justify-content: left;" href="/' . getMemberWithoutSystem($correct["members"][0])["name"] . '">' . implode(", ", array_map(function ($i) { + return getMemberWithoutSystem($i)["display_name"] ?? getMemberWithoutSystem($i)["name"] ?? $i; + }, $correct["members"])) . '</a></td>'); + } else { + echo('<td style="max-width: 100%; overflow: hidden; text-align: left; white-space: nowrap; padding: 0 15px; height: ' . 50 / count($systems) . 'px; background-color: transparent;" colspan="' . ($v > $leftCols ? $leftCols : $v) . '"></td>'); + } $leftCols -= $v; if ($leftCols < 0) $leftCols = 0; $time = strtotime($switch["timestamp"]); @@ -80,8 +84,8 @@ function displayTimeline($systems) { global $app; $showIcons = count($systems) > <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">-5h</td> <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">-4h</td> <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">-3h</td> - <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">-2</td> - <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">-1</td> + <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">-2h</td> + <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">-1h</td> <td colspan="60" style="text-align: right; padding-right: 10px; border-right: 1px solid rgba(255, 255, 255, 0.5);">Now</td> </tr> <tr> diff --git a/pages/api/violette.php b/pages/api/violette.php new file mode 100644 index 0000000..c1e3da8 --- /dev/null +++ b/pages/api/violette.php @@ -0,0 +1,23 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; + +$data = [ + "count" => 0, + "ponies" => [] +]; + +$list = scoreOrder(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true), "gdapd"); + +$data["count"] = count($list); +$data["ponies"] = array_values(array_filter(array_map(function ($i) { + return [ + "url" => "https://ponies.equestria.horse" . getAsset("gdapd", $i["id"] ?? "", "heads"), + "label" => $i["display_name"] ?? $i["name"] + ]; +}, $list), function ($i) { + return isset($i["url"]) && getAsset("gdapd", $i["id"] ?? "", "heads") !== null; +})); + +header("Content-Type: application/json"); +die(json_encode($data, JSON_PRETTY_PRINT));
\ No newline at end of file |