update theme to butterfly
This commit is contained in:
@@ -51,8 +51,8 @@ script.
|
||||
const loadArtalk = async (el, pageKey) => {
|
||||
if (typeof Artalk === 'object') initArtalk(el, pageKey)
|
||||
else {
|
||||
await btf.getCSS('!{theme.asset.artalk_css}')
|
||||
await btf.getScript('!{theme.asset.artalk_js}')
|
||||
await btf.getCSS('!{url_for(theme.asset.artalk_css)}')
|
||||
await btf.getScript('!{url_for(theme.asset.artalk_js)}')
|
||||
initArtalk(el, pageKey)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,11 @@ script.
|
||||
|
||||
ele.forEach((item, index) => {
|
||||
const mermaidSrc = item.firstElementChild
|
||||
const mermaidThemeConfig = `%%{init:{ 'theme':'${theme}'}}%%\n`
|
||||
const config = mermaidSrc.dataset.config ? JSON.parse(mermaidSrc.dataset.config) : {}
|
||||
if (!config.theme) {
|
||||
config.theme = theme
|
||||
}
|
||||
const mermaidThemeConfig = `%%{init: ${JSON.stringify(config)}}%%\n`
|
||||
const mermaidID = `mermaid-${index}`
|
||||
const mermaidDefinition = mermaidThemeConfig + mermaidSrc.textContent
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@ if choose
|
||||
else
|
||||
- pjaxSelectors.unshift('meta[name="description"]')
|
||||
|
||||
script(src=url_for(theme.asset.pjax))
|
||||
script(src=url_for(theme.asset.pjax) defer)
|
||||
script.
|
||||
(() => {
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
const pjaxSelectors = !{JSON.stringify(pjaxSelectors)}
|
||||
|
||||
window.pjax = new Pjax({
|
||||
@@ -65,10 +65,9 @@ script.
|
||||
|
||||
document.addEventListener('pjax:error', e => {
|
||||
if (e.request.status === 404) {
|
||||
const usePjax = !{theme.pjax && theme.pjax.enable}
|
||||
!{theme.error_404 && theme.error_404.enable}
|
||||
? (usePjax ? pjax.loadUrl('!{url_for("/404.html")}') : window.location.href = '!{url_for("/404.html")}')
|
||||
? pjax.loadUrl('!{url_for("/404.html")}')
|
||||
: window.location.href = e.request.responseURL
|
||||
}
|
||||
})
|
||||
})()
|
||||
})
|
||||
@@ -17,7 +17,7 @@ if (syntax_highlighter === 'prismjs' || enable) && !preprocess
|
||||
btf.addGlobalFn('encrypt', highlightAll, 'prismjs')
|
||||
})()
|
||||
|
||||
script(src=url_for(prismjs_js))
|
||||
script(src=url_for(prismjs_autoloader))
|
||||
script(src=url_for(prismjs_js) defer)
|
||||
script(src=url_for(prismjs_autoloader) defer)
|
||||
if (line_number)
|
||||
script(src=url_for(prismjs_lineNumber_js))
|
||||
script(src=url_for(prismjs_lineNumber_js) defer)
|
||||
@@ -31,7 +31,7 @@ script.
|
||||
const getData = async (isPost) => {
|
||||
try {
|
||||
const now = Date.now()
|
||||
const keyUrl = isPost ? `&url=${window.location.pathname}` : ''
|
||||
const keyUrl = isPost ? `&url=${window.location.pathname}&path=${window.location.pathname}` : ''
|
||||
const headerList = { 'Accept': 'application/json' }
|
||||
|
||||
if (!{isServerURL}) {
|
||||
@@ -62,8 +62,8 @@ script.
|
||||
const pagePV = document.getElementById('umamiPV')
|
||||
if (pagePV) {
|
||||
const data = await getData(true)
|
||||
if (data && data.pageviews && typeof data.pageviews.value !== 'undefined') {
|
||||
pagePV.textContent = data.pageviews.value
|
||||
if (data && data.pageviews) {
|
||||
pagePV.textContent = typeof data.pageviews.value !== 'undefined' ? data.pageviews.value : data.pageviews
|
||||
} else {
|
||||
console.warn('Umami Analytics: Invalid page view data received')
|
||||
}
|
||||
@@ -75,8 +75,8 @@ script.
|
||||
|
||||
if (config.site_uv) {
|
||||
const siteUV = document.getElementById('umami-site-uv')
|
||||
if (siteUV && data && data.visitors && typeof data.visitors.value !== 'undefined') {
|
||||
siteUV.textContent = data.visitors.value
|
||||
if (siteUV && data && data.visitors) {
|
||||
siteUV.textContent = typeof data.visitors.value !== 'undefined' ? data.visitors.value : data.visitors
|
||||
} else if (siteUV) {
|
||||
console.warn('Umami Analytics: Invalid site UV data received')
|
||||
}
|
||||
@@ -84,8 +84,8 @@ script.
|
||||
|
||||
if (config.site_pv) {
|
||||
const sitePV = document.getElementById('umami-site-pv')
|
||||
if (sitePV && data && data.pageviews && typeof data.pageviews.value !== 'undefined') {
|
||||
sitePV.textContent = data.pageviews.value
|
||||
if (sitePV && data && data.pageviews) {
|
||||
sitePV.textContent = typeof data.pageviews.value !== 'undefined' ? data.pageviews.value : data.pageviews
|
||||
} else if (sitePV) {
|
||||
console.warn('Umami Analytics: Invalid site PV data received')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user