mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
3 lines
44 KiB
JavaScript
3 lines
44 KiB
JavaScript
!function(e){"function"==typeof define&&define.amd?define(["jquery","jquery-mousewheel"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){"use strict";function t(e,t,a){this.date=e,this.desc=t,this.style=a}var a={i18n:{ar:{months:["كانون الثاني","شباط","آذار","نيسان","مايو","حزيران","تموز","آب","أيلول","تشرين الأول","تشرين الثاني","كانون الأول"],dayOfWeekShort:["ن","ث","ع","خ","ج","س","ح"],dayOfWeek:["الأحد","الاثنين","الثلاثاء","الأربعاء","الخميس","الجمعة","السبت","الأحد"]},ro:{months:["Ianuarie","Februarie","Martie","Aprilie","Mai","Iunie","Iulie","August","Septembrie","Octombrie","Noiembrie","Decembrie"],dayOfWeekShort:["Du","Lu","Ma","Mi","Jo","Vi","Sâ"],dayOfWeek:["Duminică","Luni","Marţi","Miercuri","Joi","Vineri","Sâmbătă"]},id:{months:["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"],dayOfWeekShort:["Min","Sen","Sel","Rab","Kam","Jum","Sab"],dayOfWeek:["Minggu","Senin","Selasa","Rabu","Kamis","Jumat","Sabtu"]},is:{months:["Janúar","Febrúar","Mars","Apríl","Maí","Júní","Júlí","Ágúst","September","Október","Nóvember","Desember"],dayOfWeekShort:["Sun","Mán","Þrið","Mið","Fim","Fös","Lau"],dayOfWeek:["Sunnudagur","Mánudagur","Þriðjudagur","Miðvikudagur","Fimmtudagur","Föstudagur","Laugardagur"]},bg:{months:["Януари","Февруари","Март","Април","Май","Юни","Юли","Август","Септември","Октомври","Ноември","Декември"],dayOfWeekShort:["Нд","Пн","Вт","Ср","Чт","Пт","Сб"],dayOfWeek:["Неделя","Понеделник","Вторник","Сряда","Четвъртък","Петък","Събота"]},fa:{months:["فروردین","اردیبهشت","خرداد","تیر","مرداد","شهریور","مهر","آبان","آذر","دی","بهمن","اسفند"],dayOfWeekShort:["یکشنبه","دوشنبه","سه شنبه","چهارشنبه","پنجشنبه","جمعه","شنبه"],dayOfWeek:["یکشنبه","دوشنبه","سهشنبه","چهارشنبه","پنجشنبه","جمعه","شنبه","یکشنبه"]},ru:{months:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],dayOfWeekShort:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"],dayOfWeek:["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"]},uk:{months:["Січень","Лютий","Березень","Квітень","Травень","Червень","Липень","Серпень","Вересень","Жовтень","Листопад","Грудень"],dayOfWeekShort:["Ндл","Пнд","Втр","Срд","Чтв","Птн","Сбт"],dayOfWeek:["Неділя","Понеділок","Вівторок","Середа","Четвер","П'ятниця","Субота"]},en:{months:["January","February","March","April","May","June","July","August","September","October","November","December"],dayOfWeekShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},el:{months:["Ιανουάριος","Φεβρουάριος","Μάρτιος","Απρίλιος","Μάιος","Ιούνιος","Ιούλιος","Αύγουστος","Σεπτέμβριος","Οκτώβριος","Νοέμβριος","Δεκέμβριος"],dayOfWeekShort:["Κυρ","Δευ","Τρι","Τετ","Πεμ","Παρ","Σαβ"],dayOfWeek:["Κυριακή","Δευτέρα","Τρίτη","Τετάρτη","Πέμπτη","Παρασκευή","Σάββατο"]},de:{months:["Januar","Februar","März","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],dayOfWeekShort:["So","Mo","Di","Mi","Do","Fr","Sa"],dayOfWeek:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"]},nl:{months:["januari","februari","maart","april","mei","juni","juli","augustus","september","oktober","november","december"],dayOfWeekShort:["zo","ma","di","wo","do","vr","za"],dayOfWeek:["zondag","maandag","dinsdag","woensdag","donderdag","vrijdag","zaterdag"]},tr:{months:["Ocak","Şubat","Mart","Nisan","Mayıs","Haziran","Temmuz","Ağustos","Eylül","Ekim","Kasım","Aralık"],dayOfWeekShort:["Paz","Pts","Sal","Çar","Per","Cum","Cts"],dayOfWeek:["Pazar","Pazartesi","Salı","Çarşamba","Perşembe","Cuma","Cumartesi"]},fr:{months:["Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre"],dayOfWeekShort:["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"],dayOfWeek:["dimanche","lundi","mardi","mercredi","jeudi","vendredi","samedi"]},es:{months:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],dayOfWeekShort:["Dom","Lun","Mar","Mié","Jue","Vie","Sáb"],dayOfWeek:["Domingo","Lunes","Martes","Miércoles","Jueves","Viernes","Sábado"]},th:{months:["มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"],dayOfWeekShort:["อา.","จ.","อ.","พ.","พฤ.","ศ.","ส."],dayOfWeek:["อาทิตย์","จันทร์","อังคาร","พุธ","พฤหัส","ศุกร์","เสาร์","อาทิตย์"]},pl:{months:["styczeń","luty","marzec","kwiecień","maj","czerwiec","lipiec","sierpień","wrzesień","październik","listopad","grudzień"],dayOfWeekShort:["nd","pn","wt","śr","cz","pt","sb"],dayOfWeek:["niedziela","poniedziałek","wtorek","środa","czwartek","piątek","sobota"]},pt:{months:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],dayOfWeekShort:["Dom","Seg","Ter","Qua","Qui","Sex","Sab"],dayOfWeek:["Domingo","Segunda","Terça","Quarta","Quinta","Sexta","Sábado"]},ch:{months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],dayOfWeekShort:["日","一","二","三","四","五","六"]},se:{months:["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"],dayOfWeekShort:["Sön","Mån","Tis","Ons","Tor","Fre","Lör"]},kr:{months:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],dayOfWeekShort:["일","월","화","수","목","금","토"],dayOfWeek:["일요일","월요일","화요일","수요일","목요일","금요일","토요일"]},it:{months:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"],dayOfWeekShort:["Dom","Lun","Mar","Mer","Gio","Ven","Sab"],dayOfWeek:["Domenica","Lunedì","Martedì","Mercoledì","Giovedì","Venerdì","Sabato"]},da:{months:["January","Februar","Marts","April","Maj","Juni","July","August","September","Oktober","November","December"],dayOfWeekShort:["Søn","Man","Tir","Ons","Tor","Fre","Lør"],dayOfWeek:["søndag","mandag","tirsdag","onsdag","torsdag","fredag","lørdag"]},no:{months:["Januar","Februar","Mars","April","Mai","Juni","Juli","August","September","Oktober","November","Desember"],dayOfWeekShort:["Søn","Man","Tir","Ons","Tor","Fre","Lør"],dayOfWeek:["Søndag","Mandag","Tirsdag","Onsdag","Torsdag","Fredag","Lørdag"]},ja:{months:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],dayOfWeekShort:["日","月","火","水","木","金","土"],dayOfWeek:["日曜","月曜","火曜","水曜","木曜","金曜","土曜"]},vi:{months:["Tháng 1","Tháng 2","Tháng 3","Tháng 4","Tháng 5","Tháng 6","Tháng 7","Tháng 8","Tháng 9","Tháng 10","Tháng 11","Tháng 12"],dayOfWeekShort:["CN","T2","T3","T4","T5","T6","T7"],dayOfWeek:["Chủ nhật","Thứ hai","Thứ ba","Thứ tư","Thứ năm","Thứ sáu","Thứ bảy"]},sl:{months:["Januar","Februar","Marec","April","Maj","Junij","Julij","Avgust","September","Oktober","November","December"],dayOfWeekShort:["Ned","Pon","Tor","Sre","Čet","Pet","Sob"],dayOfWeek:["Nedelja","Ponedeljek","Torek","Sreda","Četrtek","Petek","Sobota"]},cs:{months:["Leden","Únor","Březen","Duben","Květen","Červen","Červenec","Srpen","Září","Říjen","Listopad","Prosinec"],dayOfWeekShort:["Ne","Po","Út","St","Čt","Pá","So"]},hu:{months:["Január","Február","Március","Április","Május","Június","Július","Augusztus","Szeptember","Október","November","December"],dayOfWeekShort:["Va","Hé","Ke","Sze","Cs","Pé","Szo"],dayOfWeek:["vasárnap","hétfő","kedd","szerda","csütörtök","péntek","szombat"]},az:{months:["Yanvar","Fevral","Mart","Aprel","May","Iyun","Iyul","Avqust","Sentyabr","Oktyabr","Noyabr","Dekabr"],dayOfWeekShort:["B","Be","Ça","Ç","Ca","C","Ş"],dayOfWeek:["Bazar","Bazar ertəsi","Çərşənbə axşamı","Çərşənbə","Cümə axşamı","Cümə","Şənbə"]},bs:{months:["Januar","Februar","Mart","April","Maj","Jun","Jul","Avgust","Septembar","Oktobar","Novembar","Decembar"],dayOfWeekShort:["Ned","Pon","Uto","Sri","Čet","Pet","Sub"],dayOfWeek:["Nedjelja","Ponedjeljak","Utorak","Srijeda","Četvrtak","Petak","Subota"]},ca:{months:["Gener","Febrer","Març","Abril","Maig","Juny","Juliol","Agost","Setembre","Octubre","Novembre","Desembre"],dayOfWeekShort:["Dg","Dl","Dt","Dc","Dj","Dv","Ds"],dayOfWeek:["Diumenge","Dilluns","Dimarts","Dimecres","Dijous","Divendres","Dissabte"]},"en-GB":{months:["January","February","March","April","May","June","July","August","September","October","November","December"],dayOfWeekShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayOfWeek:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},et:{months:["Jaanuar","Veebruar","Märts","Aprill","Mai","Juuni","Juuli","August","September","Oktoober","November","Detsember"],dayOfWeekShort:["P","E","T","K","N","R","L"],dayOfWeek:["Pühapäev","Esmaspäev","Teisipäev","Kolmapäev","Neljapäev","Reede","Laupäev"]},eu:{months:["Urtarrila","Otsaila","Martxoa","Apirila","Maiatza","Ekaina","Uztaila","Abuztua","Iraila","Urria","Azaroa","Abendua"],dayOfWeekShort:["Ig.","Al.","Ar.","Az.","Og.","Or.","La."],dayOfWeek:["Igandea","Astelehena","Asteartea","Asteazkena","Osteguna","Ostirala","Larunbata"]},fi:{months:["Tammikuu","Helmikuu","Maaliskuu","Huhtikuu","Toukokuu","Kesäkuu","Heinäkuu","Elokuu","Syyskuu","Lokakuu","Marraskuu","Joulukuu"],dayOfWeekShort:["Su","Ma","Ti","Ke","To","Pe","La"],dayOfWeek:["sunnuntai","maanantai","tiistai","keskiviikko","torstai","perjantai","lauantai"]},gl:{months:["Xan","Feb","Maz","Abr","Mai","Xun","Xul","Ago","Set","Out","Nov","Dec"],dayOfWeekShort:["Dom","Lun","Mar","Mer","Xov","Ven","Sab"],dayOfWeek:["Domingo","Luns","Martes","Mércores","Xoves","Venres","Sábado"]},hr:{months:["Siječanj","Veljača","Ožujak","Travanj","Svibanj","Lipanj","Srpanj","Kolovoz","Rujan","Listopad","Studeni","Prosinac"],dayOfWeekShort:["Ned","Pon","Uto","Sri","Čet","Pet","Sub"],dayOfWeek:["Nedjelja","Ponedjeljak","Utorak","Srijeda","Četvrtak","Petak","Subota"]},ko:{months:["1월","2월","3월","4월","5월","6월","7월","8월","9월","10월","11월","12월"],dayOfWeekShort:["일","월","화","수","목","금","토"],dayOfWeek:["일요일","월요일","화요일","수요일","목요일","금요일","토요일"]},lt:{months:["Sausio","Vasario","Kovo","Balandžio","Gegužės","Birželio","Liepos","Rugpjūčio","Rugsėjo","Spalio","Lapkričio","Gruodžio"],dayOfWeekShort:["Sek","Pir","Ant","Tre","Ket","Pen","Šeš"],dayOfWeek:["Sekmadienis","Pirmadienis","Antradienis","Trečiadienis","Ketvirtadienis","Penktadienis","Šeštadienis"]},lv:{months:["Janvāris","Februāris","Marts","Aprīlis ","Maijs","Jūnijs","Jūlijs","Augusts","Septembris","Oktobris","Novembris","Decembris"],dayOfWeekShort:["Sv","Pr","Ot","Tr","Ct","Pk","St"],dayOfWeek:["Svētdiena","Pirmdiena","Otrdiena","Trešdiena","Ceturtdiena","Piektdiena","Sestdiena"]},mk:{months:["јануари","февруари","март","април","мај","јуни","јули","август","септември","октомври","ноември","декември"],dayOfWeekShort:["нед","пон","вто","сре","чет","пет","саб"],dayOfWeek:["Недела","Понеделник","Вторник","Среда","Четврток","Петок","Сабота"]},mn:{months:["1-р сар","2-р сар","3-р сар","4-р сар","5-р сар","6-р сар","7-р сар","8-р сар","9-р сар","10-р сар","11-р сар","12-р сар"],dayOfWeekShort:["Дав","Мяг","Лха","Пүр","Бсн","Бям","Ням"],dayOfWeek:["Даваа","Мягмар","Лхагва","Пүрэв","Баасан","Бямба","Ням"]},"pt-BR":{months:["Janeiro","Fevereiro","Março","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],dayOfWeekShort:["Dom","Seg","Ter","Qua","Qui","Sex","Sáb"],dayOfWeek:["Domingo","Segunda","Terça","Quarta","Quinta","Sexta","Sábado"]},sk:{months:["Január","Február","Marec","Apríl","Máj","Jún","Júl","August","September","Október","November","December"],dayOfWeekShort:["Ne","Po","Ut","St","Št","Pi","So"],dayOfWeek:["Nedeľa","Pondelok","Utorok","Streda","Štvrtok","Piatok","Sobota"]},sq:{months:["Janar","Shkurt","Mars","Prill","Maj","Qershor","Korrik","Gusht","Shtator","Tetor","Nëntor","Dhjetor"],dayOfWeekShort:["Die","Hën","Mar","Mër","Enj","Pre","Shtu"],dayOfWeek:["E Diel","E Hënë","E Martē","E Mërkurë","E Enjte","E Premte","E Shtunë"]},"sr-YU":{months:["Januar","Februar","Mart","April","Maj","Jun","Jul","Avgust","Septembar","Oktobar","Novembar","Decembar"],dayOfWeekShort:["Ned","Pon","Uto","Sre","čet","Pet","Sub"],dayOfWeek:["Nedelja","Ponedeljak","Utorak","Sreda","Četvrtak","Petak","Subota"]},sr:{months:["јануар","фебруар","март","април","мај","јун","јул","август","септембар","октобар","новембар","децембар"],dayOfWeekShort:["нед","пон","уто","сре","чет","пет","суб"],dayOfWeek:["Недеља","Понедељак","Уторак","Среда","Четвртак","Петак","Субота"]},sv:{months:["Januari","Februari","Mars","April","Maj","Juni","Juli","Augusti","September","Oktober","November","December"],dayOfWeekShort:["Sön","Mån","Tis","Ons","Tor","Fre","Lör"],dayOfWeek:["Söndag","Måndag","Tisdag","Onsdag","Torsdag","Fredag","Lördag"]},"zh-TW":{months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],dayOfWeekShort:["日","一","二","三","四","五","六"],dayOfWeek:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},zh:{months:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],dayOfWeekShort:["日","一","二","三","四","五","六"],dayOfWeek:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]},he:{months:["ינואר","פברואר","מרץ","אפריל","מאי","יוני","יולי","אוגוסט","ספטמבר","אוקטובר","נובמבר","דצמבר"],dayOfWeekShort:["א'","ב'","ג'","ד'","ה'","ו'","שבת"],dayOfWeek:["ראשון","שני","שלישי","רביעי","חמישי","שישי","שבת","ראשון"]},hy:{months:["Հունվար","Փետրվար","Մարտ","Ապրիլ","Մայիս","Հունիս","Հուլիս","Օգոստոս","Սեպտեմբեր","Հոկտեմբեր","Նոյեմբեր","Դեկտեմբեր"],dayOfWeekShort:["Կի","Երկ","Երք","Չոր","Հնգ","Ուրբ","Շբթ"],dayOfWeek:["Կիրակի","Երկուշաբթի","Երեքշաբթի","Չորեքշաբթի","Հինգշաբթի","Ուրբաթ","Շաբաթ"]},kg:{months:["Үчтүн айы","Бирдин айы","Жалган Куран","Чын Куран","Бугу","Кулжа","Теке","Баш Оона","Аяк Оона","Тогуздун айы","Жетинин айы","Бештин айы"],dayOfWeekShort:["Жек","Дүй","Шей","Шар","Бей","Жум","Ише"],dayOfWeek:["Жекшемб","Дүйшөмб","Шейшемб","Шаршемб","Бейшемби","Жума","Ишенб"]}},value:"",rtl:!1,format:"Y/m/d H:i",formatTime:"H:i",formatDate:"Y/m/d",startDate:!1,step:60,monthChangeSpinner:!0,closeOnDateSelect:!1,closeOnTimeSelect:!0,closeOnWithoutClick:!0,closeOnInputClick:!0,timepicker:!0,datepicker:!0,weeks:!1,defaultTime:!1,defaultDate:!1,minDate:!1,maxDate:!1,minTime:!1,maxTime:!1,disabledMinTime:!1,disabledMaxTime:!1,allowTimes:[],opened:!1,initTime:!0,inline:!1,theme:"",onSelectDate:function(){},onSelectTime:function(){},onChangeMonth:function(){},onChangeYear:function(){},onChangeDateTime:function(){},onShow:function(){},onClose:function(){},onGenerate:function(){},withoutCopyright:!0,inverseButton:!1,hours12:!1,next:"xdsoft_next",prev:"xdsoft_prev",dayOfWeekStart:0,parentID:"body",timeHeightInTimePicker:25,timepickerScrollbar:!0,todayButton:!0,prevButton:!0,nextButton:!0,defaultSelect:!0,scrollMonth:!0,scrollTime:!0,scrollInput:!0,lazyInit:!1,mask:!1,validateOnBlur:!0,allowBlank:!0,yearStart:1950,yearEnd:2050,monthStart:0,monthEnd:11,style:"",id:"",fixed:!1,roundTime:"round",className:"",weekends:[],highlightedDates:[],highlightedPeriods:[],disabledDates:[],disabledWeekDays:[],yearOffset:0,beforeShowDay:null,enterLikeTab:!0,showApplyButton:!1},r="en",o="en";e.datetimepicker={setLocale:function(e){o=a.i18n[e]?e:r,Date.monthNames=a.i18n[o].months,Date.dayNames=a.i18n[o].dayOfWeek}},window.getComputedStyle||(window.getComputedStyle=function(e){return this.el=e,this.getPropertyValue=function(t){var a=/(\-([a-z]){1})/g;return"float"===t&&(t="styleFloat"),a.test(t)&&(t=t.replace(a,function(e,t,a){return a.toUpperCase()})),e.currentStyle[t]||null},this}),Array.prototype.indexOf||(Array.prototype.indexOf=function(e,t){var a,r;for(a=t||0,r=this.length;r>a;a+=1)if(this[a]===e)return a;return-1}),Date.prototype.countDaysInMonth=function(){return new Date(this.getFullYear(),this.getMonth()+1,0).getDate()},e.fn.xdsoftScroller=function(t){return this.each(function(){var a,r,o,n,i,s=e(this),d=function(e){var t,a={x:0,y:0};return"touchstart"===e.type||"touchmove"===e.type||"touchend"===e.type||"touchcancel"===e.type?(t=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0],a.x=t.clientX,a.y=t.clientY):("mousedown"===e.type||"mouseup"===e.type||"mousemove"===e.type||"mouseover"===e.type||"mouseout"===e.type||"mouseenter"===e.type||"mouseleave"===e.type)&&(a.x=e.clientX,a.y=e.clientY),a},u=100,l=!1,f=0,m=0,c=0,h=!1,g=0,p=function(){};return"hide"===t?void s.find(".xdsoft_scrollbar").hide():(e(this).hasClass("xdsoft_scroller_box")||(a=s.children().eq(0),r=s[0].clientHeight,o=a[0].offsetHeight,n=e('<div class="xdsoft_scrollbar"></div>'),i=e('<div class="xdsoft_scroller"></div>'),n.append(i),s.addClass("xdsoft_scroller_box").append(n),p=function(e){var t=d(e).y-f+g;0>t&&(t=0),t+i[0].offsetHeight>c&&(t=c-i[0].offsetHeight),s.trigger("scroll_element.xdsoft_scroller",[u?t/u:0])},i.on("touchstart.xdsoft_scroller mousedown.xdsoft_scroller",function(a){r||s.trigger("resize_scroll.xdsoft_scroller",[t]),f=d(a).y,g=parseInt(i.css("margin-top"),10),c=n[0].offsetHeight,"mousedown"===a.type?(document&&e(document.body).addClass("xdsoft_noselect"),e([document.body,window]).on("mouseup.xdsoft_scroller",function o(){e([document.body,window]).off("mouseup.xdsoft_scroller",o).off("mousemove.xdsoft_scroller",p).removeClass("xdsoft_noselect")}),e(document.body).on("mousemove.xdsoft_scroller",p)):(h=!0,a.stopPropagation(),a.preventDefault())}).on("touchmove",function(e){h&&(e.preventDefault(),p(e))}).on("touchend touchcancel",function(){h=!1,g=0}),s.on("scroll_element.xdsoft_scroller",function(e,t){r||s.trigger("resize_scroll.xdsoft_scroller",[t,!0]),t=t>1?1:0>t||isNaN(t)?0:t,i.css("margin-top",u*t),setTimeout(function(){a.css("marginTop",-parseInt((a[0].offsetHeight-r)*t,10))},10)}).on("resize_scroll.xdsoft_scroller",function(e,t,d){var l,f;r=s[0].clientHeight,o=a[0].offsetHeight,l=r/o,f=l*n[0].offsetHeight,l>1?i.hide():(i.show(),i.css("height",parseInt(f>10?f:10,10)),u=n[0].offsetHeight-i[0].offsetHeight,d!==!0&&s.trigger("scroll_element.xdsoft_scroller",[t||Math.abs(parseInt(a.css("marginTop"),10))/(o-r)]))}),s.on("mousewheel",function(e){var t=Math.abs(parseInt(a.css("marginTop"),10));return t-=20*e.deltaY,0>t&&(t=0),s.trigger("scroll_element.xdsoft_scroller",[t/(o-r)]),e.stopPropagation(),!1}),s.on("touchstart",function(e){l=d(e),m=Math.abs(parseInt(a.css("marginTop"),10))}),s.on("touchmove",function(e){if(l){e.preventDefault();var t=d(e);s.trigger("scroll_element.xdsoft_scroller",[(m-(t.y-l.y))/(o-r)])}}),s.on("touchend touchcancel",function(){l=!1,m=0})),void s.trigger("resize_scroll.xdsoft_scroller",[t]))})},e.fn.datetimepicker=function(r){var n,i,s=48,d=57,u=96,l=105,f=17,m=46,c=13,h=27,g=8,p=37,k=38,y=39,x=40,b=9,v=116,T=65,D=67,S=86,O=90,w=89,M=!1,_=e.isPlainObject(r)||!r?e.extend(!0,{},a,r):e.extend(!0,{},a),W=0,F=function(e){e.on("open.xdsoft focusin.xdsoft mousedown.xdsoft",function t(){e.is(":disabled")||e.data("xdsoft_datetimepicker")||(clearTimeout(W),W=setTimeout(function(){e.data("xdsoft_datetimepicker")||n(e),e.off("open.xdsoft focusin.xdsoft mousedown.xdsoft",t).trigger("open.xdsoft")},100))})};return n=function(a){function n(){var e,t=!1;return _.startDate?t=P.strToDate(_.startDate):(t=_.value||(a&&a.val&&a.val()?a.val():""),t?t=P.strToDateTime(t):_.defaultDate&&(t=P.strToDateTime(_.defaultDate),_.defaultTime&&(e=P.strtotime(_.defaultTime),t.setHours(e.getHours()),t.setMinutes(e.getMinutes())))),t&&P.isValidDate(t)?J.data("changed",!0):t="",t||0}var i,W,F,C,A,P,J=e('<div class="xdsoft_datetimepicker xdsoft_noselect"></div>'),j=e('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'),z=e('<div class="xdsoft_datepicker active"></div>'),N=e('<div class="xdsoft_mounthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button><div class="xdsoft_label xdsoft_month"><span></span><i></i></div><div class="xdsoft_label xdsoft_year"><span></span><i></i></div><button type="button" class="xdsoft_next"></button></div>'),H=e('<div class="xdsoft_calendar"></div>'),I=e('<div class="xdsoft_timepicker active"><button type="button" class="xdsoft_prev"></button><div class="xdsoft_time_box"></div><button type="button" class="xdsoft_next"></button></div>'),Y=I.find(".xdsoft_time_box").eq(0),L=e('<div class="xdsoft_time_variant"></div>'),V=e('<button type="button" class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'),B=e('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'),E=e('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>'),q=!1,R=0,K=0;_.id&&J.attr("id",_.id),_.style&&J.attr("style",_.style),_.weeks&&J.addClass("xdsoft_showweeks"),_.rtl&&J.addClass("xdsoft_rtl"),J.addClass("xdsoft_"+_.theme),J.addClass(_.className),N.find(".xdsoft_month span").after(B),N.find(".xdsoft_year span").after(E),N.find(".xdsoft_month,.xdsoft_year").on("mousedown.xdsoft",function(t){var a,r,o=e(this).find(".xdsoft_select").eq(0),n=0,i=0,s=o.is(":visible");for(N.find(".xdsoft_select").hide(),P.currentTime&&(n=P.currentTime[e(this).hasClass("xdsoft_month")?"getMonth":"getFullYear"]()),o[s?"hide":"show"](),a=o.find("div.xdsoft_option"),r=0;r<a.length&&a.eq(r).data("value")!==n;r+=1)i+=a[0].offsetHeight;return o.xdsoftScroller(i/(o.children()[0].offsetHeight-o[0].clientHeight)),t.stopPropagation(),!1}),N.find(".xdsoft_select").xdsoftScroller().on("mousedown.xdsoft",function(e){e.stopPropagation(),e.preventDefault()}).on("mousedown.xdsoft",".xdsoft_option",function(){(void 0===P.currentTime||null===P.currentTime)&&(P.currentTime=P.now());var t=P.currentTime.getFullYear();P&&P.currentTime&&P.currentTime[e(this).parent().parent().hasClass("xdsoft_monthselect")?"setMonth":"setFullYear"](e(this).data("value")),e(this).parent().parent().hide(),J.trigger("xchange.xdsoft"),_.onChangeMonth&&e.isFunction(_.onChangeMonth)&&_.onChangeMonth.call(J,P.currentTime,J.data("input")),t!==P.currentTime.getFullYear()&&e.isFunction(_.onChangeYear)&&_.onChangeYear.call(J,P.currentTime,J.data("input"))}),J.setOptions=function(r){var o={},n=function(e){try{if(document.selection&&document.selection.createRange){var t=document.selection.createRange();return t.getBookmark().charCodeAt(2)-2}if(e.setSelectionRange)return e.selectionStart}catch(a){return 0}},i=function(e,t){if(e="string"==typeof e||e instanceof String?document.getElementById(e):e,!e)return!1;if(e.createTextRange){var a=e.createTextRange();return a.collapse(!0),a.moveEnd("character",t),a.moveStart("character",t),a.select(),!0}return e.setSelectionRange?(e.setSelectionRange(t,t),!0):!1},W=function(e,t){var a=e.replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g,"\\$1").replace(/_/g,"{digit+}").replace(/([0-9]{1})/g,"{digit$1}").replace(/\{digit([0-9]{1})\}/g,"[0-$1_]{1}").replace(/\{digit[\+]\}/g,"[0-9_]{1}");return new RegExp(a).test(t)};_=e.extend(!0,{},_,r),r.allowTimes&&e.isArray(r.allowTimes)&&r.allowTimes.length&&(_.allowTimes=e.extend(!0,[],r.allowTimes)),r.weekends&&e.isArray(r.weekends)&&r.weekends.length&&(_.weekends=e.extend(!0,[],r.weekends)),r.highlightedDates&&e.isArray(r.highlightedDates)&&r.highlightedDates.length&&(e.each(r.highlightedDates,function(a,r){var n,i=e.map(r.split(","),e.trim),s=new t(Date.parseDate(i[0],_.formatDate),i[1],i[2]),d=s.date.dateFormat(_.formatDate);void 0!==o[d]?(n=o[d].desc,n&&n.length&&s.desc&&s.desc.length&&(o[d].desc=n+"\n"+s.desc)):o[d]=s}),_.highlightedDates=e.extend(!0,[],o)),r.highlightedPeriods&&e.isArray(r.highlightedPeriods)&&r.highlightedPeriods.length&&(o=e.extend(!0,[],_.highlightedDates),e.each(r.highlightedPeriods,function(a,r){var n,i,s,d,u,l,f;if(e.isArray(r))n=r[0],i=r[1],s=r[2],f=r[3];else{var m=e.map(r.split(","),e.trim);n=Date.parseDate(m[0],_.formatDate),i=Date.parseDate(m[1],_.formatDate),s=m[2],f=m[3]}for(;i>=n;)d=new t(n,s,f),u=n.dateFormat(_.formatDate),n.setDate(n.getDate()+1),void 0!==o[u]?(l=o[u].desc,l&&l.length&&d.desc&&d.desc.length&&(o[u].desc=l+"\n"+d.desc)):o[u]=d}),_.highlightedDates=e.extend(!0,[],o)),r.disabledDates&&e.isArray(r.disabledDates)&&r.disabledDates.length&&(_.disabledDates=e.extend(!0,[],r.disabledDates)),r.disabledWeekDays&&e.isArray(r.disabledWeekDays)&&r.disabledWeekDays.length&&(_.disabledWeekDays=e.extend(!0,[],r.disabledWeekDays)),!_.open&&!_.opened||_.inline||a.trigger("open.xdsoft"),_.inline&&(q=!0,J.addClass("xdsoft_inline"),a.after(J).hide()),_.inverseButton&&(_.next="xdsoft_prev",_.prev="xdsoft_next"),_.datepicker?z.addClass("active"):z.removeClass("active"),_.timepicker?I.addClass("active"):I.removeClass("active"),_.value&&(P.setCurrentTime(_.value),a&&a.val&&a.val(P.str)),_.dayOfWeekStart=isNaN(_.dayOfWeekStart)?0:parseInt(_.dayOfWeekStart,10)%7,_.timepickerScrollbar||Y.xdsoftScroller("hide"),_.minDate&&/^[\+\-](.*)$/.test(_.minDate)&&(_.minDate=P.strToDateTime(_.minDate).dateFormat(_.formatDate)),_.maxDate&&/^[\+\-](.*)$/.test(_.maxDate)&&(_.maxDate=P.strToDateTime(_.maxDate).dateFormat(_.formatDate)),V.toggle(_.showApplyButton),N.find(".xdsoft_today_button").css("visibility",_.todayButton?"visible":"hidden"),N.find("."+_.prev).css("visibility",_.prevButton?"visible":"hidden"),N.find("."+_.next).css("visibility",_.nextButton?"visible":"hidden"),_.mask&&(a.off("keydown.xdsoft"),_.mask===!0&&(_.mask=_.format.replace(/Y/g,"9999").replace(/F/g,"9999").replace(/m/g,"19").replace(/d/g,"39").replace(/H/g,"29").replace(/i/g,"59").replace(/s/g,"59")),"string"===e.type(_.mask)&&(W(_.mask,a.val())||a.val(_.mask.replace(/[0-9]/g,"_")),a.on("keydown.xdsoft",function(t){var r,o,F=this.value,C=t.which;if(C>=s&&d>=C||C>=u&&l>=C||C===g||C===m){for(r=n(this),o=C!==g&&C!==m?String.fromCharCode(C>=u&&l>=C?C-s:C):"_",C!==g&&C!==m||!r||(r-=1,o="_");/[^0-9_]/.test(_.mask.substr(r,1))&&r<_.mask.length&&r>0;)r+=C===g||C===m?-1:1;if(F=F.substr(0,r)+o+F.substr(r+1),""===e.trim(F))F=_.mask.replace(/[0-9]/g,"_");else if(r===_.mask.length)return t.preventDefault(),!1;for(r+=C===g||C===m?0:1;/[^0-9_]/.test(_.mask.substr(r,1))&&r<_.mask.length&&r>0;)r+=C===g||C===m?-1:1;W(_.mask,F)?(this.value=F,i(this,r)):""===e.trim(F)?this.value=_.mask.replace(/[0-9]/g,"_"):a.trigger("error_input.xdsoft")}else if(-1!==[T,D,S,O,w].indexOf(C)&&M||-1!==[h,k,x,p,y,v,f,b,c].indexOf(C))return!0;return t.preventDefault(),!1}))),_.validateOnBlur&&a.off("blur.xdsoft").on("blur.xdsoft",function(){if(_.allowBlank&&!e.trim(e(this).val()).length)e(this).val(null),J.data("xdsoft_datetime").empty();else if(Date.parseDate(e(this).val(),_.format))J.data("xdsoft_datetime").setCurrentTime(e(this).val());else{var t=+[e(this).val()[0],e(this).val()[1]].join(""),a=+[e(this).val()[2],e(this).val()[3]].join("");e(this).val(!_.datepicker&&_.timepicker&&t>=0&&24>t&&a>=0&&60>a?[t,a].map(function(e){return e>9?e:"0"+e}).join(":"):P.now().dateFormat(_.format)),J.data("xdsoft_datetime").setCurrentTime(e(this).val())}J.trigger("changedatetime.xdsoft")}),_.dayOfWeekStartPrev=0===_.dayOfWeekStart?6:_.dayOfWeekStart-1,J.trigger("xchange.xdsoft").trigger("afterOpen.xdsoft")},J.data("options",_).on("mousedown.xdsoft",function(e){return e.stopPropagation(),e.preventDefault(),E.hide(),B.hide(),!1}),Y.append(L),Y.xdsoftScroller(),J.on("afterOpen.xdsoft",function(){Y.xdsoftScroller()}),J.append(z).append(I),_.withoutCopyright!==!0&&J.append(j),z.append(N).append(H).append(V),e(_.parentID).append(J),i=function(){var t=this;t.now=function(e){var a,r,o=new Date;return!e&&_.defaultDate&&(a=t.strToDateTime(_.defaultDate),o.setFullYear(a.getFullYear()),o.setMonth(a.getMonth()),o.setDate(a.getDate())),_.yearOffset&&o.setFullYear(o.getFullYear()+_.yearOffset),!e&&_.defaultTime&&(r=t.strtotime(_.defaultTime),o.setHours(r.getHours()),o.setMinutes(r.getMinutes())),o},t.isValidDate=function(e){return"[object Date]"!==Object.prototype.toString.call(e)?!1:!isNaN(e.getTime())},t.setCurrentTime=function(e){t.currentTime="string"==typeof e?t.strToDateTime(e):t.isValidDate(e)?e:t.now(),J.trigger("xchange.xdsoft")},t.empty=function(){t.currentTime=null},t.getCurrentTime=function(){return t.currentTime},t.nextMonth=function(){(void 0===t.currentTime||null===t.currentTime)&&(t.currentTime=t.now());var a,r=t.currentTime.getMonth()+1;return 12===r&&(t.currentTime.setFullYear(t.currentTime.getFullYear()+1),r=0),a=t.currentTime.getFullYear(),t.currentTime.setDate(Math.min(new Date(t.currentTime.getFullYear(),r+1,0).getDate(),t.currentTime.getDate())),t.currentTime.setMonth(r),_.onChangeMonth&&e.isFunction(_.onChangeMonth)&&_.onChangeMonth.call(J,P.currentTime,J.data("input")),a!==t.currentTime.getFullYear()&&e.isFunction(_.onChangeYear)&&_.onChangeYear.call(J,P.currentTime,J.data("input")),J.trigger("xchange.xdsoft"),r},t.prevMonth=function(){(void 0===t.currentTime||null===t.currentTime)&&(t.currentTime=t.now());var a=t.currentTime.getMonth()-1;return-1===a&&(t.currentTime.setFullYear(t.currentTime.getFullYear()-1),a=11),t.currentTime.setDate(Math.min(new Date(t.currentTime.getFullYear(),a+1,0).getDate(),t.currentTime.getDate())),t.currentTime.setMonth(a),_.onChangeMonth&&e.isFunction(_.onChangeMonth)&&_.onChangeMonth.call(J,P.currentTime,J.data("input")),J.trigger("xchange.xdsoft"),a},t.getWeekOfYear=function(e){var t=new Date(e.getFullYear(),0,1);return Math.ceil(((e-t)/864e5+t.getDay()+1)/7)},t.strToDateTime=function(e){var a,r,o=[];return e&&e instanceof Date&&t.isValidDate(e)?e:(o=/^(\+|\-)(.*)$/.exec(e),o&&(o[2]=Date.parseDate(o[2],_.formatDate)),o&&o[2]?(a=o[2].getTime()-6e4*o[2].getTimezoneOffset(),r=new Date(t.now(!0).getTime()+parseInt(o[1]+"1",10)*a)):r=e?Date.parseDate(e,_.format):t.now(),t.isValidDate(r)||(r=t.now()),r)},t.strToDate=function(e){if(e&&e instanceof Date&&t.isValidDate(e))return e;var a=e?Date.parseDate(e,_.formatDate):t.now(!0);return t.isValidDate(a)||(a=t.now(!0)),a},t.strtotime=function(e){if(e&&e instanceof Date&&t.isValidDate(e))return e;var a=e?Date.parseDate(e,_.formatTime):t.now(!0);return t.isValidDate(a)||(a=t.now(!0)),a},t.str=function(){return t.currentTime.dateFormat(_.format)},t.currentTime=this.now()},P=new i,V.on("click",function(e){e.preventDefault(),J.data("changed",!0),P.setCurrentTime(n()),a.val(P.str()),J.trigger("close.xdsoft")}),N.find(".xdsoft_today_button").on("mousedown.xdsoft",function(){J.data("changed",!0),P.setCurrentTime(0),J.trigger("afterOpen.xdsoft")}).on("dblclick.xdsoft",function(){var e,t,r=P.getCurrentTime();r=new Date(r.getFullYear(),r.getMonth(),r.getDate()),e=P.strToDate(_.minDate),e=new Date(e.getFullYear(),e.getMonth(),e.getDate()),e>r||(t=P.strToDate(_.maxDate),t=new Date(t.getFullYear(),t.getMonth(),t.getDate()),r>t||(a.val(P.str()),a.trigger("change"),J.trigger("close.xdsoft")))}),N.find(".xdsoft_prev,.xdsoft_next").on("mousedown.xdsoft",function(){var t=e(this),a=0,r=!1;!function o(e){t.hasClass(_.next)?P.nextMonth():t.hasClass(_.prev)&&P.prevMonth(),_.monthChangeSpinner&&(r||(a=setTimeout(o,e||100)))}(500),e([document.body,window]).on("mouseup.xdsoft",function n(){clearTimeout(a),r=!0,e([document.body,window]).off("mouseup.xdsoft",n)})}),I.find(".xdsoft_prev,.xdsoft_next").on("mousedown.xdsoft",function(){var t=e(this),a=0,r=!1,o=110;!function n(e){var i=Y[0].clientHeight,s=L[0].offsetHeight,d=Math.abs(parseInt(L.css("marginTop"),10));t.hasClass(_.next)&&s-i-_.timeHeightInTimePicker>=d?L.css("marginTop","-"+(d+_.timeHeightInTimePicker)+"px"):t.hasClass(_.prev)&&d-_.timeHeightInTimePicker>=0&&L.css("marginTop","-"+(d-_.timeHeightInTimePicker)+"px"),Y.trigger("scroll_element.xdsoft_scroller",[Math.abs(parseInt(L.css("marginTop"),10)/(s-i))]),o=o>10?10:o-10,r||(a=setTimeout(n,e||o))}(500),e([document.body,window]).on("mouseup.xdsoft",function i(){clearTimeout(a),r=!0,e([document.body,window]).off("mouseup.xdsoft",i)})}),W=0,J.on("xchange.xdsoft",function(t){clearTimeout(W),W=setTimeout(function(){(void 0===P.currentTime||null===P.currentTime)&&(P.currentTime=P.now());for(var t,a,n,i,s,d,u,l,f,m,c="",h=new Date(P.currentTime.getFullYear(),P.currentTime.getMonth(),1,12,0,0),g=0,p=P.now(),k=!1,y=!1,x=[],b=!0,v="",T="";h.getDay()!==_.dayOfWeekStart;)h.setDate(h.getDate()-1);for(c+="<table><thead><tr>",_.weeks&&(c+="<th></th>"),t=0;7>t;t+=1)c+="<th>"+_.i18n[o].dayOfWeekShort[(t+_.dayOfWeekStart)%7]+"</th>";
|
||
|
||
for(c+="</tr></thead>",c+="<tbody>",_.maxDate!==!1&&(k=P.strToDate(_.maxDate),k=new Date(k.getFullYear(),k.getMonth(),k.getDate(),23,59,59,999)),_.minDate!==!1&&(y=P.strToDate(_.minDate),y=new Date(y.getFullYear(),y.getMonth(),y.getDate()));g<P.currentTime.countDaysInMonth()||h.getDay()!==_.dayOfWeekStart||P.currentTime.getMonth()===h.getMonth();)x=[],g+=1,n=h.getDay(),i=h.getDate(),s=h.getFullYear(),d=h.getMonth(),u=P.getWeekOfYear(h),m="",x.push("xdsoft_date"),l=_.beforeShowDay&&e.isFunction(_.beforeShowDay.call)?_.beforeShowDay.call(J,h):null,k!==!1&&h>k||y!==!1&&y>h||l&&l[0]===!1?x.push("xdsoft_disabled"):-1!==_.disabledDates.indexOf(h.dateFormat(_.formatDate))?x.push("xdsoft_disabled"):-1!==_.disabledWeekDays.indexOf(n)&&x.push("xdsoft_disabled"),l&&""!==l[1]&&x.push(l[1]),P.currentTime.getMonth()!==d&&x.push("xdsoft_other_month"),(_.defaultSelect||J.data("changed"))&&P.currentTime.dateFormat(_.formatDate)===h.dateFormat(_.formatDate)&&x.push("xdsoft_current"),p.dateFormat(_.formatDate)===h.dateFormat(_.formatDate)&&x.push("xdsoft_today"),(0===h.getDay()||6===h.getDay()||-1!==_.weekends.indexOf(h.dateFormat(_.formatDate)))&&x.push("xdsoft_weekend"),void 0!==_.highlightedDates[h.dateFormat(_.formatDate)]&&(a=_.highlightedDates[h.dateFormat(_.formatDate)],x.push(void 0===a.style?"xdsoft_highlighted_default":a.style),m=void 0===a.desc?"":a.desc),_.beforeShowDay&&e.isFunction(_.beforeShowDay)&&x.push(_.beforeShowDay(h)),b&&(c+="<tr>",b=!1,_.weeks&&(c+="<th>"+u+"</th>")),c+='<td data-date="'+i+'" data-month="'+d+'" data-year="'+s+'" class="xdsoft_date xdsoft_day_of_week'+h.getDay()+" "+x.join(" ")+'" title="'+m+'"><div>'+i+"</div></td>",h.getDay()===_.dayOfWeekStartPrev&&(c+="</tr>",b=!0),h.setDate(i+1);if(c+="</tbody></table>",H.html(c),N.find(".xdsoft_label span").eq(0).text(_.i18n[o].months[P.currentTime.getMonth()]),N.find(".xdsoft_label span").eq(1).text(P.currentTime.getFullYear()),v="",T="",d="",f=function(e,t){var a,r,o=P.now();o.setHours(e),e=parseInt(o.getHours(),10),o.setMinutes(t),t=parseInt(o.getMinutes(),10),a=new Date(P.currentTime),a.setHours(e),a.setMinutes(t),x=[],(_.minDateTime!==!1&&_.minDateTime>a||_.maxTime!==!1&&P.strtotime(_.maxTime).getTime()<o.getTime()||_.minTime!==!1&&P.strtotime(_.minTime).getTime()>o.getTime())&&x.push("xdsoft_disabled"),(_.minDateTime!==!1&&_.minDateTime>a||_.disabledMinTime!==!1&&o.getTime()>P.strtotime(_.disabledMinTime).getTime()&&_.disabledMaxTime!==!1&&o.getTime()<P.strtotime(_.disabledMaxTime).getTime())&&x.push("xdsoft_disabled"),r=new Date(P.currentTime),r.setHours(parseInt(P.currentTime.getHours(),10)),r.setMinutes(Math[_.roundTime](P.currentTime.getMinutes()/_.step)*_.step),(_.initTime||_.defaultSelect||J.data("changed"))&&r.getHours()===parseInt(e,10)&&(_.step>59||r.getMinutes()===parseInt(t,10))&&(_.defaultSelect||J.data("changed")?x.push("xdsoft_current"):_.initTime&&x.push("xdsoft_init_time")),parseInt(p.getHours(),10)===parseInt(e,10)&&parseInt(p.getMinutes(),10)===parseInt(t,10)&&x.push("xdsoft_today"),v+='<div class="xdsoft_time '+x.join(" ")+'" data-hour="'+e+'" data-minute="'+t+'">'+o.dateFormat(_.formatTime)+"</div>"},_.allowTimes&&e.isArray(_.allowTimes)&&_.allowTimes.length)for(g=0;g<_.allowTimes.length;g+=1)T=P.strtotime(_.allowTimes[g]).getHours(),d=P.strtotime(_.allowTimes[g]).getMinutes(),f(T,d);else for(g=0,t=0;g<(_.hours12?12:24);g+=1)for(t=0;60>t;t+=_.step)T=(10>g?"0":"")+g,d=(10>t?"0":"")+t,f(T,d);for(L.html(v),r="",g=0,g=parseInt(_.yearStart,10)+_.yearOffset;g<=parseInt(_.yearEnd,10)+_.yearOffset;g+=1)r+='<div class="xdsoft_option '+(P.currentTime.getFullYear()===g?"xdsoft_current":"")+'" data-value="'+g+'">'+g+"</div>";for(E.children().eq(0).html(r),g=parseInt(_.monthStart,10),r="";g<=parseInt(_.monthEnd,10);g+=1)r+='<div class="xdsoft_option '+(P.currentTime.getMonth()===g?"xdsoft_current":"")+'" data-value="'+g+'">'+_.i18n[o].months[g]+"</div>";B.children().eq(0).html(r),e(J).trigger("generate.xdsoft")},10),t.stopPropagation()}).on("afterOpen.xdsoft",function(){if(_.timepicker){var e,t,a,r;L.find(".xdsoft_current").length?e=".xdsoft_current":L.find(".xdsoft_init_time").length&&(e=".xdsoft_init_time"),e?(t=Y[0].clientHeight,a=L[0].offsetHeight,r=L.find(e).index()*_.timeHeightInTimePicker+1,r>a-t&&(r=a-t),Y.trigger("scroll_element.xdsoft_scroller",[parseInt(r,10)/(a-t)])):Y.trigger("scroll_element.xdsoft_scroller",[0])}}),F=0,H.on("click.xdsoft","td",function(t){t.stopPropagation(),F+=1;var r=e(this),o=P.currentTime;return(void 0===o||null===o)&&(P.currentTime=P.now(),o=P.currentTime),r.hasClass("xdsoft_disabled")?!1:(o.setDate(1),o.setFullYear(r.data("year")),o.setMonth(r.data("month")),o.setDate(r.data("date")),J.trigger("select.xdsoft",[o]),a.val(P.str()),_.onSelectDate&&e.isFunction(_.onSelectDate)&&_.onSelectDate.call(J,P.currentTime,J.data("input"),t),J.data("changed",!0),J.trigger("xchange.xdsoft"),J.trigger("changedatetime.xdsoft"),(F>1||_.closeOnDateSelect===!0||_.closeOnDateSelect===!1&&!_.timepicker)&&!_.inline&&J.trigger("close.xdsoft"),void setTimeout(function(){F=0},200))}),L.on("click.xdsoft","div",function(t){t.stopPropagation();var a=e(this),r=P.currentTime;return(void 0===r||null===r)&&(P.currentTime=P.now(),r=P.currentTime),a.hasClass("xdsoft_disabled")?!1:(r.setHours(a.data("hour")),r.setMinutes(a.data("minute")),J.trigger("select.xdsoft",[r]),J.data("input").val(P.str()),_.onSelectTime&&e.isFunction(_.onSelectTime)&&_.onSelectTime.call(J,P.currentTime,J.data("input"),t),J.data("changed",!0),J.trigger("xchange.xdsoft"),J.trigger("changedatetime.xdsoft"),void(_.inline!==!0&&_.closeOnTimeSelect===!0&&J.trigger("close.xdsoft")))}),z.on("mousewheel.xdsoft",function(e){return _.scrollMonth?(e.deltaY<0?P.nextMonth():P.prevMonth(),!1):!0}),a.on("mousewheel.xdsoft",function(e){return _.scrollInput?!_.datepicker&&_.timepicker?(C=L.find(".xdsoft_current").length?L.find(".xdsoft_current").eq(0).index():0,C+e.deltaY>=0&&C+e.deltaY<L.children().length&&(C+=e.deltaY),L.children().eq(C).length&&L.children().eq(C).trigger("mousedown"),!1):_.datepicker&&!_.timepicker?(z.trigger(e,[e.deltaY,e.deltaX,e.deltaY]),a.val&&a.val(P.str()),J.trigger("changedatetime.xdsoft"),!1):void 0:!0}),J.on("changedatetime.xdsoft",function(t){if(_.onChangeDateTime&&e.isFunction(_.onChangeDateTime)){var a=J.data("input");_.onChangeDateTime.call(J,P.currentTime,a,t),delete _.value,a.trigger("change")}}).on("generate.xdsoft",function(){_.onGenerate&&e.isFunction(_.onGenerate)&&_.onGenerate.call(J,P.currentTime,J.data("input")),q&&(J.trigger("afterOpen.xdsoft"),q=!1)}).on("click.xdsoft",function(e){e.stopPropagation()}),C=0,A=function(){var t,a=J.data("input").offset(),r=a.top+J.data("input")[0].offsetHeight-1,o=a.left,n="absolute";"rtl"==J.data("input").parent().css("direction")&&(o-=J.outerWidth()-J.data("input").outerWidth()),_.fixed?(r-=e(window).scrollTop(),o-=e(window).scrollLeft(),n="fixed"):(r+J[0].offsetHeight>e(window).height()+e(window).scrollTop()&&(r=a.top-J[0].offsetHeight+1),0>r&&(r=0),o+J[0].offsetWidth>e(window).width()&&(o=e(window).width()-J[0].offsetWidth)),t=J[0];do if(t=t.parentNode,"relative"===window.getComputedStyle(t).getPropertyValue("position")&&e(window).width()>=t.offsetWidth){o-=(e(window).width()-t.offsetWidth)/2;break}while("HTML"!==t.nodeName);J.css({left:o,top:r,position:n})},J.on("open.xdsoft",function(t){var a=!0;_.onShow&&e.isFunction(_.onShow)&&(a=_.onShow.call(J,P.currentTime,J.data("input"),t)),a!==!1&&(J.show(),A(),e(window).off("resize.xdsoft",A).on("resize.xdsoft",A),_.closeOnWithoutClick&&e([document.body,window]).on("mousedown.xdsoft",function r(){J.trigger("close.xdsoft"),e([document.body,window]).off("mousedown.xdsoft",r)}))}).on("close.xdsoft",function(t){var a=!0;N.find(".xdsoft_month,.xdsoft_year").find(".xdsoft_select").hide(),_.onClose&&e.isFunction(_.onClose)&&(a=_.onClose.call(J,P.currentTime,J.data("input"),t)),a===!1||_.opened||_.inline||J.hide(),t.stopPropagation()}).on("toggle.xdsoft",function(){J.trigger(J.is(":visible")?"close.xdsoft":"open.xdsoft")}).data("input",a),R=0,K=0,J.data("xdsoft_datetime",P),J.setOptions(_),P.setCurrentTime(n()),a.data("xdsoft_datetimepicker",J).on("open.xdsoft focusin.xdsoft mousedown.xdsoft",function(){a.is(":disabled")||a.data("xdsoft_datetimepicker").is(":visible")&&_.closeOnInputClick||(clearTimeout(R),R=setTimeout(function(){a.is(":disabled")||(q=!0,P.setCurrentTime(n()),J.trigger("open.xdsoft"))},100))}).on("keydown.xdsoft",function(t){var a,r=(this.value,t.which);return-1!==[c].indexOf(r)&&_.enterLikeTab?(a=e("input:visible,textarea:visible"),J.trigger("close.xdsoft"),a.eq(a.index(this)+1).focus(),!1):-1!==[b].indexOf(r)?(J.trigger("close.xdsoft"),!0):void 0})},i=function(t){var a=t.data("xdsoft_datetimepicker");a&&(a.data("xdsoft_datetime",null),a.remove(),t.data("xdsoft_datetimepicker",null).off(".xdsoft"),e(window).off("resize.xdsoft"),e([window,document.body]).off("mousedown.xdsoft"),t.unmousewheel&&t.unmousewheel())},e(document).off("keydown.xdsoftctrl keyup.xdsoftctrl").on("keydown.xdsoftctrl",function(e){e.keyCode===f&&(M=!0)}).on("keyup.xdsoftctrl",function(e){e.keyCode===f&&(M=!1)}),this.each(function(){var t,a=e(this).data("xdsoft_datetimepicker");if(a){if("string"===e.type(r))switch(r){case"show":e(this).select().focus(),a.trigger("open.xdsoft");break;case"hide":a.trigger("close.xdsoft");break;case"toggle":a.trigger("toggle.xdsoft");break;case"destroy":i(e(this));break;case"reset":this.value=this.defaultValue,this.value&&a.data("xdsoft_datetime").isValidDate(Date.parseDate(this.value,_.format))||a.data("changed",!1),a.data("xdsoft_datetime").setCurrentTime(this.value);break;case"validate":t=a.data("input"),t.trigger("blur.xdsoft")}else a.setOptions(r);return 0}"string"!==e.type(r)&&(!_.lazyInit||_.open||_.inline?n(e(this)):F(e(this)))})},e.fn.datetimepicker.defaults=a}); |