jQuery(document).ready( function($) {
var autonext = true;
var get_video_html = function( video ) {
return '';
}
var videos_loaded = [];
var load_video = function( count ) {
var current_video = video_data[ count ];
$('#video-feature')[0].innerHTML = '
'+get_video_html( current_video )+'Back | Next
';
var id = 'video_'+current_video['post_id']
var vf = $('#video-feature')
vf.append( $(current_video['license_html']) )
var body = $(''+current_video['body']+'
');
var readmore = $('Show more
').css('cursor', 'pointer');
readmore.click(function(){
var body = $('.video-body', $(this).parent('#video-feature'));
if ( body.hasClass('opened') ) {
body.removeClass('opened');
$(this)[0].innerHTML = 'Show more';
} else {
body.addClass('opened');
$(this)[0].innerHTML = 'Show less';
}
})
vf.append( body ).append( readmore );
VideoJS.players = {}
var player = _V_( id )
$('#navigation-next').click(function(){
autonext = false;
$('#video-feature').empty()
var c = count + 1;
if ( c >= video_data.length ) c = 0;
load_video( c )
})
$('#navigation-back').click(function(){
autonext = false;
$('#video-feature')[0].innerHTML = '';
var c = count - 1;
if ( c < 0 ) c = video_data.length - 1;
load_video( c )
})
player.addEvent( 'ended', function(){
if ( autonext ) {
$('#video-feature').empty()
load_video( count + 1 )
}
})
if ( count > 0 ) {
player.ready(function(){
this.play()
autonext = true
})
}
}
if ( $('#video-feature').size() > 0 ) {
load_video( 0 )
}
})