Файловый менеджер - Редактировать - /home/lmsyaran/public_html/administrator/persianDatepicker.min.js
Назад
/*! * persianDatepicker v0.1.0 * http://github.com/behzadi/persianDatepicker/ * * Copyright (c) 2013 Mohammad hasan Behzadi All rights reserved. * * Released under the MIT license. * * jalali Date Functions * * Date: Tue Jan 1 2013 * * Last Update: Mon April 15 2019 * */ !function(t){t.fn.persianDatepicker=function(a){var s=this.data("persianDatepicker");return s?!0===a?s:this:this.each(function(){return t(this).data("persianDatepicker",new e(this,a))})};var e=function(){function e(e,a){var s=this;s.el=t(e);var n=s.el;s.options=t.extend(!1,{},{months:["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],dowTitle:["شنبه","یکشنبه","دوشنبه","سه شنبه","چهارشنبه","پنج شنبه","جمعه"],shortDowTitle:["ش","ی","د","س","چ","پ","ج"],showGregorianDate:!1,persianNumbers:!0,formatDate:"YYYY/MM/DD",selectedBefore:!1,selectedDate:null,startDate:null,endDate:null,prevArrow:"◄",nextArrow:"►",theme:"default",alwaysShow:!1,selectableYears:null,selectableMonths:[1,2,3,4,5,6,7,8,9,10,11,12],cellWidth:25,cellHeight:20,fontSize:13,isRTL:!1,closeOnBlur:!0,calendarPosition:{x:0,y:0},onShow:function(){},onHide:function(){},onSelect:function(){},onRender:function(){}},a);var i=s.options;if(_fontSize=i.fontSize,_cw=parseInt(i.cellWidth),_ch=parseInt(i.cellHeight),s.cellStyle="style='width:"+_cw+"px;height:"+_ch+"px;line-height:"+_ch+"px; font-size:"+_fontSize+"px; ' ",s.headerStyle="style='height:"+_ch+"px;line-height:"+_ch+"px; font-size:"+(_fontSize+4)+"px;' ",s.selectUlStyle="style='margin-top:"+_ch+"px;height:"+(7*_ch+20)+"px; font-size:"+(_fontSize-2)+"px;' ",s.selectMonthLiStyle="style='height:"+(7*_ch+7)/4+"px;line-height:"+(7*_ch+7)/4+"px; width:"+6.7*_cw/3+"px;width:"+6.7*_cw/3+"px\\9;' ",s.selectYearLiStyle="style='height:"+(7*_ch+10)/6+"px;line-height:"+(7*_ch+10)/6+"px; width:"+(6.7*_cw-14)/3+"px;width:"+(6.7*_cw-15)/3+"px\\9;' ",s.footerStyle="style='height:"+_ch+"px;line-height:"+_ch+"px; font-size:"+_fontSize+"px;' ",s.jDateFunctions=new jDateFunctions,null!=s.options.startDate&&("today"==s.options.startDate&&(s.options.startDate=s.now().toString("YYYY/MM/DD")),"today"==s.options.endDate&&(s.options.endDate=s.now().toString("YYYY/MM/DD")),s.options.selectedDate=s.options.startDate),null==s.options.selectedDate&&!s.options.showGregorianDate){var o=new RegExp("^([1-9][0-9][0-9][0-9])/([0]?[1-9]|[1][0-2])/([0]?[1-9]|[1-2][0-9]|[3][0-1])$");n.is("input")?o.test(n.val())&&(s.options.selectedDate=n.val()):o.test(n.html())&&(s.options.selectedDate=n.html())}if(s._persianDate=null!=s.options.selectedDate?(new persianDate).parse(s.options.selectedDate):s.now(),null!=i.selectableYears&&-1==i.selectableYears._indexOf(s._persianDate.year)&&(s._persianDate.year=i.selectableYears[0]),-1==s.options.selectableMonths._indexOf(s._persianDate.month)&&(s._persianDate.month=i.selectableMonths[0]),s.persianDate=s._persianDate,s._id="pdp-"+Math.round(1e7*Math.random()),s.persianDate.formatDate=i.formatDate,s.calendar=t('<div id="'+s._id+'" class="pdp-'+i.theme+'" />'),null!=s.options.startDate){s.options.selectableYears=[];for(var r=s.persianDate.parse(s.options.startDate).year;r<=s.persianDate.parse(s.options.endDate).year;r++)s.options.selectableYears.push(r)}(n.attr("pdp-id")||"").length||n.attr("pdp-id",s._id),n.addClass("pdp-el").on("click",function(t){s.show(t)}).on("focus",function(t){s.show(t)}),i.closeOnBlur&&n.on("blur",function(t){s.calendar.is(":hover")||s.hide(t)}),i.selectedBefore&&(null!=s.options.selectedDate?s.showDate(n,s.persianDate.parse(s.options.selectedDate).toString("YYYY/MM/DD/"+s.jDateFunctions.getWeekday(s.persianDate.parse(s.options.selectedDate)),s.now().gDate,i.showGregorianDate)):s.showDate(n,s.now().toString("YYYY/MM/DD/"+s.jDateFunctions.getWeekday(s.now())),s.now().gDate,i.showGregorianDate)),i.isRTL&&n.addClass("rtl"),s.calendar.length&&!i.alwaysShow&&s.calendar.hide(),t(document).bind("mouseup",function(e){var a=e.target,o=s.calendar;n.is(a)||o.is(a)||0!==o.has(a).length||!o.is(":visible")||s.hide();var r=t(".pdp-"+i.theme+" .yearSelect");r.is(e.target)||0!==r.has(e.target).length||r.hide(),(r=t(".pdp-"+i.theme+" .monthSelect")).is(e.target)||0!==r.has(e.target).length||r.hide()});var d=function(){var t=n.offset();s.calendar.css({top:t.top+n.outerHeight()+i.calendarPosition.y+"px",left:t.left+i.calendarPosition.x+"px"})};s.onresize=d,t(window).resize(d),t("body").append(s.calendar),s.render(),d()}return e.prototype={show:function(){this.calendar.show(),t.each(t(".pdp-el").not(this.el),function(t,e){e.length&&e.options.onHide(e.calendar)}),this.options.onShow(this.calendar),this.onresize()},hide:function(){this.options.onHide(this.calendar),this.options&&!this.options.alwaysShow&&this.calendar.hide()},render:function(){this.calendar.children().remove(),this.header(),this.dows(),this.content(),this.footer(),this.options.onRender()},header:function(){var e=this;_monthYear=t('<div class="" />'),_monthYear.appendTo(this.calendar),_head=t('<div class="pdp-header" '+e.headerStyle+" />"),_head.appendTo(this.calendar),_next=t('<div class="nextArrow" />').html(this.options.nextArrow).attr("title","ماه بعد"),null==e.options.endDate||e.persianDate.parse(e.options.endDate).year>e.persianDate.year||e.persianDate.parse(e.options.endDate).month>e.persianDate.month?(_next.bind("click",function(){for(nextMonth=e.persianDate.month+1;-1==e.options.selectableMonths._indexOf(nextMonth)&&nextMonth<13;nextMonth++);e.persianDate.addMonth(nextMonth-e.persianDate.month),e.render()}),_next.removeClass("disabled")):_next.addClass("disabled"),_next.appendTo(_head);var s=t('<ul class="monthSelect" '+e.selectUlStyle+" />").hide(),n=t('<ul class="yearSelect" '+e.selectUlStyle+" />").hide(),o=t("<span/>").html(e.options.months[e.persianDate.month-1]).mousedown(function(){return!1}).click(function(t){t.stopPropagation(),n.css({display:"none"}),s.css({display:"inline-block"})}),r=t("<span/>").html(e.options.persianNumbers?e.jDateFunctions.toPersianNums(e.persianDate.year):e.persianDate.year).mousedown(function(){return!1}).click(function(t){t.stopPropagation(),s.css({display:"none"}),n.css({display:"inline-block"}),n.scrollTop(70)});_startDate=null!=e.options.startDate?e.persianDate.parse(e.options.startDate):e.persianDate.parse("1/1/1"),_endDate=null!=e.options.endDate?e.persianDate.parse(e.options.endDate):e.persianDate.parse("9999/1/1");var d=function(s,o){var r=!1;void 0===s&&void 0===o?(b=e.persianDate.year-7,a=e.persianDate.year+14):0==o?(b=s-6,a=s,r=!0):0==s&&(b=o+1,a=b+6);var d=[];for(i=b;i<a&&b>0;i++)d.push(parseInt(i));t.each(e.options.selectableYears||(r?d.reverse():d),function(a,s){var i=t("<li "+e.selectYearLiStyle+" />").html(e.options.persianNumbers?e.jDateFunctions.toPersianNums(s):s);s==e.persianDate.year&&i.addClass("selected"),i.attr("value",s),i.bind("click",function(){e.persianDate.date=1,e.persianDate.year=parseInt(s),_endDate.year!=s&&9999!=_endDate.year||(e.persianDate.month=_endDate.month),_startDate.year!=s&&9999!=_startDate.year||(e.persianDate.month=_startDate.month),e.render()}),r?n.prepend(i):n.append(i)})};for(d(),i=1;i<=12;i++){var l=e.options.months[i-1],h=-1==e.options.selectableMonths._indexOf(i)||_startDate.year==e.persianDate.year&&_startDate.month>i||_endDate.year==e.persianDate.year&&i>_endDate.month?t('<li class="disableMonth" '+e.selectMonthLiStyle+" />").html(l):t("<li "+e.selectMonthLiStyle+" />").html(l);i==e.persianDate.month&&h.addClass("selected"),h.data("month",{month:l,monthNum:i}),h.hasClass("disableMonth")||h.bind("click",function(){e.persianDate.date=1,e.persianDate.month=t(this).data("month").monthNum,e.render()}),s.append(h)}n.bind("scroll",function(){null==e.options.selectableYears&&(c=t(this).find("li").length,firstYear=parseInt(t(this).children("li:first").val()),lastYear=parseInt(t(this).children("li:last").val()),lisHeight=c/3*(t(this).find("li:first").height()+4),_com=500*t(this).scrollTop().toString().length,t(this).scrollTop()<100*_com.toString().length&&firstYear>=1&&d(firstYear,0),_com=100*t(this).scrollTop().toString().length,lisHeight-t(this).scrollTop()>-_com&&lisHeight-t(this).scrollTop()<_com&&(d(0,lastYear),t(this).scrollTop(t(this).scrollTop()-50)),t(this).scrollTop()<_com.toString().length&&firstYear>=30&&t(this).scrollTop(100*_com.toString().length))}),_monthYear.append(s).append(n);var p=t('<div class="monthYear" />').append(o).append("<span> </span>").append(r);_head.append(p),_prev=t('<div class="prevArrow" />').html(this.options.prevArrow).attr("title","ماه قبل"),null==e.options.startDate||e.persianDate.parse(e.options.startDate).year<e.persianDate.year||e.persianDate.parse(e.options.startDate).month<e.persianDate.month?(_prev.bind("click",function(){e.persianDate.addMonth(-1),e.render()}),_prev.removeClass("disabled")):_prev.addClass("disabled"),_prev.appendTo(_head)},dows:function(){for(_row=t('<div class="dows" />'),i=0;i<7;i++)_cell=t('<div class="dow cell " '+this.cellStyle+" />").html(this.options.shortDowTitle[i]),_cell.appendTo(_row);_row.appendTo(this.calendar)},content:function(){var e=this;_days=t('<div class="days" />'),_days.appendTo(this.calendar),jd=e.persianDate,jd.date=1,_start=e.jDateFunctions.getWeekday(e.persianDate),_end=e.jDateFunctions.getLastDayOfMonth(e.persianDate);for(var a=0,s=0;a<6;a++){_row=t("<div />");for(var n=0;n<7;n++,s++)s<_start||s-_start+1>_end?_cell=t('<div class="nul cell " '+e.cellStyle+" />").html(" "):(_dt=e.getDate(e.persianDate,s-_start+1),_today="",_selday="",_disday="",0==e.now().compare(_dt)&&(_today="today"),null==e.options.startDate||-1!=e.persianDate.parse(e.options.startDate).compare(_dt)&&1!=e.persianDate.parse(e.options.endDate).compare(_dt)||(_disday="disday"),null!=e.options.selectedDate?e.persianDate.parse(e.options.selectedDate).date==s-_start+1&&(_selday="selday"):s-_start+1==e.now().date&&(_selday="selday"),_fri=6==n?"friday":"",_cell=t('<div class="day cell '+_fri+" "+_today+" "+_selday+" "+_disday+'" '+e.cellStyle+" />"),_cell.attr("data-jdate",_dt.toString("YYYY/MM/DD")),_cell.attr("data-gdate",e.jDateFunctions.getGDate(_dt)._toString("YYYY/MM/DD")),_cell.html(e.options.persianNumbers?e.jDateFunctions.toPersianNums(s-_start+1):s-_start+1),(null==e.options.startDate||-1!=e.persianDate.parse(e.options.startDate).compare(_dt)&&1!=e.persianDate.parse(e.options.endDate).compare(_dt))&&_cell.bind("click",function(){e.calendar.find(".day").removeClass("selday"),t(this).addClass("selday"),e.options.showGregorianDate?e.showDate(e.el,t(this).data("jdate"),t(this).data("gdate"),!0):e.showDate(e.el,t(this).data("jdate"),t(this).data("gdate"),!1),e.hide()})),_cell.appendTo(_row);_row.appendTo(_days)}},footer:function(){var e=this;_footer=t('<div class="pdp-footer" '+e.footerStyle+" />"),_footer.appendTo(this.calendar),e.options.selectableMonths._indexOf(e.persianDate.month)>-1&&(_goToday=t('<a class="goToday" />'),_goToday.attr("data-jdate",e.now().toString("YYYY/MM/DD/DW")),_goToday.attr("data-gdate",e.jDateFunctions.getGDate(e.now())),_goToday.attr("href","javascript:;").html("هم اکنون"),null==e.options.startDate&&_goToday.bind("click",function(){e.persianDate=e.now(),e.showDate(e.el,t(this).data("jdate"),t(this).data("gdate"),e.options.showGregorianDate),e.calendar.find(".day").removeClass("selday"),e.render(),e.calendar.find(".today").addClass("selday"),e.hide()}),_goToday.appendTo(_footer))},showDate:function(t,e,a,s){e=this.persianDate.parse(e).toString(this.options.formatDate),a=new Date(a)._toString(this.options.formatDate),t.is("input:text")?s?t.val(a):t.val(e):s?t.html(a):t.html(e),t.attr("data-jDate",e),t.attr("data-gDate",a),this.options.onSelect()},getDate:function(t,e){return t.date=e,t.day=this.jDateFunctions.getWeekday(t),t},now:function(){return this.jDateFunctions.gregorian_to_jalali(new Date)}},e}();Number.prototype.padLeft=function(t,e){var a=String(t||10).length-String(this).length+1;return a>0?new Array(a).join(e||"0")+this:this},Date.prototype._toString=function(t){return months=["Januray","February","March","April","May","June","Julay","August","September","October","November","December"],dows=["Sun","Mon","Tue","Wed","Tur","Fri","Sat"],void 0===t||"default"==t?this.toLocaleDateString():t.replace("YYYY",this.getFullYear()).replace("MM",this.getMonth()+1).replace("DD",this.getDate()).replace("0M",this.getMonth()+1>9?this.getMonth()+1:"0"+(this.getMonth()+1)).replace("0D",this.getDate()>9?this.getDate():"0"+this.getDate()).replace("hh",0==this.getHours()?(new Date).getHours():this.getHours()).replace("mm",0==this.getMinutes()?(new Date).getMinutes():this.getMinutes()).replace("ss",0==this.getSeconds()?(new Date).getSeconds():this.getSeconds()).replace("0h",this.getHours()>9?this.getHours():"0"+this.getHours()).replace("0m",this.getMinutes()>9?this.getMinutes():"0"+this.getMinutes()).replace("0s",this.getSeconds()>9?this.getSeconds():"0"+this.getSeconds()).replace("ms",0==this.getMilliseconds()?(new Date).getMilliseconds():this.getMilliseconds()).replace("tm",this.getHours()>=12&&this.getMinutes()>0?"PM":"AM").replace("NM",months[this.getMonth()]).replace("DW",this.getDay()).replace("ND",dows[this.getDay()])},Array.prototype._indexOf=function(e){return t.inArray(e,this)}}(jQuery);var persianDate=function(){function t(){this.months=["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],this.dowTitle=["شنبه","یکشنبه","دوشنبه","سه شنبه","چهارشنبه","پنج شنبه","جمعه"],this.year=1300,this.month=1,this.date=1,this.day=1,this.gDate=new Date}return t.prototype={now:function(){return(new jDateFunctions).gregorian_to_jalali(new Date)},addDay:function(e){for(var a=new jDateFunctions,s=e>0?e:-e,n=0;n<s;n++){var i=new t;i.month=this.month,i.year=this.year,i=i.addMonth(-1);var o=e>0?a.getLastDayOfMonth(this):a.getLastDayOfMonth(i);e>0?this.date+=1:this.date-=1,e>0?this.date>o&&(this.date=1,this.addMonth(1)):e<0&&(this.month>1&&this.date>o?(this.date=1,this.addMonth(1)):0==this.date&&(this.addMonth(-1),this.date=o))}return this},addMonth:function(t){for(var e=t>0?t:-t,a=0;a<e;a++)t>0?this.month+=1:this.month-=1,13==this.month?(this.month=1,this.addYear(1)):0==this.month&&(this.month=12,this.addYear(-1));return this},addYear:function(t){return this.year+=t,this},compare:function(t){return t.year==this.year&&t.month==this.month&&t.date==this.date?0:t.year>this.year?1:t.year==this.year&&t.month>this.month?1:t.year==this.year&&t.month==this.month&&t.date>this.date?1:-1},parse:function(e){arr=e.split("/"),y=arr[0],m=arr[1],d=arr[2];var a=new t;return jdf=new jDateFunctions,a.year=parseInt(y),a.month=parseInt(m),a.date=parseInt(d),a.day=jdf.getWeekday(a),a.gDate=jdf.jalali_to_gregorian(a),a},toString:function(t){return void 0===t?this.year+"/"+this.month+"/"+this.date:t.replace("YYYY",this.year).replace("MM",this.month).replace("DD",this.date).replace("0M",this.month>9?this.month:"0"+this.month.toString()).replace("0D",this.date>9?this.date:"0"+this.date.toString()).replace("hh",this.gDate.getHours()).replace("mm",this.gDate.getMinutes()).replace("ss",this.gDate.getSeconds()).replace("0h",this.gDate.getHours()>9?this.gDate.getHours():"0"+this.gDate.getHours()).replace("0m",this.gDate.getMinutes()>9?this.gDate.getMinutes():"0"+this.gDate.getMinutes()).replace("0s",this.gDate.getSeconds()>9?this.gDate.getSeconds():"0"+this.gDate.getSeconds()).replace("tm",this.gDate.getHours()>=12&&this.gDate.getMinutes()>0?"ب.ظ":"ق.ظ").replace("ms",this.gDate.getMilliseconds()).replace("NM",this.months[this.month-1]).replace("DW",this.day).replace("ND",this.dowTitle[this.day])}},t}(),jDateFunctions=function(){function t(){}return t.prototype={toPersianNums:function(t){for(strnum=t.toString(),nums=["۰","۱","۲","۳","۴","۵","۶","۷","۸","۹"],res="",i=0;i<strnum.length;i++)res+=nums[parseInt(strnum[i])];return res},gregorian_to_jalali:function(t){return gy=t.getFullYear(),gm=t.getMonth()+1,gd=t.getDate(),g_d_m=[0,31,59,90,120,151,181,212,243,273,304,334],gy>1600?(jy=979,gy-=1600):(jy=0,gy-=621),gy2=gm>2?gy+1:gy,days=365*gy+parseInt((gy2+3)/4)-parseInt((gy2+99)/100)+parseInt((gy2+399)/400)-80+gd+g_d_m[gm-1],jy+=33*parseInt(days/12053),days%=12053,jy+=4*parseInt(days/1461),days%=1461,days>365&&(jy+=parseInt((days-1)/365),days=(days-1)%365),jm=days<186?1+parseInt(days/31):7+parseInt((days-186)/30),jd=1+(days<186?days%31:(days-186)%30),t=new Date,pd=new persianDate,pd.year=jy,pd.month=jm,pd.date=jd,pd.gDate=t,pd},jalali_to_gregorian:function(t){for(jy=t.year,jm=t.month,jd=t.date,jy>979?(gy=1600,jy-=979):gy=621,days=365*jy+8*parseInt(jy/33)+parseInt((jy%33+3)/4)+78+jd+(jm<7?31*(jm-1):30*(jm-7)+186),gy+=400*parseInt(days/146097),days%=146097,days>36524&&(gy+=100*parseInt(--days/36524),days%=36524,days>=365&&days++),gy+=4*parseInt(days/1461),days%=1461,days>365&&(gy+=parseInt((days-1)/365),days=(days-1)%365),gd=days+1,sal_a=[0,31,gy%4==0&&gy%100!=0||gy%400==0?29:28,31,30,31,30,31,31,30,31,30,31],gm=0;gm<13&&(v=sal_a[gm],!(gd<=v));gm++)gd-=v;return dt=new Date,new Date(gy,gm-1,gd,dt.getHours(),dt.getMinutes(),dt.getSeconds(),dt.getMilliseconds())},getGDate:function(t){return this.jalali_to_gregorian(t)},getWeekday:function(t){return[1,2,3,4,5,6,0][this.jalali_to_gregorian(t).getDay()]},getLastDayOfMonth:function(t){return y=t.year,m=t.month,m>=1&&m<=6?31:m>=7&&m<12?30:this.isLeapYear(y)?30:29},isLeapYear:function(t){return b=t%33,(t>1342?[1,5,9,13,17,22,26,30]:[1,5,9,13,17,21,26,30])._indexOf(b)>-1}},t}();
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Генерация страницы: 0.01 |
proxy
|
phpinfo
|
Настройка