Current Path : /home/bitrix/ext_www/klimatlend.ua/bitrix/js/main/ |
Current File : /home/bitrix/ext_www/klimatlend.ua/bitrix/js/main/calendar.min.js |
var phpVars;if(!phpVars){phpVars={ADMIN_THEME_ID:".default",LANGUAGE_ID:"en",FORMAT_DATE:"DD.MM.YYYY",FORMAT_DATETIME:"DD.MM.YYYY HH:MI:SS",opt_context_ctrl:false,cookiePrefix:"BITRIX_SM",titlePrefix:"",bitrix_sessid:"",messHideMenu:"",messShowMenu:"",messHideButtons:"",messShowButtons:"",messFilterInactive:"",messFilterActive:"",messFilterLess:"",messLoading:"Loading...",messMenuLoading:"",messMenuLoadingTitle:"",messNoData:"",messExpandTabs:"",messCollapseTabs:"",messPanelFixOn:"",messPanelFixOff:"",messPanelCollapse:"",messPanelExpand:""}}function JCAdminCalendar(){var e=this;this.mess={};this.floatDiv=null;this.content=null;this.dateInitial=new Date;this.dateCurrent=null;this.dateCreate=new Date;this.bTime=false;this.bFirst=true;this.menu=null;this.form=this.field=this.fieldFrom=this.fieldTo=null;var t=document.getElementsByTagName("HEAD");if(t){var s=document.createElement("LINK");s.rel="stylesheet";s.href="/bitrix/themes/"+top.phpVars.ADMIN_THEME_ID+"/calendar.css"+(top.jsUtils.IsOpera()?"":"?"+this.mess["css_ver"]);t[0].appendChild(s)}this.Show=function(t,s,i,a,n,r){if(this.floatDiv)this.Close();this.form=top.jsUtils.FindParentObject(t,"form");if(!this.form){var l=document.getElementsByName(s);for(var o in l)if(l[o].form){this.form=l[o].form;break}}this.field=s;this.fieldFrom=i;this.fieldTo=a;this.bTime=n;var d=r*1e3-(this.dateCreate.valueOf()-this.dateCreate.getTimezoneOffset()*6e4);this.dateCurrent=this.ParseDate(this.form.elements[this.field].value);if(this.dateCurrent)this.dateInitial.setTime(this.dateCurrent.valueOf());else if(this.bFirst){this.dateInitial.setTime((new Date).valueOf()+d);this.dateInitial.setHours(0,0,0)}var h=document.body.appendChild(document.createElement("DIV"));h.id="calendar_float_div";h.className="calendar-float";h.style.position="absolute";h.style.left="-1000px";h.style.top="-1000px";h.style.zIndex=BX&&BX.WindowManager&&BX.WindowManager.Get()?BX.WindowManager.Get().zIndex+2:"1100";this.hoursSpin=new JCSpinner("hours");this.minutesSpin=new JCSpinner("minutes");this.secondsSpin=new JCSpinner("seconds");h.innerHTML='<div class="title">'+'<table cellspacing="0" width="100%">'+" <tr>"+' <td width="100%" class="title-text" onmousedown="jsFloatDiv.StartDrag(arguments[0], document.getElementById(\'calendar_float_div\'));" id="calendar_float_title">'+this.mess["title"]+'</td><td width="0%"><a class="close" href="javascript:jsAdminCalendar.Close();" title="'+this.mess["close"]+'"></a></td></tr>'+"</table>"+"</div>"+'<div class="content"></div>'+'<div class="time" align="center" style="display:'+(this.bTime?"block":"none")+'">'+'<form name="float_calendar_time">'+'<table cellspacing="0">'+" <tr>"+" <td>"+this.mess["hour"]+"</td>"+' <td><input type="text" name="hours" value="'+this.Number(this.dateInitial.getHours())+'" size="2" title="'+this.mess["hour_title"]+'" onchange="jsAdminCalendar.TimeChange(this);" onblur="jsAdminCalendar.TimeChange(this);"></td>'+" <td>"+this.hoursSpin.Show("jsAdminCalendar.hoursSpin")+"</td>"+" <td> "+this.mess["minute"]+"</td>"+' <td><input type="text" name="minutes" value="'+this.Number(this.dateInitial.getMinutes())+'" size="2" title="'+this.mess["minute_title"]+'" onchange="jsAdminCalendar.TimeChange(this);" onblur="jsAdminCalendar.TimeChange(this);"></td>'+" <td>"+this.hoursSpin.Show("jsAdminCalendar.minutesSpin")+"</td>"+" <td> "+this.mess["second"]+"</td>"+' <td><input type="text" name="seconds" value="'+this.Number(this.dateInitial.getSeconds())+'" size="2" title="'+this.mess["second_title"]+'" onchange="jsAdminCalendar.TimeChange(this);" onblur="jsAdminCalendar.TimeChange(this);"></td>'+" <td>"+this.hoursSpin.Show("jsAdminCalendar.secondsSpin")+"</td>"+" <td> </td>"+' <td><a title="'+this.mess["set_time"]+'" href="javascript:jsAdminCalendar.CurrentTime('+d+');" class="time set-time"></a></td>'+' <td><a title="'+this.mess["clear_time"]+'" href="javascript:jsAdminCalendar.ClearTime();" class="time clear-time"></a></td>'+" </tr>"+"</table>"+"</form>"+"</div>"+'<table cellspacing="0" class="time-toolbar">'+" <tr>"+' <td align="center"><a id="calendar_time_button" hidefocus="true" tabindex="-1" title="'+(this.bTime?this.mess["time_hide"]:this.mess["time"])+'" href="javascript:jsAdminCalendar.ToggleTime();" class="button '+(this.bTime?"arrow-up":"arrow-down")+'"></a></td>'+" </tr>"+"</table>";this.floatDiv=h;this.content=top.jsUtils.FindChildObject(this.floatDiv,"div","content");this.content.innerHTML=this.GetMonthPage();var u=top.jsUtils.GetRealPos(t);u["bottom"]+=2;u=top.jsUtils.AlignToPos(u,h.offsetWidth,h.offsetHeight);jsFloatDiv.Show(h,u["left"],u["top"],3);setTimeout(function(){top.jsUtils.addEvent(document,"click",e.CheckClick)},10);top.jsUtils.addEvent(document,"keypress",e.OnKeyPress);this.bFirst=false};this.GetMonthPage=function(){var e=[this.mess["jan"],this.mess["feb"],this.mess["mar"],this.mess["apr"],this.mess["may"],this.mess["jun"],this.mess["jul"],this.mess["aug"],this.mess["sep"],this.mess["okt"],this.mess["nov"],this.mess["des"]];var t=this.dateInitial.getFullYear(),s=this.dateInitial.getMonth(),i=this.dateInitial.getDate();var a=new Date;a.setHours(this.dateInitial.getHours(),this.dateInitial.getMinutes(),this.dateInitial.getSeconds());var n=a.getFullYear()==t&&a.getMonth()==s;document.getElementById("calendar_float_title").innerHTML=e[s]+", "+t;var r="";r+='<div style="width:100%;">'+'<table cellspacing="0" class="toolbar">'+"<tr>"+'<td><a title="'+this.mess["prev_mon"]+'" href="javascript:jsAdminCalendar.NavigateMonth('+(s-1)+');" class="button left"></a></td>'+'<td width="50%"></td>'+'<td><a title="'+(n?this.mess["curr_day"]:this.mess["curr"])+'" href="javascript:'+(n?"jsAdminCalendar.InsertDate('"+a.valueOf()+"')":"jsAdminCalendar.NavigateToday()")+';" class="button today"></a></td>'+'<td><a title="'+this.mess["per_mon"]+'" href="javascript:jsAdminCalendar.InsertPeriod(\''+this.getMonthFirst().valueOf()+"', '"+this.getMonthLast().valueOf()+'\');" class="button menu">'+e[s]+"</a></td>"+'<td><a title="'+this.mess["month"]+'" href="javascript:void(0)" onclick="jsAdminCalendar.MenuMonth(this);" class="button arrow"></a></td>'+'<td><a title="'+this.mess["per_year"]+'" href="javascript:jsAdminCalendar.InsertPeriod(\''+this.getYearFirst().valueOf()+"', '"+this.getYearLast().valueOf()+'\');" class="button menu">'+t+"</a></td>"+'<td><a title="'+this.mess["year"]+'" href="javascript:void(0)" onclick="jsAdminCalendar.MenuYear(this);" class="button arrow"></a></td>'+'<td width="50%"></td>'+'<td><a title="'+this.mess["next_mon"]+'" href="javascript:jsAdminCalendar.NavigateMonth('+(s+1)+');" class="button right"></a></td>'+"</tr>"+"</table>";r+='<div class="calendar">'+'<div style="width:100%;">'+'<table cellspacing="0">'+'<tr class="head">'+'<td class="week"> </td>'+"<td>"+this.mess["mo"]+"</td>"+"<td>"+this.mess["tu"]+"</td>"+"<td>"+this.mess["we"]+"</td>"+"<td>"+this.mess["th"]+"</td>"+"<td>"+this.mess["fr"]+"</td>"+"<td>"+this.mess["sa"]+"</td>"+"<td>"+this.mess["su"]+"</td>"+"</tr>";var l=new Date(t,s,1,this.dateInitial.getHours(),this.dateInitial.getMinutes(),this.dateInitial.getSeconds());var o=l.getDay()-1;if(o==-1)o=6;var d=new Date;var h=false;for(var u=0;u<6;u++){var m=u*7;d.setTime(l.valueOf());d.setDate(1-o+m);if(u>0&&d.getDate()==1)break;var f=this.WeekNumber(d);r+='<tr><td class="week"><a title="'+this.mess["per_week"]+'" href="javascript:jsAdminCalendar.InsertPeriod(\''+d.valueOf()+"', '";d.setTime(l.valueOf());d.setDate(1-o+m+6);r+=d.valueOf()+"');\">"+f+"</a></td>";for(var c=0;c<7;c++){d.setTime(l.valueOf());d.setDate(1-o+m+c);var v=d.getDate();if(u>0&&v==1)h=true;var p="";if(m+c+1>o&&!h){if(v==a.getDate()&&n)p+=" today";if(this.dateCurrent&&v==this.dateCurrent.getDate()&&s==this.dateCurrent.getMonth()&&t==this.dateCurrent.getFullYear())p+=" current"}if(c==5||c==6)p+=" holiday";if(!(m+c+1>o&&!h))p+=" inactive";r+="<td"+(p!=""?' class="'+p+'"':"")+">";r+='<a title="'+this.mess["date"]+'" href="javascript:jsAdminCalendar.InsertDate(\''+d.valueOf()+"')\">"+v+"</a>";r+="</td>"}r+="</tr>";if(h)break}r+="</table>"+"</div>"+"</div>"+"</div>";return r};this.WeekNumber=function(e){var t=new Date(e.getFullYear(),0,1);var s=t.getDay()-1;if(s==-1)s=6;var i=Math.round((e.valueOf()-t.valueOf())/(24*60*60*1e3));var a=(i-(7-s))/7+1;if(s<4)a++;if(a>52){t=new Date(e.getFullYear()+1,0,1);s=t.getDay()-1;if(s==-1)s=6;if(s<4)a=1}return a};this.NavigateToday=function(){var e=this.dateInitial.getHours(),t=this.dateInitial.getMinutes(),s=this.dateInitial.getSeconds();this.dateInitial.setTime((new Date).valueOf());this.dateInitial.setHours(e,t,s);this.content.innerHTML=jsAdminCalendar.GetMonthPage()};this.NavigateMonth=function(e){this.dateInitial.setMonth(e,1);this.content.innerHTML=jsAdminCalendar.GetMonthPage()};this.NavigateYear=function(e){this.dateInitial.setFullYear(e,this.dateInitial.getMonth(),1);this.content.innerHTML=jsAdminCalendar.GetMonthPage()};this.getMonthFirst=function(){var e=new Date;e.setTime(this.dateInitial.valueOf());e.setDate(1);return e};this.getMonthLast=function(){var e=new Date;e.setTime(this.dateInitial.valueOf());e.setMonth(e.getMonth()+1);e.setDate(0);return e};this.getYearFirst=function(){var e=new Date;e.setTime(this.dateInitial.valueOf());e.setMonth(0);e.setDate(1);return e};this.getYearLast=function(){var e=new Date;e.setTime(this.dateInitial.valueOf());e.setFullYear(e.getFullYear()+1);e.setMonth(0);e.setDate(0);return e};this.InsertDaysBack=function(e,t){if(t!=""){var s=new Date;if(t>0)s.setTime(s.valueOf()-t*24*60*60*1e3);e.value=this.FormatDate(s,top.phpVars.FORMAT_DATE);e.disabled=true}else{e.disabled=false;e.value=""}};this.ValueToString=function(e){var t=new Date;t.setTime(e);if(this.bTime){var s=document.forms.float_calendar_time;t.setHours(parseInt(s.hours.value,10));t.setMinutes(parseInt(s.minutes.value,10));t.setSeconds(parseInt(s.seconds.value,10))}return this.FormatDate(t)};this.CurrentTime=function(e){var t=new Date;t.setTime(t.valueOf()+e);var s=document.forms.float_calendar_time;s.hours.value=t.getHours();s.minutes.value=t.getMinutes();s.seconds.value=t.getSeconds();s.hours.onchange();s.minutes.onchange();s.seconds.onchange()};this.ClearTime=function(){var e=document.forms.float_calendar_time;e.hours.value=e.minutes.value=e.seconds.value="00"};this.InsertDate=function(e){this.form.elements[this.field].value=this.ValueToString(e);if(BX)BX.fireEvent(this.form.elements[this.field],"change");this.Close()};this.InsertPeriod=function(e,t){if(this.fieldFrom!=""&&this.fieldTo!=""){this.form.elements[this.fieldFrom].value=this.ValueToString(e);this.form.elements[this.fieldTo].value=this.ValueToString(t)}else this.form.elements[this.field].value=this.ValueToString(e);this.Close()};this.Number=function(e){return e<10?"0"+e:e};this.FormatDate=function(e,t){var s;var i=t?t:this.bTime?top.phpVars.FORMAT_DATETIME:top.phpVars.FORMAT_DATE;i=i.replace(/YYYY/gi,e.getFullYear());i=i.replace(/MMMM/gi,this.Number(e.getMonth()+1));i=i.replace(/MM/gi,this.Number(e.getMonth()+1));i=i.replace(/MI/gi,this.Number(e.getMinutes()));i=i.replace(/M/gi,this.Number(e.getMonth()+1));i=i.replace(/DD/gi,this.Number(e.getDate()));i=i.replace(/GG/gi,this.Number(e.getHours()));i=i.replace(/HH/gi,this.Number(e.getHours()));if(BX.isAmPmMode()){var a=this.Number(e.getHours());var n="am";if(a>12){a=a-12;n="pm"}else if(a==12)n="pm";i=i.replace(/G/gi,a);i=i.replace(/H/gi,a);i=i.replace(/TT/gi,n);i=i.replace(/T/gi,n)}i=i.replace(/SS/gi,this.Number(e.getSeconds()));return i};this.ParseDate=function(e){var t=e.split(/[^\w]/gi);var s=top.phpVars.FORMAT_DATE.split(/[^\w]/gi);if(t.length>s.length)s=top.phpVars.FORMAT_DATETIME.split(/[^\w]/gi);var i,a;var n=[],r=[];for(i=0,a=t.length;i<a;i++)if(top.jsUtils.trim(t[i])!="")n[n.length]=t[i];for(i=0,a=s.length;i<a;i++)if(top.jsUtils.trim(s[i])!="")r[r.length]=s[i];var l={};for(i=0,a=r.length;i<a;i++){if(n[i]!=undefined&&n[i].match(/[a-z]/gi)!=null){l[r[i].toUpperCase()]=n[i]}else{l[r[i].toUpperCase()]=parseInt(n[i],10)}}if(l["MM"]==undefined&&(l["M"]!=undefined||l["MMMM"]!=undefined)){if(l["M"]!=undefined){if(typeof l["M"]=="string"){l["MM"]=BX.getNumMonth(l["M"])}else{l["MM"]=l["M"]}}else{if(typeof l["MMMM"]=="string"){l["MM"]=BX.getNumMonth(l["MMMM"])}else{l["MM"]=l["MMMM"]}}}if(l["DD"]>0&&l["MM"]>0&&l["YYYY"]>0){var o=new Date;o.setDate(1);o.setFullYear(l["YYYY"]);o.setMonth(l["MM"]-1);o.setDate(l["DD"]);o.setHours(0,0,0);if(l["HH"]==undefined&&(l["H"]!=undefined||l["G"]!=undefined||l["G"]!=undefined)){if(l["H"]!=undefined)l["HH"]=l["H"];else if(l["G"]!=undefined)l["HH"]=l["G"];else l["HH"]=l["GG"];if(l["TT"]!=undefined&&l["TT"].toLowerCase()=="pm")l["HH"]=l["HH"]+12;else if(l["T"]!=undefined&&l["T"].toLowerCase()=="pm")l["HH"]=l["HH"]+12}if(!isNaN(l["HH"])&&!isNaN(l["MI"])&&!isNaN(l["SS"])){this.bTime=true;o.setHours(l["HH"],l["MI"],l["SS"])}return o}return null};this.MenuMonth=function(e){var t=[this.mess["jan"],this.mess["feb"],this.mess["mar"],this.mess["apr"],this.mess["may"],this.mess["jun"],this.mess["jul"],this.mess["aug"],this.mess["sep"],this.mess["okt"],this.mess["nov"],this.mess["des"]];var s=[];var i=this.dateInitial.getMonth();for(var a in t)s[a]={ICONCLASS:i==a?"checked":"",TEXT:t[a],ONCLICK:"jsAdminCalendar.NavigateMonth("+a+")",DEFAULT:(new Date).getMonth()==a?true:false};this.ShowMenu(e,s)};this.MenuYear=function(e){var t=[];var s=this.dateInitial.getFullYear();for(var i=0;i<11;i++){item_year=s-5+i;t[i]={ICONCLASS:s==item_year?"checked":"",TEXT:item_year,ONCLICK:"jsAdminCalendar.NavigateYear("+item_year+")",DEFAULT:(new Date).getFullYear()==item_year?true:false}}this.ShowMenu(e,t)};this.ShowMenu=function(t,s){if(!this.menu){this.menu=new PopupMenu("calendar_float_menu");this.menu.Create(parseInt(this.floatDiv.style.zIndex)+10,3);this.menu.OnClose=function(){setTimeout(function(){if(e.floatDiv)top.jsUtils.addEvent(document,"click",e.CheckClick)},10);top.jsUtils.addEvent(document,"keypress",e.OnKeyPress)}}if(this.menu.IsVisible())return;this.menu.SetItems(s);this.menu.BuildItems();var i=top.jsUtils.GetRealPos(t);i["bottom"]+=1;top.jsUtils.removeEvent(document,"click",e.CheckClick);top.jsUtils.removeEvent(document,"keypress",e.OnKeyPress);this.menu.PopupShow(i)};this.ToggleTime=function(){var e=top.jsUtils.FindChildObject(this.floatDiv,"div","time");var t=document.getElementById("calendar_time_button");if(e.style.display=="none"){e.style.display="block";t.className="button arrow-up";t.title=this.mess["time_hide"]}else{e.style.display="none";t.className="button arrow-down";t.title=this.mess["time"]}t.blur();jsFloatDiv.AdjustShadow(this.floatDiv)};this.TimeChange=function(e){this.bTime=true;var t=parseInt(e.value,10);if(isNaN(t))t="00";else if(t<0){if(e.name=="hours")t="23";else t="59"}else if(e.name=="hours"&&t>23||t>59)t="00";else t=this.Number(t);e.value=t};this.Close=function(){top.jsUtils.removeEvent(document,"click",e.CheckClick);top.jsUtils.removeEvent(document,"keypress",e.OnKeyPress);jsFloatDiv.Close(this.floatDiv);this.floatDiv.parentNode.removeChild(this.floatDiv);this.floatDiv=null};this.OnKeyPress=function(t){if(!t)t=window.event;if(!t)return;if(t.keyCode==27)e.Close()};this.CheckClick=function(t){var s=e.floatDiv;if(!s)return;var i=jsUtils.GetWindowSize();var a=t.clientX+i.scrollLeft;var n=t.clientY+i.scrollTop;var r=jsUtils.GetRealPos(s);if(a>=r.left&&a<=r.right&&n>=r.top&&n<=r.bottom)return;e.Close()}}var jsAdminCalendar=new JCAdminCalendar;function JCSpinner(e){var t=this;this.name=e;this.mousedown=false;this.Show=function(e){var t='<table cellspacing="0" class="spin">'+' <tr><td><a hidefocus="true" tabindex="-1" href="javascript:void(0);" onmousedown="'+e+'.Start(1);" class="spin spin-up"></a></td></tr>'+' <tr><td><a hidefocus="true" tabindex="-1" href="javascript:void(0);" onmousedown="'+e+'.Start(-1);" class="spin spin-down"></a></td></tr>'+"</table>";return t};this.Start=function(e){this.mousedown=true;top.jsUtils.addEvent(document,"mouseup",t.MouseUp);this.ChangeValue(e,true)};this.ChangeValue=function(e,s){if(!this.mousedown)return;var i=document.forms.float_calendar_time.elements[this.name];i.value=parseInt(i.value,10)+e;i.onchange();setTimeout(function(){t.ChangeValue(e,false)},s?1e3:150)};this.MouseUp=function(){t.mousedown=false;top.jsUtils.removeEvent(document,"mouseup",t.MouseUp)}} //# sourceMappingURL=calendar.map.js