140 lines
5.6 KiB
HTML
140 lines
5.6 KiB
HTML
<!DOCTYPE html>
|
|
<html
|
|
xmlns:th="https://www.thymeleaf.org"
|
|
th:lang="${#locale.toLanguageTag}"
|
|
th:fragment="html (header, content, footer)">
|
|
<head>
|
|
<meta charset="UTF-8"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
<title th:text="${title}"></title>
|
|
<script no-pjax th:inline="javascript">
|
|
let system_font_enable = /*[[${theme.config.style.system_font_enable}]]*/;
|
|
document.documentElement.setAttribute("system_font_enable", system_font_enable);
|
|
</script>
|
|
<script no-pjax th:inline="javascript">
|
|
let dark_theme = /*[[${theme.config.style.dark_color_scheme}]]*/;
|
|
let light_theme = /*[[${theme.config.style.light_color_scheme}]]*/;
|
|
const default_mode = /*[[${theme.config.style.default_scheme_mode}]]*/;
|
|
|
|
if (dark_theme === 'custom') {
|
|
dark_theme = /*[[${theme.config.style.custom_dark}]]*/
|
|
}
|
|
if (light_theme === 'custom') {
|
|
light_theme = /*[[${theme.config.style.custom_light}]]*/
|
|
}
|
|
|
|
let storedMode = localStorage.getItem("theme-mode");
|
|
|
|
function getSystemScheme() {
|
|
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
}
|
|
|
|
function applyTheme(mode) {
|
|
const actualMode = mode === 'system' ? getSystemScheme() : mode;
|
|
const targetTheme = actualMode === "light" ? light_theme : dark_theme;
|
|
document.documentElement.setAttribute("data-color-scheme", actualMode);
|
|
document.documentElement.setAttribute("theme-color-scheme", targetTheme);
|
|
}
|
|
|
|
|
|
if (default_mode === 'system' || !storedMode) {
|
|
localStorage.setItem("theme-mode", default_mode);
|
|
storedMode = default_mode;
|
|
}
|
|
|
|
applyTheme(storedMode);
|
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
|
|
if (localStorage.getItem("theme-mode") === "system") {
|
|
applyTheme("system");
|
|
}
|
|
});
|
|
</script>
|
|
<script no-pjax>
|
|
const pixel_status = [[${theme.config.style.pixel_style}]];
|
|
let storedStatus = localStorage.getItem("pixel_style");
|
|
if (!storedStatus) {
|
|
localStorage.setItem("pixel_style", pixel_status);
|
|
storedStatus = pixel_status.toString();
|
|
}
|
|
document.documentElement.setAttribute("pixel_style", storedStatus);
|
|
</script>
|
|
<link no-pjax rel="stylesheet" th:href="@{/assets/dist/main.css?v={version}(version=${theme.spec.version})}"/>
|
|
<script no-pjax type="module" th:src="@{/assets/dist/main.js?v={version}(version=${theme.spec.version})}"></script>
|
|
<script no-pjax type="module" th:if="${theme.config.basic.pjax_enable}"
|
|
th:src="@{/assets/dist/libs/pjax.js?v={version}(version=${theme.spec.version})}"></script>
|
|
<script no-pjax th:inline="javascript">
|
|
function applyRawCss(text) {
|
|
const style = document.createElement('style');
|
|
style.textContent = text;
|
|
document.head.appendChild(style);
|
|
}
|
|
|
|
const custom = /*[[${theme.config.style.custom}]]*/;
|
|
applyRawCss(custom);
|
|
</script>
|
|
<th:block
|
|
th:if="${theme.config?.style?.custom_font_enable and not theme.config?.style?.system_font_enable}"
|
|
th:with="font=${#objects.nullSafe(theme.config?.style?.custom_font_file, #theme.assets('/dist/JetBrainsMono-Regular.woff2'))},
|
|
ext=${font.substring(font.lastIndexOf('.') + 1)},
|
|
format=${ext == 'woff2' ? 'woff2' :
|
|
(ext == 'woff' ? 'woff' :
|
|
(ext == 'ttf' ? 'truetype' :
|
|
(ext == 'otf' ? 'opentype' :
|
|
(ext == 'eot' ? 'embedded-opentype' :
|
|
((ext == 'ttc' or ext == 'otc') ? 'collection' : ext)))))},
|
|
mime=${ext == 'woff2' ? 'font/woff2' :
|
|
(ext == 'woff' ? 'font/woff' :
|
|
(ext == 'ttf' ? 'font/ttf' :
|
|
(ext == 'otf' ? 'font/otf' :
|
|
(ext == 'sfnt' ? 'font/sfnt' :
|
|
(ext == 'eot' ? 'application/vnd.ms-fontobject' :
|
|
((ext == 'ttc' or ext == 'otc') ? 'font/collection' : 'application/octet-stream'))))))}">
|
|
<link rel="preload" th:href="${font}" as="font" th:type="${mime}" crossorigin />
|
|
<!--/*/
|
|
<style th:inline="css">
|
|
@font-face {
|
|
font-display: swap;
|
|
font-family: "custom";
|
|
font-style: normal;
|
|
font-weight: 400;
|
|
src:
|
|
local("[(${theme.config?.style?.custom_font_name})]"),
|
|
url("[(${font})]") format("[(${format})]");
|
|
}
|
|
:root {
|
|
--font-theme-default: custom;
|
|
}
|
|
</style>
|
|
/*/-->
|
|
</th:block>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="page">
|
|
<header role="banner">
|
|
<div id="header-slot" aria-hidden="true"></div>
|
|
</header>
|
|
<div class="wrapper">
|
|
<aside class="sidebar-left">
|
|
</aside>
|
|
<main class="container" role="main">
|
|
<header class="header">
|
|
<th:block th:replace="~{modules/header :: header(isHome = true)}"/>
|
|
</header>
|
|
<div class="content">
|
|
<th:block th:replace="${content}"/>
|
|
</div>
|
|
</main>
|
|
<aside class="sidebar-right">
|
|
</aside>
|
|
</div>
|
|
<footer class="footer" role="contentinfo">
|
|
<div id="footer-slot-head" aria-hidden="true"></div>
|
|
<th:block th:replace="~{modules/footer}"/>
|
|
<div id="footer-slot-tail" aria-hidden="true"></div>
|
|
</footer>
|
|
</div>
|
|
</body>
|
|
</html>
|