Wednesday, January 23, 2008

stumped by blogger

Well, I was going to post a bit of JavaScript but I have been defeated by Blogger. Since it seemed tricky, I was playing around with rendering in js and wrote a nifty little Mandelbrot rendered. Both it and the drawing code are in relatively clean objects, so I was going to dump it into Blogger's "HTML/Javascript" page element.

Alas, some part of the upload process mangles some js. There are a few mentions I discovered via Google, but not enough info to quickly determine a workaround, nor is it important enough to dive into the Blogger support queue. I'm working on a project that I'll need to host, so I'll just wait until then. If anyone knows the right incantation to get Blogger to behave, let me know.

6 comments:

tfs said...

Is it wrong to hope that your secret project is to help Vlad make OpenGL bindings for the canvas tag?

EnCore Mayne said...

not sure if this will work on your code cory but you could try. go to your dashboard's Layout settings, choose "Add a Page Element", the choose HTML/Javascript ADD TO BLOG button. input your script Save Changes and it will add that element somewhere in your template (not as a post, but permanently in the site's footer, header, sidebar or wherever you choose to put it).

cory ondrejka said...

Using the HTML/Javascript element is the problem. For some reason, certain bits of Javascript are lost/mangled as part of the input process.

EnCore Mayne said...

figured you might have looked into that aspect. blogger does have its limits (whatever you do don't compose in it. it seems to eattext after code it can't parse).

Jonathan Bishop said...

It is possible your blog site is using javascript compression (many sites do now, if not quite most). In this case, you will probably need to insert a semi-colon at the end of every line (including function declaraions) which strickly speaking you should anyway in JS. eg:

myfunc(){ somecode; };

This is because many of the compressors rely on semi-colons to allow multiple lines to be compressed to one.

Oh and be careful about comment mangling - properly formed comments only so the compressor does not get confused.

I am assuming here that you want a piece of executing JS, rather than just trying to provide human readable examples.

A.T. said...

well, Blogger shall be last to be blamed for whatever JS-related -- other blog engines (or CMSes) merely prohibit JS at all, citing its role in domain takeover in hackers attacks.