mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-17 04:40:53 +08:00
Compare commits
43 Commits
@@ -1,9 +1,11 @@
|
|||||||
|
- let disqusPageTitle = page.title.replace(/'/ig,"\\'")
|
||||||
|
|
||||||
script.
|
script.
|
||||||
function loadDisqus () {
|
function loadDisqus () {
|
||||||
var disqus_config = function () {
|
var disqus_config = function () {
|
||||||
this.page.url = '!{ page.permalink }'
|
this.page.url = '!{ page.permalink }'
|
||||||
this.page.identifier = '!{ page.path }'
|
this.page.identifier = '!{ page.path }'
|
||||||
this.page.title = '!{ page.title }'
|
this.page.title = '!{ disqusPageTitle }'
|
||||||
};
|
};
|
||||||
|
|
||||||
window.disqusReset = () => {
|
window.disqusReset = () => {
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
- let disqusjsApi = theme.disqusjs.api || 'https://disqus.skk.moe/disqus/'
|
- let disqusjsApi = theme.disqusjs.api || 'https://disqus.skk.moe/disqus/'
|
||||||
|
- let disqusjsPageTitle = page.title.replace(/'/ig,"\\'")
|
||||||
|
|
||||||
script.
|
script.
|
||||||
function loadDisqusjs () {
|
function loadDisqusjs () {
|
||||||
function addDisqusjsCSS () {
|
function addDisqusjsCSS () {
|
||||||
@@ -15,7 +17,7 @@ script.
|
|||||||
siteName: '!{theme.disqusjs.siteName}',
|
siteName: '!{theme.disqusjs.siteName}',
|
||||||
identifier: '!{ page.path }',
|
identifier: '!{ page.path }',
|
||||||
url: '!{ page.permalink }',
|
url: '!{ page.permalink }',
|
||||||
title: '!{ page.title }',
|
title: '!{ disqusjsPageTitle }',
|
||||||
api: '!{disqusjsApi}',
|
api: '!{disqusjsApi}',
|
||||||
apikey: '!{theme.disqusjs.apikey}',
|
apikey: '!{theme.disqusjs.apikey}',
|
||||||
nocomment: '!{theme.disqusjs.nocomment}',
|
nocomment: '!{theme.disqusjs.nocomment}',
|
||||||
@@ -55,4 +57,3 @@ if is_post() && !theme.comments.lazyload && theme.comments.count && theme.commen
|
|||||||
} else {
|
} else {
|
||||||
DISQUSWIDGETS.getCount({reset: true});
|
DISQUSWIDGETS.getCount({reset: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -15,15 +15,13 @@ script.
|
|||||||
}
|
}
|
||||||
|
|
||||||
const findTrueUrl = (array) => {
|
const findTrueUrl = (array) => {
|
||||||
let url = ''
|
|
||||||
Promise.all(array.map(item =>
|
Promise.all(array.map(item =>
|
||||||
fetch(item.url).then(resp => resp.json()).then(data => {
|
fetch(item.url).then(resp => resp.json()).then(data => {
|
||||||
|
const urlArray = data.body.match(/(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?/ig)
|
||||||
if (data.user.login === 'utterances-bot') {
|
if (data.user.login === 'utterances-bot') {
|
||||||
url = data.body.match(/https?\:\/\/[^\" ]+/ig).slice(-1)
|
return urlArray.pop()
|
||||||
return url[0]
|
|
||||||
} else {
|
} else {
|
||||||
url = data.body.match(/https?\:\/\/[^\" ]+/i)
|
return urlArray.shift()
|
||||||
return url[0]
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
)).then(res => {
|
)).then(res => {
|
||||||
@@ -104,8 +102,4 @@ script.
|
|||||||
|
|
||||||
newestCommentInit()
|
newestCommentInit()
|
||||||
document.addEventListener('pjax:complete', newestCommentInit)
|
document.addEventListener('pjax:complete', newestCommentInit)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hexo-theme-butterfly",
|
"name": "hexo-theme-butterfly",
|
||||||
"version": "3.7.0",
|
"version": "3.7.1",
|
||||||
"description": "A Simple and Card UI Design theme for Hexo",
|
"description": "A Simple and Card UI Design theme for Hexo",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user