aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/data/scripts/formfiller.sh
diff options
context:
space:
mode:
authorGravatar Pawel Tomak <satherot@gmail.com>2010-03-27 07:57:26 +0100
committerGravatar Pawel Tomak <satherot@gmail.com>2010-03-27 07:57:26 +0100
commit3dab456619fc0fc306dbb08faafbb18aef0e72e2 (patch)
tree79aa895772dfced9d7392d7c66c18e0f84468f66 /examples/data/scripts/formfiller.sh
parentfc50da64fe96da436896aa077ee8a8f807969220 (diff)
Moved function from formfiller-helper.js into the formfiller.sh
Diffstat (limited to 'examples/data/scripts/formfiller.sh')
-rwxr-xr-xexamples/data/scripts/formfiller.sh18
1 files changed, 17 insertions, 1 deletions
diff --git a/examples/data/scripts/formfiller.sh b/examples/data/scripts/formfiller.sh
index 9fbe8fc..c00d924 100755
--- a/examples/data/scripts/formfiller.sh
+++ b/examples/data/scripts/formfiller.sh
@@ -75,6 +75,22 @@ then
action="new"
fi
+dumpFunction='function dump() {
+ var rv="";
+ var xp_res=document.evaluate("//input", document.documentElement, null, XPathResult.ANY_TYPE,null);
+ var input;
+ while(input=xp_res.iterateNext()) {
+ var type=(input.type?input.type:text);
+ if(type == "text" || type == "password" || type == "file") {
+ rv += input.name + "(" + type + "):" + input.value + "\\n";
+ }
+ else if(type == "checkbox" || type == "radio") {
+ rv += input.name + "[" + input.value + "]" + "(" + type + "):" + (input.checked?"ON":"") + "\\n";
+ }
+ }
+ return rv;
+}; '
+
if [ "$action" = 'load' ]
then
[ -e $keydir/$domain ] || exit 2
@@ -92,7 +108,7 @@ then
elif [ "$action" = "once" ]
then
tmpfile=`mktemp`
- echo "script @scripts_dir/formfiller-helper.js" | \
+ echo "js "$dumpFunction" dump(); " | \
socat - unix-connect:$socket > $tmpfile
${editor} $tmpfile