Skip to content

Instantly share code, notes, and snippets.

@lazypower
Created April 15, 2011 23:30
Show Gist options
  • Save lazypower/922650 to your computer and use it in GitHub Desktop.
Save lazypower/922650 to your computer and use it in GitHub Desktop.
// wrap this in the document.ready method, so it knows what to attach to
$(document).ready(function()
{
$(function () {
//playlist builder
$(function()
{
var count = 0;
obj = $('<ul>');
obj.attr('class', 'video-playlist');
for ( i = 0; i < jsonData.length; i++ ){
html = $('li.playlist-template').clone();
html.attr('id', count + '_video');
//html.find('a').attr('href', '?id=' + jsonData[count].MemberID);
html.find('a').attr('href', '#featured-vid').attr('title', jsonData[count].MemberID).bind('click', function() {
EmbedVid($(this).attr('title'));
});
html.find('img').attr('src', 'images/vidThumbs/' + jsonData[count].MemberID + '.jpg').attr('alt', jsonData[count].Name);
html.find('span.name').text(jsonData[count].Name);
html.find('span.date').text(jsonData[count].Submitted);
html.appendTo(obj);
count++;
if ( (count % 4 == 0 && count != 0) || count == jsonData.length)
{
$('div.pages').append(obj);
obj = $('<ul>');
obj.attr('class', 'video-playlist');
}
}
//paginate the data and make it scrollable
$("#playlist-pages").scrollable({items:".pages"}).navigator({indexed:true});
});
});
//Feature Video Populator
function EmbedVid(someID)
{
html = $('.embed-template').clone();
html.attr('flashvars','value="file=upload/' + someID + '.flv&amp;image=images/vidThumbs/' + someID + '.jpg"');
html.find('embed').attr('flashvars','file=upload/' + someID + '.flv&amp;image=images/vidThumbs/' + someID + '.jpg"');
// addthis attributes
html.find('.addthis_toolbox').attr('addthis:url','http://www.university-bound.com/scholarships/?ID=' + someID);
html.find('a').attr('addthis:url','http://www.university-bound.com/scholarships/?ID=' + someID);
// better clear the video holder
$('#video-holder').empty();
$('#video-holder').append(html.children());
//$('#video-holder').children(visible)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment