|
|
@ -72,15 +72,14 @@ |
|
|
|
setTheme('light'); |
|
|
|
setTheme('light'); |
|
|
|
} |
|
|
|
} |
|
|
|
H.set('padTheme', newTheme); |
|
|
|
H.set('padTheme', newTheme); |
|
|
|
console.log('here'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
function setTheme(newTheme){ |
|
|
|
|
|
|
|
|
|
|
|
function setTheme(newTheme) { |
|
|
|
document.body.classList.remove('light'); |
|
|
|
document.body.classList.remove('light'); |
|
|
|
document.body.classList.remove('dark'); |
|
|
|
document.body.classList.remove('dark'); |
|
|
|
document.body.classList.add(newTheme); |
|
|
|
document.body.classList.add(newTheme); |
|
|
|
var btns = Array.prototype.slice.call(document.getElementById('tools').querySelectorAll('a img')); |
|
|
|
var btns = Array.prototype.slice.call(document.getElementById('tools').querySelectorAll('a img')); |
|
|
|
if (newTheme == 'light'){ |
|
|
|
if (newTheme == 'light') { |
|
|
|
// check if current theme is dark otherwise we'll get `_dark_dark@2x.png` |
|
|
|
// check if current theme is dark otherwise we'll get `_dark_dark@2x.png` |
|
|
|
if (H.get('padTheme', 'auto') == 'dark'){ |
|
|
|
if (H.get('padTheme', 'auto') == 'dark'){ |
|
|
|
for (var i=0; i<btns.length; i++) { |
|
|
|
for (var i=0; i<btns.length; i++) { |
|
|
@ -97,15 +96,17 @@ |
|
|
|
|
|
|
|
|
|
|
|
if (H.get('padTheme', 'auto') == 'light') { |
|
|
|
if (H.get('padTheme', 'auto') == 'light') { |
|
|
|
setTheme('light'); |
|
|
|
setTheme('light'); |
|
|
|
} else if (H.get('padTheme', 'auto') == 'dark'){ |
|
|
|
} else if (H.get('padTheme', 'auto') == 'dark') { |
|
|
|
setTheme('dark'); |
|
|
|
setTheme('dark'); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
const isDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches |
|
|
|
const isDarkMode = window.matchMedia("(prefers-color-scheme: dark)").matches |
|
|
|
if (isDarkMode) setTheme('dark'); |
|
|
|
if (isDarkMode) { |
|
|
|
else setTheme('light'); |
|
|
|
setTheme('dark'); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
setTheme('light'); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var $writer = H.getEl('writer'); |
|
|
|
var $writer = H.getEl('writer'); |
|
|
|
var $btnPublish = H.getEl('publish'); |
|
|
|
var $btnPublish = H.getEl('publish'); |
|
|
|
var $wc = H.getEl("wc"); |
|
|
|
var $wc = H.getEl("wc"); |
|
|
|