You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
8.9 KiB
13 lines
8.9 KiB
8 years ago
|
/* =
|
||
|
jquery.eventCalendar.js
|
||
|
version: 0.68
|
||
|
date: 17-07-2015
|
||
|
author:
|
||
|
Jaime Fernandez (@vissit)
|
||
|
company:
|
||
|
Paradigma Tecnologico (@paradigmate)
|
||
|
url:
|
||
|
http://www.vissit.com/projects/eventCalendar/
|
||
|
*/
|
||
|
|
||
|
;!function(e){function t(t,a){var l=e.extend({},e.fn.eventCalendar.defaults,a),o={wrap:"",directionLeftMove:"300",eventsJson:{}};t.each(function(){o.wrap=e(this),o.wrap.addClass("eventCalendar-wrap").append("<div class='eventCalendar-list-wrap'><p class='eventCalendar-subtitle'></p><span class='eventCalendar-loading'>"+l.locales.txt_loading+"</span><div class='eventCalendar-list-content'><ul class='eventCalendar-list'></ul></div></div>"),l.eventsScrollable&&o.wrap.find(".eventCalendar-list-content").addClass("scrollable"),d(o),e(window).resize(function(){d(o)}),n("current",o,l),r(o,l,l.eventsLimit,!1,!1,!1,!1),s(o,l),o.wrap.on("click",".eventCalendar-day a",function(t){t.preventDefault();var a=o.wrap.attr("data-current-year"),n=o.wrap.attr("data-current-month"),s=e(this).parent().attr("rel");r(o,l,!1,a,n,s,"day")}),o.wrap.on("click",".eventCalendar-monthTitle",function(e){e.preventDefault();var t=o.wrap.attr("data-current-year"),a=o.wrap.attr("data-current-month");r(o,l,l.eventsLimit,t,a,!1,"month")})}),o.wrap.find(".eventCalendar-list").on("click",".eventCalendar-eventTitle",function(t){if(!l.showDescription){t.preventDefault();var a=e(this).parent().find(".eventCalendar-eventDesc");if(!a.find("a").size()){var n=e(this).attr("href"),r=e(this).attr("target");a.append('<a href="'+n+'" target="'+r+'" class="bt">'+l.locales.txt_GoToEventUrl+"</a>")}a.is(":visible")?a.slideUp():(l.onlyOneDescription&&o.wrap.find(".eventCalendar-eventDesc").slideUp(),a.slideDown())}})}function a(e,t){return"string"==typeof e.date?e.date.toLowerCase()>t.date.toLowerCase()?1:-1:e.date>t.date?1:-1}function n(t,a,n){var l=e("<div class='eventCalendar-slider'></div>"),s=e("<div class='eventCalendar-monthWrap'></div>"),o=e("<div class='eventCalendar-currentTitle'><a href='#' class='eventCalendar-monthTitle'></a></div>"),d=e("<a href='#' class='eventCalendar-arrow eventCalendar-prev'><span>"+n.locales.txt_prev+"</span></a><a href='#' class='eventCalendar-arrow eventCalendar-next'><span>"+n.locales.txt_next+"</span></a>");if($eventsCalendarDaysList=e("<ul class='eventCalendar-daysList'></ul>"),date=new Date,a.wrap.find(".eventCalendar-slider").length?a.wrap.find(".eventCalendar-slider").append(s):(a.wrap.prepend(l),l.append(s)),a.wrap.find(".eventCalendar-monthWrap.eventCalendar-currentMonth").removeClass("eventCalendar-currentMonth").addClass("eventCalendar-oldMonth"),s.addClass("eventCalendar-currentMonth").append(o,$eventsCalendarDaysList),"current"===t)day=date.getDate(),l.append(d);else{date=new Date(a.wrap.attr("data-current-year"),a.wrap.attr("data-current-month"),1,0,0,0),day=0,moveOfMonth=1,"prev"===t&&(moveOfMonth=-1),date.setMonth(date.getMonth()+moveOfMonth);var i=new Date;date.getMonth()===i.getMonth()&&(day=i.getDate())}var v=date.getFullYear(),c=(new Date).getFullYear(),p=date.getMonth(),f=p+1;"current"!=t&&r(a,n,n.eventsLimit,v,p,!1,t),a.wrap.attr("data-current-month",p).attr("data-current-year",v),moment.locale(n.locales.locale);var h=moment(v+" "+f,"YYYY MM").format("MMMM YYYY");o.find(".eventCalendar-monthTitle").html(h);var C,m=32-new Date(v,p,32).getDate(),u=[];if(n.showDayAsWeeks){if($eventsCalendarDaysList.addClass("eventCalendar-showAsWeek"),n.showDayNameInCalendar)for($eventsCalendarDaysList.addClass("eventCalendar-showDayNames"),C=0,n.startWeekOnMonday&&(C=1);7>C;C++)u.push('<li class="eventCalendar-day-header">'+moment()._locale._weekdaysShort[C]+"</li>"),6===C&&n.startWeekOnMonday&&u.push('<li class="eventCalendar-day-header">'+moment()._locale._weekdaysShort[0]+"</li>");dt=new Date(v,p,1);var w=dt.getDay();for(n.startWeekOnMonday&&(w=dt.getDay()-1),0>w&&(w=6),C=w;C>0;C--)u.push('<li class="eventCalendar-day eventCalendar-empty"></li>')}for(dayCount=1;m>=dayCount;dayCount++){var y="";day>0&&dayCount===day&&v===c&&(y="today"),u.push('<li id="dayList_'+dayCount+'" rel="'+dayCount+'" class="eventCalendar-day '+y+'"><a href="#">'+dayCount+"</a></li>")}$eventsCalendarDaysList.append(u.join("")),l.css("height",s.height()+"px")}function r(t,a,n,r,s,d,i){n=n||0,r=r||"",d=d||"",s="undefined"!=typeof s?s:"",t.wrap.find(".eventCalen
|