Files
hexo-theme-butterfly/layout/includes/comments/valine.pug
hwy0127@gmail.com 5a3363e0e4 fix bugs
2019-06-17 21:25:18 +08:00

70 lines
2.3 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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}',
recordIP: true
});