Fix darkmode get switched on in session when there's no preferences yet

This commit is contained in:
Hadi Nategh 2021-03-18 16:32:21 +01:00
parent 1a1e3818c2
commit 98813ef055

View File

@ -1331,13 +1331,13 @@ var fw_base = (function(){ "use strict"; return Class.extend(
*/ */
_setDarkMode: function(_state) _setDarkMode: function(_state)
{ {
let state = _state == '0' ?'0':'1'; let state = !_state || _state == '0' ?'0':'1';
jQuery('html').attr('data-darkmode', state); jQuery('html').attr('data-darkmode', state);
jQuery('iframe').each((i, frame) =>{ jQuery('iframe').each((i, frame) =>{
try { try {
if (frame && frame.contentWindow && frame.contentWindow.jQuery) if (frame && frame.contentWindow && frame.contentWindow.jQuery)
{ {
frame.contentWindow.jQuery('html').attr('data-darkmode', _state == 0?'':'1'); frame.contentWindow.jQuery('html').attr('data-darkmode', state == 0?'':'1');
} }
}catch(e) }catch(e)
{ {