-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(comments): add Cusdis support (#43)
* feat(comments): add Cusdis support * feat: set cusdis theme
- Loading branch information
WingLim
authored
Sep 25, 2021
1 parent
628a0be
commit a673237
Showing
2 changed files
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
.disqus-container { | ||
padding-top: 2rem; | ||
} | ||
|
||
#cusdis_thread { | ||
padding-top: 2rem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<div id="cusdis_thread" data-host="https://cusdis.com" | ||
data-app-id="{{ .Site.Params.comments.cusdis.id }}" | ||
data-page-id="{{ .File.UniqueID }}" | ||
data-page-url="{{ .Permalink }}" | ||
data-page-title="{{ .Title }}"></div> | ||
<script async defer src="https://cusdis.com/js/cusdis.es.js"></script> | ||
|
||
<script> | ||
function setCusdisTheme(theme) { | ||
let cusdis = document.querySelector('#cusdis_thread iframe'); | ||
if (cusdis) { | ||
window.CUSDIS.setTheme(theme) | ||
} | ||
} | ||
|
||
window.addEventListener('onColorSchemeChange', (e) => { | ||
setCusdisTheme(e.detail) | ||
}) | ||
</script> |