diff options
author | Paweł Zuzelski <pawelz@pld-linux.org> | 2010-03-28 18:19:14 +0200 |
---|---|---|
committer | Paweł Zuzelski <pawelz@pld-linux.org> | 2010-03-28 18:19:14 +0200 |
commit | 22c3109e1a26c2eb37e03d3f7bb86079c2e0874c (patch) | |
tree | 48122f272b7b3bcf76c504ef5715e9d464e84011 /examples/data/scripts/follow.js | |
parent | 116a0b1459f56c9727bfdf056f37930332dbf6ba (diff) |
emit FORM_ACTIVE, when form element follow.js'ed
Due to Uzbl removal it is no longer possible to emit event from js script. So
follow.js does not emit FORM_ACTIVE event, when user selects form element
using follow.js. Workaround for that is to run follow.js from shell script,
set some global variable and next read this variable from shell script.
Diffstat (limited to 'examples/data/scripts/follow.js')
-rw-r--r-- | examples/data/scripts/follow.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/examples/data/scripts/follow.js b/examples/data/scripts/follow.js index a42447c..9236ed4 100644 --- a/examples/data/scripts/follow.js +++ b/examples/data/scripts/follow.js @@ -17,6 +17,7 @@ var doc = document; var win = window; var links = document.links; var forms = document.forms; +var rv = ""; //Make onlick-links "clickable" try { HTMLElement.prototype.click = function() { @@ -131,16 +132,23 @@ function clickElem(item) { item.click(); window.location = item.href; } else if (name == 'INPUT') { - var type = item.getAttribute('type').toUpperCase(); + var type; + try { + type = item.getAttribute('type').toUpperCase(); + } catch(err) { + type = 'TEXT'; + } if (type == 'TEXT' || type == 'FILE' || type == 'PASSWORD') { item.focus(); item.select(); } else { item.click(); } + rv="XXXFORMELEMENTCLICKEDXXX"; } else if (name == 'TEXTAREA' || name == 'SELECT') { item.focus(); item.select(); + rv="XXXFORMELEMENTCLICKEDXXX"; } else { item.click(); window.location = item.href; |