|
|
|
|
@ -1,8 +1,8 @@ |
|
|
|
|
var EXPO = EXPO || {}; //isolated namespace
|
|
|
|
|
EXPO.profile = EXPO.profile || {}; |
|
|
|
|
if (EXPO.profile.calendar){ |
|
|
|
|
if (EXPO.profile.calendar) { |
|
|
|
|
console.warn('WARNING: EXPO.profile.calendar is already defined!'); |
|
|
|
|
}else { |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
EXPO.profile.calendar = (function () { |
|
|
|
|
// dependencies
|
|
|
|
|
@ -20,57 +20,81 @@ if (EXPO.profile.calendar){ |
|
|
|
|
//инициализация общих свойств
|
|
|
|
|
that.init = function (options) { |
|
|
|
|
$.extend(this.opt, options); |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* scrolling calendar object |
|
|
|
|
* depend on mCustomScroll Jquery plugin |
|
|
|
|
* @type {*|jQuery|HTMLElement} |
|
|
|
|
*/ |
|
|
|
|
var self = this, |
|
|
|
|
$scrollBox = $('#'+this.opt.scrollBoxId), |
|
|
|
|
$calendar = $('#'+this.opt.calenadrId), |
|
|
|
|
currentDayOffset = $calendar.find('td.'+this.opt.currentDayClass).index()*this.opt.cellWidth, |
|
|
|
|
$leftScroll = $('#'+this.opt.scrollLeftId), |
|
|
|
|
$rightScroll = $('#'+this.opt.scrollRightId), |
|
|
|
|
$noEventsField = $('.'+this.opt.noEventsClass), |
|
|
|
|
$calendarToggle = $('.'+this.opt.calendarToggleClass), |
|
|
|
|
scrollStep = this.opt.cellWidth*this.opt.cellsToScroll, |
|
|
|
|
index = 0; |
|
|
|
|
$scrollBox = $('#' + this.opt.scrollBoxId), |
|
|
|
|
$calendar = $('#' + this.opt.calenadrId), |
|
|
|
|
currentDayOffset = $calendar.find('td.' + this.opt.currentDayClass).index() * this.opt.cellWidth, |
|
|
|
|
$leftScroll = $('#' + this.opt.scrollLeftId), |
|
|
|
|
$rightScroll = $('#' + this.opt.scrollRightId), |
|
|
|
|
$noEventsField = $('.' + this.opt.noEventsClass), |
|
|
|
|
$calendarToggle = $('.' + this.opt.calendarToggleClass), |
|
|
|
|
scrollStep = this.opt.cellWidth * this.opt.cellsToScroll, |
|
|
|
|
index = 0, |
|
|
|
|
currentWeekOffset = function () { |
|
|
|
|
var offset = 0, |
|
|
|
|
result = 0, |
|
|
|
|
width = self.opt.cellWidth, |
|
|
|
|
$calendar = $('#' + self.opt.calenadrId), |
|
|
|
|
currentDay = $calendar.find('td.' + self.opt.currentDayClass).index()+1, |
|
|
|
|
onestep = self.opt.cellsToScroll, |
|
|
|
|
allDays = $calendar.find('.'+self.opt.daysClass+' td').length, |
|
|
|
|
stepsCount = allDays / onestep, |
|
|
|
|
currenCount = allDays / currentDay; |
|
|
|
|
result = stepsCount - currenCount; |
|
|
|
|
if (result) { |
|
|
|
|
result = Math.round(result); |
|
|
|
|
offset = onestep * result * width; |
|
|
|
|
} else { |
|
|
|
|
|
|
|
|
|
offset = 0; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return offset; |
|
|
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
$(function () { |
|
|
|
|
$noEventsField.each(function () { |
|
|
|
|
if(!$(this).attr('colspan') || $(this).attr('colspan') == 1){ |
|
|
|
|
$(this).find('.'+self.opt.eventWrapClass).addClass('small'); |
|
|
|
|
if (!$(this).attr('colspan') || $(this).attr('colspan') == 1) { |
|
|
|
|
$(this).find('.' + self.opt.eventWrapClass).addClass('small'); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
$('.'+self.opt.eventsClass).each(function () { |
|
|
|
|
$('.' + self.opt.eventsClass).each(function () { |
|
|
|
|
index++; |
|
|
|
|
if(index == 3 ){ |
|
|
|
|
if (index == 3) { |
|
|
|
|
$(this).addClass('grey'); |
|
|
|
|
} |
|
|
|
|
if(index == 4 ){ |
|
|
|
|
if (index == 4) { |
|
|
|
|
$(this).addClass('grey'); |
|
|
|
|
index = 0; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
$(window).load(function(){ |
|
|
|
|
$(window).load(function () { |
|
|
|
|
$scrollBox.mCustomScrollbar({ |
|
|
|
|
axis:'y', |
|
|
|
|
axis: 'y', |
|
|
|
|
horizontalScroll: true, |
|
|
|
|
advanced:{ // Advanced options
|
|
|
|
|
advanced: { // Advanced options
|
|
|
|
|
autoScrollOnFocus: false, |
|
|
|
|
updateOnContentResize: false, // Scrollbar will be updated on content resize
|
|
|
|
|
updateOnBrowserResize: false // Scrollbar will be updated on browser resize
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
$scrollBox.mCustomScrollbar("scrollTo",currentDayOffset); |
|
|
|
|
$scrollBox.mCustomScrollbar("scrollTo", currentWeekOffset()); |
|
|
|
|
}); |
|
|
|
|
$leftScroll.on('click', function () { |
|
|
|
|
$scrollBox.mCustomScrollbar("scrollTo",'+='+scrollStep); |
|
|
|
|
$scrollBox.mCustomScrollbar("scrollTo", '+=' + scrollStep); |
|
|
|
|
}); |
|
|
|
|
$rightScroll.on('click', function () { |
|
|
|
|
$scrollBox.mCustomScrollbar("scrollTo",'-='+scrollStep); |
|
|
|
|
$scrollBox.mCustomScrollbar("scrollTo", '-=' + scrollStep); |
|
|
|
|
}); |
|
|
|
|
$calendarToggle.on('click', function () { |
|
|
|
|
var $switch = $(this); |
|
|
|
|
|