42 lines
1.3 KiB
Plaintext
42 lines
1.3 KiB
Plaintext
<%- js(theme.comments.valine.js) %>
|
|
<script>
|
|
function emoji(path, idx, ext) {
|
|
return path + "/" + path + "-" + idx + "." + ext;
|
|
}
|
|
var emojiMaps = {};
|
|
for (var i = 1; i <= 54; i++) {
|
|
emojiMaps['tieba-' + i] = emoji('tieba', i, 'png');
|
|
}
|
|
for (var i = 1; i <= 101; i++) {
|
|
emojiMaps['qq-' + i] = emoji('qq', i, 'gif');
|
|
}
|
|
for (var i = 1; i <= 116; i++) {
|
|
emojiMaps['aru-' + i] = emoji('aru', i, 'gif');
|
|
}
|
|
for (var i = 1; i <= 125; i++) {
|
|
emojiMaps['twemoji-' + i] = emoji('twemoji', i, 'png');
|
|
}
|
|
for (var i = 1; i <= 4; i++) {
|
|
emojiMaps['weibo-' + i] = emoji('weibo', i, 'png');
|
|
}
|
|
function load_comment(){
|
|
if(!document.getElementById("valine_container"))return;
|
|
const el = document.getElementById("valine_container");
|
|
var path = el.getAttribute('comment_id');
|
|
const placeholder = "<%= theme.comments.valine.placeholder %>";
|
|
if (!path) {
|
|
path = decodeURI(window.location.pathname);
|
|
}
|
|
var valine = new Valine();
|
|
valine.init(Object.assign(<%- JSON.stringify(theme.comments.valine) %>, {
|
|
el: '#valine_container',
|
|
path: path,
|
|
placeholder: placeholder,
|
|
emojiCDN: 'https://cdn.jsdelivr.net/gh/volantis-x/cdn-emoji/valine/',
|
|
emojiMaps: emojiMaps,
|
|
}));
|
|
|
|
}
|
|
load_comment();
|
|
</script>
|