mirror of
https://github.com/cotes2020/jekyll-theme-chirpy.git
synced 2026-06-23 16:28:40 +00:00
feat(theme): persist user theme preferences (#2756)
- Migrate theme persistence from `sessionStorage` to `localStorage` - Rename theme HTML attribute to `data-bs-theme` for Bootstrap compatibility - Trim and compile CSS according to the chosen theme mode
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
|
||||
{%- comment -%} Auto switch theme {%- endcomment -%}
|
||||
function reloadDisqus(event) {
|
||||
if (event.source === window && event.data && event.data.id === Theme.ID) {
|
||||
if (event.source === window && event.data && event.data.id === Theme.eventId) {
|
||||
{%- comment -%} Disqus hasn't been loaded {%- endcomment -%}
|
||||
if (typeof DISQUS === 'undefined') {
|
||||
return;
|
||||
@@ -33,7 +33,7 @@
|
||||
|
||||
addDisqus();
|
||||
|
||||
if (Theme.switchable) {
|
||||
if (Theme.isToggleable) {
|
||||
addEventListener('message', reloadDisqus);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user