From f53375fcba7aabad1e384f4abb68a690e02f4fb2 Mon Sep 17 00:00:00 2001 From: Eltrac Koalar Date: Wed, 25 Mar 2020 08:06:16 +0800 Subject: =?UTF-8?q?=F0=9F=92=A1=20Perf:=20=E5=88=87=E6=8D=A2=E5=A4=9C?= =?UTF-8?q?=E9=97=B4=E6=A8=A1=E5=BC=8F=E6=97=B6=E4=BC=9A=E6=9C=89=E6=9B=B4?= =?UTF-8?q?=E5=A4=9A=E7=9A=84=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/js/miracles.min.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'assets') diff --git a/assets/js/miracles.min.js b/assets/js/miracles.min.js index 93b7735..998aa82 100644 --- a/assets/js/miracles.min.js +++ b/assets/js/miracles.min.js @@ -78,10 +78,12 @@ function Dark() { addCookie("darkTheme", "on", 9); $("#toggle-dark-button").html(''); $("#toggle-dark-mobile").html(''); + alertSend("已切换夜间模式"); } else { addCookie("darkTheme", "off", 9); $("#toggle-dark-button").html(''); $("#toggle-dark-mobile").html(''); + alertSend("已切换日间模式") } } @@ -100,7 +102,7 @@ function Gray() { } } //toggleSepia - +/* 已被弃用的功能 function Sepia() { $("html").toggleClass("html-filter-sepia"); $("html").removeClass("html-filter-gray"); @@ -111,6 +113,7 @@ function Sepia() { addCookie("sepiaFilter", "off", 0); } } +*/ /** * Explore and load themes/filter @@ -122,13 +125,16 @@ if (whetherDark == "on" || schemeGeter.matches) { $("body").addClass("body-dark"); $("#toggle-dark-button").html(''); $("#toggle-dark-mobile").html(''); + alertSend("检测到您上次使用深色模式,已自动切换"); } //支持系统深色模式 function swDarkMode(scheme){ - if(scheme.matches) - $("body").addClass("body-dark"); - else if(window.matchMedia ("(prefers-color-scheme: light)").matches) - $("body").removeClass("body-dark"); + if(scheme.matches) { + $("body").addClass("body-dark"); + alertSend("检测到系统深色模式,已自动切换"); + }else if(window.matchMedia ("(prefers-color-scheme: light)").matches){ + $("body").removeClass("body-dark"); + } } schemeGeter.addListener(swDarkMode); -- cgit v1.2.3