breaking changes: cdn 可一鍵設置 本地文件/可單獨配置主題文件,第三方文件的 cdn

breaking changes: 移除 utterances,giscus, addtoany, busuanzi 的 cdn 配置
This commit is contained in:
Jerry
2022-02-19 00:43:01 +08:00
Unverified
parent c1ac4a5e16
commit ab6672429f
30 changed files with 335 additions and 234 deletions

View File

@@ -5,7 +5,7 @@ script.
function addDisqusjsCSS () {
const ele = document.createElement('link')
ele.rel = 'stylesheet'
ele.href= '!{url_for(theme.CDN.disqusjs_css)}'
ele.href= '!{url_for(theme.asset.disqusjs_css)}'
document.getElementsByTagName('head')[0].appendChild(ele)
}
@@ -26,7 +26,7 @@ script.
if (window.disqusJsLoad) initDisqusjs()
else {
addDisqusjsCSS()
getScript('!{url_for(theme.CDN.disqusjs)}').then(initDisqusjs)
getScript('!{url_for(theme.asset.disqusjs)}').then(initDisqusjs)
window.disqusJsLoad = true
}
}

View File

@@ -5,7 +5,7 @@ script.
let nowTheme = document.documentElement.getAttribute('data-theme') === 'dark' ? '!{themes.dark}' : '!{themes.light}'
const config = Object.assign({
src: '!{theme.CDN.giscus}',
src: 'https://giscus.app/client.js',
'data-repo': '!{repo}',
'data-repo-id': '!{repo_id}',
'data-category-id': '!{category_id}',

View File

@@ -2,7 +2,7 @@ script.
function addGitalkSource () {
const ele = document.createElement('link')
ele.rel = 'stylesheet'
ele.href= '!{url_for(theme.CDN.gitalk_css)}'
ele.href= '!{url_for(theme.asset.gitalk_css)}'
document.getElementsByTagName('head')[0].appendChild(ele)
}
@@ -24,7 +24,7 @@ script.
if (typeof Gitalk === 'function') initGitalk()
else {
addGitalkSource()
getScript('!{url_for(theme.CDN.gitalk)}').then(initGitalk)
getScript('!{url_for(theme.asset.gitalk)}').then(initGitalk)
}
}

View File

@@ -37,7 +37,7 @@ script.
setTimeout(runFn,0)
return
}
getScript('!{theme.CDN.twikoo}').then(runFn)
getScript('!{theme.asset.twikoo}').then(runFn)
}
if ('!{use[0]}' === 'Twikoo' || !!{lazyload}) {

View File

@@ -2,7 +2,7 @@ script.
function loadUtterances () {
let ele = document.createElement('script')
ele.setAttribute('id', 'utterances_comment')
ele.setAttribute('src', '!{url_for(theme.CDN.utterances)}')
ele.setAttribute('src', 'https://utteranc.es/client.js')
ele.setAttribute('repo', '!{theme.utterances.repo}')
ele.setAttribute('issue-term', '!{theme.utterances.issue_term}')
let nowTheme = document.documentElement.getAttribute('data-theme') === 'dark' ? '#{theme.utterances.dark_theme}' : '#{theme.utterances.light_theme}'

View File

@@ -18,7 +18,7 @@ script.
}
if (typeof Valine === 'function') initValine()
else getScript('!{url_for(theme.CDN.valine)}').then(initValine)
else getScript('!{url_for(theme.asset.valine)}').then(initValine)
}
if ('!{theme.comments.use[0]}' === 'Valine' || !!{theme.comments.lazyload}) {

View File

@@ -13,7 +13,7 @@ script.
}
if (typeof Waline === 'function') initWaline()
else getScript('!{url_for(theme.CDN.waline)}').then(initWaline)
else getScript('!{url_for(theme.asset.waline)}').then(initWaline)
}
if ('!{theme.comments.use[0]}' === 'Waline' || !!{theme.comments.lazyload}) {