diff options
author | Pawel Tomak <satherot@gmail.com> | 2010-03-28 10:43:35 +0200 |
---|---|---|
committer | Pawel Tomak <satherot@gmail.com> | 2010-03-28 10:43:35 +0200 |
commit | 0331e7be9ff08e289630e1d2a7b1c1f4da8f3f06 (patch) | |
tree | b20ce5fed8df5e6549c9e072eaff99b3ecd2b3d4 /examples | |
parent | 60a692daa915c1708b159216b1d5b2bed1667c4d (diff) |
Added support for multilines in textareas
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/data/scripts/formfiller.sh | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/examples/data/scripts/formfiller.sh b/examples/data/scripts/formfiller.sh index a1f7392..4204dc8 100755 --- a/examples/data/scripts/formfiller.sh +++ b/examples/data/scripts/formfiller.sh @@ -95,9 +95,14 @@ dumpFunction='function dump() { rv += input.name + "(" + type + "):" + input.value + "\\n"; } else if(type == "checkbox" || type == "radio") { - rv += input.name + "[" + input.value + "](" + type + "):" + (input.checked?"ON":"") + "\\n"; + rv += input.name + "[" + input.value + "](" + type + "):" + (input.checked?"ON":"OFF") + "\\n"; } } + xp_res=allFrames[j].document.evaluate("//textarea", allFrames[j].document.documentElement, null, XPathResult.ANY_TYPE,null); + var input; + while(input=xp_res.iterateNext()) { + rv += input.name + "(textarea):" + input.value + "\\n"; + } } catch(err) { } } @@ -140,14 +145,17 @@ then option=`echo -e -n "$menu"| dmenu ${LINES} -nb "${NB}" -nf "${NF}" -sb "${SB}" -sf "${SF}" -p "${PROMPT}"` fi - sed 's/\([^\[]\+\)\[\([^\]]*\)](\(radio\|checkbox\)):[ ]*\(.\+\)/\1[\2](\3):1/;s/\([^\[]\+\)\[\([^\]]*\)](\(radio\|checkbox\)):$/\1[\2](\3):0/' -i $keydir/$domain + sed 's/\([^[]\+\)\[\([^]]*\)\](\(radio\|checkbox\)):[ ]*\(on\|yes\|1\)$/\1[\2](\3):1/I;s/\([^[]\+\)\[\([^]]*\)\](\(radio\|checkbox\)):[ ]*\(off\|no\|0\)$/\1[\2](\3):0/I' -i $keydir/$domain fields=`cat $keydir/$domain | \ - sed -n -e "/^!profile=${option}/,/^!profile=/p"` + sed -n -e "/^!profile=${option}/,/^!profile=/p" | \ + sed 's/^\([^[]\+\[[^]]*]([^)]\+):\|[^(]\+([^)]\+):\)/<\1>/' | \ + sed 's/^\(.\+\)$/\1{{br}}/g' | \ + tr -d '\n'| sed 's/{{br}}<\([^[]\+\[[^]]*]([^)]\+):\|[^(]\+([^)]\+):\)>/\n\1/g'` echo "${fields}" | \ sed -n -e "s/\([^(]\+\)(\(password\|text\|textarea\)\+):[ ]*\(.\+\)/js $insertFunction; insert('\1', '\2', '\3', 0);/p" | \ - sed -e 's/@/\\@/g' > $fifo + sed -e 's/@/\\@/g;s/{{br}}/\\\\n/g' > $fifo echo "${fields}" | \ - sed -n -e "s/\([^[]\+\)\[\([^]]*\)](\(radio\|checkbox\)):[ ]*\(.\+\)/js $insertFunction; insert('\1', '\3', '\2', '\4');/p" | \ + sed -n -e "s/\([^[]\+\)\[\([^]]*\)\](\(radio\|checkbox\)):[ ]*\(.\+\)/js $insertFunction; insert('\1', '\3', '\2', \4);/p" | \ sed -e 's/@/\\@/g' > $fifo elif [ "$action" = "once" ] then @@ -159,13 +167,16 @@ then [ -e $tmpfile ] || exit 2 - sed 's/\([^[]\+\)\[\([^]]*\)](\(radio\|checkbox\)):[ ]*\(.\+\)/\1[\2](\3):1/;s/\([^\[]\+\)\[\([^\]]*\)](\(radio\|checkbox\)):$/\1[\2](\3):0/' -i $tmpfile - fields=`cat $tmpfile` + sed 's/\([^[]\+\)\[\([^]]*\)\](\(radio\|checkbox\)):[ ]*\(on\|yes\|1\)$/\1[\2](\3):1/I;s/\([^[]\+\)\[\([^]]*\)\](\(radio\|checkbox\)):[ ]*\(off\|no\|0\)$/\1[\2](\3):0/I' -i $tmpfile + fields=`cat $tmpfile | \ + sed 's/^\([^[]\+\[[^]]*]([^)]\+):\|[^(]\+([^)]\+):\)/<\1>/' | \ + sed 's/^\(.\+\)$/\1{{br}}/g' | \ + tr -d '\n'| sed 's/{{br}}<\([^[]\+\[[^]]*]([^)]\+):\|[^(]\+([^)]\+):\)>/\n\1/g'` echo "${fields}" | \ sed -n -e "s/\([^(]\+\)(\(password\|text\|textarea\)\+):[ ]*\(.\+\)/js $insertFunction; insert('\1', '\2', '\3', 0);/p" | \ - sed -e 's/@/\\@/g' > $fifo + sed -e 's/@/\\@/g;s/{{br}}/\\\\n/g' > $fifo echo "${fields}" | \ - sed -n -e "s/\([^\[]\+\)\[\([^\]]*\)](\(radio\|checkbox\)):[ ]*\(.\+\)/js $insertFunction; insert('\1', '\3', '\2', '\4');/p" | \ + sed -n -e "s/\([^[]\+\)\[\([^]]*\)\](\(radio\|checkbox\)):[ ]*\(.\+\)/js $insertFunction; insert('\1', '\3', '\2', \4);/p" | \ sed -e 's/@/\\@/g' > $fifo rm -f $tmpfile else |