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.
1 lines
3.1 KiB
1 lines
3.1 KiB
var EXPO=EXPO||{};EXPO.profile=EXPO.profile||{},EXPO.profile.calendar?console.warn("WARNING: EXPO.profile.calendar is already defined!"):EXPO.profile.calendar=function(){var e=(EXPO.common,{});return e.opt={},$(function(){$("#btn_delete").on("click",function(e){e.preventDefault();var t=$("input[name=expo]:checkbox:checked").map(function(){return $(this).val()}).get(),s=$("input[name=conf]:checkbox:checked").map(function(){return $(this).val()}).get(),n=$("input[name=seminar]:checkbox:checked").map(function(){return $(this).val()}).get(),a=$("input[name=webinar]:checkbox:checked").map(function(){return $(this).val()}).get(),i={expo:JSON.stringify(t),conf:JSON.stringify(s),seminar:JSON.stringify(n),webinar:JSON.stringify(a)};$.get("/profile/calendar/remove/",i,function(e){e.success&&location.reload()})})}),e.init=function(e){$.extend(this.opt,e);var t=this,s=$("#"+this.opt.scrollBoxId),n=$("#"+this.opt.calenadrId),a=(n.find("td."+this.opt.currentDayClass).index()*this.opt.cellWidth,$("#"+this.opt.scrollLeftId)),i=$("#"+this.opt.scrollRightId),o=$("."+this.opt.noEventsClass),r=$("."+this.opt.calendarToggleClass),c=this.opt.cellWidth*this.opt.cellsToScroll,l=0,d=function(){var e,s,n=0,a=0,i=t.opt.cellWidth,o=$("#"+t.opt.calenadrId),r=o.find("td."+t.opt.currentDayClass).index(),c=t.opt.cellsToScroll,l=o.find("."+t.opt.daysClass+" td").length;return t.stepWidth=c*i,t.calendarWidth=i*l,r>0?(r++,e=l/c,s=l/r,a=e-s,t.currentDay=r,a?(a=Math.floor(a-1),n=c*a*i):n=0):(t.currentDay=0,n=0),n};this.currentOffset=d(),this.$messages=[],$(function(){o.each(function(){$(this).attr("colspan")&&1!=$(this).attr("colspan")?$(this).width()>t.stepWidth&&t.$messages.push($(".message",$(this)).width(t.stepWidth).css({marginLeft:t.currentOffset+"px"})):$(this).find("."+t.opt.eventWrapClass).addClass("small")}),$("."+t.opt.eventsClass).each(function(){l++,3==l&&$(this).addClass("grey"),4==l&&($(this).addClass("grey"),l=0)})}),$(window).load(function(){s.mCustomScrollbar({axis:"y",horizontalScroll:!0,setLeft:"-"+EXPO.profile.calendar.currentOffset+"px",mouseWheel:{enable:!1},scrollButtons:{enable:!1},contentTouchScroll:!1,scrollInertia:1e3,timeout:0,advanced:{autoScrollOnFocus:!1,updateOnContentResize:!1,updateOnBrowserResize:!1},keyboard:{enable:!1}})}),a.on("click",function(){if(t.currentOffset>=t.stepWidth){t.currentOffset-=c,s.mCustomScrollbar("scrollTo","+="+c);for(var e=0;e<t.$messages.length;e++){var n=parseInt(t.$messages[e].inlineStyle("margin-left"));n>0&&t.$messages[e].css({marginLeft:t.currentOffset+"px"})}}}),i.on("click",function(){if(t.currentOffset+t.stepWidth<t.calendarWidth){t.currentOffset+=c,s.mCustomScrollbar("scrollTo","-="+c);for(var e=0;e<t.$messages.length;e++){var n=parseInt(t.$messages[e].inlineStyle("margin-left"));n+t.$messages[e].width()<t.calendarWidth&&t.$messages[e].css({marginLeft:t.currentOffset+"px"})}}}),r.on("click",function(){var e=$(this),t=e.closest(".ep-sect"),s=t.children("div.ep-sect-body");return t.hasClass("eps-opened")?(i.hide(),a.hide(),s.stop().animate({opacity:0},300,function(){t.removeClass("eps-opened")})):(i.show(),a.show(),s.stop().animate({opacity:1},300,function(){t.addClass("eps-opened")})),!1})},e}(); |