2023-01-01 21:12:58 +08:00
|
|
|
{{ partial "head/meta.html" . }}
|
|
|
|
{{ partial "head/opengraph.html" . }}
|
|
|
|
{{ partial "head/twitter.html" . }}
|
|
|
|
{{ partial "head/googleplus.html" . }}
|
|
|
|
{{ partial "head/facebook.html" . }}
|
2023-02-16 16:19:45 +08:00
|
|
|
{{ partial "head/verify.html" . }}
|
2025-01-15 21:42:22 +08:00
|
|
|
{{ partial "head/styles.html" . }}
|
2022-10-23 16:05:23 +08:00
|
|
|
<script type="text/javascript">
|
|
|
|
(function(){
|
|
|
|
localDB = {
|
|
|
|
set: function (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 (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;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
theme = {
|
|
|
|
active: function() {
|
|
|
|
const localState = localDB.get('theme');
|
|
|
|
if (localState == undefined) return;
|
|
|
|
theme.toggle(localState);
|
|
|
|
window.matchMedia("(prefers-color-scheme: dark)").addListener(function (evt) {
|
|
|
|
theme.toggle(evt.matches ? 'dark' : 'light');
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
toggle: function (theme) {
|
|
|
|
document.documentElement.setAttribute('data-theme', theme);
|
|
|
|
localDB.set('theme', theme, 2);
|
|
|
|
|
|
|
|
const iframe = document.querySelector('iframe.giscus-frame');
|
|
|
|
if (iframe) {
|
|
|
|
const config = { setConfig: { theme: theme } };
|
|
|
|
iframe.contentWindow.postMessage({ giscus: config }, 'https://giscus.app');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
theme.active();
|
|
|
|
})(window);
|
|
|
|
</script>
|
2023-01-01 21:12:58 +08:00
|
|
|
{{ partial "head/config.html" . }}
|
2025-01-15 21:42:22 +08:00
|
|
|
{{ partialCached "head/script/analytics.html" . }}
|
2022-07-22 17:16:34 +08:00
|
|
|
|