From 977011a1db4959b96393b9b86843c9b48906ac2c Mon Sep 17 00:00:00 2001 From: hjdhnx Date: Sun, 4 Dec 2022 19:34:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=81=B0=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/js/grey.js | 26 ++++++++++++++++++++++++++ templates/admin.html | 2 +- templates/index.html | 11 ++--------- templates/layui_jxs.html | 3 ++- templates/layui_list.html | 5 +++-- templates/login.html | 1 + templates/logtail.html | 1 + templates/rules_to_clear.html | 1 + templates/rules_to_view.html | 1 + templates/settings.html | 2 +- 10 files changed, 39 insertions(+), 14 deletions(-) create mode 100644 static/js/grey.js diff --git a/static/js/grey.js b/static/js/grey.js new file mode 100644 index 0000000..4ce5602 --- /dev/null +++ b/static/js/grey.js @@ -0,0 +1,26 @@ +var global_grey = { + '-webkit-filter':'grayscale(1)', + '-moz-filter':'grayscale(1)', + '-ms-filter':'grayscale(1)', + '-o-filter':'grayscale(1)', + 'filter':'grayscale(1)', +}; + +function autoGreyByTime(){ + let now = new Date(); + let now_hours = now.getHours(); + // console.log(now_hours,typeof now_hours); + if(now_hours >= 23 || now_hours < 8){ + $('html').css(global_grey); + } +} +autoGreyByTime(); + +function darkModeHandler() { + const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)'); + if (mediaQuery.matches) { + let color = '#1b1b1b'; + $('body').css({"background": color }); + } +} +darkModeHandler(); \ No newline at end of file diff --git a/templates/admin.html b/templates/admin.html index 70fbbe7..267a75b 100644 --- a/templates/admin.html +++ b/templates/admin.html @@ -8,10 +8,10 @@ - + - + + @@ -19,14 +20,6 @@
+
diff --git a/templates/layui_list.html b/templates/layui_list.html index 3844d77..425cd62 100644 --- a/templates/layui_list.html +++ b/templates/layui_list.html @@ -9,9 +9,10 @@ - - + + + diff --git a/templates/login.html b/templates/login.html index 371207b..09c2c77 100644 --- a/templates/login.html +++ b/templates/login.html @@ -43,6 +43,7 @@ + diff --git a/templates/logtail.html b/templates/logtail.html index 4d45272..eef102c 100644 --- a/templates/logtail.html +++ b/templates/logtail.html @@ -9,6 +9,7 @@ tvbox实时日志 + diff --git a/templates/rules_to_clear.html b/templates/rules_to_clear.html index d8a1e7f..2ebd438 100644 --- a/templates/rules_to_clear.html +++ b/templates/rules_to_clear.html @@ -9,6 +9,7 @@ 删除已缓存规则列表-{{rules.count}} +