Building SlideSix - Part 3

Another quick highlight of SlideSix is the super cool shadowbox jQuery plugin used to embed the video how to's.

I have to admit I really didn't do much more then copy/paste (gasp!) the code from the inline video player demo that ships with the shadowbox download. I wanted something quick and dirty, so I didn't bother to dig in deeply into the code, but here's the script:

var hasClass = function(el, cls){
return el.className && el.className == cls;
};

var escapeHTML = function(html){
return html.replace(/</g, '&lt;');
};

window.onload = function(){
var S = Shadowbox;
S.init({
flvPlayer: '/includes/js/shadowbox-1.0/flvplayer.swf',
autoplayMovies: false // don't automatically play movies
});


var a = document.getElementsByTagName('a'); // live node list
var links = [];
for(var i = 0, len = a.length; i < len; ++i){
if(hasClass(a[i], 'vidplayer')){
links[links.length] = a[i];
}
}
var obj, markup, html;
for(var i = 0, len = links.length; i < len; ++i){
var link = links[i];
obj = S.buildCacheObj(link);
markup = S.movieMarkup(obj);
html = S.createHTML(markup);
link.parentNode.innerHTML = html;
}
};

Basically the script looks for every <a> tag with a class of 'vidplayer' and replaces the tag contents with a SWF viewer for the FLV vids.

flv player

I did peek into the plugin a bit, and it is very configurable by simply passing in some arguments to the shadowbox constructor. Here is what one of my <a> tags looks like:

<a rel="shadowbox;width=350;height=250;options={showMovieControls:true}" class="vidplayer" href="/includes/demos/register.flv">Register</a>

Can't get much easier then that.

Related Blog Entries

Comments

Calendar

Sun Mon Tue Wed Thu Fri Sat
     12
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31       

Subscribe

Enter your email address to subscribe to this blog.

Tags

actionscript ajax blogging cfsnippets coldfusion flash forms flex funny stuff misc model-glue off topic personal project learn slidesix sql

Recent Comments

Adding Auto Generated Code Downloads to BlogCFC
ada5fsa said: http://www.mountwashingto... http://extjs.com/forum/me... h... [More]

BlogCFC Survey #2
ada5fsa said: http://www.mountwashingto... http://extjs.com/forum/me... h... [More]

Most Difficult Captcha Of All Time
kokkooo said: [url=http://synchrophase.info/...]消費者金融 ブラック[/url] [url=http://geji-geji.com/]消費者金融ブラック[/url] [url=http... [More]

Most Difficult Captcha Of All Time
kokkooo said: <a href="http://synchrophase.info/...">消費者金融 ブラック</a> <a href="http://gej... [More]

Using A PlayStation 2 HDD In Your PC
Vodin said: Well dang. Thanks man, my uncle who owns a Video Game shop had a PS2 harddrive in the junk box, I sn... [More]

RSS


coldfusionbloggers

FullAsAGoog MXNA

Consumed By Feed-Squirrel.com