From: Daniel Carl Date: Sat, 30 Mar 2013 01:13:27 +0000 (+0100) Subject: Fixed none working hint class replacing. X-Git-Url: https://git.owens.tech/assets/static/git-logo.png/assets/static/git-logo.png/git?a=commitdiff_plain;h=e3525eccf8f952787447b1077cb9bfc51a201e56;p=vimb.git Fixed none working hint class replacing. If a hint become focused the new hint class was not set properly to the element. And the hint class was already set if the hints where cleared. --- diff --git a/src/hints.js b/src/hints.js index 632cb4a..b00aebb 100644 --- a/src/hints.js +++ b/src/hints.js @@ -69,6 +69,7 @@ function VimbHints(mode, usage, bg, bgf, fg, style, maxHints) var hint = hintSpan.cloneNode(false); hint.style.left = Math.max((rect.left + win.scrollX), win.scrollX) - 3 + "px"; hint.style.top = Math.max((rect.top + win.scrollY), win.scrollY) - 3 + "px"; + hint.className = hClass; hint.appendChild(doc.createTextNode(hCount + 1)); fragment.appendChild(hint); @@ -176,6 +177,8 @@ function VimbHints(mode, usage, bg, bgf, fg, style, maxHints) if (hint.e) { hint.e.style.background = hint.bg; hint.e.style.color = hint.fg; + hint.e.classList.remove(hClassFocus); + hint.e.classList.remove(hClass); hint.span.parentNode.removeChild(hint.span); } } @@ -244,7 +247,7 @@ function VimbHints(mode, usage, bg, bgf, fg, style, maxHints) /* reset previous focused hint */ var hint = _getHintByNum(focusNum); if (hint) { - hint.e.className = hint.e.className.replace(hClassFocus, hClass); + hint.e.classList.remove(hClassFocus); hint.e.style.background = bg; _mouseEvent(hint.e, "mouseout"); } @@ -254,7 +257,7 @@ function VimbHints(mode, usage, bg, bgf, fg, style, maxHints) /* mark new hint as focused */ hint = _getHintByNum(focusNum); if (hint) { - hint.e.className = hint.e.className.replace(hClass, hClassFocus); + hint.e.classList.add(hClassFocus); hint.e.style.background = bgf; var source = _getSrc(hint.e); _mouseEvent(hint.e, "mouseover");