🏗️ First time sync the css & js files from hexo theme NexT
This commit is contained in:
39
assets/js/third-party/comments/changyan.js
vendored
Normal file
39
assets/js/third-party/comments/changyan.js
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/* global NexT, CONFIG */
|
||||
|
||||
document.addEventListener('page:loaded', () => {
|
||||
const { appid, appkey } = CONFIG.changyan;
|
||||
const mainJs = 'https://cy-cdn.kuaizhan.com/upload/changyan.js';
|
||||
const countJs = `https://cy-cdn.kuaizhan.com/upload/plugins/plugins.list.count.js?clientId=${appid}`;
|
||||
|
||||
// Get the number of comments
|
||||
setTimeout(() => {
|
||||
return NexT.utils.getScript(countJs, {
|
||||
attributes: {
|
||||
async: true,
|
||||
id : 'cy_cmt_num'
|
||||
}
|
||||
});
|
||||
}, 0);
|
||||
|
||||
// When scroll to comment section
|
||||
if (CONFIG.page.comments && !CONFIG.page.isHome) {
|
||||
NexT.utils.loadComments('#SOHUCS')
|
||||
.then(() => {
|
||||
return NexT.utils.getScript(mainJs, {
|
||||
attributes: {
|
||||
async: true
|
||||
}
|
||||
});
|
||||
})
|
||||
.then(() => {
|
||||
window.changyan.api.config({
|
||||
appid,
|
||||
conf: appkey
|
||||
});
|
||||
})
|
||||
.catch(error => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error('Failed to load Changyan', error);
|
||||
});
|
||||
}
|
||||
});
|
||||
41
assets/js/third-party/comments/disqus.js
vendored
Normal file
41
assets/js/third-party/comments/disqus.js
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
/* global NexT, CONFIG, DISQUS */
|
||||
|
||||
document.addEventListener('page:loaded', () => {
|
||||
|
||||
if (CONFIG.disqus.count) {
|
||||
const loadCount = () => {
|
||||
NexT.utils.getScript(`https://${CONFIG.disqus.shortname}.disqus.com/count.js`, {
|
||||
attributes: { id: 'dsq-count-scr' }
|
||||
});
|
||||
};
|
||||
|
||||
// defer loading until the whole page loading is completed
|
||||
window.addEventListener('load', loadCount, false);
|
||||
}
|
||||
|
||||
if (CONFIG.page.comments) {
|
||||
// `disqus_config` should be a global variable
|
||||
// See https://help.disqus.com/en/articles/1717084-javascript-configuration-variables
|
||||
window.disqus_config = function() {
|
||||
this.page.url = CONFIG.page.permalink;
|
||||
this.page.identifier = CONFIG.page.path;
|
||||
this.page.title = CONFIG.page.title;
|
||||
if (CONFIG.disqus.i18n.disqus !== 'disqus') {
|
||||
this.language = CONFIG.disqus.i18n.disqus;
|
||||
}
|
||||
};
|
||||
NexT.utils.loadComments('#disqus_thread').then(() => {
|
||||
if (window.DISQUS) {
|
||||
DISQUS.reset({
|
||||
reload: true,
|
||||
config: window.disqus_config
|
||||
});
|
||||
} else {
|
||||
NexT.utils.getScript(`https://${CONFIG.disqus.shortname}.disqus.com/embed.js`, {
|
||||
attributes: { dataset: { timestamp: '' + +new Date() } }
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
18
assets/js/third-party/comments/disqusjs.js
vendored
Normal file
18
assets/js/third-party/comments/disqusjs.js
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
/* global NexT, CONFIG, DisqusJS */
|
||||
|
||||
document.addEventListener('page:loaded', () => {
|
||||
if (!CONFIG.page.comments) return;
|
||||
|
||||
NexT.utils.loadComments('#disqus_thread')
|
||||
.then(() => NexT.utils.getScript(CONFIG.disqusjs.js, { condition: window.DisqusJS }))
|
||||
.then(() => {
|
||||
window.dsqjs = new DisqusJS({
|
||||
api : CONFIG.disqusjs.api || 'https://disqus.com/api/',
|
||||
apikey : CONFIG.disqusjs.apikey,
|
||||
shortname : CONFIG.disqusjs.shortname,
|
||||
url : CONFIG.page.permalink,
|
||||
identifier: CONFIG.page.path,
|
||||
title : CONFIG.page.title
|
||||
});
|
||||
});
|
||||
});
|
||||
24
assets/js/third-party/comments/gitalk.js
vendored
Normal file
24
assets/js/third-party/comments/gitalk.js
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
/* global NexT, CONFIG, Gitalk */
|
||||
|
||||
document.addEventListener('page:loaded', () => {
|
||||
if (!CONFIG.page.comments) return;
|
||||
|
||||
NexT.utils.loadComments('.gitalk-container')
|
||||
.then(() => NexT.utils.getScript(CONFIG.gitalk.js, {
|
||||
condition: window.Gitalk
|
||||
}))
|
||||
.then(() => {
|
||||
const gitalk = new Gitalk({
|
||||
clientID : CONFIG.gitalk.client_id,
|
||||
clientSecret : CONFIG.gitalk.client_secret,
|
||||
repo : CONFIG.gitalk.repo,
|
||||
owner : CONFIG.gitalk.github_id,
|
||||
admin : [CONFIG.gitalk.admin_user],
|
||||
id : CONFIG.gitalk.path_md5,
|
||||
proxy : CONFIG.gitalk.proxy,
|
||||
language : CONFIG.gitalk.language || window.navigator.language,
|
||||
distractionFreeMode: CONFIG.gitalk.distraction_free_mode
|
||||
});
|
||||
gitalk.render(document.querySelector('.gitalk-container'));
|
||||
});
|
||||
});
|
||||
15
assets/js/third-party/comments/isso.js
vendored
Normal file
15
assets/js/third-party/comments/isso.js
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
/* global NexT, CONFIG */
|
||||
|
||||
document.addEventListener('page:loaded', () => {
|
||||
if (!CONFIG.page.comments) return;
|
||||
|
||||
NexT.utils.loadComments('#isso-thread')
|
||||
.then(() => NexT.utils.getScript(`${CONFIG.isso}js/embed.min.js`, {
|
||||
attributes: {
|
||||
dataset: {
|
||||
isso: `${CONFIG.isso}`
|
||||
}
|
||||
},
|
||||
parentNode: document.querySelector('#isso-thread')
|
||||
}));
|
||||
});
|
||||
19
assets/js/third-party/comments/livere.js
vendored
Normal file
19
assets/js/third-party/comments/livere.js
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
/* global NexT, CONFIG, LivereTower */
|
||||
|
||||
document.addEventListener('page:loaded', () => {
|
||||
if (!CONFIG.page.comments) return;
|
||||
|
||||
NexT.utils.loadComments('#lv-container').then(() => {
|
||||
window.livereOptions = {
|
||||
refer: CONFIG.page.path.replace(/index\.html$/, '')
|
||||
};
|
||||
|
||||
if (typeof LivereTower === 'function') return;
|
||||
|
||||
NexT.utils.getScript('https://cdn-city.livere.com/js/embed.dist.js', {
|
||||
attributes: {
|
||||
async: true
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
17
assets/js/third-party/comments/utterances.js
vendored
Normal file
17
assets/js/third-party/comments/utterances.js
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/* global NexT, CONFIG */
|
||||
|
||||
document.addEventListener('page:loaded', () => {
|
||||
if (!CONFIG.page.comments) return;
|
||||
|
||||
NexT.utils.loadComments('.utterances-container')
|
||||
.then(() => NexT.utils.getScript('https://utteranc.es/client.js', {
|
||||
attributes: {
|
||||
async : true,
|
||||
crossOrigin : 'anonymous',
|
||||
'repo' : CONFIG.utterances.repo,
|
||||
'issue-term': CONFIG.utterances.issue_term,
|
||||
'theme' : CONFIG.utterances.theme
|
||||
},
|
||||
parentNode: document.querySelector('.utterances-container')
|
||||
}));
|
||||
});
|
||||
Reference in New Issue
Block a user