diff options
-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"; } |