From fbd666e85d85ca836ffa6ec86ad1034d4100abf4 Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Fri, 22 May 2009 21:05:01 +0200 Subject: updates/doc/fixes for formfiller script from Sylvester Johansson --- AUTHORS | 1 + docs/TODO | 1 + examples/configs/sampleconfig-dev | 4 ++++ examples/data/forms/bbs.archlinux.org | 5 +++++ examples/scripts/formfiller.sh | 26 +++++++++++++++++--------- 5 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 examples/data/forms/bbs.archlinux.org diff --git a/AUTHORS b/AUTHORS index 66bd93e..c5da932 100644 --- 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: diff --git a/docs/TODO b/docs/TODO index 0b0e035..0bd238b 100644 --- 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: diff --git a/examples/configs/sampleconfig-dev b/examples/configs/sampleconfig-dev index c1b136c..e0ae84c 100644 --- a/examples/configs/sampleconfig-dev +++ b/examples/configs/sampleconfig-dev @@ -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 index 0000000..73c1539 --- /dev/null +++ b/examples/data/forms/bbs.archlinux.org @@ -0,0 +1,5 @@ +form_sent: +redirect_url: +req_username: +req_password: +login: diff --git a/examples/scripts/formfiller.sh b/examples/scripts/formfiller.sh index 006678c..e7ef3b5 100755 --- a/examples/scripts/formfiller.sh +++ b/examples/scripts/formfiller.sh @@ -1,23 +1,31 @@ #!/bin/bash # simple login form filler for uzbl. -# put your login information in the file $keydir/ +# put the form entry values you want to add (eg login information) in the file $keydir/ # in the format : +# (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 '.*|\1: |p' > $keydir/$domain $editor $keydir/$domain -- cgit v1.2.3