halo-theme-hao/templates/modules/layouts/layout.html

81 lines
2.6 KiB
HTML

<!DOCTYPE html>
<html lang="en" th:fragment="layout(content, htmlType)" xmlns:th="http://www.thymeleaf.org">
<!-- head 中自定义的 -->
<head th:replace="~{modules/head :: head(htmlType = ${htmlType})}">
<title th:text="${site.title}"></title>
</head>
<body id="body">
<!-- 控制台 -->
<div th:replace="~{modules/widgets/console :: console}"></div>
<!-- sidebar -->
<div th:replace="~{modules/sidebar :: sidebar}"></div>
<!-- loading 页面 -->
<div th:replace="~{modules/loading-box :: loading-box}"></div>
<!-- 内容 -->
<th:block th:replace="${content}"></th:block>
<div>
<script th:src="@{/assets/js/utils.js}" type="text/javascript"></script>
<script th:src="@{/assets/js/main.js}" type="text/javascript"></script>
<script th:src="@{/assets/lib/pjax.min.js}"></script>
<script th:src="@{/assets/lib/snackbar.min.js}"></script>
<script th:src="@{/assets/lib/view-image.min.js}"></script>
<div id="js-pjax"></div>
<script th:src="@{/assets/js/extend/covercolor/web.js}"></script>
<script>
let pjaxSelectors = [
'title',
'#body-wrap',
'#site-config',
'meta[name="description"]',
'#js-pjax'
]
const pjax = new Pjax({
elements: 'a:not([target="_blank"])',
selectors: pjaxSelectors,
cacheBust: false,
analytics: false,
scrollRestoration: false
})
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)
})
document.addEventListener('pjax:error', (e) => {
if (e.request.status === 404) {
pjax.loadUrl('/404.html')
}
})
</script>
</div>
<div class="needEndHide" id="nav-music" onclick="acrylic.musicToggle()">
<div id="nav-music-hoverTips">音乐已暂停</div>
<meting-js data-lrctype="0" id="1708664797" mutex="true" order="random" preload="none" server="tencent" theme="var(--heo-main)"
type="playlist">
</meting-js>
</div>
</body>
</html>
<!-- 所有文章路径 -->
<script>const posts = [];
function toRandomPost() {
window.pjax ? pjax.loadUrl('/' + posts[Math.floor(Math.random() * posts.length)]) : window.open('/' + posts[Math.floor(Math.random() * posts.length)], "_self");
}</script>