From fe07e1207c596286aac3e59de0cfb004cdd26dd7 Mon Sep 17 00:00:00 2001 From: xiu2 <54703944+XIU2@users.noreply.github.com> Date: Fri, 7 May 2021 08:46:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20[=E6=9A=97=E9=BB=91?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F]=20=E4=BB=A3=E7=A0=81=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zhihu-Beautification.user.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Zhihu-Beautification.user.js b/Zhihu-Beautification.user.js index 1ec6506..4b0fb0f 100644 --- a/Zhihu-Beautification.user.js +++ b/Zhihu-Beautification.user.js @@ -1,6 +1,6 @@ // ==UserScript== // @name 知乎美化 -// @version 1.1.13 +// @version 1.1.14 // @author X.I.U // @description 宽屏显示、暗黑模式(4种)、隐藏文章开头大图、调整图片最大高度、向下翻时自动隐藏顶栏、文章编辑页面与实际文章宽度一致、屏蔽登录提示 // @match *://www.zhihu.com/* @@ -20,7 +20,7 @@ (function() { var menu_ALL = [ ['menu_widescreenDisplay', '宽屏显示', '宽屏显示', true], - ['menu_darkMode', '暗黑模式', '暗黑模式', false], + ['menu_darkMode', '暗黑模式', '暗黑模式', true], ['menu_darkModeType', '暗黑模式切换(1~4)', '暗黑模式切换', 1], ['menu_picHeight', '调整图片最大高度', '调整图片最大高度', true], ['menu_postimg', '隐藏文章开头大图', '隐藏文章开头大图', true], @@ -250,6 +250,11 @@ html {filter: brightness(75%) sepia(30%) !important;} switch(menu_value('menu_darkModeType')) { case 1: style += style_6; + if (getTheme() === 'light') { + document.cookie="theme=dark; expires=Thu, 18 Dec 2031 12:00:00 GMT; path=/"; + document.getElementsByTagName('html')[0].setAttribute('data-theme', 'dark') + location.reload(); // 刷新网页 + } break; case 2: style += style_7;