Redirect and the Droopy upload graphic.

Posted by SuriRaven 
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.
Now, this forum is in read-only mode. You find details Details hereContinue on /r/PirateBox
Redirect and the Droopy upload graphic.
May 26, 2013 10:18AM
Having looked through Droopy, it's apparent that it renders the upload 'spinner' as a table using javascript for the animation. It doesn't actually do any meaningful indication of data transfer, just a little animation. It seems a little untidy using javascript for something so trivial. So I came up with an alternative approach.


160,161d159
< #progress td {height: 10px; width: 13px; background-color: #eee;
< border: 1px solid #aaa; padding: 0px;}
181d178
< update();
191,198d187
< function update() {
< setTimeout(update, 300);
< e = document.getElementById("cell"+curcell);
< e.style.backgroundColor = "#eee";
< curcell = (curcell+1) %% ncell
< e = document.getElementById("cell"+curcell);
< e.style.backgroundColor = "#aaa";
< }
215,217c204
< <table id="progress"><tr>
< <td id="cell0"/><td id="cell1"/><td id="cell2"/><td id="cell3"/>
< </tr></table>
---
> <img alt="" src="data:image/gif;base64,R0lGODlhCAABAJEBAAAAAAAAAAAAAAAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQJMgABACwAAAAACAABAAACAwSCWQAh+QQJMgABACwAAAAACAABAAACBEwAZgUAIfkECTIAAQAsAAAAAAgAAQAAAgSMA2AFACH5BAUyAAEALAAAAAAIAAEAAAIDjA9QADs=" width=200px height=25px>

It still works just the same, except it uses an embedded animated GIF to do the spinny graphic. It looks different, as I had to get the size down as small as possible. But look how much smaller and simpler it is. I used gif rather than png, as IE doesn't support animated png.

Also, the redirect method used is a little untidy - as the main page is in an index.html, anyone who gets sent straight there while trying to access the web will still have the wrong hostname in their browser, leading to accidential cache poisoning. This can be easily solved by just moving the redirect into index.html, and putting the main page for the piratebox in something like main.html instead.
Re: Redirect and the Droopy upload graphic.
May 26, 2013 10:30AM
Interesting.
The only advantage from the JavaScript solution against a GIF is, that old Smartphones can't display animated gifs -.- ;(

About the redirect. Yes, true. Good point. .. and it is a very easy solution I haven't thought about lol



Edited 1 time(s). Last edit at 05/26/2013 10:32AM by Matthias.
Re: Redirect and the Droopy upload graphic.
May 26, 2013 12:36PM
And many people run their smartphones with javascript disabled. I'm just old-school when it comes to web design: Script is something to use only when you must, and shorter is better. Droopy isn't the most readable of programs, so shaving a few lines off is a good thing.

I might try to find a way to make my piratebox internet-accessible so everyone can check out my adjustments and test it once I've gotten all the bugs out. It's undergoing battery life testing right now. Four and a half hours in, and still running - I'd estimate eight hours. Double that when I get a Pi A. Only problem with that is that the droopy page still needs piratebox.lan to resolve correctly.



Edited 1 time(s). Last edit at 05/26/2013 12:39PM by SuriRaven.
Re: Redirect and the Droopy upload graphic.
May 26, 2013 01:29PM
> Only problem with that is that the droopy page still needs piratebox.lan to resolve correctly.

and that is the reason to get rid of droopy...

btw: i move this thread into the developer-forum
Re: Redirect and the Droopy upload graphic.
May 26, 2013 06:15PM
Move seems appropriate, yes.

Droopy, to paraphrase a famous line, is the worst solution we have except for all the others. It's a hideous monster of a solution, but it does work - and what else is there that does? I think the best option might be to just improve Droopy - make it smaller and more efficient. A really minimalist uploader.


Test finished, but I only got five hours. Clearly needs a little more work.