Loading...
Loading...

Sunday, December 17, 2006

In Post Video Bar

This afternoon, one of our customers asked how to place a Video Bar in the middle of his post content... Turns out that this is not as simple as it sounds since blogging platforms tend to block script tags sitting withing a post body. There are other ways to solve this problem though. I choose a pretty lazy approach and will probably do something a bit more element later... I just created an anchor tag with a javascript URL that calls a new function that ends up dynamicly extending the post with a video bar. The downside of this approach is that you have to click something to make the video bar show up.



The code to do this is pretty trivial... I just add this to a template that already has a video bar and then create a javascript url to call it.

The Code:

function inPostVideoBar(barDivName, searchExpression) {
// video bar
var vbOptions = {
largeResultSet : false,
master : videoSearch,
horizontal : true
}
var vb = new GSvideoBar(document.getElementById(barDivName),
null, vbOptions);
vb.execute(searchExpression);
}


The Call:

<div id="vb1">
<a href="javascript:inPostVideoBar('vb1', 'vw gti');">
Check out my Videos
</a>
</div>