From d500b6c018dca9ffce51b6fd670ac8105a33f318 Mon Sep 17 00:00:00 2001 From: hogelog Date: Fri, 19 Dec 2008 08:19:45 +0000 Subject: * fix endless recursion bug. git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@27067 d0d07461-0603-4401-acd4-de1884942a52 --- char-hints-mod2.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'char-hints-mod2.js') diff --git a/char-hints-mod2.js b/char-hints-mod2.js index 9fc58dd..0d285b2 100644 --- a/char-hints-mod2.js +++ b/char-hints-mod2.js @@ -127,7 +127,7 @@ set charhintshow=uppercase|lowercase: return chars; } //}}} - function showCharHints(win) //{{{ + function showCharHints() //{{{ { function showHints(win) { @@ -136,21 +136,22 @@ set charhintshow=uppercase|lowercase: let num = elem.getAttribute("number"); let hintchar = num2chars(parseInt(num, 10)); elem.setAttribute("hintchar", showCase(hintchar)); - pageHints.push(elem); + if(isValidHint(hintchar)) + validHints.push(elem); } - Array.forEach(win.frames, showCharHints); + Array.forEach(win.frames, showHints); } - pageHints = []; + validHints = []; showHints(window.content); } //}}} - function isValidHint(elem) //{{{ + function isValidHint(hint) //{{{ { - return inputCase(elem.getAttribute("hintchar")).indexOf(hintInput) == 0; + return inputCase(hint).indexOf(hintInput) == 0; } //}}} var hintInput = ""; - var pageHints = []; + var validHints = []; var charhints = plugins.charhints = { show: function (minor, filter, win) //{{{ { @@ -174,7 +175,6 @@ set charhintshow=uppercase|lowercase: } } if(hintInput.length>0) { - let validHints = pageHints.filter(isValidHint); let numstr = String(chars2num(hintInput)); // no setTimeout, don't run nice setTimeout(function () { -- cgit v1.2.3