diff options
author | ben <ben@blackbox.(none)> | 2010-02-19 13:33:39 +0100 |
---|---|---|
committer | ben <ben@blackbox.(none)> | 2010-02-19 13:33:39 +0100 |
commit | 7f9f6e8f4a952b05e1be20ba2a5f71d0522a9d72 (patch) | |
tree | e3630d2853c3ada35d5dfb5f8e6358859e704700 /.config/uzbl/scripts/formfiller.sh | |
parent | a35c6d11fe098005a3347895b9995df15c0164c5 (diff) | |
download | dotfiles-7f9f6e8f4a952b05e1be20ba2a5f71d0522a9d72.tar.gz dotfiles-7f9f6e8f4a952b05e1be20ba2a5f71d0522a9d72.tar.bz2 dotfiles-7f9f6e8f4a952b05e1be20ba2a5f71d0522a9d72.zip |
.config/uzbl: delete the old foler for restart
Diffstat (limited to '.config/uzbl/scripts/formfiller.sh')
-rwxr-xr-x | .config/uzbl/scripts/formfiller.sh | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/.config/uzbl/scripts/formfiller.sh b/.config/uzbl/scripts/formfiller.sh deleted file mode 100755 index 10afaba..0000000 --- a/.config/uzbl/scripts/formfiller.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -# simple html form (eg for logins) filler (and manager) for uzbl. -# uses settings files like: $keydir/<domain> -# files contain lines like: <fieldname>: <value> - - -# user arg 1: -# edit: force editing the file (falls back to new if not found) -# new: start with a new file. -# load: try to load from file into form - -# something else (or empty): if file not available: new, otherwise load. - -keydir=${XDG_DATA_HOME:-$HOME/.local/share}/uzbl/forms -[ -d "`dirname $keydir`" ] || exit 1 -[ -d "$keydir" ] || mkdir "$keydir" - -editor=${VISUAL} -if [[ -z ${editor} ]]; then - #editor='gvim' - editor='urxvt -e vim' -fi - -config=$1; shift -pid=$1; shift -xid=$1; shift -fifo=$1; shift -socket=$1; shift -url=$1; shift -title=$1; shift -action=$1 - -[ -d $keydir ] || mkdir $keydir || exit 1 - -if [ "$action" != 'edit' -a "$action" != 'new' -a "$action" != 'load' ] -then - action=new - [[ -e $keydir/$domain ]] && action=load -elif [ "$action" == 'edit' ] && [[ ! -e $keydir/$domain ]] -then - action=new -fi -domain=$(echo $url | sed -re 's|(http\|https)+://([A-Za-z0-9\.]+)/.*|\2|') - - -#regex='s|.*<input.*?name="([[:graph:]]+)".*?/>.*|\1: |p' # sscj's first version, does not work on http://wiki.archlinux.org/index.php?title=Special:UserLogin&returnto=Main_Page - regex='s|.*<input.*?name="([^"]*)".*|\1: |p' #works on arch wiki, but not on http://lists.uzbl.org/listinfo.cgi/uzbl-dev-uzbl.org TODO: improve - - -if [ "$action" = 'load' ] -then - [[ -e $keydir/$domain ]] || exit 2 - gawk -F': ' '{ print "js document.getElementsByName(\"" $1 "\")[0].value = \"" $2 "\";"}' $keydir/$domain >> $fifo -else - if [ "$action" == 'new' ] - then - curl "$url" | grep '<input' | sed -nre "$regex" > $keydir/$domain - fi - [[ -e $keydir/$domain ]] || exit 3 #this should never happen, but you never know. - $editor $keydir/$domain #TODO: if user aborts save in editor, the file is already overwritten -fi |