2020-10-04 10:23:08 -04:00
|
|
|
<script src="https://utteranc.es/client.js"
|
|
|
|
repo="{{ .Site.Params.comments.utterances.repo }}"
|
|
|
|
issue-term="{{ .Site.Params.comments.utterances.issueTerm }}"
|
|
|
|
{{ with .Site.Params.comments.utterances.label }}
|
|
|
|
label="{{ . }}"
|
|
|
|
{{ end }}
|
2021-02-11 12:46:23 -05:00
|
|
|
crossorigin="anonymous"
|
|
|
|
async
|
|
|
|
>
|
2020-10-04 10:23:08 -04:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.utterances {
|
|
|
|
max-width: unset;
|
|
|
|
}
|
2021-01-01 07:32:19 -05:00
|
|
|
</style>
|
|
|
|
|
|
|
|
<script>
|
2021-02-11 12:46:23 -05:00
|
|
|
function setUtterancesTheme(theme) {
|
2021-01-01 07:32:19 -05:00
|
|
|
let utterances = document.querySelector('.utterances iframe');
|
|
|
|
if (utterances) {
|
|
|
|
utterances.contentWindow.postMessage(
|
|
|
|
{
|
|
|
|
type: 'set-theme',
|
2021-02-11 12:46:23 -05:00
|
|
|
theme: `github-${theme}`
|
2021-01-01 07:32:19 -05:00
|
|
|
},
|
|
|
|
'https://utteranc.es'
|
|
|
|
);
|
|
|
|
}
|
2021-02-11 12:46:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
addEventListener('message', event => {
|
|
|
|
if (event.origin !== 'https://utteranc.es') return;
|
|
|
|
setUtterancesTheme(document.body.dataset.scheme)
|
|
|
|
});
|
|
|
|
|
|
|
|
window.addEventListener('onColorSchemeChange', (e) => {
|
|
|
|
setUtterancesTheme(e.detail)
|
2021-01-01 07:32:19 -05:00
|
|
|
})
|
|
|
|
</script>
|