orbit-basic/app/assets/javascripts/event.js

66 lines
1.8 KiB
JavaScript

$(document).ready(function(){
var result = '',
title_text = '',
link_text = '',
summary_text = '',
startDate_text = '',
startMon_text = '',
startDay_text = '',
endDate_text = '',
time_text = '',
selet = 0,
xmlLength = '',
indexA = '',
indexB = '',
indexC = '',
month = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
checking = 1,
$events = $('.events'),
$mon = $('.events .mon'),
$day = $('.events .day'),
$link_text = $('.events .event_name'),
$time = $('.events .event_info'),
$next = $('.events .links_next'),
$prev = $('.events .links_prev'),
objLength = $events.find('ul > li').length;
$next.on("click", function(){
if (checking&&selet < xmlLength) {
$('.links_prev').removeClass('disabled')
selet+=objLength;
$events.find('ul').fadeOut("fast", function () {
resetText()
$events.find('ul').fadeIn("fast" ,getEvent(selet));
});
if ((xmlLength-selet) == objLength) {
$('.links_next').addClass('disabled')
checking = 0;
} else if ((xmlLength-selet) < objLength) {
$('.links_next').addClass('disabled')
checking = 0;
}
}
return false;
});
$prev.on("click", function(){
if (selet > 0) {
$('.links_next').removeClass('disabled')
checking = 1;
selet-=objLength;
$events.find('ul').fadeOut("fast", function () {
$events.find('ul').fadeIn("fast" ,getEvent(selet));
});
if ((xmlLength-selet) == xmlLength ) {
$('.links_prev').addClass('disabled')
}
}
return false;
});
function resetText() {
$events.find('li').find($mon).html('');
$events.find('li').find($day).html('');
$events.find('li').find($link_text).html('');
$events.find('li').find($link_text).attr('href', '');
$events.find('li').find($time).html('');
}
});