mirror of https://github.com/jkjoy/sunpeiwen.git
31 lines
773 B
Plaintext
31 lines
773 B
Plaintext
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="<%=config.language%>">
|
|
<head>
|
|
<%-partial('partials/head')%>
|
|
</head>
|
|
<body data-theme="light" class="notransition">
|
|
<script>
|
|
const body = document.body;
|
|
const data = body.getAttribute("data-theme");
|
|
const initTheme = (state) => {
|
|
if (state === "dark") {
|
|
body.setAttribute("data-theme", "dark");
|
|
} else if (state === "light") {
|
|
body.removeAttribute("data-theme");
|
|
} else {
|
|
localStorage.setItem("theme", data);
|
|
}
|
|
};
|
|
|
|
initTheme(localStorage.getItem("theme"));
|
|
|
|
setTimeout(() => body.classList.remove("notransition"), 75);
|
|
</script>
|
|
<%-partial('partials/header')%>
|
|
<%- body %>
|
|
<%-partial('partials/foot')%>
|
|
</body>
|
|
</html>
|