hexo-theme-stellar/layout/_partial/plugins/comments/beaudar/script.ejs

26 lines
868 B
Plaintext
Raw Normal View History

2021-07-23 12:10:24 +08:00
<script>
function beaudar(){
if(!document.getElementById("beaudar"))return;
setTimeout(function() {
var checkbeaudar = setInterval(function () {
var el = document.getElementById("beaudar");
if (!el) return
clearInterval(checkbeaudar)
try {
el.innerHTML="";
} catch (error) {}
var script = document.createElement('script');
script.src = 'https://beaudar.lipk.org/client.js';
const keys = ['repo', 'issue-term', 'issue-number', 'theme', 'label', 'crossorigin', 'input-position', 'comment-order', 'keep-theme'];
keys.forEach((key, i) => {
if (el.attributes[key] && el.attributes[key].value) {
script.setAttribute(key, el.attributes[key].value);
}
});
el.appendChild(script);
}, 200)
});
}
beaudar();
</script>