[Facebooker-talk] js2fbjs

Richard Jordan jordanr at cs.washington.edu
Sun Jul 20 21:49:44 EDT 2008


Hi,
I've put together a basic translator for JavaScript to Facebook 
JavaScript.  You can check it out on GitHub or even get as a plugin if 
your running Rails 2.1,
   http://github.com/jordanr/js2fbjs/tree/master
   script/plugin install git://github.com/jordanr/js2fbjs.git

It should work immediately with Facebooker.  I hooked it into Facebooker 
and Rails through render.  Right away, it'll parse whatever you are 
rendering and then try to rewrite it back into Facebook JavaScript.  If it 
fails, it leaves alone your code.

As of now, it rewrites,
* DOM accessors --> Facebook getter/setters
* confirm("...") --> Facebook dialogs
* setAttribute('foo', 'bar') --> setFoo('bar')
* style.foo = 'bar' --> setStyle('foo', 'bar')

Mike, do you think this idea is worth while?  People don't have to learn 
fbjs and Rails helpers work.  Imagine sending prototype.js through it and 
having facebooker.js come out!

Sincerely,
Richard


More information about the Facebooker-talk mailing list