tbtlr / gordon

An open source Flash™ runtime written in pure JavaScript
MIT License
1.8k stars 111 forks source link

Feature Request: Bookmarklet #3

Closed mschatz closed 13 years ago

mschatz commented 14 years ago

This is a really cool project. You will rule the world if you create a bookmarklet that lets you use gordon to render swf files on-the-fly. This would help, for example, to render swf files on the iPhone that can't otherwise be seen at all.

Great Work!

Mike

badboy commented 14 years ago

that could be a bit hard. As far as I understand Gordon loads the swf file via an AJAX call but AJAX calls are restricted to the website they are executed from. So loading a SWF file from an extern site is impossible.

attilammagyar commented 13 years ago

I've just committed a draft of bookmarklet support into my fork. The relevant commits are:

This is a first-draft version, it needs to be integrated better into the codebase and some cleanups might be needed here and there, but it seems to work in real-life scenarios. Don't expect a miracle, "work" in this case means that it invokes Gordon and lets it load the SWF. After that usually some JS errors are thrown by Gordon (e.g. "type is not defined" coming from the 126th line of src/renderer/svg.js), so some bugfixes are needed in Gordon itself. It works fine with demo SWFs from http://paulirish.com/work/gordon/demos/ , but I also found some other sites that at least start to render: http://faraday.physics.utoronto.ca/IYearLab/Intros/BoylesLaw ./Flash/piston.html .

mschatz commented 13 years ago

Very cool.

Mike

eligrey commented 13 years ago

Why not have an anonymous bookmarklet that doesn't leak globals, such as the following?:

javascript:document.documentElement.appendChild(document.createElement("script")).src="http://path/to/bookmarklet/gordonbm.js";
attilammagyar commented 13 years ago

Thanks for the advice, I committed it here: https://github.com/attilammagyar/gordon/commit/313956ffa917da2c34040206a3d85ccb738f1a21 .