主 题:本站为什么没有自动切换夜间模式的功能
发 布 者:loganyoyo
标签分类: 日常
时 间:2026-09-17 22:32:14
内容预览:写了个小脚本才舒服// nodeseekfunction applyNodeSeekDarkMode(url) { if (url) { const urlObj = new URL(url); const hostname = urlObj.hostname; if (hostname.endsWith("nodeseek.com")) { const isSystemDark = window.matchMedia('(prefers-color-scheme: dark)').matches; if (isSystemDark) { document.cookie = "colorscheme=dark; path=/; domain=www.nodeseek.com; SameSite=Lax; max-age=31536000"; document.addEventListener('DOMContentLoaded', () =%26gt%3b { document.body.classList.replace('light-layout', 'dark-layout'); }); } else { document.cookie = "colorscheme=light; path=/; domain=www.nodeseek.com; SameSite=Lax; max-age=31536000"; document.addEventListener('DOMContentLoaded', () =%26gt%3b { document.body.classList.replace('dark-layout', 'light-lay
直达链接: https://www.nodeseek.com/post-934351-1
发 布 者:loganyoyo
标签分类: 日常
时 间:2026-09-17 22:32:14
内容预览:写了个小脚本才舒服// nodeseekfunction applyNodeSeekDarkMode(url) { if (url) { const urlObj = new URL(url); const hostname = urlObj.hostname; if (hostname.endsWith("nodeseek.com")) { const isSystemDark = window.matchMedia('(prefers-color-scheme: dark)').matches; if (isSystemDark) { document.cookie = "colorscheme=dark; path=/; domain=www.nodeseek.com; SameSite=Lax; max-age=31536000"; document.addEventListener('DOMContentLoaded', () =%26gt%3b { document.body.classList.replace('light-layout', 'dark-layout'); }); } else { document.cookie = "colorscheme=light; path=/; domain=www.nodeseek.com; SameSite=Lax; max-age=31536000"; document.addEventListener('DOMContentLoaded', () =%26gt%3b { document.body.classList.replace('dark-layout', 'light-lay
直达链接: https://www.nodeseek.com/post-934351-1