diff options
Diffstat (limited to 'includes/footer.php')
-rw-r--r-- | includes/footer.php | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/includes/footer.php b/includes/footer.php new file mode 100644 index 0000000..c120941 --- /dev/null +++ b/includes/footer.php @@ -0,0 +1,57 @@ +<?php + +if (!function_exists("timeAgo")) { + function timeAgo($time): string { + if (!is_numeric($time)) { + $time = strtotime($time); + } + + $periods = ["second", "minute", "hour", "day", "week", "month", "year", "age"]; + $lengths = array("60", "60", "24", "7", "4.35", "12", "100"); + + $now = time(); + + $difference = $now - $time; + if ($difference <= 10 && $difference >= 0) { + return $tense = "now"; + } elseif ($difference > 0) { + $tense = "ago"; + } else { + $tense = "later"; + } + + for ($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) { + $difference /= $lengths[$j]; + } + + $difference = round($difference); + + $period = $periods[$j] . ($difference >1 ? "s" :''); + return "{$difference} {$period} {$tense} "; + } +} + +?> + +<hr> +<div class="container text-muted"> + © <?= date("Y") ?> <a href="https://equestria.horse" target="_blank" class="text-muted">Equestria.dev Developers</a><br> + PluralKit data updated <?= trim(timeAgo(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/refresh.json"), true)["timestamp"])) ?>, next update in <?php $t = 5 - round((time() - json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/refresh.json"), true)["timestamp"]) / 60); ?><?= $t > 1 ? $t . " minutes" : ($t > 0 ? "a minute" : "a few seconds") ?> + <br><br><br> +</div> + +<script> + let tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]')) + let tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) { + return new bootstrap.Tooltip(tooltipTriggerEl) + }); + + Array.from(document.querySelectorAll('[data-bs-toggle="tooltip"]')).forEach((item) => { + if (!item.classList.contains("tooltip-nohelp")) { + item.style.cursor = "help"; + } + }) +</script> + +</body> +</html>
\ No newline at end of file |