Skip to content

Commit

Permalink
fix: cannot switch color scheme without utterances
Browse files Browse the repository at this point in the history
  • Loading branch information
wangchucheng committed Jul 6, 2021
1 parent 671af13 commit ccd5695
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions assets/js/eureka.js
Expand Up @@ -154,12 +154,14 @@ function getcolorscheme() {
{{ $enableUtterances := and (eq $commentHandler "utterances") (eq .Site.Params.comment.utterances.theme "eureka") }}
{{- if $enableUtterances }}
function switchUtterancesTheme(theme) {
const message = {
type: 'set-theme',
theme: theme,
};
const utterances = document.querySelector('iframe').contentWindow; // try event.source instead
utterances.postMessage(message, 'https://utteranc.es');
try {
const message = {
type: 'set-theme',
theme: theme,
};
const utterances = document.querySelector('iframe').contentWindow; // try event.source instead
utterances.postMessage(message, 'https://utteranc.es');
} catch {}
}
{{- end }}

Expand Down
2 changes: 1 addition & 1 deletion data/eureka.yaml
@@ -1 +1 @@
version: 0.8.1-dev
version: 0.8.1
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "hugo-eureka",
"version": "0.8.1-dev",
"version": "0.8.1",
"description": "Eureka is a feature-rich and highly customizable Hugo theme.",
"repository": "https://github.com/wangchucheng/hugo-eureka",
"author": "C. Wang <me@wangchucheng.com>",
Expand Down

0 comments on commit ccd5695

Please sign in to comment.