updates/doc/fixes for formfiller script from Sylvester Johansson
authorDieter Plaetinck <dieter@plaetinck.be>
Fri, 22 May 2009 19:05:01 +0000 (21:05 +0200)
committerDieter Plaetinck <dieter@plaetinck.be>
Fri, 22 May 2009 19:05:01 +0000 (21:05 +0200)
AUTHORS
docs/TODO
examples/configs/sampleconfig-dev
examples/data/forms/bbs.archlinux.org [new file with mode: 0644]
examples/scripts/formfiller.sh

diff --git a/AUTHORS b/AUTHORS
index 66bd93e..c5da932 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -15,6 +15,7 @@ Contributors:
     Damien Leon - misc
     Peter Suschlik - backwards searching
     (salinasv) - move some variables to heap
+    Sylvester Johansson (scj) - original form filler script
 
 Originaly based on http://trac.webkit.org/browser/trunk/WebKitTools/GtkLauncher/main.c
 Which is  copyrighted:
index 0b0e035..0bd238b 100644 (file)
--- a/docs/TODO
+++ b/docs/TODO
@@ -41,6 +41,7 @@ More or less in order of importance/urgency
 * regex style page searching? so you can do 'or' and 'and' things. flags like case sensitive etc.
 * check for real command name, not just the first letter.
 * let users attach handlers to the most common events/signals in uzbl.
+  great use case: automatically calling formfiller for certain sites
 * write little script to open new urls with the urxvt url thing +document.
 
 SOMEDAY:
index c1b136c..e0ae84c 100644 (file)
@@ -111,6 +111,10 @@ bind    S         = js alert("hi");
 bind    XS        = sh 'echo "act script alert (\\"This is sent by the shell via a fifo\\")" > "$4"'
 
 
+# this script allows you to load predefined values into html forms. (eg login information)
+# if you have no config file yet, it will let you create settings easily.
+bind z = spawn ./examples/scripts/formfiller.sh
+
 # we ship some javascripts to do keyboard based link hinting/following.  (webkit does not have C DOM bindings yet)
 # this is similar to how it works in vimperator (and konqueror)
 # TODO: did we resolve: "no click() event for hyperlinks so no referrer set" ?
diff --git a/examples/data/forms/bbs.archlinux.org b/examples/data/forms/bbs.archlinux.org
new file mode 100644 (file)
index 0000000..73c1539
--- /dev/null
@@ -0,0 +1,5 @@
+form_sent: 
+redirect_url: 
+req_username: <your username>
+req_password: <password>
+login: 
index 006678c..e7ef3b5 100755 (executable)
@@ -1,23 +1,31 @@
 #!/bin/bash
 
 # simple login form filler for uzbl.
-# put your login information in the file $keydir/<domain>
+# put the form entry values you want to add (eg login information) in the file $keydir/<domain>
 # in the format <fieldname>: <value>
+# (these files can be automatically created for you by setting editor and triggering this script on a site without a config)
 
-keydir=$XDG_CONFIG_HOME/uzbl/keys
-editor=gvim
+[ -d /usr/share/uzbl/examples/data/forms  ] && keydir=/usr/share/uzbl/examples/data/forms  # you will probably get permission denied errors here.
+[ -d $XDG_DATA_HOME/uzbl/forms            ] && keydir=$XDG_DATA_HOME/uzbl/forms
+[ -d ./examples/data/forms                ] && keydir=./examples/data/forms #useful when developing
+[ -z "$keydir" ] && exit 1
+
+#editor=gvim
+editor='urxvt -e vim'
 
 config=$1; shift
-pid=$1;                 shift
-xid=$1;                 shift
-fifo=$1;        shift
+pid=$1;    shift
+xid=$1;    shift
+fifo=$1;   shift
 socket=$1; shift
-url=$1;                 shift
-title=$1;       shift
+url=$1;    shift
+title=$1;  shift
+
+[ -d $keydir ] || mkdir $keydir || exit 1
 
 domain=$(echo $url | sed -re 's|(http\|https)+://([A-Za-z0-9\.]+)/.*|\2|')
 if [[ -e $keydir/$domain ]]; then
-       gawk -F': ' '{ print "act script document.getElementsByName(\"" $1 "\")[0].value = \"" $2 "\";"}' $keydir/$domain >> $fifo
+       gawk -F': ' '{ print "act js document.getElementsByName(\"" $1 "\")[0].value = \"" $2 "\";"}' $keydir/$domain >> $fifo
 else
        curl "$url" | grep '<input' | sed -nre 's|.*<input.*?name="([[:graph:]]+)".*?/>.*|\1: |p' > $keydir/$domain
        $editor $keydir/$domain