mixin include() if block block mixin css(url, extranl = false) if extranl || url.startsWith('http') || url.startsWith('//') link(rel="stylesheet" type="text/css" href=url) else link(rel="stylesheet", href=($config && $config.base || "") + url) mixin js(url, extranl = false) if extranl || url.startsWith('http') || url.startsWith('//') script(type="text/javascript" src=url) else script(src=($config && $config.base || "") + url) mixin link(href, name) //- attributes == {class: "btn"} a(href=href)&attributes(attributes)= name doctype html html(lang="zh-CN") head block head title #{site_title || $site && $site.site_title || ''} meta(name="description" content=site_description || $site && $site.site_description || '') meta(name="keywords" content=keywords || $site && $site.keywords || '') if $site && $site.site_favicon link(rel="shortcut icon", href=$site.site_favicon) meta(charset="utf-8") meta(name="viewport" content="width=device-width, initial-scale=1") +css('reset.css') +js('lib/htmx.min.js') +js('https://cdn.tailwindcss.com') +css('https://unpkg.com/simplebar@latest/dist/simplebar.css', true) +css('simplebar-shim.css') +js('https://unpkg.com/simplebar@latest/dist/simplebar.min.js', true) //- body(style="--bg:url("+($site && $site.site_bg || '#fff')+")") //- body(style="--bg:url(./static/bg2.webp)") body noscript style. .simplebar-content-wrapper { scrollbar-width: auto; -ms-overflow-style: auto; } .simplebar-content-wrapper::-webkit-scrollbar, .simplebar-hide-scrollbar::-webkit-scrollbar { display: initial; width: initial; height: initial; } div(data-simplebar style="height: 100%") div(style="height: 100%; display: flex; flex-direction: column" id="aaaa") block content block scripts +js('lib/bg-change.js') script. const el = document.querySelector('.simplebar-content-wrapper') const scrollTop = sessionStorage.getItem('scrollTop-'+location.pathname) el.scrollTop = scrollTop el.addEventListener("scroll", function(e) { sessionStorage.setItem('scrollTop-'+location.pathname, e.target.scrollTop) }) function getCookie(cname) { var name = cname + "="; var decodedCookie = decodeURIComponent(document.cookie); var ca = decodedCookie.split(';'); for(var i = 0; i { toast.style.opacity = '0'; setTimeout(() => { if (toast.parentNode) toast.parentNode.removeChild(toast); }, 300); }; const resetTimer = () => { clearTimeout(timer); timer = setTimeout(removeToast, 5000); }; toast.addEventListener('mouseenter', resetTimer); toast.addEventListener('mouseleave', resetTimer); container.appendChild(toast); resetTimer(); } try { const toastObj = JSON.parse(msg); showToast(toastObj.message, toastObj.type); } catch (e) { showToast(msg); } }