[wiki] [sites] wiki updated
changeset: 430:0751a1a7ac47
tag: tip
user: pancake
date: Thu Jan 14 14:03:47 2010 +0100
files: surf.suckless.org/files/link_hints.md
description:
* Code cleanup for the link hinting script (thanks nibble)
diff -r b0dcd33d8765 -r 0751a1a7ac47 surf.suckless.org/files/link_hints.md
--- a/surf.suckless.org/files/link_hints.md Thu Jan 14 13:34:15 2010 +0100
+++ b/surf.suckless.org/files/link_hints.md Thu Jan 14 14:03:47 2010 +0100
_AT_@ -20,7 +20,7 @@
Code
----
- /* based on chromium plugin code */
+ /* based on chromium plugin code, adapted by Nibble<.gs_AT_gmail> */
var hint_num_str = '';
var hint_elems = [];
var hint_open_in_new_tab = false;
_AT_@ -28,8 +28,11 @@
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);
_AT_@ -43,17 +46,9 @@
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) {
_AT_@ -206,7 +201,6 @@
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 );
Received on Thu Jan 14 2010 - 14:11:04 CET
This archive was generated by hypermail 2.3.0
: Thu Sep 13 2012 - 19:31:06 CEST