Files
blog/public/js/shuoshuo.js
T

46 lines
1.6 KiB
JavaScript

function loadArtalk(memo_id) {
const commentDiv = document.getElementById('memo_' + memo_id);
const commentBtn = document.getElementById('btn_memo_' + memo_id);
if (commentDiv.style.display === 'none') {
commentDiv.style.display = 'block';
commentBtn.innerHTML = '收起评论';
new Artalk({
el: '#memo_' + memo_id, // 绑定元素的 Selector
pageKey: '/m/' + memo_id, // 固定链接 (留空自动获取)
pageTitle: '', // 页面标题 (留空自动获取)
server: 'https://artalk.usj.cc', // 后端地址
site: '优世界', // 在后端中创建的站点名
});
} else {
commentDiv.style.display = 'none';
commentBtn.innerHTML = '点击评论';
}
}
Artalk.loadCountWidget({
server: 'https://artalk.usj.cc',
site: '优世界',
pvEl: '#ArtalkPV',
countEl: '#ArtalkCount',
});
function getTotal() {
var totalUrl = "https://memos.usj.cc/api/memo/stats?creatorId=1"
fetch(totalUrl).then(res => res.json()).then(resdata => {
if (resdata.data) {
var allnums = resdata.data.length
var memosCount = document.getElementById('memosCount');
memosCount.innerHTML = allnums;
}
}).catch(err => {
// Do something for an error here
});
};
window.onload = getTotal();
// Memos Total End
// 激活灯箱插件
window.ViewImage && ViewImage.init('.text img , .memos-photo img');
// 将说说页面第一个和最后一个 hr 标签的 display 属性设置为 none
$("hr").first().css('display', 'none');
$("hr").last().css('display', 'none');