Current Path : /var/www/html/clients/e-nkama.ru/e-nkama_bitrix/bitrix/js/calendar/ |
Current File : /var/www/html/clients/e-nkama.ru/e-nkama_bitrix/bitrix/js/calendar/cal-week.min.js |
JCEC.prototype.BuildWeekDaysTable=function(){var e=this.Tabs["week"],t=e.pBodyCont.rows[0],i=e.pBodyCont.rows[1],s=e.pBodyCont.rows[2],o,a;for(o=0;o<7;o++){t.insertCell(o+1);a=i.insertCell(o+1);a.innerHTML='<div class="bxec-wdv-more-ev"> </div>'}s.cells[0].colSpan="9";e.pTimelineCont=s.cells[0].firstChild;this.ResizeTabTitle(e)};JCEC.prototype.ResizeTabTitle=function(e){var t=bxInt(e.pBodyCont.parentNode.offsetWidth)-40-16,i,s;if(e.id=="week"){e.dayColWidth=Math.round(t/7);e.arDayColWidth=[];i=t-e.dayColWidth*7;for(s=0;s<7;s++){e.arDayColWidth[s]=e.dayColWidth;if(i<0){e.arDayColWidth[s]--;i++}else if(i>0){e.arDayColWidth[s]++;i--}}}else if(e.id=="day"){e.dayColWidth=t;e.arDayColWidth=[e.dayColWidth]}};JCEC.prototype.FillWeekDaysTitle=function(e){this.dragDrop.Reset();var t=this.Tabs[e.tabId],i=t.pBodyCont,s=i.rows[0],o=i.rows[1],a=e.startDate,r=[],l=this,n,d,c,h,T,y,m,f,C,p,u,D,b;t.curDay=false;for(n=1;n<=e.count;n++){T=this.ConvertDayIndex(a.getDay());y=a.getDate();m=a.getMonth();f=a.getFullYear();c=this.days[T][1]+", "+a.getDate();h=this.days[T][0]+", "+a.getDate()+" "+this.arConfig.month_r[m]+" "+f;u=s.cells[n];D=o.cells[n];u.setAttribute("data-bx-day-ind",n-1);D.setAttribute("data-bx-day-ind",n-1);b=BX.create("A",{props:{className:"bxec-day-link",href:"javascript:void(0)",title:EC_MESS.GoToDay},html:c});BX.cleanNode(u);u.style.width=t.arDayColWidth[n-1]-2+"px";u.appendChild(this.CreateStrut(t.arDayColWidth[n-1]-2));u.appendChild(b);b.onmousedown=function(e){return BX.PreventDefault(e)};b.onclick=function(e){var i=t.arDays[this.parentNode.cellIndex-1];l.SetTab("day",false,{bSetDay:false});l.SetDay(i.date,i.month,i.year);return BX.PreventDefault(e)};u.title=h;p=this.week_holidays[T]||this.year_holidays[y+"."+m];C=y==this.currentDate.date&&m==this.currentDate.month&&f==this.currentDate.year;d="";if(C||p){if(C){d="bxec-cur-day";t.curDay={cellInd:n}}if(p)d+=" bxec-hol-day"}u.className=D.className=d;r.push({day:T,date:y,month:m,year:f,bHoliday:p,bCurDay:C,pWnd:u,pMoreEvents:D,Events:{begining:[],hidden:[],all:[]},EventsCount:0});if(!this.bReadOnly){u.onmousedown=D.onmousedown=function(){l.DayTitleOnMouseDown(this,e.tabId)};u.onmouseup=D.onmouseup=function(t){if(!l.dragDrop.IsDragDropNow()){l.DayTitleOnMouseUp(this,e.tabId);BX.PreventDefault(t)}};u.onmouseover=D.onmouseover=function(){l.DayTitleOnMouseOver(this,e.tabId)}}a.setDate(a.getDate()+1);if(n==1)t.activeFirst=new Date(f,m,y).getTime();if(n==e.count)t.activeLast=new Date(f,m,y,23,59).getTime();this.dragDrop.RegisterTitleDay(u,D,t.id)}return r};JCEC.prototype.BuildTimelineGrid=function(e,t){var i=BX.create("TABLE",{props:{className:"bxec-wdv-timeline-tbl"}}),s="",o="",a=this,r=e.id,l,n,d,c,h,T,y,m,f,C,p=this.arConfig.workTime[0].split("."),u=this.arConfig.workTime[1].split("."),D=bxIntEx(p[0]),b=bxIntEx(p[1]),w=bxIntEx(u[0]),v=bxIntEx(u[1]);e.arDays=t;if(e.pTimelineCont)BX.cleanNode(e.pTimelineCont);for(l=0;l<24;l++){f=l<D+1&&b==30||l>=w&&v==0||l>w||l<D;C=l>=w&&v==30||l<D||l>=w;s=f?" bxec-wdv-hol-row":"";o=C?" bxec-wdv-hol-row":"";d=i.insertRow(-1);d.className="bxec-half-time-row1"+s;h=d.insertCell(-1);h.innerHTML=this.FormatTimeByNum(l);h.rowSpan="2";h.className="bxec-time";c=i.insertRow(-1);c.className="bxec-half-time-row2"+o;for(n=0;n<e.daysCount;n++){T=d.insertCell(-1);if(l==0){T.style.width=e.arDayColWidth[n]-2+"px";T.appendChild(this.CreateStrut(e.arDayColWidth[n]-2))}y=c.insertCell(-1);if(!this.bReadOnly){T.onmousedown=y.onmousedown=function(){a.TimeCellOnMouseDown(this,r)};T.onmouseup=y.onmouseup=function(){a.TimeCellOnMouseUp(this,r)};T.onmouseover=y.onmouseover=function(){a.TimeCellOnMouseOver(this,r)}}m=t[n];if(!m.bHoliday&&!m.bCurDay)continue;if(m.bHoliday){BX.addClass(T,"bxec-time-hol-c1");BX.addClass(y,"bxec-time-hol-c2")}if(m.bCurDay){BX.addClass(T,"bxec-time-cur-c1");BX.addClass(y,"bxec-time-cur-c2")}}}i.rows[0].cells[0].appendChild(this.CreateStrut(40));if(BX.browser.IsIE()){setTimeout(function(){try{var t=i.rows[0].cells[i.rows[0].cells.length-1];var s=e.pBodyCont.rows[0].cells[e.pBodyCont.rows[0].cells.length-2];if(t.offsetLeft-s.offsetLeft>2)t.style.width=e.dayColWidth+50+"px"}catch(o){}},500)}e.pTimelineTable=i;e.pTimelineCont.appendChild(i);setTimeout(function(){e.pTimelineCont.scrollTop=40*bxInt(D);if(e.id=="week"){var t=3;if(BX.browser.IsChrome()||BX.browser.IsSafari())t=6;i.style.width=e.pBodyCont.offsetWidth-t+"px"}},0);if(e.curDay)setTimeout(function(){a.ShowCurTimePointer(r)},100);else this.HideCurTimePointer(r);this.dragDrop.RegisterTimeline(e.pTimelineCont,e);this.BuildWeekEventHolder()};JCEC.prototype.TimeCellOnMouseOver=function(e,t){if(this.selectTimeMode){this.selectTimeEndObj=e;this.SelectTime(t)}};JCEC.prototype.TimeCellOnMouseDown=function(e,t){this.selectTimeMode=true;this.selectTimeStartObj=this.selectTimeEndObj=e;if(e.className.indexOf("bxec-time-selected")==-1)return this.SelectTime(t);this.selectTimeMode=false;this.DeSelectTime(t);this.CloseAddEventDialog()};JCEC.prototype.TimeCellOnMouseUp=function(){if(!this.selectTimeMode)return;this.ShowAddEventDialog();this.selectTimeMode=false};JCEC.prototype.DayTitleOnMouseOver=function(e,t){if(this.selectTimeMode&&!this.selectDayTMode){var i=this.__GetRelativeCell(e);this.selectTimeEndObj=this.Tabs[t].pTimelineTable.rows[i.rowInd].cells[i.cellInd];this.SelectTime(t);return}if(this.selectDayTMode){this.selectDayTEndObj=e;this.SelectDaysT(t)}};JCEC.prototype.DayTitleOnMouseDown=function(e,t){this.selectDayTMode=true;this.selectDayTStartObj=this.selectDayTEndObj=e;if(e.className.indexOf("bxec-day-t-selected")==-1){if(this.arSelectedTime&&this.arSelectedTime.length>0)this.SelectTime(t);this.SelectDaysT(t);return}this.selectDayTMode=false;this.DeSelectDaysT();this.CloseAddEventDialog()};JCEC.prototype.DayTitleOnMouseUp=function(e,t){if(this.selectTimeMode&&!this.selectDayTMode){var i=this.__GetRelativeCell(e);this.selectTimeEndObj=this.Tabs[t].pTimelineTable.rows[i.rowInd].cells[i.cellInd];this.TimeCellOnMouseOver(this.selectTimeEndObj,t);this.TimeCellOnMouseUp(this.selectTimeEndObj,t);return}if(!this.selectDayTMode)return;this.ShowAddEventDialog();this.selectDayTMode=false};JCEC.prototype.__GetRelativeCell=function(e){var t=e.cellIndex,i=0;if(t>this.__ConvertCellIndex(this.selectTimeStartObj.parentNode.rowIndex,this.selectTimeStartObj.cellIndex)){t--;i=47}return{cellInd:t,rowInd:i}};JCEC.prototype.SelectDaysT=function(e){if(!this.arSelectedDaysT)this.arSelectedDaysT=[];if(!this.selectDayTStartObj||!this.selectDayTEndObj)return;if(this.arSelectedDaysT.length>0)this.DeSelectDaysT();var t=this.Tabs[e],i=this.selectDayTStartObj,s=this.selectDayTEndObj,o=i.cellIndex,a=s.cellIndex,r=t.pBodyCont,l=r.rows[0],n=r.rows[1],d;if(o>a){i=this.selectDayTEndObj;s=this.selectDayTStartObj;o=i.cellIndex;a=s.cellIndex}this.curDayTSelection={sDay:t.arDays[o-1],eDay:t.arDays[a-1]};for(d=o;d<=a;d++){c1=l.cells[d];c2=n.cells[d];BX.addClass(c1,"bxec-day-t-selected");BX.addClass(c2,"bxec-day-t-selected");this.arSelectedDaysT.push({pCell1:c1,pCell2:c2})}};JCEC.prototype.DeSelectDaysT=function(){if(!this.arSelectedDaysT)return;var e,t;for(e=0,t=this.arSelectedDaysT.length;e<t;e++){BX.removeClass(this.arSelectedDaysT[e].pCell1,"bxec-day-t-selected");BX.removeClass(this.arSelectedDaysT[e].pCell2,"bxec-day-t-selected")}this.arSelectedDaysT=[]};JCEC.prototype.SelectTime=function(e){if(!this.arSelectedTime)this.arSelectedTime=[];if(!this.selectTimeStartObj||!this.selectTimeEndObj)return;if(this.arSelectedTime.length>0)this.DeSelectTime(e);var t=this.Tabs[e],i=this.selectTimeStartObj,s=i.parentNode.rowIndex,o=this.__ConvertCellIndex(s,i.cellIndex),a=this.selectTimeEndObj,r=a.parentNode.rowIndex,l=this.__ConvertCellIndex(r,a.cellIndex),n={sDay:t.arDays[o-1],eDay:t.arDays[l-1],sTime:s/2,eTime:r/2+.5},d,c,h,T,y,m,f;if(s>r&&o==l||o>l){n.sTime+=.5;n.eTime-=.5}n.sHour=Math.floor(n.sTime);n.eHour=Math.floor(n.eTime);n.sMin=(n.sTime-n.sHour)*60;n.eMin=(n.eTime-n.eHour)*60;this.curTimeSelection=n;if(o==l){this._SelectTime({sRow:s,eRow:r,col:o,bShowNotifier:true,tabId:e,oDays:n})}else{if(o<l){c=o;h=l;m=s;f=r}else{c=l;h=o;m=r;f=s;_d=n.sDay;n.sDay=n.eDay;n.eDay=_d;_t=n.sTime;n.sTime=n.eTime;n.eTime=_t}for(d=c;d<=h;d++){T=d==c?m:0;y=d==h?f:47;this._SelectTime({sRow:T,eRow:y,col:d,bShowNotifier:d==c,tabId:e,oDays:n})}}};JCEC.prototype._SelectTime=function(e){var t=this.Tabs[e.tabId].pTimelineTable,i=Math.min(e.eRow,e.sRow),s=Math.max(e.eRow,e.sRow),o,a;for(o=i;o<=s;o++){a=t.rows[o].cells[this.__ConvertCellIndex(o,e.col,true)];BX.addClass(a,"bxec-time-selected");xxx=this.arSelectedTime.push({pCell:a})}if(e.bShowNotifier){if(i==e.eRow&&e.eRow!=e.sRow){_d=e.oDays.sDay;e.oDays.sDay=e.oDays.eDay;e.oDays.eDay=_d;_t=e.oDays.sTime;e.oDays.sTime=e.oDays.eTime;e.oDays.eTime=_t}this.ShowSelectTimeNotifier({tabId:e.tabId,rowInd:i,colInd:e.col,oDays:e.oDays})}};JCEC.prototype.__ConvertCellIndex=function(e,t,i){if(e/2!==Math.round(e/2))t+=i?-1:1;return t};JCEC.prototype.DeSelectTime=function(e){if(!this.arSelectedTime)return;var t,i;for(t=0,i=this.arSelectedTime.length;t<i;t++)BX.removeClass(this.arSelectedTime[t].pCell,"bxec-time-selected");this.HideSelectTimeNotifier({tabId:e});this.arSelectedTime=[]};JCEC.prototype.ShowSelectTimeNotifier=function(e,t){var i=this.Tabs[e.tabId],s=i.pTimelineTable,o=s.rows[e.rowInd].cells[this.__ConvertCellIndex(e.rowInd,e.colInd,true)],a=bxInt(o.offsetLeft),r=bxInt(o.offsetTop),l=Math.floor(e.oDays.sTime),n=Math.floor(e.oDays.eTime),d=(e.oDays.sTime-l)*60,c=(e.oDays.eTime-n)*60,h=e.oDays.sDay,T=e.oDays.eDay,y=-19,m=15,f,C,p;if(n==24)n="00";if(!i.pSTNotifier)i.pSTNotifier=s.parentNode.appendChild(BX.create("DIV",{props:{className:"bxec-st-notifier"}}));C=this.FormatTimeByNum(l,d);p=this.FormatTimeByNum(n,c);if(e.oDays.sDay==e.oDays.eDay)f="<nobr>"+C+" - "+p+"</nobr>";else f="<nobr>"+bxFormatDate(h.date,h.month+1,h.year)+" "+C+" - "+bxFormatDate(T.date,T.month+1,T.year)+" "+p+"</nobr>";if(bxInt(l)<=0)y=20;i.pSTNotifier.innerHTML='<img class="bxec-iconkit" src="/bitrix/images/1.gif">'+f;i.pSTNotifier.style.left=a+m+"px";i.pSTNotifier.style.top=r+y+"px";i.pSTNotifier.style.display="block"};JCEC.prototype.HideSelectTimeNotifier=function(e){var t=this.Tabs[e.tabId];if(!t.pSTNotifier)return;t.pSTNotifier.style.display="none"};JCEC.prototype.BuildSingleDayTable=function(){var e=this.Tabs["day"],t=e.pBodyCont,i=t.rows[0],s=t.rows[1],o=t.rows[2],a;i.insertCell(1);a=s.insertCell(1);a.innerHTML='<div class="bxec-wdv-more-ev"> </div>';o.cells[0].colSpan="3";e.pTimelineCont=o.cells[0].firstChild;this.ResizeTabTitle(e)};JCEC.prototype.ShowCurTimePointer=function(e){var t=this;var i=this.Tabs[e];if(!i.oCurTimePointer)this.CreateCurTimePointer(e);function s(){var e=new Date,s=bxInt(e.getHours()),o=bxInt(e.getMinutes()),a=i.pTimelineTable.rows[s*2].cells[1],r=a.offsetTop+Math.round(a.offsetHeight*2*o/6)/10-(BX.browser.IsSafari()?3:4);i.oCurTimePointer.pWnd.style.top=r+"px";i.oCurTimePointer.pWnd.title=EC_MESS.CurTime+" - "+t.FormatTimeByNum(s,o)}var o=i.oCurTimePointer,a=i.pTimelineTable.rows[0].cells[i.curDay.cellInd];if(!a)return;i.pTimelineCont.appendChild(o.pWnd);o.pWnd.style.display="block";o.pWnd.style.left=bxInt(a.offsetLeft)-bxGetPixel()+"px";o.pWnd.style.width=bxInt(a.offsetWidth)+"px";o.interval=setInterval(s,6e4);s()};JCEC.prototype.CreateCurTimePointer=function(e){this.Tabs[e].oCurTimePointer={pWnd:BX.create("DIV",{props:{className:"bxec-time-pointer"},html:'<img class="bxec-iconkit" src="/bitrix/images/1.gif">'})}};JCEC.prototype.HideCurTimePointer=function(e){var t=this.Tabs[e];if(!t.oCurTimePointer)return;if(t.oCurTimePointer.interval)clearInterval(t.oCurTimePointer.interval);t.oCurTimePointer.pWnd.style.display="none"};JCEC.prototype.SetWeek=function(e,t,i){var s=this.Selector.OnChange(i,t,e),o=s.monthTo,a=s.yearTo,r=this.GetWeekByDate({date:s.dateTo,month:s.monthTo,year:s.yearTo});if(!this.arLoadedMonth[o+"."+a])return this.LoadEvents(o,a,{week:e,month:t,year:i});var l=(new Date).getTime();if(l>=s.weekStartDate.getTime()&&l<=s.weekEndDate.getTime()){o=this.currentDate.month;a=this.currentDate.year;r=this.GetWeekByDate(this.currentDate)}var n=this.activeDate.month!=o||this.activeDate.year!=a;this.activeDate.week=r;this.activeDate.month=o;this.activeDate.year=a;if(n)this.SetTabNeedRefresh("week",true);this.BuildTimelineGrid(this.Tabs["week"],this.FillWeekDaysTitle({tabId:"week",count:7,startDate:s.weekStartDate}))};JCEC.prototype.SetDay=function(e,t,i){var s=this.Selector.OnChange(i,t,false,e),o=s.month,a=s.year;if(!this.arLoadedMonth[o+"."+a])return this.LoadEvents(o,a,{date:e,month:t,year:i});var r=this.activeDate.month!=s.month||this.activeDate.year!=s.year;this.activeDate.date=s.date;this.activeDate.month=s.month;this.activeDate.year=s.year;if(r)this.SetTabNeedRefresh("day",true);var l=this.FillWeekDaysTitle({tabId:"day",count:1,startDate:s.oDate});this.BuildTimelineGrid(this.Tabs["day"],l)}; //# sourceMappingURL=cal-week.map.js