aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/config/config2
-rw-r--r--examples/data/scripts/follow.js10
-rw-r--r--examples/data/scripts/follow.sh26
3 files changed, 36 insertions, 2 deletions
diff --git a/examples/config/config b/examples/config/config
index de01cf3..29e7d16 100644
--- a/examples/config/config
+++ b/examples/config/config
@@ -324,7 +324,7 @@ set follow_hint_keys = 0123456789
#set follow_hint_keys = qwerty
#set follow_hint_keys = asdfghjkl;
#set follow_hint_keys = thsnd-rcgmvwb/;789aefijkopquxyz234
-@cbind fl* = script @scripts_dir/follow.js '@follow_hint_keys %s'
+@cbind ff* = spawn @scripts_dir/follow.sh "%s"
# --- Form filler binds ---
# This script allows you to configure (per domain) values to fill in form
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;
diff --git a/examples/data/scripts/follow.sh b/examples/data/scripts/follow.sh
new file mode 100644
index 0000000..44a0d55
--- /dev/null
+++ b/examples/data/scripts/follow.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+config=$1;
+shift
+pid=$1;
+shift
+xid=$1;
+shift
+fifo=$1;
+shift
+socket=$1;
+shift
+url=$1;
+shift
+title=$1;
+shift
+
+echo 'script @scripts_dir/follow.js "@{follow_hint_keys} '$1'"' | socat - unix-connect:$socket
+
+# Read variable set by script. If it equals XXXFORMELEMENTCLICKEDXXX emit
+# FORM_ACTIVE event
+echo 'js rv' \
+ | socat - unix-connect:$socket \
+ | grep -q XXXINPUTELEMENTCLICKEDXXX \
+ && echo 'event FORM_ACTIVE' \
+ | socat - unix-connect:$socket