-
-
Notifications
You must be signed in to change notification settings - Fork 93
Expand file tree
/
Copy pathGiscus.razor.js
More file actions
18 lines (17 loc) · 780 Bytes
/
Copy pathGiscus.razor.js
File metadata and controls
18 lines (17 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
window.initGiscus = (divClass, giscus) => {
const script = document.createElement('script');
script.src = 'https://giscus.app/client.js'
script.setAttribute('data-repo', giscus.repository)
script.setAttribute('data-repo-id', giscus.repositoryId)
script.setAttribute('data-category', giscus.category)
script.setAttribute('data-category-id', giscus.categoryId)
script.setAttribute('data-mapping', 'title')
script.setAttribute('data-reactions-enabled', '0')
script.setAttribute('data-emit-metadata', '0')
script.setAttribute('data-theme', 'dark_dimmed')
script.crossOrigin = 'anonymous'
const elementToAppend = document.getElementsByClassName(divClass)[0]
if (elementToAppend) {
elementToAppend.appendChild(script)
}
}