layout
This commit is contained in:
@@ -1,23 +1,42 @@
|
||||
#loading-box(onclick='document.getElementById("loading-box").classList.add("loaded")')
|
||||
.loading-bg
|
||||
div.loading-img
|
||||
.loading-image-dot
|
||||
#loading-box
|
||||
.loading-left-bg
|
||||
.loading-right-bg
|
||||
.spinner-box
|
||||
.configure-border-1
|
||||
.configure-core
|
||||
.configure-border-2
|
||||
.configure-core
|
||||
.loading-word= _p('loading')
|
||||
|
||||
script.
|
||||
const preloader = {
|
||||
endLoading: () => {
|
||||
document.body.style.overflow = 'auto';
|
||||
document.getElementById('loading-box').classList.add("loaded")
|
||||
},
|
||||
initLoading: () => {
|
||||
document.body.style.overflow = '';
|
||||
document.getElementById('loading-box').classList.remove("loaded")
|
||||
|
||||
(()=>{
|
||||
const $loadingBox = document.getElementById('loading-box')
|
||||
const $body = document.body
|
||||
const preloader = {
|
||||
endLoading: () => {
|
||||
if ($loadingBox.classList.contains('loaded')) return
|
||||
$body.style.overflow = ''
|
||||
$loadingBox.classList.add('loaded')
|
||||
},
|
||||
initLoading: () => {
|
||||
$body.style.overflow = 'hidden'
|
||||
$loadingBox.classList.remove('loaded')
|
||||
}
|
||||
}
|
||||
}
|
||||
window.addEventListener('load',()=> { preloader.endLoading() })
|
||||
|
||||
if (!{theme.pjax && theme.pjax.enable}) {
|
||||
document.addEventListener('pjax:send', () => { preloader.initLoading() })
|
||||
document.addEventListener('pjax:complete', () => { preloader.endLoading() })
|
||||
}
|
||||
preloader.initLoading()
|
||||
|
||||
if (document.readyState === 'complete') {
|
||||
preloader.endLoading()
|
||||
} else {
|
||||
window.addEventListener('load', preloader.endLoading)
|
||||
document.addEventListener('DOMContentLoaded', preloader.endLoading)
|
||||
// Add timeout protection: force end after 7 seconds
|
||||
setTimeout(preloader.endLoading, 7000)
|
||||
}
|
||||
|
||||
if (!{theme.pjax && theme.pjax.enable}) {
|
||||
btf.addGlobalFn('pjaxSend', preloader.initLoading, 'preloader_init')
|
||||
btf.addGlobalFn('pjaxComplete', preloader.endLoading, 'preloader_end')
|
||||
}
|
||||
})()
|
||||
@@ -1,7 +1,5 @@
|
||||
if theme.preloader.source === 1
|
||||
include ./fullpage-loading.pug
|
||||
else if theme.preloader.source === 2
|
||||
include ./pace.pug
|
||||
else
|
||||
include ./fullpage-loading.pug
|
||||
include ./pace.pug
|
||||
if theme.preloader.enable
|
||||
if theme.preloader.source === 1
|
||||
include ./fullpage-loading.pug
|
||||
else
|
||||
include ./pace.pug
|
||||
Reference in New Issue
Block a user