rejetto forum
Software => HFS ~ HTTP File Server => HTML & templates => Topic started by: exorcist on October 29, 2010, 12:57:24 PM
-
At first, I'm very oldschool and still using the lastest stable version 2.2f :) I made a template that meets my creteria and everything works absolutely great!
I added:
onClick="window.open('/~progress');"
in the "Upload File" button section code:
<input name="upbtn" ... >
Now when the user hits the upload button, it also opens a new window with upload progress.
My question is: Can I use some "trigger" to close this window when the upload is complete?
I've tried the following ways with javascript inserted in the beginning of [progress-upload-file] section:
1)
<script type="text/javascript">
if (%perc% > 98) {
window.close();
}
</script>
2)
<script type="text/javascript">
var param = (%total-bytes%-%done-bytes%)/1024-2.5*%speed-kb%;
if (param<0) {
window.close();
}
Both methods depend of the refresh rate setup in [progress] section and don't work stable.
Any hints will be heartily appreciated! :)
Template file dwk.tpl (http://www.rejetto.com/forum/index.php?action=dlattach;topic=9264.0;attach=5784) attached to the post...
-
i have no experience about creating "new windows" with javascript,
but i guess you can keep track of them by using "names", and then close that named window in the "results" page.
have you every seen the current default template of 2.3 ? it has a box inside the page that's updated regularly. It's a joy for the eye. :D
i went for this after firefox not refreshing with the 2.2's method.
-
Closing with javascript works perfectly :) I just can't come up with a proper condition (trigger) when actually the upload is complete (when [progress] switches to [progress-nofiles]) to close the progress window :)
-
sorry for the late reply.
did you try putting the javascript code for closing in the [progress-nofiles] ?
that will work just as a trigger