diff options
author | Brendan Taylor <whateley@gmail.com> | 2010-11-24 15:13:02 -0700 |
---|---|---|
committer | Brendan Taylor <whateley@gmail.com> | 2010-11-24 15:13:02 -0700 |
commit | b5b38b968697becad4034b5803d39ff6c78aa107 (patch) | |
tree | 4160a304f1dde3d728b39aa0c6ff107cb9951041 /examples/data/scripts/follow.js | |
parent | 3659b1d8bc32956d1be5e25a6c30a085953f0435 (diff) |
make follow.sh use the utils scripts, restore mode changing functionality
Diffstat (limited to 'examples/data/scripts/follow.js')
-rw-r--r-- | examples/data/scripts/follow.js | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/examples/data/scripts/follow.js b/examples/data/scripts/follow.js index 3a18b1b..d995696 100644 --- a/examples/data/scripts/follow.js +++ b/examples/data/scripts/follow.js @@ -119,30 +119,37 @@ function generateHint(el, label) { // hint.style.webkitTransform = 'scale(1) rotate(0deg) translate(-6px,-5px)'; return hint; } -//Here we choose what to do with an element if we -//want to "follow" it. On form elements we "select" -//or pass the focus, on links we try to perform a click, -//but at least set the href of the link. (needs some improvements) + +// Here we choose what to do with an element that the user has selected. +// Form elements get selected and/or focussed, and links and buttons are +// clicked. This function returns "XXXRESET_MODEXXX" to indicate that uzbl +// should be reset to command mode with an empty keycmd, or +// "XXX_EMIT_FORM_ACTIVEXXX" to indicate that uzbl should be set to insert mode. function clickElem(item) { removeAllHints(); if (item) { var name = item.tagName; if (name == 'BUTTON') { item.click(); + return "XXXRESET_MODEXXX"; } else if (name == 'INPUT') { var type = item.type.toUpperCase(); if (type == 'TEXT' || type == 'SEARCH' || type == 'PASSWORD') { item.focus(); item.select(); + return "XXXEMIT_FORM_ACTIVEXXX"; } else { item.click(); + return "XXXRESET_MODEXXX"; } } else if (name == 'TEXTAREA' || name == 'SELECT') { item.focus(); item.select(); + return "XXXEMIT_FORM_ACTIVEXXX"; } else { item.click(); window.location = item.href; + return "XXXRESET_MODEXXX"; } } } |