diff options
author | Pawel Tomak <satherot@gmail.com> | 2010-03-26 20:05:48 +0100 |
---|---|---|
committer | Pawel Tomak <satherot@gmail.com> | 2010-03-26 20:05:48 +0100 |
commit | f18b80263ad72f432d9127f3025ea85bf89e87c7 (patch) | |
tree | 6251eb894ec676ca3779bb62213d3dcf832859bb /examples | |
parent | 1dc6b9e5646542180490ae2e92eff304564fc8fc (diff) |
Speed up for forms output to the file
Moved dumping javascript code to the function dump()
outerHTML is now being used only on forms, not entire documents
Diffstat (limited to 'examples')
-rwxr-xr-x | examples/data/scripts/formfiller.sh | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/examples/data/scripts/formfiller.sh b/examples/data/scripts/formfiller.sh index 5dc6345..4b62ea1 100755 --- a/examples/data/scripts/formfiller.sh +++ b/examples/data/scripts/formfiller.sh @@ -74,6 +74,8 @@ then action="new" fi +dumpFunction='function dump() { var output = ""; var allFrames = new Array(window); for(f=0;f<window.frames.length;f=f+1) { allFrames.push(window.frames[f]); }; for(j=0;j<allFrames.length;j=j+1) { try { var myf = allFrames[j].document.forms; if(myf.length > 0) { for(k=0;k<myf.length;k=k+1) { output = output + myf[k].outerHTML; } } } catch(err) { } } return output; }; ' + if [ "$action" = 'load' ] then [ -e $keydir/$domain ] || exit 2 @@ -91,9 +93,7 @@ then elif [ "$action" = "once" ] then tmpfile=`mktemp` - html=`echo 'js if(window.frames.length > 0) { for(j=0;j<window.frames.length;j=j+1) { try { window.frames[j].document.documentElement.outerHTML; } catch(err) { } } }' | \ - socat - unix-connect:$socket` - html=${html}" "`echo 'js document.documentElement.outerHTML' | \ + html=`echo 'js '${dumpFunction}' dump(); ' | \ socat - unix-connect:$socket` html=`echo ${html} | \ tr -d '\n' | \ @@ -143,9 +143,7 @@ else # login(text): # passwd(password): # - html=`echo 'js if(window.frames.length > 0) { for(i=0;i<window.frames.length;i=i+1) { try { window.frames[i].document.documentElement.outerHTML; } catch(err) { } } }' | \ - socat - unix-connect:$socket` - html=${html}" "`echo 'js document.documentElement.outerHTML' | \ + html=`echo 'js '${dumpFunction}' dump(); ' | \ socat - unix-connect:$socket` echo ${html} | \ tr -d '\n' | \ |