diff options
author | Brendan Taylor <whateley@gmail.com> | 2011-05-22 17:40:17 -0700 |
---|---|---|
committer | Brendan Taylor <whateley@gmail.com> | 2011-05-22 17:40:17 -0700 |
commit | 7281314db93b1b126d06787cd54d83e419703934 (patch) | |
tree | bad68303cee74a27df720956bb0341c253f82899 | |
parent | 1e99fb0311d0652524ea929bc34f0cfff07cd55d (diff) | |
parent | d8cd0405b206fefecd30ee6c03fe8a4583f2eab2 (diff) |
Merge pull request #52 from keis/follow-input-fix
form input follower fixes
-rw-r--r-- | examples/config/config | 2 | ||||
-rw-r--r-- | examples/data/scripts/follow.js | 12 |
2 files changed, 7 insertions, 7 deletions
diff --git a/examples/config/config b/examples/config/config index 9507b95..8ae9cb3 100644 --- a/examples/config/config +++ b/examples/config/config @@ -83,7 +83,7 @@ set download_handler = sync_spawn @scripts_dir/download.sh @on_event LOAD_FINISH spawn @scripts_dir/history.sh # Switch to insert mode if a (editable) html form is clicked -@on_event FOCUS_ELEMENT sh 'if [ "$1" == INPUT ]; then echo "@set_mode insert" > $UZBL_FIFO; fi' %s +@on_event FOCUS_ELEMENT sh 'if [ "$1" = INPUT -o "$1" = TEXTAREA -o "$1" = SELECT ]; then echo "@set_mode insert" > $UZBL_FIFO; fi' %s # Switch to command mode if anything else is clicked @on_event ROOT_ACTIVE @set_mode command diff --git a/examples/data/scripts/follow.js b/examples/data/scripts/follow.js index 2d65489..5ecdcef 100644 --- a/examples/data/scripts/follow.js +++ b/examples/data/scripts/follow.js @@ -135,19 +135,19 @@ uzbl.follow.generateHint = function(doc, el, label, top, left) { // but at least set the href of the link. (needs some improvements) uzbl.follow.clickElem = function(item) { if(!item) return; - var name = item.tagName; - if (name == 'INPUT') { - var type = item.getAttribute('type').toUpperCase(); - if (type == 'TEXT' || type == 'FILE' || type == 'PASSWORD') { + if (item instanceof HTMLInputElement) { + var type = item.type; + if (type == 'text' || type == 'file' || type == 'password') { item.focus(); item.select(); return "XXXEMIT_FORM_ACTIVEXXX"; } // otherwise fall through to a simulated mouseclick. - } else if (name == 'TEXTAREA' || name == 'SELECT') { + } else if (item instanceof HTMLTextAreaElement || item instanceof HTMLSelectElement) { item.focus(); - item.select(); + if(typeof item.select != 'undefined') + item.select(); return "XXXEMIT_FORM_ACTIVEXXX"; } |