-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathheader.php
More file actions
90 lines (84 loc) · 3.55 KB
/
header.php
File metadata and controls
90 lines (84 loc) · 3.55 KB
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
89
90
<nav class="navbar navbar-expand-lg" style="background-color: var(--bs-content-bg); border-bottom: var(--bs-border-width) solid var(--bs-content-border-color);">
<div class="container">
<a class="navbar-brand" href="https://regist.cc"><img src="default-monochrome-black.png" width="160" alt="Free Domain Logo of Regist.CC"></a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="d-flex">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="https://regist.cc">Register a new domain</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://regist.cc/report.php">Report a domain</a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://github.com/registcc/Website">Open source edition</a>
</li>
</ul>
<button class="btn btn-light ms-2" id="bd-theme" onclick="toggleDarkMode()">
<i class="bi bi-moon-fill"></i>
</button>
</div>
</div>
</nav>
<script type="text/javascript" src="https://platform-api.sharethis.com/js/sharethis.js#property=652c35368218170012d4d02f&product=sticky-share-buttons&source=platform" async="async"></script>
<div class="sharethis-sticky-share-buttons"></div>
<script>
// Function to read cookie
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(";");
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) === " ") {
c = c.substring(1, c.length);
}
if (c.indexOf(nameEQ) === 0) {
return c.substring(nameEQ.length, c.length);
}
}
return null;
}
// Function to set cookie
function setCookie(name, value, days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + days * 24 * 60 * 60 * 1000);
expires = "; expires=" + date.toUTCString();
}
document.cookie = name + "=" + (value || "") + expires + "; path=/";
}
// Set system preference if cookie (with saved preference) not present
var systemColorMode = window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
if (readCookie("halfmoonColorMode") === null) {
document.documentElement.setAttribute("data-bs-theme", systemColorMode);
}
// Function to toggle dark mode and set cookie
function setTheme(theme) {
document.documentElement.setAttribute("data-bs-theme", theme);
setTheme(theme === "dark" ? "vs-dark" : "vs-light");
}
function toggleDarkMode() {
var rootPreference = document.documentElement.getAttribute("data-bs-theme");
if (rootPreference === "light" || rootPreference === null) {
setTheme("dark");
setCookie("halfmoonColorMode", "dark", 365);
} else {
setTheme("light");
setCookie("halfmoonColorMode", "light", 365);
}
}
// Initialize initialTheme
var initialTheme = "dark";
// Initial theme setup
var storedTheme = readCookie("halfmoonColorMode");
if (storedTheme === "dark" || (storedTheme === null && window.matchMedia("(prefers-color-scheme: dark)").matches)) {
initialTheme = "dark";
document.documentElement.setAttribute("data-bs-theme", "dark");
} else {
initialTheme = "light";
document.documentElement.setAttribute("data-bs-theme", "light");
}
</script>