Adrianotiger / web-esheep

web based esheep (remembering the esheep from '95)
https://adrianotiger.github.io/web-esheep/
GNU General Public License v3.0
95 stars 21 forks source link

Remove external dependencies and make the library stand-alone #5

Closed kelvinau closed 6 years ago

kelvinau commented 6 years ago

Two items I suggest on making it stand-alone:

Adrianotiger commented 6 years ago

Hi Kelvy, I will check it and find a solution. I have now a new server and the possibility to have https.

The problem was the cross-domain scripting. Using a php script I was able to give access to every domain including the headers: header('Content-Disposition: inline; filename="animation.xml"'); header('Access-Control-Allow-Origin: *'); But would it be a solution to move it on a https server? Or host the xml on github (probably this will not work because the server does not give the access to other domains).

The idea on the popover was to give credits to the user who generated the animation, not the the website itself :P I will change a little bit the design of the popup and give the possibility to remove it over the animation.

I am also check if I can create a subfolder with all animations, so everyone can upload the xml on GitHub instead of upload them on my server.

I can do a lot on the web-based eSheep as I don't have the certificate to compile the C# project anymore.

Adrianotiger commented 6 years ago

Can you check if I built it correctly? My script is 30kb, once compiled with .min.js it is 80kb! I think this is not the idea of minimizing the size of a script...

kelvinau commented 6 years ago

Moving to a https server will be better and of course you can set "Access-Control-Allow-Origin: *", given that it's just for a xml file I think there's not much any security concern. That can resolve the issue. But still, some users, like me, don't want to rely on external resources because of various reasons. One solution will be adding an option to overwrite the animationFile. Then people can download a xml and uses it locally, and simply just use the default https://adrianotiger.github.io/web-esheep/pets/original.xml.

Thanks for the option on the popup! I think this is a good solution.

kelvinau commented 6 years ago

It actually makes sense that the size increases after being compiled, because besides minimizing, the code is also converted into ES2015 syntax in order to solve issue #3. Our source code is written in ES6 format with class structure, IE does not support that and we use Babel to convert ES6 to ES2015 for cross-browser compatibility. ES2015's way of defining class is lengthy and so the line of codes increases.