feat(notification): 添加通知方式

This commit is contained in:
naiba
2020-12-19 22:14:36 +08:00
parent b118958f35
commit d19de0edc2
16 changed files with 391 additions and 58 deletions

View File

@@ -134,8 +134,6 @@
</div>
</div>
</div>
<button id="darkmodeButton"></button>
<footer>
<p style="text-align:center;padding: 15px;">Powered by <a href="https://github.com/naiba/nezha">哪吒面板</a> build ·
{{.Version}}
@@ -202,30 +200,6 @@
if (hour > 17 || hour < 4) {
document.body.classList.add('dark');
}
return
//darkmode
if (document.getElementById("darkmodeButton")) {
var night = parseInt(document.cookie.replace(/(?:(?:^|.*;\s*)dark\s*=\s*([^;]*).*$)|^.*$/, "$1") || '0');
if (night) {
document.body.classList.add('dark');
console.log('Dark mode on', night);
}
document.getElementById("darkmodeButton").onclick = function () {
night = parseInt(document.cookie.replace(/(?:(?:^|.*;\s*)dark\s*=\s*([^;]*).*$)|^.*$/, "$1") || '0');
if (!night) {
document.body.classList.add('dark');
document.cookie = "dark=1";
console.log('Dark mode on', night);
} else {
document.body.classList.remove('dark');
document.cookie = "dark=0";
console.log('Dark mode off', night);
}
}
} else {
document.cookie && (document.cookie = "");
console.log('Darkmode not Support');
}
},
secondToDate(s) {
var d = Math.floor(s / 3600 / 24);