signature=b9510bb92c802053efc2665a044774c5,24679.html

学而不思 | Kylin

(function() {

var hm = document.createElement("script");

hm.src = "https://hm.baidu.com/hm.js?f76c34daefe747deee7c7be3ead2ba80";

var s = document.getElementsByTagName("script")[0];

s.parentNode.insertBefore(hm, s);

})();

function gtag(){dataLayer.push(arguments);}

gtag('js', new Date());

gtag('config', 'UA-159334016-1');

root: '/',

algolia: undefined,

localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容:${query}"}},

translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"简"},

noticeOutdate: {"limitDay":90,"position":"top","messagePrev":"自上次更新以来已经","messageNext":"天,文章的内容可能已过时或存在差异。"},

highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},

copy: {

success: '复制成功',

error: '复制错误',

noSupport: '浏览器不支持'

},

relativeDate: {

homepage: false,

post: false

},

runtime: '天',

date_suffix: {

just: '刚刚',

min: '分钟前',

hour: '小时前',

day: '天前',

month: '个月前'

},

copyright: {"limitCount":50000,"languages":{"author":"作者: Kylin","link":"链接: ","source":"来源: Kylin","info":"著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。"}},

lightbox: 'fancybox',

Snackbar: {"chs_to_cht":"你已切换为繁体","cht_to_chs":"你已切换为简体","day_to_night":"你已切换为深色模式","night_to_day":"你已切换为浅色模式","bgLight":"#FF0000","bgDark":"#2d3035","position":"bottom-left"},

source: {

jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',

justifiedGallery: {

js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',

css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'

},

fancybox: {

js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',

css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'

}

},

isPhotoFigcaption: false,

islazyload: true,

isanchor: false

}

isPost: true,

isHome: false,

isHighlightShrink: false,

isToc: true,

postUpdate: '2020-11-16 09:57:08'

}

#nav {

opacity: 1

}

.justified-gallery img {

opacity: 1

}

#recent-posts time,

#post-meta time {

display: inline !important

}

win.saveToLocal = {

set: function setWithExpiry(key, value, ttl) {

if (ttl === 0) return

const now = new Date()

const expiryDay = ttl * 86400000

const item = {

value: value,

expiry: now.getTime() + expiryDay,

}

localStorage.setItem(key, JSON.stringify(item))

},

get: function getWithExpiry(key) {

const itemStr = localStorage.getItem(key)

if (!itemStr) {

return undefined

}

const item = JSON.parse(itemStr)

const now = new Date()

if (now.getTime() > item.expiry) {

localStorage.removeItem(key)

return undefined

}

return item.value

}

}

win.getScript = url => new Promise((resolve, reject) => {

const script = document.createElement('script')

script.src = url

script.async = true

script.onerror = reject

script.onload = script.onreadystatechange = function() {

const loadState = this.readyState

if (loadState && loadState !== 'loaded' && loadState !== 'complete') return

script.onload = script.onreadystatechange = null

resolve()

}

document.head.appendChild(script)

})

win.activateDarkMode = function () {

document.documentElement.setAttribute('data-theme', 'dark')

if (document.querySelector('meta[name="theme-color"]') !== null) {

document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')

}

}

win.activateLightMode = function () {

document.documentElement.setAttribute('data-theme', 'light')

if (document.querySelector('meta[name="theme-color"]') !== null) {

document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')

}

}

const t = saveToLocal.get('theme')

const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches

const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches

const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches

const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified

if (t === undefined) {

if (isLightMode) activateLightMode()

else if (isDarkMode) activateDarkMode()

else if (isNotSpecified || hasNoSupport) {

const now = new Date()

const hour = now.getHours()

const isNight = hour <= 6 || hour >= 18

isNight ? activateDarkMode() : activateLightMode()

}

window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {

if (saveToLocal.get('theme') === undefined) {

e.matches ? activateDarkMode() : activateLightMode()

}

})

} else if (t === 'light') activateLightMode()

else activateDarkMode()

const asideStatus = saveToLocal.get('aside-status')

if (asideStatus !== undefined) {

if (asideStatus === 'hide') {

document.documentElement.classList.add('hide-aside')

} else {

document.documentElement.classList.remove('hide-aside')

}

}

const fontSizeVal = saveToLocal.get('global-font-size')

if (fontSizeVal !== undefined) {

document.documentElement.style.setProperty('--global-font-size', fontSizeVal + 'px')

}

})(window)

Kylin

学而不思

您好, 这里需要密码.
文章作者: Kylin
文章链接: https://www.kylin.show/24679.html
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Kylin
打赏
  • 微信
  • 支付寶

评论

一键复制

编辑

Web IDE

原始数据

按行查看

历史

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值