aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples/data/scripts/formfiller.sh
diff options
context:
space:
mode:
Diffstat (limited to 'examples/data/scripts/formfiller.sh')
-rwxr-xr-xexamples/data/scripts/formfiller.sh24
1 files changed, 14 insertions, 10 deletions
diff --git a/examples/data/scripts/formfiller.sh b/examples/data/scripts/formfiller.sh
index 3dc9dc4..394bfbd 100755
--- a/examples/data/scripts/formfiller.sh
+++ b/examples/data/scripts/formfiller.sh
@@ -39,7 +39,10 @@ GenForm ()
GetOption ()
{
DMENU_SCHEME=formfiller
- DMENU_PROMPT="choose profile"
+
+ # util/dmenu.sh doesn't handle spaces in DMENU_PROMPT. a proper fix will be
+ # tricky.
+ DMENU_PROMPT="choose_profile"
DMENU_LINES=4
. "$UZBL_UTIL_DIR/dmenu.sh"
@@ -66,27 +69,28 @@ ParseFields ()
field = $0
sub ( /[^:]*:/, "", field )
- if ( parts[2] ~ /(text|password|search)/ )
- printf( "js uzbl.formfiller.insert(\"%s\",\"%s\",\"%s\",0);\n",
- parts[1], parts[2], field )
-
- else if ( parts[2] ~ /(checkbox|radio)/ )
+ if ( parts[2] ~ /^(checkbox|radio)$/ )
printf( "js uzbl.formfiller.insert(\"%s\",\"%s\",\"%s\",%s);\n",
parts[1], parts[2], parts[3], field )
- else if ( parts[2] == "textarea" ) {
+ else if ( parts[2] ~ /^textarea$/ ) {
field = ""
while (getline) {
if ( /^%/ ) break
sub ( /^\\/, "" )
gsub ( /"/, "\\\"" )
gsub ( /\\/, "\\\\" )
- field = field $0 "\\n"
+ field = field $0 "\\\\n"
}
printf( "js uzbl.formfiller.insert(\"%s\",\"%s\",\"%s\",0);\n",
parts[1], parts[2], field )
}
+ else
+ printf( "js uzbl.formfiller.insert(\"%s\",\"%s\",\"%s\",0);\n",
+ parts[1], parts[2], field )
+
+
}'
}
@@ -116,7 +120,7 @@ Load ()
ParseProfile $option < "$file" \
| ParseFields \
- | sed 's/@/\\@/' \
+ | sed 's/@/\\@/g' \
> "$UZBL_FIFO"
}
@@ -132,7 +136,7 @@ Once ()
test -e "$tmpfile" &&
ParseFields < "$tmpfile" \
- | sed 's/@/\\@' \
+ | sed 's/@/\\@/g' \
> "$UZBL_FIFO"
}