openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 8702fc6dbe1406ad682494ed48937d9f19d88595
parent f59125d2f80eb00303f901a4ac977314f1b5337d
Author: dankert <openrat@jandankert.de>
Date:   Sat, 18 Dec 2021 03:57:38 +0100

New: Using localStorage for user style.

Diffstat:
Mmodules/cms/ui/themes/default/script/openrat/workbench.js | 14++++++++++++++
1 file changed, 14 insertions(+), 0 deletions(-)

diff --git a/modules/cms/ui/themes/default/script/openrat/workbench.js b/modules/cms/ui/themes/default/script/openrat/workbench.js @@ -68,6 +68,7 @@ export default class Workbench { }; this.registerWorkbench(); + this.initializeTheme(); this.initializeStartupNotices(); this.initializeEvents(); this.initializeKeystrokes(); @@ -88,6 +89,16 @@ export default class Workbench { } + + initializeTheme() { + if (window.localStorage) { + let style = window.localStorage.getItem('style'); + if (style) + this.setUserStyle(style); + } + } + + initializeDirtyWarning() { // If the application should be closed, inform the user about unsaved changes. @@ -392,6 +403,9 @@ export default class Workbench { */ setUserStyle( styleName ) { + if ( window.localStorage ) + window.localStorage.setItem('style',styleName); + let styleUrl = View.createUrl('index','themestyle',0,{'style':styleName} ); document.getElementById('user-style').setAttribute('href',styleUrl); }