-
Notifications
You must be signed in to change notification settings - Fork 432
Expand file tree
/
Copy pathgiscus.ejs
More file actions
37 lines (37 loc) · 1.57 KB
/
giscus.ejs
File metadata and controls
37 lines (37 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<script src="https://giscus.app/client.js"
data-repo="<%- giscus.repo %>"
data-repo-id="<%- giscus['repo-id'] %>"
data-category="<%- giscus.category %>"
data-category-id="<%- giscus['category-id'] %>"
data-mapping="<%- giscus.mapping %>"
data-reactions-enabled="<%- giscus['reactions-enabled'] ? 1 : 0 %>"
data-emit-metadata="0"
data-input-position="<%- giscus['input-position'] %>"
data-theme="<%- giscus.theme %>"
data-lang="<%- giscus.language %>"
crossorigin="anonymous"
<%- giscus.loading ? `data-loading=${giscus.loading}` : '' %>
async>
</script>
<script type="application/javascript">
const giscusIframeObserver = new MutationObserver(function (mutations) {
mutations.forEach(function (mutation) {
mutation.addedNodes.forEach(function (addedNode) {
if (addedNode.matches && addedNode.matches('div.giscus')) {
const giscusIframe = addedNode.querySelector('iframe.giscus-frame');
if(giscusIframe) {
giscusIframe.addEventListener("load", function() {
window.setTimeout(() => {
toggleGiscusIfUsed(hasAlternateSentinel(), authorPrefersDark);
}, 100);
});
giscusIframeObserver.disconnect();
}
}
});
});
});
giscusIframeObserver.observe(document.body, { childList: true, subtree: true });
</script>
<input type="hidden" id="giscus-base-theme" value="<%- giscus.baseTheme %>">
<input type="hidden" id="giscus-alt-theme" value="<%- giscus.altTheme %>">