edit zenmode to not be persisted

This commit is contained in:
Nuno Coração 2024-01-04 21:25:53 +00:00
parent 2fdb03f9f5
commit 09bdcb78a2
3 changed files with 10 additions and 8 deletions

View file

@ -24,13 +24,14 @@ function _toogleZenMode(zendModeButton) {
if (body.classList.contains('zen-mode-enable')) {
// Persist configuration
localStorage.setItem('blowfish-zen-mode-enabled', 'true');
//localStorage.setItem('blowfish-zen-mode-enabled', 'true');
// Change title to enable
zendModeButton.setAttribute('title', titleI18nEnable)
// Auto-scroll to title article
window.scrollTo(window.scrollX, header.getBoundingClientRect().top - 90);
} else {
localStorage.setItem('blowfish-zen-mode-enabled', 'false');
//localStorage.setItem('blowfish-zen-mode-enabled', 'false');
zendModeButton.setAttribute('title', titleI18nDisable);
document.querySelector('body').scrollIntoView();
}
@ -56,10 +57,10 @@ function _registerZendModeButtonClick(zendModeButton) {
}
// Initialize localstorage option 'blowfish-zen-mode-enabled' to false, if it does not exist, otherwise enable it.
if (localStorage.getItem('blowfish-zen-mode-enabled') === null) {
localStorage.setItem('blowfish-zen-mode-enabled', 'false');
} else if (localStorage.getItem('blowfish-zen-mode-enabled') === 'true') {
_toogleZenMode(zendModeButton)
}
//if (localStorage.getItem('blowfish-zen-mode-enabled') === null) {
// localStorage.setItem('blowfish-zen-mode-enabled', 'false');
//} else if (localStorage.getItem('blowfish-zen-mode-enabled') === 'true') {
// _toogleZenMode(zendModeButton)
//}
});
})();

View file

@ -44,7 +44,7 @@ smartTOCHideUnfocusedChildren = false
showMoreLinkDest = "docs"
cardView = false
cardViewScreenWidth = false
layoutBackgroundBlur = true # only used when layout equals background
layoutBackgroundBlur = false # only used when layout equals background
[article]
showDate = false

View file

@ -232,6 +232,7 @@ Many of the article defaults here can be overridden on a per article basis by sp
| `article.showWordCount` | `false` | Whether or not article word counts are displayed. |
| `article.showComments` | `false` | Whether or not the [comments partial]({{< ref "partials#comments" >}}) is included after the article footer. |
| `article.sharingLinks` | _Not set_ | Which sharing links to display at the end of each article. When not provided, or set to `false` no links will be displayed. Available values are: "linkedin", "twitter", "reddit", "pinterest", "facebook", "email", "whatsapp", and "telegram" |
| `article.showZenMode` | `true` | Flag to activate Zen Mode reading feature for articles. |
### List