1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
<?php global $navigation; global $isLoggedIn; global $isLowerLoggedIn; ?>
<div id="mobile-navigation">
<div id="mobile-navigation-container" class="container" style="display: grid; grid-template-columns: repeat(<?= count(array_values(array_filter($navigation, function ($item) use ($isLoggedIn) {
return !$item["admin"] || $isLoggedIn;
}))) + 1 ?>, 1fr); height: 100%;">
<a title="Cold Haze" data-bs-toggle="tooltip" href="/" id="mobile-navigation-item--logo" class="tooltip-nohelp mobile-navigation-item">
<img src="/assets/logo/newlogo.png" alt="" style="width:24px;vertical-align: middle;">
</a>
<?php foreach ($navigation as $id => $item): if (!$item["admin"] || $isLoggedIn): ?>
<a onclick="toggleMobileNavigation('<?= $id ?>');" title="<?= $item["name"] ?>" data-bs-toggle="tooltip" id="mobile-navigation-item-<?= $id ?>" class="tooltip-nohelp mobile-navigation-item">
<img src="<?= $item["icon"] ?>" <?php if ($item["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px;vertical-align: middle;border-radius:3px;">
</a>
<?php endif; endforeach; ?>
</div>
</div>
<div id="mobile-navigation-box-container" style="display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 48px; background-color: rgba(0, 0, 0, .75); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); z-index: 99999; overflow: auto;">
<?php foreach ($navigation as $id => $item): if (!$item["admin"] || $isLoggedIn): ?>
<div id="mobile-navigation-box-<?= $id ?>" style="display: none; margin-top: 10px; margin-bottom: 10px;" class="mobile-navigation-box container">
<div class="pane-group-title">
<img src="<?= $item["icon"] ?>" <?php if ($item["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px;vertical-align: middle;">
<span style="vertical-align: middle;"><?= $item["name"] ?></span>
</div>
<?php foreach ($item["items"] as $category): ?>
<div class="pane-group-category <?= $category["minimal"] ? "pane-group-category-minimal" : "" ?>" <?= $category["minimal"] ? 'style="display: grid; grid-template-columns: repeat(' . ($isLowerLoggedIn ? 2 : 3) . ', 1fr); grid-gap: 10px;"' : "" ?>>
<?php if (isset($category["name"])): ?>
<div class="pane-group-category-title"><?= $category["name"] ?></div>
<?php endif; ?>
<?php foreach ($category["items"] as $link): if (isset($link)): if (!($isLowerLoggedIn && $link["private"])): ?>
<a class="pane-group-item" href="<?= $link["link"] ?>">
<img src="<?= $link["icon"] ?>" <?php if ($link["invert"]): ?>class="dropdown-icon"<?php endif; ?> alt="" style="width:24px; border-radius: 5px; vertical-align: middle;">
<?php if (!$category["minimal"]): ?><span style="vertical-align: middle;<?= isset($link["stepped"]) ? "color: $link[stepped];" : "" ?>"><?= isset($link["stepped"]) ? "<b>$link[name]</b>" : $link["name"] ?></span><?php endif; ?>
</a>
<?php endif; endif; endforeach; ?>
</div>
<?php endforeach; ?>
</div>
<?php endif; endforeach; ?>
</div>
<style>
.mobile-navigation-item {
display: flex;
cursor: pointer;
align-items: center;
justify-content: center;
}
.mobile-navigation-item:hover {
background: rgba(255, 255, 255, .1);
}
.mobile-navigation-item:active, .mobile-navigation-item:focus, .mobile-navigation-item.open {
background: rgba(255, 255, 255, .25);
}
</style>
<script>
function closeMobileNavigation() {
document.getElementById("mobile-navigation-box-container").style.display = "none";
document.body.style.overflow = "";
Array.from(document.getElementsByClassName("mobile-navigation-item")).forEach((i) => {
i.classList.remove("open");
});
Array.from(document.getElementsByClassName("mobile-navigation-box")).forEach((i) => {
i.style.display = "none";
});
}
function openMobileNavigation(id) {
document.getElementById("mobile-navigation-item-" + id).classList.add("open");
document.body.style.overflow = "hidden";
document.getElementById("mobile-navigation-box-container").style.display = "block";
document.getElementById("mobile-navigation-box-" + id).style.display = "block";
}
function toggleMobileNavigation(id) {
if (document.getElementById("mobile-navigation-box-" + id).style.display !== "block") {
closeMobileNavigation();
openMobileNavigation(id);
} else {
closeMobileNavigation();
}
}
</script>
|