Select Git revision
mediarack.js
mediarack.js 8.43 KiB
var showLimit = 5;
var showOffset = 0;
var loadShows = true;
var movieLimit = 5;
var movieOffset = 0;
var loadMovies = true;
$(document).ready(function() {
getLatest();
getShows();
getMovies();
$(".nav a").on('click',function(e) {
e.preventDefault();
$('.content').hide();
$(".nav li").removeClass('active');
$(this).parent().addClass('active');
window.scrollTo(0, 0);
$($(this).attr('href')).show();
});
$(window).scroll(function(){
if ($(window).scrollTop()+200 >= ($(document).height() - ($(window).height()))){
if ($("#shows").is(":visible") && loadShows == true) {
loadShows = false;
getShows();
}
if ($("#movies").is(":visible") && loadMovies == true) {
loadMovies = false;
getMovies();
}
}
});
});
function getLatest() {
$.getJSON('api.php', {
'type': 'shows',
'get': 'latest'
}, function(data) {
$.each(data, function (key, ep) {
var ulLatestContainer = $("#latestShows");
var liLatestItem = $('<li><img src="api.php?get=poster&show='+escape(ep.show)+'" /><div class="epLabel">'+ep.show+'<br />'+ep.episode+'<br />'+ep.name+'<br />'+ep.airdate+'</div></li>');
ulLatestContainer.append(liLatestItem);
});
$('.jcarousel').jcarousel({
wrap: 'both'
});
$('.jcarousel-control-prev')
.on('jcarouselcontrol:active', function() {
$(this).removeClass('inactive');
})
.on('jcarouselcontrol:inactive', function() {
$(this).addClass('inactive');
})
.jcarouselControl({
target: '-=1'
});
$('.jcarousel-control-next')
.on('jcarouselcontrol:active', function() {
$(this).removeClass('inactive');
})
.on('jcarouselcontrol:inactive', function() {
$(this).addClass('inactive');
})
.jcarouselControl({