26 lines
816 B
Plaintext
26 lines
816 B
Plaintext
<script>
|
|
function utterances(){
|
|
if(!document.getElementById("utterances"))return;
|
|
setTimeout(function() {
|
|
var checkUtterances = setInterval(function () {
|
|
var el = document.getElementById("utterances");
|
|
if (!el) return
|
|
clearInterval(checkUtterances)
|
|
try {
|
|
el.innerHTML="";
|
|
} catch (error) {}
|
|
var script = document.createElement('script');
|
|
script.src = 'https://utteranc.es/client.js';
|
|
const keys = ['repo', 'issue-term', 'theme', 'label', 'crossorigin'];
|
|
keys.forEach((key, i) => {
|
|
if (el.attributes[key] && el.attributes[key].value) {
|
|
script.setAttribute(key, el.attributes[key].value);
|
|
}
|
|
});
|
|
el.appendChild(script);
|
|
}, 200)
|
|
});
|
|
}
|
|
utterances();
|
|
</script>
|