add theme
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
#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 $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')
|
||||
}
|
||||
}
|
||||
|
||||
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')
|
||||
}
|
||||
})()
|
||||
5
themes/butterfly/layout/includes/loading/index.pug
Normal file
5
themes/butterfly/layout/includes/loading/index.pug
Normal file
@@ -0,0 +1,5 @@
|
||||
if theme.preloader.enable
|
||||
if theme.preloader.source === 1
|
||||
include ./fullpage-loading.pug
|
||||
else
|
||||
include ./pace.pug
|
||||
12
themes/butterfly/layout/includes/loading/pace.pug
Normal file
12
themes/butterfly/layout/includes/loading/pace.pug
Normal file
@@ -0,0 +1,12 @@
|
||||
script.
|
||||
window.paceOptions = {
|
||||
restartOnPushState: false
|
||||
}
|
||||
|
||||
btf.addGlobalFn('pjaxSend', () => {
|
||||
Pace.restart()
|
||||
}, 'pace_restart')
|
||||
|
||||
|
||||
link(rel="stylesheet", href=url_for(theme.preloader.pace_css_url || theme.asset.pace_default_css))
|
||||
script(src=url_for(theme.asset.pace_js))
|
||||
Reference in New Issue
Block a user