halo-theme-hao/templates/index.html

522 lines
23 KiB
HTML

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<meta content="width=device-width,initial-scale=1" name="viewport">
<title th:text="${site.title}"></title>
<meta content="telephone=no" name="format-detection">
<meta content="var(--heo-card-bg)" name="theme-color">
<script th:src="@{/assets/js/heo.js}"></script>
<link rel="stylesheet" th:href="@{/assets/zhheo/zhheoblog.css}">
<!-- fontawesome-pro https://github.com/duyplus/fontawesome-pro -->
<link href="https://cdn.jsdelivr.net/gh/duyplus/fontawesome-pro/css/all.min.css"
media="print"
onload='this.media="all"'
rel="stylesheet"
/>
<!-- 右下角通知 -->
<link href="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/node-snackbar/0.1.16/snackbar.min.css"
media="print"
onload='this.media="all"'
rel="stylesheet"
/>
<!-- 全局配置 -->
<script>var GLOBAL_CONFIG = {
root: "/",
localSearch: void 0,
translate: {defaultEncoding: 2, translateDelay: 0, msgToTraditionalChinese: "简", msgToSimplifiedChinese: "繁"},
noticeOutdate: void 0,
highlight: {plugin: "highlighjs", highlightCopy: !0, highlightLang: !0, highlightHeightLimit: 400},
copy: {success: "复制成功", error: "复制错误", noSupport: "浏览器不支持"},
relativeDate: {homepage: !0, post: !1},
runtime: "天",
date_suffix: {just: "刚刚", min: "分钟前", hour: "小时前", day: "天前", month: "个月前"},
copyright: void 0,
lightbox: "fancybox",
Snackbar: {
chs_to_cht: "你已切换为繁体",
cht_to_chs: "你已切换为简体",
day_to_night: "你已切换为深色模式",
night_to_day: "你已切换为浅色模式",
bgLight: "#49b1f5",
bgDark: "#121212",
position: "top-center"
},
source: {
jQuery: "https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.6.0/jquery.min.js",
justifiedGallery: {
js: "https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/justifiedGallery/3.8.1/js/jquery.justifiedGallery.min.js",
css: "https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/justifiedGallery/3.8.1/css/justifiedGallery.min.css"
},
fancybox: {
js: "https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/fancybox/3.5.7/jquery.fancybox.min.js",
css: "https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/fancybox/3.5.7/jquery.fancybox.min.css"
}
},
isPhotoFigcaption: !0,
islazyload: !0,
isanchor: !1
}</script>
<!-- 站点配置 -->
<script id="config-diff">var GLOBAL_CONFIG_SITE = {
title: "张洪Heo",
isPost: !1,
isHome: !0,
isHighlightShrink: !1,
isToc: !1,
postUpdate: "2022-09-30 12:24:38"
}</script>
<noscript>
<style>#nav {
opacity: 1
}
.justified-gallery img {
opacity: 1
}
#post-meta time, #recent-posts time {
display: inline !important
}</style>
</noscript>
<script>(win => {
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')
heo.initThemeColor()
}
win.activateLightMode = function () {
document.documentElement.setAttribute('data-theme', 'light')
heo.initThemeColor()
}
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')
}
}
})(window)</script>
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.6.0/jquery.min.js"></script>
<link href="https://at.alicdn.com/t/font_1891866_47sukspu18q.css" rel="stylesheet">
<link href="https://cdn2.tianli0.top/npm/remixicon@2.5.0/fonts/remixicon.css" rel="stylesheet">
<link href="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/Swiper/8.0.6/swiper-bundle.min.css" rel="stylesheet">
<link rel="stylesheet" th:href="@{/assets/zhheo/commentBarrage.css}">
<script data-pace-options='{ "restartOnRequestAfter":false,"eventLag":false}'
src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/pace/1.2.4/pace.min.js"></script>
</head>
<body>
<!-- loading 页面 -->
<div id="loading-box" onclick="heo.hideLoading()">
<div class="loading-bg"><img class="loading-img" src="https://img.zhheo.com/i/2022/08/31/630f01a3755aa.webp"></div>
</div>
<div id="web_bg"></div>
<!-- 控制台 -->
<div th:replace="modules/widgets/console :: console"></div>
<div class="page" id="body-wrap">
<!-- 头部导航栏 -->
<header class="not-top-img" id="page-header">
<nav th:replace="modules/nav :: nav"></nav>
</header>
<div id="home_top">
<!-- 每日说说 -->
<div th:replace="modules/time-list :: time-list"></div>
<!-- 置顶内容 -->
<div th:replace="modules/recent-top :: recent-top"></div>
</div>
<main class="layout" id="content-inner">
<div class="recent-posts" id="recent-posts">
<!-- 分类导航栏 -->
<div th:replace="modules/category-bar :: category-bar"></div>
<th:block th:replace="modules/post-list :: post-list"></th:block>
</div>
<div th:replace="modules/aside :: aside"></div>
</main>
<!-- 底部 -->
<footer th:replace="modules/footer :: footer"></footer>
</div>
<!--<div th:replace="module/rightside :: rightside"></div>-->
<div id="rightside">
<div id="rightside-config-hide">
<button id="translateLink" title="简繁转换" type="button"></button>
<button id="darkmode" title="浅色和深色模式转换" type="button"><i class="fas fa-adjust"></i></button>
<button id="hide-aside-btn" title="单栏和双栏切换" type="button"><i class="fas fa-arrows-alt-h"></i></button>
</div>
<div id="rightside-config-show">
<button id="rightside_config" title="设置" type="button"><i class="fas fa-cog fa-spin"></i></button>
<button id="go-up" title="回到顶部" type="button"><i class="fas fa-arrow-up"></i></button>
</div>
</div>
<div class="js-pjax">
<div id="rightMenu">
<div class="rightMenu-group rightMenu-small">
<div class="rightMenu-item" id="menu-backward"><i class="fa-solid fa-arrow-left"></i></div>
<div class="rightMenu-item" id="menu-forward"><i class="fa-solid fa-arrow-right"></i></div>
<div class="rightMenu-item" id="menu-refresh"><i class="fa-solid fa-arrow-rotate-right"></i></div>
<div class="rightMenu-item" id="menu-top"><i class="fa-solid fa-arrow-up"></i></div>
</div>
<div class="rightMenu-group rightMenu-line rightMenuPlugin">
<div class="rightMenu-item" id="menu-copytext"><i class="fa-duotone fa-copy"></i><span>复制选中文本</span>
</div>
<div class="rightMenu-item" id="menu-pastetext"><i class="fa-duotone fa-paste"></i><span>粘贴文本</span>
</div>
<a class="rightMenu-item" id="menu-commenttext"><i
class="fa-duotone fa-comment-medical"></i><span>引用到评论</span></a>
<div class="rightMenu-item" id="menu-newwindow"><i
class="fa-duotone fa-window-restore"></i><span>新窗口打开</span></div>
<div class="rightMenu-item" id="menu-copylink"><i
class="fa-duotone fa-link-horizontal"></i><span>复制链接地址</span></div>
<div class="rightMenu-item" id="menu-copyimg"><i class="fa-duotone fa-images"></i><span>复制此图片</span>
</div>
<div class="rightMenu-item" id="menu-downloadimg"><i
class="fa-duotone fa-download"></i><span>下载此图片</span></div>
<div class="rightMenu-item" id="menu-search"><i
class="fa-solid fa-magnifying-glass"></i><span>站内搜索</span></div>
<div class="rightMenu-item" id="menu-searchBaidu"><i
class="fa-solid fa-magnifying-glass"></i><span>百度搜索</span></div>
<div class="rightMenu-item" id="menu-music-toggle"><i class="fas fa-play"></i><span>播放音乐</span></div>
<div class="rightMenu-item" id="menu-music-back"><i
class="fa-duotone fa-backward"></i><span>切换到上一首</span></div>
<div class="rightMenu-item" id="menu-music-forward"><i
class="fa-duotone fa-forward"></i><span>切换到下一首</span></div>
<div class="rightMenu-item" id="menu-music-playlist"
onclick='window.open("https://music.163.com/#/playlist?app_version=8.8.36&amp;id=5197802668","_blank")'>
<i class="fa-duotone fa-list-music"></i><span>查看所有歌曲</span></div>
<div class="rightMenu-item" id="menu-music-copyMusicName"><i class="fa-duotone fa-copy"></i>
<span>复制歌名</span></div>
</div>
<div class="rightMenu-group rightMenu-line rightMenuOther"><a class="rightMenu-item menu-link"
id="menu-randomPost"><i
class="fa-duotone fa-dice"></i><span>随便逛逛</span></a><a class="rightMenu-item menu-link"
href="categories/index.html"><i
class="fa-duotone fa-list-tree"></i><span>博客分类</span></a><a class="rightMenu-item menu-link"
href="tags/index.html"><i
class="fa-duotone fa-tags"></i><span>文章标签</span></a></div>
<div class="rightMenu-group rightMenu-line"><a class="rightMenu-item menu-link" href="cc/index.html"><i
class="fa-solid fa-hand"></i><span>隐私协议</span></a><a class="rightMenu-item menu-link"
href="cc/index.html"><i
class="fa-solid fa-closed-captioning"></i><span>版权协议</span></a></div>
<div class="rightMenu-group rightMenu-line rightMenuOther">
<div class="rightMenu-item" id="menu-copy"><i
class="fa-duotone fa-link-horizontal"></i><span>复制地址</span></div>
<div class="rightMenu-item" id="menu-commentBarrage"><i class="fa-solid fa-message-captions"></i><span
class="menu-commentBarrage-text">关闭热评</span></div>
<div class="rightMenu-item" id="menu-darkmode"><i class="fa-solid fa-moon"></i><span
class="menu-darkmode-text">显示模式</span></div>
<div class="rightMenu-item" id="menu-translate"><i class="fa-duotone fa-language"></i><span>轉為繁體</span>
</div>
</div>
</div>
<div id="rightmenu-mask"></div>
</div>
<div>
<script th:src="@{/assets/js/utils.js}"></script>
<script th:src="@{/assets/js/main.js}"></script>
<script charset="utf-8" data-pjax="" th:src="@{/assets/zhheo/blogex.js}"></script>
<script src="https://cdn.zhheo.com/JS-Heo/translate/tw_cn.js"></script>
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/instant.page/5.1.0/instantpage.min.js"
type="module"></script>
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/vanilla-lazyload/17.3.1/lazyload.iife.min.js"></script>
<script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/node-snackbar/0.1.16/snackbar.min.js"></script>
<script defer src="https://cdn.zhheo.com/public/algolia/algolia.js"></script>
<script>var preloader = {
endLoading: () => {
//- document.body.style.overflow = 'auto';
document.getElementById('loading-box').classList.add("loaded")
},
initLoading: () => {
//- document.body.style.overflow = '';
document.getElementById('loading-box').classList.remove("loaded")
}
}
window.addEventListener('load', preloader.endLoading())
setTimeout(function () {
preloader.endLoading();
}, 3000)</script>
<div class="js-pjax"></div>
<script>window.addEventListener('load', () => {
const changeContent = (content) => {
if (content === '') return content
content = content.replace(/<img.*?src="(.*?)"?[^\>]+>/ig, '[图片]') // replace image link
content = content.replace(/<a[^>]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, '[链接]') // replace url
content = content.replace(/<pre><code>.*?<\/pre>/gi, '[代码]') // replace code
content = content.replace(/<[^>]+>/g, "") // remove html tag
if (content.length > 150) {
content = content.substring(0, 150) + '...'
}
return content
}
const getComment = () => {
const runTwikoo = () => {
twikoo.getRecentComments({
envId: 'https://twikoo.zhheo.com',
region: '',
pageSize: 6,
includeReply: true
}).then(function (res) {
const twikooArray = res.map(e => {
return {
'content': changeContent(e.comment),
'avatar': e.avatar,
'nick': e.nick,
'url': e.url + '#' + e.id,
'date': new Date(e.created).toISOString()
}
})
saveToLocal.set('twikoo-newest-comments', JSON.stringify(twikooArray), 10 / (60 * 24))
generateHtml(twikooArray)
}).catch(function (err) {
const $dom = document.querySelector('#card-newest-comments .aside-list')
$dom.innerHTML = "无法获取评论,请确认相关配置是否正确"
})
}
if (typeof twikoo === 'object') {
runTwikoo()
} else {
getScript('https://cdn2.tianli0.top/npm/twikoo@1.6.5/dist/twikoo.all.min.js').then(runTwikoo)
}
}
const generateHtml = array => {
let result = ''
if (array.length) {
for (let i = 0; i < array.length; i++) {
result += '<div class=\'aside-list-item\'>'
if (true) {
const name = 'data-lazy-src'
result += `<a href='${array[i].url}' class='thumbnail'><img ${name}='${array[i].avatar}' alt='${array[i].nick}'><div class='name'><span>${array[i].nick}</span></div></a>`
}
result += `<div class='content'>
<a class='comment' href='${array[i].url}'>${array[i].content}</a>
<time datetime="${array[i].date}">${btf.diffDate(array[i].date, true)}</time></div>
</div>`
}
} else {
result += '没有评论'
}
let $dom = document.querySelector('#card-newest-comments .aside-list')
$dom.innerHTML = result
window.lazyLoadInstance && window.lazyLoadInstance.update()
window.pjax && window.pjax.refresh($dom)
}
const newestCommentInit = () => {
if (document.querySelector('#card-newest-comments .aside-list')) {
const data = saveToLocal.get('twikoo-newest-comments')
if (data) {
generateHtml(JSON.parse(data))
} else {
getComment()
}
}
}
newestCommentInit()
document.addEventListener('pjax:complete', newestCommentInit)
})</script>
<script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/qrcodejs/1.0.0/qrcode.min.js"></script>
<script data-pjax=""
src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/Swiper/6.6.2/swiper-bundle.min.js"></script>
<script th:src="@{/assets/zhheo/rightmenu.js}"></script>
<script th:src="@{/assets/zhheo/random.js}"></script>
<script data-pjax th:src="@{/zhheo/commentBarrage.js}"></script>
<script src="https://cdn.zhheo.com/public/waterfall/waterfall.min.js"></script>
<script src="https://cdn.zhheo.com/public/assist/assist-entry.min.js"></script>
<script src="https://cdn.zhheo.com/public/aplayer/Meting2.min.js"></script>
<script src="https://cdn.zhheo.com/public/pjax/pjax.min.js"></script>
<script>let pjaxSelectors = [
'title',
'#config-diff',
'#body-wrap',
'#rightside-config-hide',
'#rightside-config-show',
'.js-pjax'
]
if (false) {
pjaxSelectors.unshift('meta[property="og:image"]', 'meta[property="og:title"]', 'meta[property="og:url"]')
}
var pjax = new Pjax({
elements: 'a:not([target="_blank"])',
selectors: pjaxSelectors,
cacheBust: false,
analytics: false,
scrollRestoration: false
})
document.addEventListener('pjax:send', function () {
// removeEventListener toc scroll
window.removeEventListener('scroll', window.tocScrollFn)
typeof preloader === 'object' && preloader.initLoading()
if (window.aplayers) {
for (let i = 0; i < window.aplayers.length; i++) {
if (!window.aplayers[i].options.fixed) {
window.aplayers[i].destroy()
}
}
}
typeof typed === 'object' && typed.destroy()
//reset readmode
const $bodyClassList = document.body.classList
$bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')
})
document.addEventListener('pjax:complete', function () {
window.refreshFn()
document.querySelectorAll('script[data-pjax]').forEach(item => {
const newScript = document.createElement('script')
const content = item.text || item.textContent || item.innerHTML || ""
Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
newScript.appendChild(document.createTextNode(content))
item.parentNode.replaceChild(newScript, item)
})
GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()
typeof chatBtnFn === 'function' && chatBtnFn()
typeof panguInit === 'function' && panguInit()
// google analytics
typeof gtag === 'function' && gtag('config', '', {'page_path': window.location.pathname});
typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()
// Analytics
if (false) {
MtaH5.pgv()
}
// prismjs
typeof Prism === 'object' && Prism.highlightAll()
typeof preloader === 'object' && preloader.endLoading()
})
document.addEventListener('pjax:error', (e) => {
if (e.request.status === 404) {
pjax.loadUrl('/404.html')
}
})</script>
</div>
<div class="js-pjax">
<script>
coverColor(),
removeLoading(),
addRightMenuClickEvent(),
navTitle(),
heo.topPostScroll(),
heo.topCategoriesBarScroll(),
heo.sayhi(),
heo.addTag(),
heo.stopImgRightDrag(),
heo.addFriendLinksInFooter(),
heo.qrcodeCreate(),
heo.hidecookie(),
heo.onlyHome(),
heo.addNavBackgroundInit(),
heo.initIndexEssay(),
heo.changeTimeInEssay(),
heo.reflashEssayWaterFall(),
heo.addMediumInEssay(),
heo.darkModeStatus(),
heo.categoriesBarActive(),
heo.initThemeColor()
</script>
</div>
</body>
</html>