Skip to content

Commit 66bd702

Browse files
committed
Fixed button icon state displaying
Signed-off-by: Hofi <hofione@gmail.com>
1 parent 23b098f commit 66bd702

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

_includes/skins.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@
7676
setCookie(selectedSkinBackgroundColorKey, backgroundColor);
7777
};
7878

79-
function toggleIcon(target, off) {
80-
if (off) {
79+
function setIcon(target, isOff) {
80+
if (isOff) {
8181
target.classList.remove('fa-toggle-on');
8282
target.classList.add('fa-toggle-off');
8383
}
@@ -91,7 +91,7 @@
9191
var off = getSkinModeState() == darkModeStateOff;
9292

9393
setSkinModeState(off ? darkModeStateOn : darkModeStateOff);
94-
toggleIcon(event.target, off);
94+
setIcon(event.target, off == false);
9595

9696
event.currentTarget.blur();
9797
}
@@ -107,8 +107,10 @@
107107
// Why this is not working?!?!
108108
//document.body.style.removeProperty("backgroundColor");
109109
document.body.style.backgroundColor = "";
110-
111-
toggleIcon($('#skin-button').find('.masthead_button_icon')[0], getSkinModeState());
110+
111+
var currSkinModeState = getSkinModeState();
112+
setIcon($('#skin-button').find('.masthead_button_icon')[0], currSkinModeState == darkModeStateOff);
113+
112114
$("#skin-button").on("click", toggleSkin);
113115

114116
// TODO: See, setSkinModeState - stylesheet.onload

0 commit comments

Comments
 (0)