diff options
author | Wang Chucheng <me@wangchucheng.com> | 2021-07-06 18:12:35 +0300 |
---|---|---|
committer | Wang Chucheng <me@wangchucheng.com> | 2021-07-06 18:12:35 +0300 |
commit | ccd5695125f1516db25424dc723eaa9fc6b3e87a (patch) | |
tree | cbeac9615776cac6a22dd5f8526e52be4cc53ae0 | |
parent | 671af134f27c9de5786a6abad4c8b722b2b7af93 (diff) |
fix: cannot switch color scheme without utterancesv0.8.1
-rw-r--r-- | assets/js/eureka.js | 14 | ||||
-rw-r--r-- | data/eureka.yaml | 2 | ||||
-rw-r--r-- | package.json | 2 |
3 files changed, 10 insertions, 8 deletions
diff --git a/assets/js/eureka.js b/assets/js/eureka.js index 5aa52a7..f2ea102 100644 --- a/assets/js/eureka.js +++ b/assets/js/eureka.js @@ -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 }} diff --git a/data/eureka.yaml b/data/eureka.yaml index b7b5629..986f7e6 100644 --- a/data/eureka.yaml +++ b/data/eureka.yaml @@ -1 +1 @@ -version: 0.8.1-dev
\ No newline at end of file +version: 0.8.1
\ No newline at end of file diff --git a/package.json b/package.json index 5310624..3857f8d 100644 --- a/package.json +++ b/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>", |