char-hints-mod2を小文字だけで使用
char-hints-mod2 のおかげで タイプ量は確実に減って喜んでいたのですが、
shiftを 押すことが億劫になってきたので、修正してみた。
基本的に、いきなり選択するか、ある程度絞り込んでから選択のどちらかと思うので、
- 一文字目が
だったら 「絞り込み;選択」の形式 ( aa;aa = aaAA相当) - 上記以外は、いきなり選択 (aa=AA 相当)
を 実装してみた。
あと 絞り込みを行ったとき、styleがdisplay:noneのノードもhintsに含まれていたので、除外しました。
追記
書いてみたものの よけい面倒な気がしてきた…orz
小文字だけでhints
diff -r c8c2ce4a6a7b char-hints-mod2.js --- a/char-hints-mod2.js Thu May 21 23:51:31 2009 +0430 +++ b/char-hints-mod2.js Thu May 21 23:57:47 2009 +0430 @@ -225,18 +225,25 @@ commandline.command += eventkey; } let hintString = commandline.command; - commandline.command = hintString.replace(inputRegex, ""); + let filter,selector; + if(/^\s/.test(hintString)){ + [filter, selector] = hintString.substring(1).split(";"); + selector = selector || ""; + }else{ + filter = ""; + selector = hintString; + } + + commandline.command = filter; charhints.original.onInput(event); - for(let i=0,l=hintString.length;i<l;++i) { - if(inputRegex.test(hintString[i])) { - hintInput += hintString[i]; - } - } + hintInput = selector.toUpperCase(); let hints = getCharHints(window.content); showCharHints(hints); if(hintInput.length>0) processHintInput(hintInput, hints); + + commandline.command = hintString; }, //}}} onEvent: function (event) //{{{ {
display:none の 除外
diff -r 0eed12fc8d17 char-hints-mod2.js --- a/char-hints-mod2.js Fri May 22 00:00:34 2009 +0430 +++ b/char-hints-mod2.js Fri May 22 00:01:41 2009 +0430 @@ -125,7 +125,7 @@ { let hints = []; (function (win) { - let elems = [elem for(elem in buffer.evaluateXPath('//*[@liberator:highlight="Hint" and @number]', win.document))]; + let elems = [elem for(elem in buffer.evaluateXPath('//*[@liberator:highlight="Hint" and @number][not(contains(@style,"display: none;"))]', win.document))]; hints = hints.concat(elems); Array.forEach(win.frames, arguments.callee); })(win);
迷走中
SKKっぽくした。
デフォルトとあまりかわらない気がしてきた…
- aiueoJK => AiueoJk
- J => j
diff -r 6c99267820aa char-hints-mod2.js --- a/char-hints-mod2.js Fri May 22 02:27:26 2009 +0430 +++ b/char-hints-mod2.js Fri May 22 02:28:01 2009 +0430 @@ -226,10 +226,9 @@ } let hintString = commandline.command; let filter,selector,m; - let filter,selector; - if(/^\s/.test(hintString)){ - [filter, selector] = hintString.substring(1).split(";"); - selector = selector || ""; + if(m = /(^[^a-z][^A-Z]*)(?:([A-Z].*$)|$)/.exec(hintString)){ + filter = m[1]; + selector = m[2] || ""; }else{ filter = ""; selector = hintString;