update comments
This commit is contained in:
parent
37e0e9cc51
commit
4628aa4c50
|
@ -76,9 +76,12 @@ comments:
|
||||||
issue-term: pathname
|
issue-term: pathname
|
||||||
issue-number:
|
issue-number:
|
||||||
theme: preferred-color-scheme
|
theme: preferred-color-scheme
|
||||||
|
label:
|
||||||
input-position: top # top/bottom 评论框位置
|
input-position: top # top/bottom 评论框位置
|
||||||
comment-order: desc # desc 排序
|
comment-order: desc # desc 排序
|
||||||
keep-theme: # true/false
|
keep-theme: # true/false
|
||||||
|
loading: false
|
||||||
|
branch: main
|
||||||
# utterances
|
# utterances
|
||||||
# https://utteranc.es/
|
# https://utteranc.es/
|
||||||
utterances:
|
utterances:
|
||||||
|
@ -86,6 +89,7 @@ comments:
|
||||||
issue-term: pathname
|
issue-term: pathname
|
||||||
issue-number:
|
issue-number:
|
||||||
theme: preferred-color-scheme
|
theme: preferred-color-scheme
|
||||||
|
label:
|
||||||
valine:
|
valine:
|
||||||
js: https://cdn.jsdelivr.net/gh/XuxuGood/simple-blog-cdn@main/js/Valine.min.js
|
js: https://cdn.jsdelivr.net/gh/XuxuGood/simple-blog-cdn@main/js/Valine.min.js
|
||||||
appId: # your appId
|
appId: # your appId
|
||||||
|
|
|
@ -1,25 +1,26 @@
|
||||||
<script>
|
<script>
|
||||||
function beaudar(){
|
function loadBeaudar() {
|
||||||
if(!document.getElementById("beaudar"))return;
|
const els = document.querySelectorAll("#comments #beaudar");
|
||||||
setTimeout(function() {
|
if (els.length === 0) return;
|
||||||
var checkbeaudar = setInterval(function () {
|
els.forEach((el, i) => {
|
||||||
var el = document.getElementById("beaudar");
|
try {
|
||||||
if (!el) return
|
el.innerHTML = '';
|
||||||
clearInterval(checkbeaudar)
|
} catch (error) {
|
||||||
try {
|
console.log(error);
|
||||||
el.innerHTML="";
|
}
|
||||||
} catch (error) {}
|
var script = document.createElement('script');
|
||||||
var script = document.createElement('script');
|
script.src = 'https://beaudar.lipk.org/client.js';
|
||||||
script.src = 'https://beaudar.lipk.org/client.js';
|
script.async = true;
|
||||||
const keys = ['repo', 'issue-term', 'issue-number', 'theme', 'label', 'crossorigin', 'input-position', 'comment-order', 'keep-theme'];
|
for (let key of Object.keys(el.attributes)) {
|
||||||
keys.forEach((key, i) => {
|
let attr = el.attributes[key];
|
||||||
if (el.attributes[key] && el.attributes[key].value) {
|
if (['class', 'id'].includes(attr.name) === false) {
|
||||||
script.setAttribute(key, el.attributes[key].value);
|
script.setAttribute(attr.name, attr.value);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
el.appendChild(script);
|
el.appendChild(script);
|
||||||
}, 200)
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
beaudar();
|
window.addEventListener('DOMContentLoaded', (event) => {
|
||||||
|
loadBeaudar();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,25 +1,26 @@
|
||||||
<script>
|
<script>
|
||||||
function utterances(){
|
function loadUtterances() {
|
||||||
if(!document.getElementById("utterances"))return;
|
const els = document.querySelectorAll("#comments #utterances");
|
||||||
setTimeout(function() {
|
if (els.length === 0) return;
|
||||||
var checkUtterances = setInterval(function () {
|
els.forEach((el, i) => {
|
||||||
var el = document.getElementById("utterances");
|
try {
|
||||||
if (!el) return
|
el.innerHTML = '';
|
||||||
clearInterval(checkUtterances)
|
} catch (error) {
|
||||||
try {
|
console.log(error);
|
||||||
el.innerHTML="";
|
}
|
||||||
} catch (error) {}
|
var script = document.createElement('script');
|
||||||
var script = document.createElement('script');
|
script.src = 'https://utteranc.es/client.js';
|
||||||
script.src = 'https://utteranc.es/client.js';
|
script.async = true;
|
||||||
const keys = ['repo', 'issue-term', 'issue-number', 'theme', 'label', 'crossorigin'];
|
for (let key of Object.keys(el.attributes)) {
|
||||||
keys.forEach((key, i) => {
|
let attr = el.attributes[key];
|
||||||
if (el.attributes[key] && el.attributes[key].value) {
|
if (['class', 'id'].includes(attr.name) === false) {
|
||||||
script.setAttribute(key, el.attributes[key].value);
|
script.setAttribute(attr.name, attr.value);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
el.appendChild(script);
|
el.appendChild(script);
|
||||||
}, 200)
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
utterances();
|
window.addEventListener('DOMContentLoaded', (event) => {
|
||||||
|
loadUtterances();
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
.cmt-body.beaudar
|
||||||
|
margin: 0 -4px
|
||||||
|
width: 'calc(100% + %s)' % 8px
|
|
@ -7,6 +7,10 @@ if hexo-config('plugins.scrollreveal.enable')
|
||||||
@import 'scrollreveal'
|
@import 'scrollreveal'
|
||||||
|
|
||||||
// 评论
|
// 评论
|
||||||
|
if hexo-config('comments.service') == 'beaudar'
|
||||||
|
@import 'comments/beaudar'
|
||||||
|
if hexo-config('comments.service') == 'twikoo'
|
||||||
|
@import 'comments/twikoo'
|
||||||
if hexo-config('comments.service') == 'utterances'
|
if hexo-config('comments.service') == 'utterances'
|
||||||
@import 'comments/utterances'
|
@import 'comments/utterances'
|
||||||
if hexo-config('comments.service') == 'valine'
|
if hexo-config('comments.service') == 'valine'
|
||||||
|
|
Loading…
Reference in New Issue