From 72379dd288e862fa724b06e901d8dbe01a2fb2dc Mon Sep 17 00:00:00 2001 From: drry Date: Sat, 13 Dec 2008 05:24:05 +0000 Subject: * fixed a regex. * et cetera. git-svn-id: http://svn.coderepos.org/share/lang/javascript/vimperator-plugins/trunk@26610 d0d07461-0603-4401-acd4-de1884942a52 --- char-hints-mod2.js | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'char-hints-mod2.js') diff --git a/char-hints-mod2.js b/char-hints-mod2.js index 66c2d89..cd322a5 100644 --- a/char-hints-mod2.js +++ b/char-hints-mod2.js @@ -25,7 +25,7 @@ set histchars="hjkl" => show char-hint use h, j, k, l. ; //}}} -(function (){ +(function () { const DEFAULT_HINTCHARS = "HJKLASDFGYUIOPQWERTNMZXCVB"; @@ -38,7 +38,7 @@ set histchars="hjkl" => show char-hint use h, j, k, l. var num = 0; var hintchars = options.hintchars.toUpperCase(); var base = hintchars.length; - for(let i=0;i show char-hint use h, j, k, l. chars = hintchars[((num % base))] + chars; num = Math.floor(num/base); } while(num>0); - + return chars; } //}}} function showCharHints() //{{{ { - for (let elem in buffer.evaluateXPath("//*[@liberator:highlight and @number]", window.content.document)) + for(let elem in buffer.evaluateXPath("//*[@liberator:highlight and @number]", window.content.document)) { let num = elem.getAttribute("number"); let hintchar = num2chars(parseInt(num, 10)); @@ -65,30 +65,30 @@ set histchars="hjkl" => show char-hint use h, j, k, l. } } //}}} - let hintContext = hints.addMode; - let hintChars = []; - let charhints = plugins.charhints = { - show: function(minor, filter, win) //{{{ + var hintContext = hints.addMode; + var hintChars = []; + var charhints = plugins.charhints = { + show: function (minor, filter, win) //{{{ { charhints.original.show(minor, filter, win); hintChars = []; showCharHints(); }, //}}} - onInput: function(event) //{{{ + onInput: function (event) //{{{ { - let hintString = commandline.command; - commandline.command = hintString.replace(/[A-Z]/g, ""); + var hintString = commandline.command; + commandline.command = hintString.replace(/[A-Z]+/g, ""); charhints.original.onInput(event); showCharHints(); - for(let i=0;i0) { - let numstr = String(chars2num(hintChars.join(''))); - setTimeout(function() { - for(let i=0;i show char-hint use h, j, k, l. }, //}}} }; - if(!charhints.original){ + if(!charhints.original) { charhints.original = { show: hints.show, onInput: liberator.eval("onInput", hintContext), @@ -108,21 +108,21 @@ set histchars="hjkl" => show char-hint use h, j, k, l. charhints.install = function () //{{{ { hints.show = charhints.show; - liberator.eval('onInput = plugins.charhints.onInput', hintContext); + liberator.eval("onInput = plugins.charhints.onInput", hintContext); highlight.CSS = highlight.CSS.replace( - 'Hint::after,,* content: attr(number);', - 'Hint::after,,* content: attr(hintchar);'); + "Hint::after,,* content: attr(number);", + "Hint::after,,* content: attr(hintchar);"); highlight.reload(); }; //}}} charhints.uninstall = function () //{{{ { hints.show = charhints.original.show; - liberator.eval('onInput = plugins.charhints.original.onInput', hintContext); + liberator.eval("onInput = plugins.charhints.original.onInput", hintContext); highlight.CSS = highlight.CSS.replace( - 'Hint::after,,* content: attr(hintchar);', - 'Hint::after,,* content: attr(number);'); + "Hint::after,,* content: attr(hintchar);", + "Hint::after,,* content: attr(number);"); highlight.reload(); }; //}}} } -- cgit v1.2.3