护眼模式(侧边按钮版)

为简单有效的全网通用护眼模式(夜间模式、暗黑模式、深色模式)添加了侧边按钮

安装此脚本?
作者推荐脚本

您可能也喜欢护眼模式

安装此脚本
  1. // ==UserScript==
  2. // @name 护眼模式(侧边按钮版)
  3. // @name:zh-CN 护眼模式(侧边按钮版)
  4. // @name:zh-TW 護眼模式(側邊按鈕版)
  5. // @name:en Dark Mode
  6. // @version 1.1
  7. // @author tutrabbit
  8. // @description 为简单有效的全网通用护眼模式(夜间模式、暗黑模式、深色模式)添加了侧边按钮
  9. // @description:zh-CN 为简单有效的全网通用护眼模式(夜间模式、暗黑模式、深色模式)添加了侧边按钮
  10. // @description:zh-TW 為簡單有效的全網通用護眼模式(夜間模式、暗黑模式、深色模式)添加了側邊按鈕
  11. // @description:en Simple and effective network-wide eye protection mode (night mode, dark mode, dark mode)
  12. // @match *://*/*
  13. // @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAALfElEQVRYhX2Xe3Bd1XXGf3vvc859X+nq6nUlW5Yly7JlI2xsYzAwtnk4ATpAxkNTHm0mnaTT/gHTTvrIBDLTpp1JUoZppqHQls5AKTR2INOWJJQSXF4x2BhsJCRZ8kuWZckPSVf3/Trn7N3RVTFpQrNn1l97n7O/vda31reWMKMPcmUJA9U8vrwHGdqCHn4HPzePaIxhVSoYbYRXrn7BeMVbCUduF6kVUXHwvQP+6amDaqDnoIompmQytaBnTmB8H5lowrjgFss48SBeI/hUEEZeudLi1ywhJEIJdL6Q8rzal/1a5SGC4XZrYBvWwEZobMdLdH6RH+z/Io1taEeh52fe8tOZbysl/ouWFvANYP7fSz4DgAEBBIL4xiS8ubmnVcTZK68aRK29Dtm8dgnZJydRW+/E2nrnp19nz+7U77+60zt0qMz07J/KxuQTwrIw4rMBCDP6wC+FIIcO34eudDdXf/7jD52Opi772lugY3AZr++hp06gz48j+waRqTWYmVHcS+chEMFeuw1hBzBzY7g/fQE9fmqBYPzBQKrpVa/R4OkC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Ii5cSAtlPRHYct13axWvJNwadiiAli4iEP8VAJ89HQtR129TLiG1nos0Nt8dSOi12qi9lRq3utVqT/lirql24hW3vLBQi3d3XUqu73+PZOonBNR/WnbYSMeGTO5/Xf6ZtwDwPwtFRezQVs+sAAAAAElFTkSuQmCC
  14. // @grant GM_registerMenuCommand
  15. // @grant GM_unregisterMenuCommand
  16. // @grant GM_openInTab
  17. // @grant GM_getValue
  18. // @grant GM_setValue
  19. // @grant GM_notification
  20. // @sandbox JavaScript
  21. // @noframes
  22. // @license GPL-3.0 License
  23. // @run-at document-start
  24. // @namespace https://github.com/susmouse/DarkModeByXIU2_Enhanced
  25. // @supportURL https://github.com/susmouse/DarkModeByXIU2_Enhanced
  26. // @homepageURL https://github.com/susmouse/DarkModeByXIU2_Enhanced
  27. // ==/UserScript==
  28.  
  29. (function () {
  30. "use strict";
  31. var menu_ALL = [
  32. [
  33. "menu_disable",
  34. "✅ 已启用 (点击对当前网站禁用)",
  35. "❌ 已禁用 (点击对当前网站启用)",
  36. [],
  37. ],
  38. [
  39. "menu_runDuringTheDay",
  40. "白天保持开启 (比晚上亮一点点)",
  41. "白天保持开启",
  42. true,
  43. ],
  44. ["menu_darkModeAuto", "护眼模式跟随浏览器", "护眼模式跟随浏览器", false],
  45. [
  46. "menu_autoRecognition",
  47. "智能排除自带暗黑模式的网页 (beta)",
  48. "智能排除自带暗黑模式的网页 (beta)",
  49. true,
  50. ],
  51. [
  52. "menu_forcedToEnable",
  53. "✅ 已强制当前网站启用护眼模式 (👆)",
  54. "❌ 未强制当前网站启用护眼模式 (👆)",
  55. [],
  56. ],
  57. ["menu_darkModeType", "点击切换模式", "点击切换模式", 2],
  58. ["menu_customMode", "自定义当前模式", "自定义当前模式", true],
  59. ["menu_customMode1", , , "60|50"],
  60. ["menu_customMode2", , , "60|40|50|50"],
  61. ["menu_customMode3", , , "90"],
  62. [
  63. "menu_customMode3_exclude",
  64. ,
  65. ,
  66. 'img, .img, video, [style*="background"][style*="url"], svg',
  67. ],
  68. ["menu_customTime", "自定义昼夜时间", "自定义昼夜时间", "6:00|18:00"],
  69. ["menu_autoSwitch", "晚上自动切换模式", "晚上自动切换模式", ""],
  70. ["menu_showButton", "显示按钮", "显示按钮", true],
  71. [
  72. "menu_buttonSize", // 菜单项:按钮尺寸
  73. "🛠️调整按钮尺寸",
  74. "🛠️调整按钮尺寸",
  75. 35, // 默认按钮尺寸
  76. ],
  77. ],
  78. menu_ID = [];
  79. for (let i = 0; i < menu_ALL.length; i++) {
  80. // 如果读取到的值为 null 就写入默认值
  81. if (GM_getValue(menu_ALL[i][0]) == null) {
  82. GM_setValue(menu_ALL[i][0], menu_ALL[i][3]);
  83. }
  84. }
  85. registerMenuCommand();
  86. // addButton() 函数中使用了一些条件语句来判断是否应该显示按钮,这些判断依赖于一些变量,例如 menu_disable("check") 的返回值,它代表当前网站是否被禁用护眼模式。
  87. // 当夜间模式关闭时,menu_disable("check") 返回 false,导致按钮的样式被设置为 transform: scale(0);opacity: 0;,也就是隐藏了。
  88. // 由于 addButton() 被调用时,网页可能还没有加载完成,因此 menu_disable("check") 返回的值可能不准确,导致按钮隐藏?
  89. setTimeout(function () {
  90. // 延迟调用 addButton
  91. addButton();
  92. }, 500);
  93.  
  94. // 自定义昼夜时间 过渡性调整(精确到分钟),过段时间移除
  95. if (GM_getValue("menu_customTime", "").indexOf(":") === -1)
  96. GM_setValue(
  97. "menu_customTime",
  98. GM_getValue("menu_customTime", "6|18").replace("|", ":00|") + ":00"
  99. );
  100.  
  101. if (menu_ID.length > 1) {
  102. addStyle();
  103. }
  104.  
  105. // 注册(不可用)脚本菜单
  106. function registerMenuCommand() {
  107. if (menu_ID.length != []) {
  108. for (let i = 0; i < menu_ID.length; i++) {
  109. GM_unregisterMenuCommand(menu_ID[i]);
  110. }
  111. }
  112. for (let i = 0; i < menu_ALL.length; i++) {
  113. // 循环注册(不可用)脚本菜单
  114. menu_ALL[i][3] = GM_getValue(menu_ALL[i][0]);
  115. if (menu_ALL[i][0] === "menu_disable") {
  116. // 启用/禁用护眼模式 (当前网站)
  117. if (menu_disable("check")) {
  118. // 当前网站是否已存在禁用列表中
  119. menu_ID[i] = GM_registerMenuCommand(`${menu_ALL[i][2]}`, function () {
  120. menu_disable("del");
  121. });
  122. return;
  123. } else {
  124. if (
  125. GM_getValue("menu_darkModeAuto") &&
  126. !window.matchMedia("(prefers-color-scheme: dark)").matches
  127. ) {
  128. menu_ID[i] = GM_registerMenuCommand(
  129. `❌ 当前浏览器为白天模式 (点击关闭 [护眼模式跟随浏览器])`,
  130. function () {
  131. GM_setValue("menu_darkModeAuto", false);
  132. location.reload();
  133. }
  134. );
  135. return;
  136. }
  137. menu_ID[i] = GM_registerMenuCommand(`${menu_ALL[i][1]}`, function () {
  138. menu_disable("add");
  139. });
  140. }
  141. } else if (menu_ALL[i][0] === "menu_darkModeType") {
  142. // 点击切换模式
  143. if (menu_ALL[i][3] > 3) {
  144. // 避免在减少 raw 数组后,用户储存的数据大于数组而报错
  145. menu_ALL[i][3] = 1;
  146. GM_setValue(menu_ALL[i][0], menu_ALL[i][3]);
  147. }
  148. let menu_newMode = getAutoSwitch();
  149. menu_ID[i] = GM_registerMenuCommand(
  150. `${menu_num(menu_newMode)} ${menu_ALL[i][1]}`,
  151. function () {
  152. menu_toggle(`${menu_ALL[i][3]}`, `${menu_ALL[i][0]}`);
  153. }
  154. );
  155. } else if (menu_ALL[i][0] === "menu_customMode") {
  156. // 自定义当前模式
  157. GM_setValue(menu_ALL[i][0], menu_ALL[i][3]);
  158. menu_ID[i] = GM_registerMenuCommand(
  159. `#️⃣ ${menu_ALL[i][1]}`,
  160. function () {
  161. menu_customMode();
  162. }
  163. );
  164. } else if (menu_ALL[i][0] === "menu_customTime") {
  165. // 自定义昼夜时间
  166. GM_setValue(menu_ALL[i][0], menu_ALL[i][3]);
  167. menu_ID[i] = GM_registerMenuCommand(
  168. `#️⃣ ${menu_ALL[i][1]}`,
  169. function () {
  170. menu_customTime();
  171. }
  172. );
  173. } else if (
  174. menu_ALL[i][0] === "menu_customMode1" ||
  175. menu_ALL[i][0] === "menu_customMode2" ||
  176. menu_ALL[i][0] === "menu_customMode3" ||
  177. menu_ALL[i][0] === "menu_customMode3_exclude"
  178. ) {
  179. // 当前模式值
  180. GM_setValue(menu_ALL[i][0], menu_ALL[i][3]);
  181. } else if (menu_ALL[i][0] === "menu_autoSwitch") {
  182. // 晚上自动切换模式
  183. menu_ID[i] = GM_registerMenuCommand(
  184. `#️⃣ ${menu_ALL[i][1]}`,
  185. function () {
  186. menu_customAutoSwitch();
  187. }
  188. );
  189. } else if (menu_ALL[i][0] === "menu_forcedToEnable") {
  190. // 强制当前网站启用护眼模式
  191. if (menu_value("menu_autoRecognition")) {
  192. // 自动排除自带暗黑模式的网页 (beta)
  193. if (menu_forcedToEnable("check")) {
  194. // 当前网站是否已存在列表中
  195. menu_ID[i] = GM_registerMenuCommand(
  196. `${menu_ALL[i][1]}`,
  197. function () {
  198. menu_forcedToEnable("del");
  199. }
  200. );
  201. } else {
  202. menu_ID[i] = GM_registerMenuCommand(
  203. `${menu_ALL[i][2]}`,
  204. function () {
  205. menu_forcedToEnable("add");
  206. }
  207. );
  208. }
  209. }
  210. } else if (menu_ALL[i][0] === "menu_showButton") {
  211. // 显示/隐藏按钮
  212. menu_ID[i] = GM_registerMenuCommand(
  213. `${menu_ALL[i][3] ? "✅" : "❌"} ${menu_ALL[i][1]}`,
  214. function () {
  215. menu_switch(
  216. `${menu_ALL[i][3]}`,
  217. `${menu_ALL[i][0]}`,
  218. `${menu_ALL[i][2]}`
  219. );
  220. }
  221. );
  222. } else if (menu_ALL[i][0] === "menu_buttonSize") {
  223. // 按钮尺寸
  224. menu_ID[i] = GM_registerMenuCommand(
  225. `#️⃣ ${menu_ALL[i][1]}`,
  226. menu_customButtonSize // 直接关联到调整尺寸函数
  227. );
  228. } else {
  229. menu_ID[i] = GM_registerMenuCommand(
  230. `${menu_ALL[i][3] ? "✅" : "❌"} ${menu_ALL[i][1]}`,
  231. function () {
  232. menu_switch(
  233. `${menu_ALL[i][3]}`,
  234. `${menu_ALL[i][0]}`,
  235. `${menu_ALL[i][2]}`
  236. );
  237. }
  238. );
  239. }
  240. }
  241. menu_ID[menu_ID.length] = GM_registerMenuCommand(
  242. "💬 反馈 & 建议",
  243. function () {
  244. window.GM_openInTab(
  245. "https://github.com/XIU2/UserScript#xiu2userscript",
  246. { active: true, insert: true, setParent: true }
  247. );
  248. window.GM_openInTab(
  249. "https://gf.qytechs.cn/zh-CN/scripts/426377/feedback",
  250. { active: true, insert: true, setParent: true }
  251. );
  252. }
  253. );
  254. }
  255.  
  256. // 菜单数字图标
  257. function menu_num(num) {
  258. return ["0️⃣", "1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣", "🔟"][
  259. num
  260. ];
  261. }
  262.  
  263. // 晚上自动切换模式
  264. function menu_customAutoSwitch() {
  265. let newAutoSwitch = prompt(
  266. "白天、晚上使用不同模式,修改后立即生效~\n格式:白天模式|晚上模式\n例如:1|3(即白天模式 1 晚上模式 3)\n默认:留空(即关闭该功能)",
  267. GM_getValue("menu_autoSwitch")
  268. );
  269. if (newAutoSwitch === "") {
  270. GM_setValue("menu_autoSwitch", "");
  271. } else if (newAutoSwitch != null) {
  272. if (newAutoSwitch.split("|").length == 2) {
  273. GM_setValue("menu_autoSwitch", newAutoSwitch);
  274. } else {
  275. alert(`填入内容格式错误...`);
  276. }
  277. }
  278. registerMenuCommand(); // 重新注册(不可用)脚本菜单
  279. if (document.getElementById("XIU2DarkMode")) {
  280. document.getElementById("XIU2DarkMode").remove(); // 即时修改样式
  281. addStyle();
  282. }
  283. }
  284. // 获取当前模式
  285. function getAutoSwitch() {
  286. let darkModeType = GM_getValue("menu_darkModeType"),
  287. hours = new Date().getHours(),
  288. time = GM_getValue("menu_customTime").split("|").map(Number);
  289. if (GM_getValue("menu_autoSwitch") != "") {
  290. // 晚上自动切换模式
  291. if (isDaytime()) {
  292. // 白天
  293. darkModeType = GM_getValue("menu_autoSwitch").split("|")[0];
  294. } else {
  295. // 晚上
  296. darkModeType = GM_getValue("menu_autoSwitch").split("|")[1];
  297. }
  298. }
  299. return parseInt(darkModeType);
  300. }
  301.  
  302. // 自定义按钮尺寸
  303. function menu_customButtonSize() {
  304. let newSize = parseInt(
  305. prompt(
  306. "请输入按钮的新尺寸 (单位: px):",
  307. GM_getValue("menu_buttonSize")
  308. )
  309. );
  310. if (isNaN(newSize) || newSize <= 0) {
  311. alert("请输入有效的数字!");
  312. return;
  313. }
  314. GM_setValue("menu_buttonSize", newSize);
  315. location.reload(); // 刷新页面以应用新尺寸
  316. }
  317.  
  318. // 新增函数:添加护眼模式切换按钮
  319. function addButton() {
  320. if (!menu_value("menu_showButton")) return;
  321.  
  322. var buttonSize = GM_getValue("menu_buttonSize"); // 从 menu_value 获取按钮尺寸
  323. var buttonWidth = buttonSize + 2; // 悬停距离
  324. var hoveringSpan = buttonWidth / 2;
  325.  
  326. var button = document.createElement("div");
  327. button.id = "toggleEyeProtectModeButton";
  328. button.style =
  329. "position: fixed; left: -" +
  330. hoveringSpan +
  331. "px; bottom: 10px; z-index: 999; cursor: pointer; user-select: none; transition: left 0.3s;";
  332.  
  333. // 根据护眼模式状态设置默认图标
  334. var isDisabled = menu_disable("check");
  335. var lightSvgStyle = isDisabled
  336. ? "transform: scale(0);opacity: 0;"
  337. : "transform: scale(1);opacity: 1;";
  338. var darkSvgStyle = isDisabled
  339. ? "transform: scale(1);opacity: 1;"
  340. : "transform: scale(0);opacity: 0;";
  341.  
  342. button.innerHTML =
  343. '<div id="darkmode-button" style="width: ' +
  344. buttonSize +
  345. "px;height: " +
  346. buttonSize +
  347. 'px;background: #fff;border:1px solid #f6f6f6;display: flex;align-items: center;justify-content: center;border-radius: 50%;position: relative;">' +
  348. '<svg fill="#009fe8" id="svg-light" style="width: ' +
  349. (buttonSize * 0.7) + // 根据比例计算 svg 尺寸
  350. "px;height: " +
  351. (buttonSize * 0.7) +
  352. 'px;margin: 0;padding: 0;transition: transform 0.3s, opacity 0.3s;position: absolute;' +
  353. lightSvgStyle +
  354. '" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path d="M587.264 104.96c33.28 57.856 52.224 124.928 52.224 196.608 0 218.112-176.128 394.752-393.728 394.752-29.696 0-58.368-3.584-86.528-9.728C223.744 832.512 369.152 934.4 538.624 934.4c229.376 0 414.72-186.368 414.72-416.256 1.024-212.992-159.744-389.12-366.08-413.184z"></path><path d="M340.48 567.808l-23.552-70.144-70.144-23.552 70.144-23.552 23.552-70.144 23.552 70.144 70.144 23.552-70.144 23.552-23.552 70.144zM168.96 361.472l-30.208-91.136-91.648-30.208 91.136-30.208 30.72-91.648 30.208 91.136 91.136 30.208-91.136 30.208-30.208 91.648z"></path></svg>' +
  355. '<svg fill="#009fe8" id="svg-dark" style="width: ' +
  356. (buttonSize * 0.7) + // 根据比例计算 svg 尺寸
  357. "px;height: " +
  358. (buttonSize * 0.7) +
  359. 'px;margin: 0;padding: 0;transition: transform 0.3s, opacity 0.3s;position: absolute;' +
  360. darkSvgStyle +
  361. '" viewBox="0 0 1024 1024" xmlns="http://www.w3.org/2000/svg"><path d="M234.24 512a277.76 277.76 0 1 0 555.52 0 277.76 277.76 0 1 0-555.52 0zM512 187.733a42.667 42.667 0 0 1-42.667-42.666v-102.4a42.667 42.667 0 0 1 85.334 0v102.826A42.667 42.667 0 0 1 512 187.733zm-258.987 107.52a42.667 42.667 0 0 1-29.866-12.373l-72.96-73.387a42.667 42.667 0 0 1 59.306-59.306l73.387 72.96a42.667 42.667 0 0 1 0 59.733 42.667 42.667 0 0 1-29.867 12.373zm-107.52 259.414H42.667a42.667 42.667 0 0 1 0-85.334h102.826a42.667 42.667 0 0 1 0 85.334zm34.134 331.946a42.667 42.667 0 0 1-29.44-72.106l72.96-73.387a42.667 42.667 0 0 1 59.733 59.733l-73.387 73.387a42.667 42.667 0 0 1-29.866 12.373zM512 1024a42.667 42.667 0 0 1-42.667-42.667V878.507a42.667 42.667 0 0 1 85.334 0v102.826A42.667 42.667 0 0 1 512 1024zm332.373-137.387a42.667 42.667 0 0 1-29.866-12.373l-73.387-73.387a42.667 42.667 0 0 1 0-59.733 42.667 42.667 0 0 1 59.733 0l72.96 73.387a42.667 42.667 0 0 1-29.44 72.106zm136.96-331.946H878.507a42.667 42.667 0 1 1 0-85.334h102.826a42.667 42.667 0 0 1 0 85.334zM770.987 295.253a42.667 42.667 0 0 1-29.867-12.373 42.667 42.667 0 0 1 0-59.733l73.387-72.96a42.667 42.667 0 1 1 59.306 59.306l-72.96 73.387a42.667 42.667 0 0 1-29.866 12.373z"></path></svg>' +
  362. "</div>";
  363.  
  364. document.body.appendChild(button);
  365.  
  366. // 绑定点击事件
  367. button.onclick = function () {
  368. var isDisabled = menu_disable("check"); // 检查当前网站是否已禁用护眼模式
  369. if (isDisabled) {
  370. // 如果已禁用,则启用
  371. menu_disable("del");
  372. document.getElementById("svg-light").style.transform = "scale(0)";
  373. document.getElementById("svg-light").style.opacity = "0";
  374. document.getElementById("svg-dark").style.transform = "scale(1)";
  375. document.getElementById("svg-dark").style.opacity = "1";
  376. } else {
  377. // 如果未禁用,则禁用
  378. menu_disable("add");
  379. document.getElementById("svg-light").style.transform = "scale(1)";
  380. document.getElementById("svg-light").style.opacity = "1";
  381. document.getElementById("svg-dark").style.transform = "scale(0)";
  382. document.getElementById("svg-dark").style.opacity = "0";
  383. }
  384. };
  385.  
  386. // 悬停事件
  387. button.addEventListener("mouseover", function () {
  388. this.style.left = "5px";
  389. });
  390. button.addEventListener("mouseout", function () {
  391. this.style.left = "-" + hoveringSpan + "px";
  392. });
  393. }
  394.  
  395. // 自定义当前模式
  396. function menu_customMode() {
  397. let newMods, tip, defaults, name;
  398. switch (getAutoSwitch()) {
  399. case 1:
  400. tip =
  401. "自定义 [模式 1],修改后立即生效 (部分网页可能需要刷新)~\n格式:亮度 (白天)|亮度 (晚上)\n默认:60|50(均为百分比 1~100,不需要 % 符号)";
  402. defaults = "60|50";
  403. name = "menu_customMode1";
  404. break;
  405. case 2:
  406. tip =
  407. "自定义 [模式 2],修改后立即生效 (部分网页可能需要刷新)~\n格式:亮度 (白天)|暖色 (白天)|亮度 (晚上)|暖色 (晚上)\n默认:60|40|50|50(均为百分比 1~100,不需要 % 符号)";
  408. defaults = "60|40|50|50";
  409. name = "menu_customMode2";
  410. break;
  411. case 3:
  412. tip =
  413. "自定义 [模式 3],修改后立即生效 (部分网页可能需要刷新)~\n格式:反色\n默认:90(均为百分比 50~100,不需要 % 符号)";
  414. defaults = "90";
  415. name = "menu_customMode3";
  416. break;
  417. }
  418. newMods = prompt(tip, GM_getValue(`${name}`));
  419. if (newMods === "") {
  420. GM_setValue(`${name}`, defaults);
  421. registerMenuCommand(); // 重新注册(不可用)脚本菜单
  422. } else if (newMods != null) {
  423. GM_setValue(`${name}`, newMods);
  424. registerMenuCommand(); // 重新注册(不可用)脚本菜单
  425. }
  426. if (getAutoSwitch() == 3) {
  427. tip =
  428. '自定义 [模式 3] 排除目标,修改后立即生效 (部分网页可能需要刷新)~\n格式:CSS 选择器 (如果不会写可以找我)\n默认:img, .img, video, [style*="background"][style*="url"], svg\n (使用英文逗号间隔,末尾不要有逗号)';
  429. defaults = 'img, .img, video, [style*="background"][style*="url"], svg';
  430. name = "menu_customMode3_exclude";
  431. newMods = prompt(tip, GM_getValue(`${name}`));
  432. if (newMods === "") {
  433. GM_setValue(`${name}`, defaults);
  434. registerMenuCommand(); // 重新注册(不可用)脚本菜单
  435. } else if (newMods != null) {
  436. GM_setValue(`${name}`, newMods);
  437. registerMenuCommand(); // 重新注册(不可用)脚本菜单
  438. }
  439. }
  440. if (document.getElementById("XIU2DarkMode")) {
  441. document.getElementById("XIU2DarkMode").remove(); // 即时修改样式
  442. addStyle();
  443. }
  444. }
  445.  
  446. // 自定义昼夜时间
  447. function menu_customTime() {
  448. let newMods = prompt(
  449. "自定义脚本内和白天/晚上相关的时间,修改后刷新网页生效~\n格式:6:00|18:30 (即 6:00 ~ 18:30 之间是白天时间)\n也支持反向设置:14:00|12:00 (即 12:00 ~ 14:00 之间是夜晚时间)",
  450. GM_getValue("menu_customTime")
  451. );
  452. if (newMods === "") {
  453. GM_setValue("menu_customTime", "6:00|18:00");
  454. registerMenuCommand(); // 重新注册(不可用)脚本菜单
  455. } else if (newMods != null) {
  456. GM_setValue("menu_customTime", newMods);
  457. registerMenuCommand(); // 重新注册(不可用)脚本菜单
  458. }
  459. }
  460.  
  461. // 强制当前网站启用护眼模式
  462. function menu_forcedToEnable(type) {
  463. switch (type) {
  464. case "check":
  465. if (check()) return true;
  466. return false;
  467. break;
  468. case "add":
  469. add();
  470. break;
  471. case "del":
  472. del();
  473. break;
  474. }
  475.  
  476. function check() {
  477. // 存在返回真,不存在返回假
  478. let websiteList = menu_value("menu_forcedToEnable"); // 读取网站列表
  479. if (websiteList.indexOf(location.host) === -1) return false; // 不存在返回假
  480. return true;
  481. }
  482.  
  483. function add() {
  484. if (check()) return;
  485. let websiteList = menu_value("menu_forcedToEnable"); // 读取网站列表
  486. websiteList.push(location.host); // 追加网站域名
  487. GM_setValue("menu_forcedToEnable", websiteList); // 写入配置
  488. location.reload(); // 刷新网页
  489. }
  490.  
  491. function del() {
  492. if (!check()) return;
  493. let websiteList = menu_value("menu_forcedToEnable"), // 读取网站列表
  494. index = websiteList.indexOf(location.host);
  495. websiteList.splice(index, 1); // 删除网站域名
  496. GM_setValue("menu_forcedToEnable", websiteList); // 写入配置
  497. location.reload(); // 刷新网页
  498. }
  499. }
  500.  
  501. // 启用/禁用护眼模式 (当前网站)
  502. function menu_disable(type) {
  503. switch (type) {
  504. case "check":
  505. if (check()) return true;
  506. return false;
  507. break;
  508. case "add":
  509. add();
  510. break;
  511. case "del":
  512. del();
  513. break;
  514. }
  515.  
  516. function check() {
  517. // 存在返回真,不存在返回假
  518. let websiteList = menu_value("menu_disable"); // 读取网站列表
  519. if (websiteList.indexOf(location.host) === -1) return false; // 不存在返回假
  520. return true;
  521. }
  522.  
  523. function add() {
  524. if (check()) return;
  525. let websiteList = menu_value("menu_disable"); // 读取网站列表
  526. websiteList.push(location.host); // 追加网站域名
  527. GM_setValue("menu_disable", websiteList); // 写入配置
  528. location.reload(); // 刷新网页
  529. }
  530.  
  531. function del() {
  532. if (!check()) return;
  533. let websiteList = menu_value("menu_disable"), // 读取网站列表
  534. index = websiteList.indexOf(location.host);
  535. websiteList.splice(index, 1); // 删除网站域名
  536. GM_setValue("menu_disable", websiteList); // 写入配置
  537. location.reload(); // 刷新网页
  538. }
  539. }
  540.  
  541. // 切换暗黑模式
  542. function menu_toggle(menu_status, Name) {
  543. menu_status = parseInt(menu_status);
  544. if (menu_status >= 3) {
  545. menu_status = 1;
  546. } else {
  547. menu_status += 1;
  548. }
  549. GM_setValue(`${Name}`, menu_status);
  550. registerMenuCommand(); // 重新注册(不可用)脚本菜单
  551. if (document.getElementById("XIU2DarkMode")) {
  552. document.getElementById("XIU2DarkMode").remove(); // 即时修改样式
  553. addStyle();
  554. }
  555. //location.reload(); // 刷新网页
  556. }
  557.  
  558. // 菜单开关
  559. function menu_switch(menu_status, Name, Tips) {
  560. if (menu_status == "true") {
  561. GM_setValue(`${Name}`, false);
  562. GM_notification({
  563. text: `已关闭 [${Tips}] 功能\n(点击刷新网页后生效)`,
  564. timeout: 3500,
  565. onclick: function () {
  566. location.reload();
  567. },
  568. });
  569. } else {
  570. GM_setValue(`${Name}`, true);
  571. GM_notification({
  572. text: `已开启 [${Tips}] 功能\n(点击刷新网页后生效)`,
  573. timeout: 3500,
  574. onclick: function () {
  575. location.reload();
  576. },
  577. });
  578. }
  579. if (Name === "menu_autoRecognition") {
  580. location.reload(); // 刷新网页
  581. }
  582. registerMenuCommand(); // 重新注册(不可用)脚本菜单
  583. }
  584.  
  585. // 返回菜单值
  586. function menu_value(menuName) {
  587. for (let menu of menu_ALL) {
  588. if (menu[0] == menuName) {
  589. return menu[3];
  590. }
  591. }
  592. }
  593.  
  594. // 添加样式
  595. function addStyle() {
  596. let remove = false,
  597. style_Add = document.createElement("style"),
  598. hours = new Date().getHours(),
  599. style_10 = menu_value("menu_customMode1").split("|"),
  600. style_20 = menu_value("menu_customMode2").split("|"),
  601. style_30 = menu_value("menu_customMode3").split("|"),
  602. style = ``,
  603. style_00 = `html, body {background-color: #ffffff !important;}`,
  604. style_11 = `html {filter: brightness(${style_10[0]}%) !important;}`,
  605. style_11_firefox = `html {filter: brightness(${style_10[0]}%) !important; background-image: url();}`,
  606. style_12 = `html {filter: brightness(${style_10[1]}%) !important;}`,
  607. style_12_firefox = `html {filter: brightness(${style_10[1]}%) !important; background-image: url();}`,
  608. style_21 = `html {filter: brightness(${style_20[0]}%) sepia(${style_20[1]}%) !important;}`,
  609. style_21_firefox = `html {filter: brightness(${style_20[0]}%) sepia(${style_20[1]}%) !important; background-image: url();}`,
  610. style_22 = `html {filter: brightness(${style_20[2]}%) sepia(${style_20[3]}%) !important;}`,
  611. style_22_firefox = `html {filter: brightness(${style_20[2]}%) sepia(${style_20[3]}%) !important; background-image: url();}`,
  612. style_31 = `html {filter: invert(${
  613. style_30[0]
  614. }%) !important; text-shadow: 0 0 0 !important;}
  615. ${menu_value(
  616. "menu_customMode3_exclude"
  617. )} {filter: invert(1) !important;}
  618. img[alt="[公式]"] {filter: none !important;}`,
  619. style_31_firefox = `html {filter: invert(${
  620. style_30[0]
  621. }%) !important; background-image: url(); text-shadow: 0 0 0 !important;}
  622. ${menu_value(
  623. "menu_customMode3_exclude"
  624. )} {filter: invert(1) !important;}
  625. img[alt="[公式]"] {filter: none !important;}`,
  626. style_31_scrollbar = `::-webkit-scrollbar {height: 12px !important;}
  627. ::-webkit-scrollbar-thumb {border-radius: 0;border-color: transparent;border-style: dashed;background-color: #3f4752 !important;background-clip: padding-box;transition: background-color .32s ease-in-out;}
  628. ::-webkit-scrollbar-corner {background: #202020 !important;}
  629. ::-webkit-scrollbar-track {background-color: #22272e !important;}
  630. ::-webkit-scrollbar-thumb:hover {background: #3f4752 !important;}`;
  631.  
  632. // Firefox 浏览器需要特殊对待
  633. if (navigator.userAgent.toLowerCase().indexOf("firefox") > -1) {
  634. style_11 = style_11_firefox;
  635. style_12 = style_12_firefox;
  636. style_21 = style_21_firefox;
  637. style_22 = style_22_firefox;
  638. style_31 = style_31_firefox;
  639. }
  640.  
  641. // 白天
  642. if (isDaytime()) {
  643. if (menu_value("menu_runDuringTheDay")) {
  644. style_12 = style_11;
  645. style_22 = style_21;
  646. } else {
  647. style_12 = style_22 = "";
  648. }
  649. }
  650.  
  651. let darkModeType = getAutoSwitch();
  652.  
  653. switch (darkModeType) {
  654. case 1:
  655. style += style_12;
  656. break;
  657. case 2:
  658. style += style_22;
  659. break;
  660. case 3:
  661. style += style_31 + style_31_scrollbar;
  662. if (location.hostname.indexOf("search.bilibili.com") > -1) {
  663. style += `ul.video-list img, ul.video-list .video-item .img .mask-video, ul.video-list .video-item .img .van-danmu, ul.video-list .video-item .img .van-framepreview {filter: none !important;}`;
  664. } else if (location.hostname.indexOf(".bilibili.com") > -1) {
  665. style += `
  666. .bpx-player-container[data-screen="full"] .bpx-player-video-wrap {filter: invert(1) !important;}
  667. .bpx-player-container[data-screen="web"] {filter: invert(1) !important;}
  668. .bpx-player-container[data-screen="web"] video {filter: none !important;}
  669. * {font-weight: bold !important;}`;
  670. } else if (location.hostname.indexOf(".huya.com") > -1) {
  671. style += `#player-wrap[style="height: 100%;"], .player-loading, .sidebar-show, #player-ctrl-wrap {filter: invert(1) !important;}`;
  672. }
  673. break;
  674. }
  675. style_Add.id = "XIU2DarkMode";
  676. style_Add.type = "text/css";
  677. //console.log(document,document.lastElementChild,document.querySelector('html'))
  678. if (document.lastElementChild) {
  679. document.lastElementChild.appendChild(style_Add).textContent = style;
  680. } else {
  681. // 发现个别网站速度太慢的话,就会出现脚本运行太早,连 html 标签都还没加载。。。
  682. let timer1 = setInterval(function () {
  683. // 每 5 毫秒检查一下 html 是否已存在
  684. if (document.lastElementChild) {
  685. clearInterval(timer1); // 取消定时器
  686. document.lastElementChild.appendChild(style_Add).textContent = style;
  687. }
  688. });
  689. }
  690.  
  691. let websiteList = [];
  692. if (menu_value("menu_autoRecognition")) {
  693. // 智能排除自带暗黑模式的网页 (beta)
  694. websiteList = menu_value("menu_forcedToEnable"); // 强制当前网站启用护眼模式
  695. }
  696.  
  697. // 为了避免 body 还没加载导致无法检查是否设置背景颜色
  698. let timer = setInterval(function () {
  699. // 每 5 毫秒检查一下 body 是否已存在
  700. if (document.body) {
  701. clearInterval(timer); // 取消定时器(每 5 毫秒一次的)
  702. setTimeout(function () {
  703. // 为了避免太快 body 的 CSS 还没加载上,先延迟 150 毫秒(缺点就是可能会出现短暂一闪而过的暗黑滤镜)
  704. console.log(
  705. "[护眼模式] html:",
  706. window.getComputedStyle(document.lastElementChild).backgroundColor,
  707. "body:",
  708. window.getComputedStyle(document.body).backgroundColor
  709. );
  710. if (
  711. window.getComputedStyle(document.body).backgroundColor ===
  712. "rgba(0, 0, 0, 0)" &&
  713. window.getComputedStyle(document.lastElementChild)
  714. .backgroundColor === "rgba(0, 0, 0, 0)" &&
  715. !(
  716. document.querySelector(
  717. 'head>meta[name="color-scheme"],head>link[href^="resource:"]'
  718. ) && window.matchMedia("(prefers-color-scheme: dark)").matches
  719. )
  720. ) {
  721. // 如果 body 没有 CSS 背景颜色(或是在资源页 且 浏览器为白天模式),那就需要添加一个背景颜色,否则影响滤镜效果
  722. let style_Add2 = document.createElement("style");
  723. style_Add2.id = "XIU2DarkMode2";
  724. document.lastElementChild.appendChild(style_Add2).textContent =
  725. style_00;
  726. } else if (
  727. (document.querySelector(
  728. 'head>meta[name="color-scheme"],head>link[href^="resource:"]'
  729. ) &&
  730. window.matchMedia("(prefers-color-scheme: dark)").matches) ||
  731. document.querySelector(
  732. "html[class*=dark], html[data-dark-theme*=dark], html[data-theme*=dark], html[data-color-mode*=dark], body[class*=dark]"
  733. ) ||
  734. window.getComputedStyle(document.body).backgroundColor ===
  735. "rgb(0, 0, 0)" ||
  736. (getColorValue(document.body) > 0 &&
  737. getColorValue(document.body) < 898989) ||
  738. (getColorValue(document.lastElementChild) > 0 &&
  739. getColorValue(document.lastElementChild) < 898989) ||
  740. (window.getComputedStyle(document.body).backgroundColor ===
  741. "rgba(0, 0, 0, 0)" &&
  742. window.getComputedStyle(document.lastElementChild)
  743. .backgroundColor === "rgb(0, 0, 0)")
  744. ) {
  745. // 如果是在资源页 且 浏览器为暗黑模式,或 html/body 元素包含 dark 标识,或底色为黑色 (等于0,0,0) 或深色 (小于 89,89,89),就停用本脚本滤镜
  746. if (menu_value("menu_autoRecognition")) {
  747. // 排除自带暗黑模式的网页 (beta)
  748. for (let i = 0; i < websiteList.length; i++) {
  749. // 这些网站强制启用护眼模式滤镜
  750. if (websiteList[i] === location.host) return;
  751. }
  752. console.log(
  753. "[护眼模式] 检测到当前网页自带暗黑模式,停用本脚本滤镜..."
  754. );
  755. document.getElementById("XIU2DarkMode").remove();
  756. remove = true;
  757. }
  758. }
  759. }, 150);
  760.  
  761. // 用来解决一些 CSS 加载缓慢的网站,可能会出现没有正确排除的问题,在没有找到更好的办法之前,先这样凑活着用
  762. setTimeout(function () {
  763. console.log(
  764. "[护眼模式] html:",
  765. window.getComputedStyle(document.lastElementChild).backgroundColor,
  766. "body:",
  767. window.getComputedStyle(document.body).backgroundColor
  768. );
  769. if (
  770. (document.querySelector(
  771. 'head>meta[name="color-scheme"],head>link[href^="resource:"]'
  772. ) &&
  773. window.matchMedia("(prefers-color-scheme: dark)").matches) ||
  774. document.querySelector(
  775. "html[class*=dark], html[data-dark-theme*=dark], html[data-theme*=dark], html[data-color-mode*=dark], body[class*=dark]"
  776. ) ||
  777. window.getComputedStyle(document.body).backgroundColor ===
  778. "rgb(0, 0, 0)" ||
  779. (getColorValue(document.body) > 0 &&
  780. getColorValue(document.body) < 898989) ||
  781. (getColorValue(document.lastElementChild) > 0 &&
  782. getColorValue(document.lastElementChild) < 898989) ||
  783. (window.getComputedStyle(document.body).backgroundColor ===
  784. "rgba(0, 0, 0, 0)" &&
  785. window.getComputedStyle(document.lastElementChild)
  786. .backgroundColor === "rgb(0, 0, 0)")
  787. ) {
  788. // 如果是在资源页 且 浏览器为暗黑模式,或 html/body 元素包含 dark 标识,或底色为黑色 (等于0,0,0) 或深色 (小于 89,89,89),就停用本脚本滤镜
  789. if (menu_value("menu_autoRecognition")) {
  790. // 排除自带暗黑模式的网页 (beta)
  791. for (let i = 0; i < websiteList.length; i++) {
  792. // 这些网站强制启用护眼模式滤镜
  793. if (websiteList[i] === location.host) return;
  794. }
  795. if (remove) return;
  796. console.log(
  797. "[护眼模式] 检测到当前网页自带暗黑模式,停用本脚本滤镜...."
  798. );
  799. if (document.getElementById("XIU2DarkMode"))
  800. document.getElementById("XIU2DarkMode").remove();
  801. if (document.getElementById("XIU2DarkMode2"))
  802. document.getElementById("XIU2DarkMode2").remove();
  803. }
  804. }
  805. }, 1500);
  806. }
  807. });
  808.  
  809. // 解决远景论坛会清理掉前面插入的 CSS 样式的问题
  810. if (location.hostname === "bbs.pcbeta.com") {
  811. let timer1 = setInterval(function () {
  812. if (!document.getElementById("XIU2DarkMode")) {
  813. document.lastElementChild.appendChild(style_Add).textContent = style;
  814. clearInterval(timer1);
  815. }
  816. });
  817. }
  818. }
  819.  
  820. // 获取背景颜色值
  821. function getColorValue(e) {
  822. let rgbValueArry = window
  823. .getComputedStyle(e)
  824. .backgroundColor.replace(/rgba|rgb|\(|\)| /g, "")
  825. .split(",");
  826. return parseInt(rgbValueArry[0] + rgbValueArry[1] + rgbValueArry[2]);
  827. }
  828.  
  829. // 判断当前是白天还是晚上
  830. function isDaytime() {
  831. let nowTime =
  832. new Date(
  833. "2022-03-07 " +
  834. new Date().getHours() +
  835. ":" +
  836. new Date().getMinutes() +
  837. ":00"
  838. ).getTime() / 1000,
  839. time = GM_getValue("menu_customTime").split("|");
  840. time[0] = new Date("2022-03-07 " + time[0] + ":00").getTime() / 1000;
  841. time[1] = new Date("2022-03-07 " + time[1] + ":00").getTime() / 1000;
  842. if (time[0] < time[1]) {
  843. if (nowTime > time[0] && nowTime < time[1]) return true;
  844. return false;
  845. } else {
  846. if (nowTime > time[0] || nowTime < time[1]) return true;
  847. return false;
  848. }
  849. }
  850. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址