1
mirror of https://github.com/interstellar750/hexo_s synced 2024-10-19 00:23:51 +08:00
hexo_s/themes/Chic/layout/layout.ejs

36 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

<!DOCTYPE html>
<html lang="<%= config.language %>">
<head>
<%- partial('_partial/head',{cache: true}) %>
</head>
<body>
<script>
// this function is used to check current theme before page loaded.
(() => {
const currentTheme = window.localStorage && window.localStorage.getItem('theme') || '';
const isDark = currentTheme === 'dark';
const pagebody = document.getElementsByTagName('body')[0]
if (isDark) {
pagebody.classList.add('dark-theme');
// mobile
document.getElementById("mobile-toggle-theme").innerText = "· Dark"
} else {
pagebody.classList.remove('dark-theme');
// mobile
document.getElementById("mobile-toggle-theme").innerText = "· Light"
}
})();
</script>
<div class="wrapper">
<%- partial('_partial/header',{cache: true}) %>
<div class="main">
<%- body %>
</div>
<%- partial('_partial/footer',{cache: true}) %>
</div>
</body>
</html>