sites

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 305895d04ba587814dfa03b07813101f82a7bc94
parent f0b44dc6ede940322c342bedd84761f8fb7d42be
Author: pancake <unknown>
Date:   Thu, 14 Jan 2010 14:03:47 +0100

* Code cleanup for the link hinting script (thanks nibble)
Diffstat:
Msurf.suckless.org/files/link_hints.md | 20+++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/surf.suckless.org/files/link_hints.md b/surf.suckless.org/files/link_hints.md @@ -20,7 +20,7 @@ Author Code ---- - /* based on chromium plugin code */ + /* based on chromium plugin code, adapted by Nibble<.gs@gmail> */ var hint_num_str = ''; var hint_elems = []; var hint_open_in_new_tab = false; @@ -28,8 +28,11 @@ Code function hintMode(newtab){ hint_enabled = true; - if (newtab) hint_open_in_new_tab = true; - else hint_open_in_new_tab = false; + if (newtab) { + hint_open_in_new_tab = true; + } else { + hint_open_in_new_tab = false; + } setHints(); document.removeEventListener('keydown', initKeyBind, false); document.addEventListener('keydown', hintHandler, false); @@ -43,17 +46,9 @@ Code if (hint_num_str == '') hint_num_str = '1'; judgeHintNum(Number(hint_num_str)); - } else if (/[0-9asdfghjkl;]/.test(pressedKey) == false || pressedKey =='Esc') { + } else if (/[0-9]/.test(pressedKey) == false) { removeHints(); } else { - // TODO - if (pressedKey == 'U+00BA') { - pressedKey = ';'; - } - var num = ';asdfghjkl'.indexOf(pressedKey); - if (num >= 0) { - pressedKey = num; - } hint_num_str += pressedKey; var hint_num = Number(hint_num_str); if (hint_num * 10 > hint_elems.length + 1) { @@ -206,7 +201,6 @@ Code function initKeyBind(e){ var t = e.target; if( t.nodeType == 1){ - tn=t.tagName.toLowerCase(); addKeyBind( 'C-f', 'hintMode()', e ); addKeyBind( 'C-F', 'hintMode(true)', e ); addKeyBind( 'C-c', 'removeHints()', e );