@@ -151,16 +151,23 @@ class Widget {
151151 this . setTabbedView ( tabbedView ) ;
152152
153153 tabSetting . addEventListener ( 'change' , ( ) => {
154- let tabbedView = 'true' ;
155- if ( ! tabSetting . checked ) {
156- tabbedView = 'false' ;
157- }
158- cookies . set ( 'tabbed_view' , tabbedView , { expires : 3650 } ) ;
159- this . setTabbedView ( tabSetting . checked ) ;
154+ if ( window . confirm ( Strings . RELOAD_CONFIRM_MSG ) ) {
155+ let tabbedView = 'true' ;
156+ if ( ! tabSetting . checked ) {
157+ tabbedView = 'false' ;
158+ }
159+ cookies . set ( 'tabbed_view' , tabbedView , { expires : 3650 } ) ;
160+ this . setTabbedView ( tabSetting . checked ) ;
160161
161- // Current approach: just reload the page to
162- // set the correct theme for all widgets.
163- location . reload ( ) ;
162+ // Current approach: just reload the page to
163+ // set the correct theme for all widgets.
164+ location . reload ( ) ;
165+ }
166+ else
167+ {
168+ // Revert if user chooses "no change"
169+ tabSetting . checked = ! tabSetting . checked ;
170+ }
164171 } ) ;
165172
166173 this . initCompilerSwitches ( ) ;
@@ -175,16 +182,23 @@ class Widget {
175182 this . setTheme ( cookieTheme ) ;
176183
177184 themeSetting . addEventListener ( 'change' , ( ) => {
178- let theme = 'light' ;
179- if ( themeSetting . checked ) {
180- theme = 'dark' ;
181- }
182- cookies . set ( 'theme' , theme , { expires : 3650 } ) ;
183- this . setTheme ( theme ) ;
185+ if ( window . confirm ( Strings . RELOAD_CONFIRM_MSG ) ) {
186+ let theme = 'light' ;
187+ if ( themeSetting . checked ) {
188+ theme = 'dark' ;
189+ }
190+ cookies . set ( 'theme' , theme , { expires : 3650 } ) ;
191+ this . setTheme ( theme ) ;
184192
185- // Current approach: just reload the page to
186- // set the correct theme for all widgets.
187- location . reload ( ) ;
193+ // Current approach: just reload the page to
194+ // set the correct theme for all widgets.
195+ location . reload ( ) ;
196+ }
197+ else
198+ {
199+ // Revert if user chooses "no change"
200+ themeSetting . checked = ! themeSetting . checked ;
201+ }
188202 } ) ;
189203
190204 const resetButton =
0 commit comments