mirror of
https://github.com/jerryc127/hexo-theme-butterfly.git
synced 2026-04-16 19:40:55 +08:00
first commit
This commit is contained in:
15
layout/includes/comments/disqus.pug
Normal file
15
layout/includes/comments/disqus.pug
Normal file
@@ -0,0 +1,15 @@
|
||||
if theme.disqus.enable
|
||||
#disqus_thread
|
||||
script.
|
||||
var unused = null;
|
||||
var disqus_config = function () {
|
||||
this.page.url = '!{ page.permalink }';
|
||||
this.page.identifier = '!{ page.path }';
|
||||
this.page.title = '!{ page.title }';
|
||||
}
|
||||
var d = document, s = d.createElement('script');
|
||||
s.src = "https://" + '!{theme.disqus.shortname}' +".disqus.com/embed.js";
|
||||
s.setAttribute('data-timestamp', '' + +new Date());
|
||||
(d.head || d.body).appendChild(s);
|
||||
if theme.disqus.count
|
||||
script#dsq-count-scr(src="https://" + theme.disqus.shortname + ".disqus.com/count.js" async)
|
||||
13
layout/includes/comments/gitalk.pug
Normal file
13
layout/includes/comments/gitalk.pug
Normal file
@@ -0,0 +1,13 @@
|
||||
if theme.gitment && theme.gitment.enable
|
||||
#gitment-container
|
||||
script.
|
||||
var gitment = new Gitment({
|
||||
id: md5(decodeURI(location.pathname)),
|
||||
owner: '!{theme.gitment.owner}',
|
||||
repo: '!{theme.gitment.repo}',
|
||||
oauth: {
|
||||
client_id: '!{theme.gitment.client_id}',
|
||||
client_secret: '!{theme.gitment.client_secret}'
|
||||
}
|
||||
})
|
||||
gitment.render('gitment-container')
|
||||
12
layout/includes/comments/gitment.pug
Normal file
12
layout/includes/comments/gitment.pug
Normal file
@@ -0,0 +1,12 @@
|
||||
if theme.gitment && theme.gitment.enable
|
||||
#gitment-container
|
||||
script.
|
||||
var gitment = new Gitment({
|
||||
owner: '!{theme.gitment.owner}',
|
||||
repo: '!{theme.gitment.repo}',
|
||||
oauth: {
|
||||
client_id: '!{theme.gitment.client_id}',
|
||||
client_secret: '!{theme.gitment.client_secret}'
|
||||
}
|
||||
})
|
||||
gitment.render('gitment-container')
|
||||
17
layout/includes/comments/index.pug
Normal file
17
layout/includes/comments/index.pug
Normal file
@@ -0,0 +1,17 @@
|
||||
hr
|
||||
#post-comment
|
||||
.comment_headling
|
||||
i.fa.fa-comments.fa-fw(aria-hidden="true")
|
||||
=" "
|
||||
span= _p('comment')
|
||||
|
||||
if theme.disqus.enable
|
||||
include ./disqus.pug
|
||||
else if theme.laibili && theme.laibili.enable
|
||||
include ./laibili.pug
|
||||
else if theme.gitment && theme.gitment.enable
|
||||
include ./gitment.pug
|
||||
else if theme.gitalk && theme.gitalk.enable
|
||||
include ./gitalk.pug
|
||||
else if theme.valine && theme.valine.enable
|
||||
include ./valine.pug
|
||||
11
layout/includes/comments/laibili.pug
Normal file
11
layout/includes/comments/laibili.pug
Normal file
@@ -0,0 +1,11 @@
|
||||
if theme.laibili && theme.laibili.enable
|
||||
#lv-container(data-id="city" data-uid=theme.laibili.uid)
|
||||
script.
|
||||
(function(d, s) {
|
||||
var j, e = d.getElementsByTagName(s)[0];
|
||||
if (typeof LivereTower === 'function') { return; }
|
||||
j = d.createElement(s);
|
||||
j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
|
||||
j.async = true;
|
||||
e.parentNode.insertBefore(j, e);
|
||||
})(document, 'script');
|
||||
69
layout/includes/comments/valine.pug
Normal file
69
layout/includes/comments/valine.pug
Normal file
@@ -0,0 +1,69 @@
|
||||
if theme.valine && theme.valine.enable
|
||||
#vcomment.vcomment
|
||||
script(src='https://cdn1.lncld.net/static/js/3.0.4/av-min.js')
|
||||
script(src='https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js')
|
||||
script.
|
||||
var notify = '#{ theme.valine.notify }' == true ? true : false;
|
||||
var verify = '#{ theme.valine.verify }' == true ? true : false;
|
||||
var GUEST_INFO = ['nick','mail','link'];
|
||||
var guest_info = '#{ theme.valine.guest_info }'.split(',').filter(function(item){
|
||||
return GUEST_INFO.indexOf(item) > -1
|
||||
});
|
||||
guest_info = guest_info.length == 0 ? GUEST_INFO :guest_info;
|
||||
|
||||
var localeName = 'tw',
|
||||
localeMode = {
|
||||
head: {
|
||||
nick: '暱稱(必填)',
|
||||
mail: '郵箱(必填,可以收到回復提醒)',
|
||||
link: '網址(選填)',
|
||||
},
|
||||
tips: {
|
||||
comments: '評論',
|
||||
sofa: '快來做第一個評論的人吧~',
|
||||
busy: '還在提交中,請稍候...',
|
||||
again: '這麼簡單也能錯,也是沒誰了.'
|
||||
},
|
||||
ctrl: {
|
||||
reply: '回覆',
|
||||
ok: '好的',
|
||||
sure: '確認',
|
||||
cancel: '取消',
|
||||
confirm: '確認',
|
||||
continue: '繼續',
|
||||
more: '查看更多...',
|
||||
try: '再試試?',
|
||||
preview: '預覽',
|
||||
emoji: '表情'
|
||||
},
|
||||
error: {
|
||||
99: '初始化失敗,請檢查init中的`el`元素.',
|
||||
100: '初始化失敗,請檢查你的AppId和AppKey.',
|
||||
401: '未經授權的操作,請檢查你的AppId和AppKey.',
|
||||
403: '訪問被api域名白名單拒絕,請檢查你的安全域名設置.',
|
||||
},
|
||||
timeago: {
|
||||
seconds: '秒前',
|
||||
minutes: '分鐘前',
|
||||
hours: '小時前',
|
||||
days: '天前',
|
||||
now: '剛剛'
|
||||
}
|
||||
};
|
||||
|
||||
window.valine = new Valine();
|
||||
valine.installLocale(localeName,localeMode);
|
||||
|
||||
valine.init({
|
||||
el:'#vcomment',
|
||||
notify:notify,
|
||||
verify:verify,
|
||||
appId:'#{theme.valine.appId}',
|
||||
appKey:'#{theme.valine.appKey}',
|
||||
placeholder:'#{theme.valine.placeholder}',
|
||||
avatar:'#{theme.valine.avatar}',
|
||||
guest_info:guest_info,
|
||||
pageSize:'#{theme.valine.pageSize}',
|
||||
lang:'#{theme.valine.lang}',
|
||||
visitor: true
|
||||
});
|
||||
Reference in New Issue
Block a user