Verbose Logging

software development with some really amazing hair

T + G I F R

Hacking MarkItUp! To Help Me Embed Videos

· · Posted in Programming
Tagged with

I use swfobject to embed videos because, as I explained back here, just blindly copying the embed code doesn't work that well half the time, and videos end up being different sizes, etc.

I was getting kind of fed up with having to go back and remember how to do it every time though. The format is pretty straightforward, but I don't embed videos often enough to actually remember the exact syntax, so I found myself going back to posts with videos to see how I did it, or looking at my code.

No more I say!

I also use markItUp! for editing posts, so I have a bit of a nicer interface to editing plain Textile. Granted I chose Textile because I actually like typing it, but never you mind that...

With markItUp), you can configure the control bar, of course, so I added a button to process selected text, or simply return a default embed template:

Now since most embed code is pretty much the same, I can deal with the selected text nicely:

This lets me paste in standard embed code, like this YouTube embed code for a Job for a Cowboy video,

…highlight it, then click the button, and have it process it to my embed code, with the proper values all replaced, so my script can process it when it hits your screen.

Less work for me (in the long run), more awesome for you.