From 3556014fbafdc17079785e9083141c79480f9180 Mon Sep 17 00:00:00 2001 From: t1m0n Date: Fri, 4 Dec 2015 15:12:10 +0300 Subject: [PATCH] update docs and readme --- README.md | 12 +++++++-- dist/js/datepicker.js | 2 +- dist/js/datepicker.min.js | 2 +- docs/index-ru.html | 27 +++---------------- docs/index.html | 8 +++--- docs/jade/mixins/param.jade | 2 +- docs/jade/pages/index-ru.jade | 49 ++++++++++++++++++++++++++++++++- docs/jade/pages/index.jade | 51 +++++++++++++++++++++++++++++++++-- src/js/datepicker.js | 2 +- 9 files changed, 119 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index ed22ad8..f637aef 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Lightweight cross-browser jQuery datepicker, built with es5 and css-flexbox. Wor ## Install ``` -bower i --save-dev air-datepicker +bower i --save air-datepicker ``` ## Usage @@ -14,4 +14,12 @@ $('.my-datepicker').datepicker([options]) ## Demo and docs * [In English](http://t1m0n.name/air-datepicker/docs/) -* [In Russian](http://t1m0n.name/air-datepicker/docs/index-ru.html) \ No newline at end of file +* [In Russian](http://t1m0n.name/air-datepicker/docs/index-ru.html) + +## Change log + +### v.1.1.0 +* add keyboard navigation +* add `classes` option to add custom classes +* add `altField` option +* bug fixes diff --git a/dist/js/datepicker.js b/dist/js/datepicker.js index e2a5b97..550ff89 100644 --- a/dist/js/datepicker.js +++ b/dist/js/datepicker.js @@ -22,6 +22,7 @@ var Datepicker; altField: '', altFieldDateFormat: '@', toggleSelected: true, + keyboardNav: true, position: 'bottom left', offset: 12, @@ -59,7 +60,6 @@ var Datepicker; months: 'yyyy', years: 'yyyy1 - yyyy2' }, - keyboardNav: true, // events onSelect: '', diff --git a/dist/js/datepicker.min.js b/dist/js/datepicker.min.js index 8f340f0..6b67fb9 100644 --- a/dist/js/datepicker.min.js +++ b/dist/js/datepicker.min.js @@ -1 +1 @@ -var Datepicker;!function(t,e,i){var s,a,n="datepicker",h=".datepicker-here",o=!1,r='
',c={classes:"",inline:!1,language:"ru",startDate:new Date,firstDay:"",weekends:[6,0],dateFormat:"",altField:"",altFieldDateFormat:"@",toggleSelected:!0,position:"bottom left",offset:12,view:"days",minView:"days",showOtherMonths:!0,selectOtherMonths:!0,moveToOtherMonthsOnSelect:!0,showOtherYears:!0,selectOtherYears:!0,moveToOtherYearsOnSelect:!0,minDate:"",maxDate:"",disableNavWhenOutOfRange:!0,multipleDates:!1,multipleDatesSeparator:",",todayButton:!1,clearButton:!1,showEvent:"focus",autoClose:!1,monthsFiled:"monthsShort",prevHtml:'',nextHtml:'',navTitles:{days:"MM, yyyy",months:"yyyy",years:"yyyy1 - yyyy2"},keyboardNav:!0,onSelect:"",onChangeMonth:"",onChangeYear:"",onChangeDecade:"",onChangeView:"",onRenderCell:""},d={ctrlRight:[17,39],ctrlUp:[17,38],ctrlLeft:[17,37],ctrlDown:[17,40],shiftRight:[16,39],shiftUp:[16,38],shiftLeft:[16,37],shiftDown:[16,40],altUp:[18,38],altRight:[18,39],altLeft:[18,37],altDown:[18,40],ctrlShiftUp:[16,17,38]};Datepicker=function(t,a){this.el=t,this.$el=e(t),this.opts=e.extend(!0,{},c,a,this.$el.data()),s==i&&(s=e("body")),this.opts.startDate||(this.opts.startDate=new Date),"INPUT"==this.el.nodeName&&(this.elIsInput=!0),this.opts.altField&&(this.$altField="string"==typeof this.opts.altField?e(this.opts.altField):this.opts.altField),this.inited=!1,this.visible=!1,this.silent=!1,this.currentDate=this.opts.startDate,this.currentView=this.opts.view,this._createShortCuts(),this.selectedDates=[],this.views={},this.keys=[],this.init()},Datepicker.prototype={viewIndexes:["days","months","years"],init:function(){o||this.opts.inline||!this.elIsInput||this._buildDatepickersContainer(),this._buildBaseHtml(),this._defineLocale(this.opts.language),this._syncWithMinMaxDates(),this.elIsInput&&(this.opts.inline||(this._setPositionClasses(this.opts.position),this._bindEvents())),this.opts.classes&&this.$datepicker.addClass(this.opts.classes),this.views[this.currentView]=new Datepicker.Body(this,this.currentView,this.opts),this.views[this.currentView].show(),this.nav=new Datepicker.Navigation(this,this.opts),this.view=this.currentView,this.inited=!0},_createShortCuts:function(){this.minDate=this.opts.minDate?this.opts.minDate:new Date(-86399999136e5),this.maxDate=this.opts.maxDate?this.opts.maxDate:new Date(86399999136e5)},_bindEvents:function(){this.$el.on(this.opts.showEvent,this._onShowEvent.bind(this)),this.$el.on("blur",this._onBlur.bind(this)),this.$el.on("input",this._onInput.bind(this)),this.$datepicker.on("mousedown",this._onMouseDownDatepicker.bind(this)),this.$datepicker.on("mouseup",this._onMouseUpDatepicker.bind(this)),e(t).on("resize",this._onResize.bind(this)),this.opts.keyboardNav&&(this.$el.on("keydown",this._onKeyDown.bind(this)),this.$el.on("keyup",this._onKeyUp.bind(this)),this.$el.on("hotKey",this._onHotKey.bind(this)))},isWeekend:function(t){return-1!==this.opts.weekends.indexOf(t)},_defineLocale:function(t){"string"==typeof t?(this.loc=Datepicker.language[t],this.loc||(console.warn("Can't find language \""+t+'" in Datepicker.language, will use "ru" instead'),this.loc=e.extend(!0,{},Datepicker.language.ru)),this.loc=e.extend(!0,{},Datepicker.language.ru,Datepicker.language[t])):this.loc=e.extend(!0,{},Datepicker.language.ru,t),this.opts.dateFormat&&(this.loc.dateFormat=this.opts.dateFormat),this.opts.firstDay&&(this.loc.firstDay=this.opts.firstDay)},_buildDatepickersContainer:function(){o=!0,s.append('
'),a=e("#datepickers-container")},_buildBaseHtml:function(){var t,i=e('
');t="INPUT"==this.el.nodeName?this.opts.inline?i.insertAfter(this.$el):a:i.appendTo(this.$el),this.$datepicker=e(r).appendTo(t),this.$content=e(".datepicker--content",this.$datepicker),this.$nav=e(".datepicker--nav",this.$datepicker)},_triggerOnChange:function(){if(!this.selectedDates.length)return this.opts.onSelect("","",this);var t,e=this.selectedDates,i=Datepicker.getParsedDate(e[0]),s=this,a=new Date(i.year,i.month,i.date);t=e.map(function(t){return s.formatDate(s.loc.dateFormat,t)}).join(this.opts.multipleDatesSeparator),this.opts.multipleDates&&(a=e.map(function(t){var e=Datepicker.getParsedDate(t);return new Date(e.year,e.month,e.date)})),this.opts.onSelect(t,a,this)},next:function(){var t=this.parsedDate,e=this.opts;switch(this.view){case"days":this.date=new Date(t.year,t.month+1,1),e.onChangeMonth&&e.onChangeMonth(this.parsedDate.month,this.parsedDate.year);break;case"months":this.date=new Date(t.year+1,t.month,1),e.onChangeYear&&e.onChangeYear(this.parsedDate.year);break;case"years":this.date=new Date(t.year+10,0,1),e.onChangeDecade&&e.onChangeDecade(this.curDecade)}},prev:function(){var t=this.parsedDate,e=this.opts;switch(this.view){case"days":this.date=new Date(t.year,t.month-1,1),e.onChangeMonth&&e.onChangeMonth(this.parsedDate.month,this.parsedDate.year);break;case"months":this.date=new Date(t.year-1,t.month,1),e.onChangeYear&&e.onChangeYear(this.parsedDate.year);break;case"years":this.date=new Date(t.year-10,0,1),e.onChangeDecade&&e.onChangeDecade(this.curDecade)}},formatDate:function(t,e){e=e||this.date;var i=t,s=this.loc,a=Datepicker.getDecade(e),n=Datepicker.getParsedDate(e);switch(!0){case/@/.test(i):i=i.replace(/@/,e.getTime());case/dd/.test(i):i=i.replace(/\bdd\b/,n.fullDate);case/d/.test(i):i=i.replace(/\bd\b/,n.date);case/DD/.test(i):i=i.replace(/\bDD\b/,s.days[n.day]);case/D/.test(i):i=i.replace(/\bD\b/,s.daysShort[n.day]);case/mm/.test(i):i=i.replace(/\bmm\b/,n.fullMonth);case/m/.test(i):i=i.replace(/\bm\b/,n.month+1);case/MM/.test(i):i=i.replace(/\bMM\b/,this.loc.months[n.month]);case/M/.test(i):i=i.replace(/\bM\b/,s.monthsShort[n.month]);case/yyyy/.test(i):i=i.replace(/\byyyy\b/,n.year);case/yyyy1/.test(i):i=i.replace(/\byyyy1\b/,a[0]);case/yyyy2/.test(i):i=i.replace(/\byyyy2\b/,a[1]);case/yy/.test(i):i=i.replace(/\byy\b/,n.year.toString().slice(-2))}return i},selectDate:function(t){var e=this.parsedDate,i="";if(t instanceof Date){if("days"==this.view&&t.getMonth()!=e.month&&this.opts.moveToOtherMonthsOnSelect&&(i=new Date(t.getFullYear(),t.getMonth(),1)),"years"==this.view&&t.getFullYear()!=e.year&&this.opts.moveToOtherYearsOnSelect&&(i=new Date(t.getFullYear(),0,1)),i&&(this.silent=!0,this.date=i,this.silent=!1,this.nav._render()),this.opts.multipleDates){if(this.selectedDates.length===this.opts.multipleDates)return;this._isSelected(t)||this.selectedDates.push(t)}else this.selectedDates=[t];this._setInputValue(),this.opts.onSelect&&this._triggerOnChange(),this.opts.autoClose&&this.hide(),this.views[this.currentView]._render()}},removeDate:function(t){var e=this.selectedDates,i=this;if(t instanceof Date)return e.some(function(s,a){return Datepicker.isSame(s,t)?(e.splice(a,1),i.views[i.currentView]._render(),i._setInputValue(),i.opts.onSelect&&i._triggerOnChange(),!0):void 0})},today:function(){this.silent=!0,this.view=this.opts.minView,this.silent=!1,this.date=new Date},clear:function(){this.selectedDates=[],this.views[this.currentView]._render(),this.opts.onSelect&&this._triggerOnChange()},update:function(t,i){var s=arguments.length;return 2==s?this.opts[t]=i:1==s&&"object"==typeof t&&(this.opts=e.extend(!0,this.opts,t)),this._createShortCuts(),this._syncWithMinMaxDates(),this._defineLocale(this.opts.language),this.nav._addButtonsIfNeed(),this.nav._render(),this.views[this.currentView]._render(),this.elIsInput&&!this.opts.inline&&(this._setPositionClasses(this.opts.position),this.visible&&this.setPosition(this.opts.position)),this.opts.classes&&this.$datepicker.addClass(this.opts.classes),this},_syncWithMinMaxDates:function(){var t=this.date.getTime();this.silent=!0,this.minTime>t&&(this.date=this.minDate),this.maxTime=this.minTime&&i<=this.maxTime,month:h>=this.minTime&&o<=this.maxTime,year:s.year>=a.year&&s.year<=n.year};return e?r[e]:r.day},_getDimensions:function(t){var e=t.offset();return{width:t.outerWidth(),height:t.outerHeight(),left:e.left,top:e.top}},_setPositionClasses:function(t){t=t.split(" ");var e=t[0],i=t[1],s="datepicker -"+e+"-"+i+"- -from-"+e+"-";this.visible&&(s+=" active"),this.$datepicker.removeAttr("class").addClass(s)},setPosition:function(t){t=t||this.opts.position;var e,i,s=this._getDimensions(this.$el),a=this._getDimensions(this.$datepicker),n=t.split(" "),h=this.opts.offset,o=n[0],r=n[1];switch(o){case"top":e=s.top-a.height-h;break;case"right":i=s.left+s.width+h;break;case"bottom":e=s.top+s.height+h;break;case"left":i=s.left-a.width-h}switch(r){case"top":e=s.top;break;case"right":i=s.left+s.width-a.width;break;case"bottom":e=s.top+s.height-a.height;break;case"left":i=s.left;break;case"center":/left|right/.test(o)?e=s.top+s.height/2-a.height/2:i=s.left+s.width/2-a.width/2}this.$datepicker.css({left:i,top:e})},show:function(){this.setPosition(this.opts.position),this.$datepicker.addClass("active"),this.visible=!0},hide:function(){this.$datepicker.removeClass("active").css({left:"-100000px"}),this.focused="",this.keys=[],this.inFocus=!1,this.visible=!1,this.$el.blur()},down:function(t){this._changeView(t,"down")},up:function(t){this._changeView(t,"up")},_changeView:function(t,e){t=t||this.focused||this.date;var i="up"==e?this.viewIndex+1:this.viewIndex-1;i>2&&(i=2),0>i&&(i=0),this.silent=!0,this.date=new Date(t.getFullYear(),t.getMonth(),1),this.silent=!1,this.view=this.viewIndexes[i]},_handleHotKey:function(t){var e,i,s,a=Datepicker.getParsedDate(this._getFocusedDate()),n=this.opts,h=!1,o=!1,r=!1,c=a.year,d=a.month,l=a.date;switch(t){case"ctrlRight":case"ctrlUp":d+=1,h=!0;break;case"ctrlLeft":case"ctrlDown":d-=1,h=!0;break;case"shiftRight":case"shiftUp":o=!0,c+=1;break;case"shiftLeft":case"shiftDown":o=!0,c-=1;break;case"altRight":case"altUp":r=!0,c+=10;break;case"altLeft":case"altDown":r=!0,c-=10;break;case"ctrlShiftUp":this.up()}s=Datepicker.getDaysCount(new Date(c,d)),i=new Date(c,d,l),l>s&&(l=s),i.getTime()this.maxTime&&(i=this.maxDate),this.focused=i,e=Datepicker.getParsedDate(i),h&&n.onChangeMonth&&n.onChangeMonth(e.month,e.year),o&&n.onChangeYear&&n.onChangeYear(e.year),r&&n.onChangeDecade&&n.onChangeDecade(this.curDecade)},_registerKey:function(t){var e=this.keys.some(function(e){return e==t});e||this.keys.push(t)},_unRegisterKey:function(t){var e=this.keys.indexOf(t);this.keys.splice(e,1)},_isHotKeyPressed:function(){var t,e=!1,i=this,s=this.keys.sort();for(var a in d)t=d[a],s.length==t.length&&t.every(function(t,e){return t==s[e]})&&(i._trigger("hotKey",a),e=!0);return e},_trigger:function(t,e){this.$el.trigger(t,e)},_focusNextCell:function(t,e){e=e||this.cellType;var i=Datepicker.getParsedDate(this._getFocusedDate()),s=i.year,a=i.month,n=i.date;if(!this._isHotKeyPressed()){switch(t){case 37:"day"==e?n-=1:"","month"==e?a-=1:"","year"==e?s-=1:"";break;case 38:"day"==e?n-=7:"","month"==e?a-=3:"","year"==e?s-=4:"";break;case 39:"day"==e?n+=1:"","month"==e?a+=1:"","year"==e?s+=1:"";break;case 40:"day"==e?n+=7:"","month"==e?a+=3:"","year"==e?s+=4:""}var h=new Date(s,a,n);h.getTime()this.maxTime&&(h=this.maxDate),this.focused=h}},_getFocusedDate:function(){var t=this.focused||this.selectedDates[this.selectedDates.length-1],e=this.parsedDate;if(!t)switch(this.view){case"days":t=new Date(e.year,e.month,(new Date).getDate());break;case"months":t=new Date(e.year,e.month,1);break;case"years":t=new Date(e.year,0,1)}return t},_getCell:function(t,e){e=e||this.cellType;var i,s=Datepicker.getParsedDate(t),a='.datepicker--cell[data-year="'+s.year+'"]';switch(e){case"month":a='[data-month="'+s.month+'"]';break;case"day":a+='[data-month="'+s.month+'"][data-date="'+s.date+'"]'}return i=this.views[this.currentView].$el.find(a),i.length?i:""},_onShowEvent:function(){this.visible||this.show()},_onBlur:function(){!this.inFocus&&this.visible&&this.hide()},_onMouseDownDatepicker:function(t){this.inFocus=!0},_onMouseUpDatepicker:function(t){this.inFocus=!1,this.$el.focus()},_onInput:function(){var t=this.$el.val();t||this.clear()},_onResize:function(){this.visible&&this.setPosition()},_onKeyDown:function(t){var e=t.which;if(this._registerKey(e),e>=37&&40>=e&&(t.preventDefault(),this._focusNextCell(e)),13==e&&this.focused){if(this._getCell(this.focused).hasClass("-disabled-"))return;if(this.view!=this.opts.minView)this.down();else{var i=this._isSelected(this.focused,this.cellType);i?i&&this.opts.toggleSelected&&this.removeDate(this.focused):this.selectDate(this.focused)}}27==e&&this.hide()},_onKeyUp:function(t){var e=t.which;this._unRegisterKey(e)},_onHotKey:function(t,e){this._handleHotKey(e)},set focused(t){if(!t&&this.focused){var e=this._getCell(this.focused);e.length&&e.removeClass("-focus-")}this._focused=t,this.date=t},get focused(){return this._focused},get parsedDate(){return Datepicker.getParsedDate(this.date)},set date(t){return t instanceof Date?(this.currentDate=t,this.inited&&!this.silent&&(this.views[this.view]._render(),this.nav._render(),this.visible&&this.elIsInput&&this.setPosition()),t):void 0},get date(){return this.currentDate},set view(t){return this.viewIndex=this.viewIndexes.indexOf(t),this.viewIndex<0?void 0:(this.prevView=this.currentView,this.currentView=t,this.inited&&(this.views[t]?this.views[t]._render():this.views[t]=new Datepicker.Body(this,t,this.opts),this.views[this.prevView].hide(),this.views[t].show(),this.nav._render(),this.opts.onChangeView&&this.opts.onChangeView(t),this.elIsInput&&this.visible&&this.setPosition()),t)},get view(){return this.currentView},get cellType(){return this.view.substring(0,this.view.length-1)},get minTime(){var t=Datepicker.getParsedDate(this.minDate);return new Date(t.year,t.month,t.date).getTime()},get maxTime(){var t=Datepicker.getParsedDate(this.maxDate);return new Date(t.year,t.month,t.date).getTime()},get curDecade(){return Datepicker.getDecade(this.date)}},Datepicker.getDaysCount=function(t){return new Date(t.getFullYear(),t.getMonth()+1,0).getDate()},Datepicker.getParsedDate=function(t){return{year:t.getFullYear(),month:t.getMonth(),fullMonth:t.getMonth()+1<10?"0"+(t.getMonth()+1):t.getMonth()+1,date:t.getDate(),fullDate:t.getDate()<10?"0"+t.getDate():t.getDate(),day:t.getDay()}},Datepicker.getDecade=function(t){var e=10*Math.floor(t.getFullYear()/10);return[e,e+9]},Datepicker.template=function(t,e){return t.replace(/#\{([\w]+)\}/g,function(t,i){return e[i]||0===e[i]?e[i]:void 0})},Datepicker.isSame=function(t,e,i){var s=Datepicker.getParsedDate(t),a=Datepicker.getParsedDate(e),n=i?i:"day",h={day:s.date==a.date&&s.month==a.month&&s.year==a.year,month:s.month==a.month&&s.year==a.year,year:s.year==a.year};return h[n]},Datepicker.language={ru:{days:["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"],daysShort:["Вос","Пон","Вто","Сре","Чет","Пят","Суб"],daysMin:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"],months:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],monthsShort:["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],today:"Сегодня",clear:"Очистить",dateFormat:"dd.mm.yyyy",firstDay:1}},e.fn[n]=function(t){return Datepicker.prototype[t]?void Datepicker.prototype[t].apply(this.data(n),Array.prototype.slice.call(arguments,1)):this.each(function(){if(e.data(this,n)){var i=e.data(this,n);i.opts=e.extend(!0,i.opts,t),i.update()}else e.data(this,n,new Datepicker(this,t))})},e(function(){e(h).datepicker()})}(window,jQuery),function(){var t={days:'
',months:'
',years:'
'},e=Datepicker;e.Body=function(t,e,i){this.d=t,this.type=e,this.opts=i,this.init()},e.Body.prototype={init:function(){this._buildBaseHtml(),this._render(),this._bindEvents()},_bindEvents:function(){this.$el.on("click",".datepicker--cell",$.proxy(this._onClickCell,this))},_buildBaseHtml:function(){this.$el=$(t[this.type]).appendTo(this.d.$content),this.$names=$(".datepicker--days-names",this.$el),this.$cells=$(".datepicker--cells",this.$el)},_getDayNamesHtml:function(t,e,i,s){return e=void 0!=e?e:t,i=i?i:"",s=void 0!=s?s:0,s>7?i:7==e?this._getDayNamesHtml(t,0,i,++s):(i+='
'+this.d.loc.daysMin[e]+"
",this._getDayNamesHtml(t,++e,i,++s))},_getDaysHtml:function(t){var i=e.getDaysCount(t),s=new Date(t.getFullYear(),t.getMonth(),1).getDay(),a=new Date(t.getFullYear(),t.getMonth(),i).getDay(),n=s-this.d.loc.firstDay,h=6-a+this.d.loc.firstDay;n=0>n?n+7:n,h=h>6?h-7:h;for(var o,r,c=-n+1,d="",l=c,p=i+h;p>=l;l++)r=t.getFullYear(),o=t.getMonth(),d+=this._getDayHtml(new Date(r,o,l));return d},_getDayHtml:function(t){var i="datepicker--cell datepicker--cell-day",s=new Date,a=e.getParsedDate(t),n={},h=a.date;return this.opts.onRenderCell&&(n=this.opts.onRenderCell(t,"day")||{},h=n.html?n.html:h,i+=n.classes?" "+n.classes:""),this.d.isWeekend(a.day)&&(i+=" -weekend-"),e.isSame(s,t)&&(i+=" -current-"),this.d.focused&&e.isSame(t,this.d.focused)&&(i+=" -focus-"),this.d._isSelected(t,"day")&&(i+=" -selected-"),(!this.d._isInRange(t)||n.disabled)&&(i+=" -disabled-"),a.month!=this.d.parsedDate.month&&(i+=" -other-month-",this.opts.selectOtherMonths||(i+=" -disabled-"),this.opts.showOtherMonths||(h="")),'
'+h+"
"},_getMonthsHtml:function(t){for(var i="",s=e.getParsedDate(t),a=0;12>a;)i+=this._getMonthHtml(new Date(s.year,a)),a++;return i},_getMonthHtml:function(t){var i="datepicker--cell datepicker--cell-month",s=e.getParsedDate(t),a=new Date,n=this.d.loc,h=n[this.opts.monthsFiled][s.month],o={};return this.opts.onRenderCell&&(o=this.opts.onRenderCell(t,"month")||{},h=o.html?o.html:h,i+=o.classes?" "+o.classes:""),e.isSame(a,t,"month")&&(i+=" -current-"),this.d._isSelected(t,"month")&&(i+=" -selected-"),this.d.focused&&e.isSame(t,this.d.focused,"month")&&(i+=" -focus-"),(!this.d._isInRange(t,"month")||o.disabled)&&(i+=" -disabled-"),'
'+h+"
"},_getYearsHtml:function(t){var i=(e.getParsedDate(t),e.getDecade(t)),s=i[0]-1,a="",n=s;for(n;n<=i[1]+1;n++)a+=this._getYearHtml(new Date(n,0));return a},_getYearHtml:function(t){var i="datepicker--cell datepicker--cell-year",s=e.getDecade(this.d.date),a=new Date,n=e.getParsedDate(t),h=n.year,o={};return this.opts.onRenderCell&&(o=this.opts.onRenderCell(t,"year")||{},h=o.html?o.html:h,i+=o.classes?" "+o.classes:""),(n.years[1])&&(i+=" -other-decade-",this.opts.selectOtherYears||(i+=" -disabled-"),this.opts.showOtherYears||(h="")),e.isSame(a,t,"year")&&(i+=" -current-"),this.d._isSelected(t,"year")&&(i+=" -selected-"),this.d.focused&&e.isSame(t,this.d.focused,"year")&&(i+=" -focus-"),(!this.d._isInRange(t,"year")||o.disabled)&&(i+=" -disabled-"),'
'+h+"
"},_renderTypes:{days:function(){var t=this._getDayNamesHtml(this.d.loc.firstDay),e=this._getDaysHtml(this.d.currentDate);this.$cells.html(e),this.$names.html(t)},months:function(){var t=this._getMonthsHtml(this.d.currentDate);this.$cells.html(t)},years:function(){var t=this._getYearsHtml(this.d.currentDate);this.$cells.html(t)}},_render:function(){this._renderTypes[this.type].bind(this)()},show:function(){this.$el.addClass("active"),this.acitve=!0},hide:function(){this.$el.removeClass("active"),this.active=!1},_handleClick:function(t){var e=t.data("date")||1,i=t.data("month")||0,s=t.data("year")||this.d.parsedDate.year;if(this.d.view!=this.opts.minView)return void this.d.down(new Date(s,i,e));var a=new Date(s,i,e),n=this.d._isSelected(a,this.d.cellType);n?n&&this.opts.toggleSelected&&this.d.removeDate(a):this.d.selectDate(a)},_onClickCell:function(t){var e=$(t.target).closest(".datepicker--cell");e.hasClass("-disabled-")||this._handleClick.bind(this)(e)}}}(),function(){var t='
#{prevHtml}
#{title}
#{nextHtml}
',e='
',i='#{label}';Datepicker.Navigation=function(t,e){this.d=t,this.opts=e,this.$buttonsContainer="",this.init()},Datepicker.Navigation.prototype={init:function(){this._buildBaseHtml(),this._bindEvents()},_bindEvents:function(){this.d.$nav.on("click",".datepicker--nav-action",$.proxy(this._onClickNavButton,this)),this.d.$nav.on("click",".datepicker--nav-title",$.proxy(this._onClickNavTitle,this)),this.d.$datepicker.on("click",".datepicker--button",$.proxy(this._onClickNavButton,this))},_buildBaseHtml:function(){this._render(),this._addButtonsIfNeed()},_addButtonsIfNeed:function(){this.opts.todayButton&&this._addButton("today"),this.opts.clearButton&&this._addButton("clear")},_render:function(){var e=this._getTitle(this.d.currentDate),i=Datepicker.template(t,$.extend({title:e},this.opts));this.d.$nav.html(i),"years"==this.d.view&&$(".datepicker--nav-title",this.d.$nav).addClass("-disabled-"),this.setNavStatus()},_getTitle:function(t){return this.d.formatDate(this.opts.navTitles[this.d.view],t)},_addButton:function(t){this.$buttonsContainer.length||this._addButtonsContainer();var e={action:t,label:this.d.loc[t]},s=Datepicker.template(i,e);this.$buttonsContainer.append(s)},_addButtonsContainer:function(){this.d.$datepicker.append(e),this.$buttonsContainer=$(".datepicker--buttons",this.d.$datepicker)},setNavStatus:function(){if((this.opts.minDate||this.opts.maxDate)&&this.opts.disableNavWhenOutOfRange){var t=this.d.parsedDate,e=t.month,i=t.year,s=t.date;switch(this.d.view){case"days":this.d._isInRange(new Date(i,e-1,s),"month")||this._disableNav("prev"),this.d._isInRange(new Date(i,e+1,s),"month")||this._disableNav("next");break;case"months":this.d._isInRange(new Date(i-1,e,s),"year")||this._disableNav("prev"),this.d._isInRange(new Date(i+1,e,s),"year")||this._disableNav("next");break;case"years":this.d._isInRange(new Date(i-10,e,s),"year")||this._disableNav("prev"),this.d._isInRange(new Date(i+10,e,s),"year")||this._disableNav("next")}}},_disableNav:function(t){$('[data-action="'+t+'"]',this.d.$nav).addClass("-disabled-")},_activateNav:function(t){$('[data-action="'+t+'"]',this.d.$nav).removeClass("-disabled-")},_onClickNavButton:function(t){var e=$(t.target).closest("[data-action]"),i=e.data("action");this.d[i]()},_onClickNavTitle:function(t){return $(t.target).hasClass("-disabled-")?void 0:"days"==this.d.view?this.d.view="months":void(this.d.view="years")}}}(); \ No newline at end of file +var Datepicker;!function(t,e,i){var s,a,n="datepicker",h=".datepicker-here",o=!1,r='
',c={classes:"",inline:!1,language:"ru",startDate:new Date,firstDay:"",weekends:[6,0],dateFormat:"",altField:"",altFieldDateFormat:"@",toggleSelected:!0,keyboardNav:!0,position:"bottom left",offset:12,view:"days",minView:"days",showOtherMonths:!0,selectOtherMonths:!0,moveToOtherMonthsOnSelect:!0,showOtherYears:!0,selectOtherYears:!0,moveToOtherYearsOnSelect:!0,minDate:"",maxDate:"",disableNavWhenOutOfRange:!0,multipleDates:!1,multipleDatesSeparator:",",todayButton:!1,clearButton:!1,showEvent:"focus",autoClose:!1,monthsFiled:"monthsShort",prevHtml:'',nextHtml:'',navTitles:{days:"MM, yyyy",months:"yyyy",years:"yyyy1 - yyyy2"},onSelect:"",onChangeMonth:"",onChangeYear:"",onChangeDecade:"",onChangeView:"",onRenderCell:""},d={ctrlRight:[17,39],ctrlUp:[17,38],ctrlLeft:[17,37],ctrlDown:[17,40],shiftRight:[16,39],shiftUp:[16,38],shiftLeft:[16,37],shiftDown:[16,40],altUp:[18,38],altRight:[18,39],altLeft:[18,37],altDown:[18,40],ctrlShiftUp:[16,17,38]};Datepicker=function(t,a){this.el=t,this.$el=e(t),this.opts=e.extend(!0,{},c,a,this.$el.data()),s==i&&(s=e("body")),this.opts.startDate||(this.opts.startDate=new Date),"INPUT"==this.el.nodeName&&(this.elIsInput=!0),this.opts.altField&&(this.$altField="string"==typeof this.opts.altField?e(this.opts.altField):this.opts.altField),this.inited=!1,this.visible=!1,this.silent=!1,this.currentDate=this.opts.startDate,this.currentView=this.opts.view,this._createShortCuts(),this.selectedDates=[],this.views={},this.keys=[],this.init()},Datepicker.prototype={viewIndexes:["days","months","years"],init:function(){o||this.opts.inline||!this.elIsInput||this._buildDatepickersContainer(),this._buildBaseHtml(),this._defineLocale(this.opts.language),this._syncWithMinMaxDates(),this.elIsInput&&(this.opts.inline||(this._setPositionClasses(this.opts.position),this._bindEvents())),this.opts.classes&&this.$datepicker.addClass(this.opts.classes),this.views[this.currentView]=new Datepicker.Body(this,this.currentView,this.opts),this.views[this.currentView].show(),this.nav=new Datepicker.Navigation(this,this.opts),this.view=this.currentView,this.inited=!0},_createShortCuts:function(){this.minDate=this.opts.minDate?this.opts.minDate:new Date(-86399999136e5),this.maxDate=this.opts.maxDate?this.opts.maxDate:new Date(86399999136e5)},_bindEvents:function(){this.$el.on(this.opts.showEvent,this._onShowEvent.bind(this)),this.$el.on("blur",this._onBlur.bind(this)),this.$el.on("input",this._onInput.bind(this)),this.$datepicker.on("mousedown",this._onMouseDownDatepicker.bind(this)),this.$datepicker.on("mouseup",this._onMouseUpDatepicker.bind(this)),e(t).on("resize",this._onResize.bind(this)),this.opts.keyboardNav&&(this.$el.on("keydown",this._onKeyDown.bind(this)),this.$el.on("keyup",this._onKeyUp.bind(this)),this.$el.on("hotKey",this._onHotKey.bind(this)))},isWeekend:function(t){return-1!==this.opts.weekends.indexOf(t)},_defineLocale:function(t){"string"==typeof t?(this.loc=Datepicker.language[t],this.loc||(console.warn("Can't find language \""+t+'" in Datepicker.language, will use "ru" instead'),this.loc=e.extend(!0,{},Datepicker.language.ru)),this.loc=e.extend(!0,{},Datepicker.language.ru,Datepicker.language[t])):this.loc=e.extend(!0,{},Datepicker.language.ru,t),this.opts.dateFormat&&(this.loc.dateFormat=this.opts.dateFormat),this.opts.firstDay&&(this.loc.firstDay=this.opts.firstDay)},_buildDatepickersContainer:function(){o=!0,s.append('
'),a=e("#datepickers-container")},_buildBaseHtml:function(){var t,i=e('
');t="INPUT"==this.el.nodeName?this.opts.inline?i.insertAfter(this.$el):a:i.appendTo(this.$el),this.$datepicker=e(r).appendTo(t),this.$content=e(".datepicker--content",this.$datepicker),this.$nav=e(".datepicker--nav",this.$datepicker)},_triggerOnChange:function(){if(!this.selectedDates.length)return this.opts.onSelect("","",this);var t,e=this.selectedDates,i=Datepicker.getParsedDate(e[0]),s=this,a=new Date(i.year,i.month,i.date);t=e.map(function(t){return s.formatDate(s.loc.dateFormat,t)}).join(this.opts.multipleDatesSeparator),this.opts.multipleDates&&(a=e.map(function(t){var e=Datepicker.getParsedDate(t);return new Date(e.year,e.month,e.date)})),this.opts.onSelect(t,a,this)},next:function(){var t=this.parsedDate,e=this.opts;switch(this.view){case"days":this.date=new Date(t.year,t.month+1,1),e.onChangeMonth&&e.onChangeMonth(this.parsedDate.month,this.parsedDate.year);break;case"months":this.date=new Date(t.year+1,t.month,1),e.onChangeYear&&e.onChangeYear(this.parsedDate.year);break;case"years":this.date=new Date(t.year+10,0,1),e.onChangeDecade&&e.onChangeDecade(this.curDecade)}},prev:function(){var t=this.parsedDate,e=this.opts;switch(this.view){case"days":this.date=new Date(t.year,t.month-1,1),e.onChangeMonth&&e.onChangeMonth(this.parsedDate.month,this.parsedDate.year);break;case"months":this.date=new Date(t.year-1,t.month,1),e.onChangeYear&&e.onChangeYear(this.parsedDate.year);break;case"years":this.date=new Date(t.year-10,0,1),e.onChangeDecade&&e.onChangeDecade(this.curDecade)}},formatDate:function(t,e){e=e||this.date;var i=t,s=this.loc,a=Datepicker.getDecade(e),n=Datepicker.getParsedDate(e);switch(!0){case/@/.test(i):i=i.replace(/@/,e.getTime());case/dd/.test(i):i=i.replace(/\bdd\b/,n.fullDate);case/d/.test(i):i=i.replace(/\bd\b/,n.date);case/DD/.test(i):i=i.replace(/\bDD\b/,s.days[n.day]);case/D/.test(i):i=i.replace(/\bD\b/,s.daysShort[n.day]);case/mm/.test(i):i=i.replace(/\bmm\b/,n.fullMonth);case/m/.test(i):i=i.replace(/\bm\b/,n.month+1);case/MM/.test(i):i=i.replace(/\bMM\b/,this.loc.months[n.month]);case/M/.test(i):i=i.replace(/\bM\b/,s.monthsShort[n.month]);case/yyyy/.test(i):i=i.replace(/\byyyy\b/,n.year);case/yyyy1/.test(i):i=i.replace(/\byyyy1\b/,a[0]);case/yyyy2/.test(i):i=i.replace(/\byyyy2\b/,a[1]);case/yy/.test(i):i=i.replace(/\byy\b/,n.year.toString().slice(-2))}return i},selectDate:function(t){var e=this.parsedDate,i="";if(t instanceof Date){if("days"==this.view&&t.getMonth()!=e.month&&this.opts.moveToOtherMonthsOnSelect&&(i=new Date(t.getFullYear(),t.getMonth(),1)),"years"==this.view&&t.getFullYear()!=e.year&&this.opts.moveToOtherYearsOnSelect&&(i=new Date(t.getFullYear(),0,1)),i&&(this.silent=!0,this.date=i,this.silent=!1,this.nav._render()),this.opts.multipleDates){if(this.selectedDates.length===this.opts.multipleDates)return;this._isSelected(t)||this.selectedDates.push(t)}else this.selectedDates=[t];this._setInputValue(),this.opts.onSelect&&this._triggerOnChange(),this.opts.autoClose&&this.hide(),this.views[this.currentView]._render()}},removeDate:function(t){var e=this.selectedDates,i=this;if(t instanceof Date)return e.some(function(s,a){return Datepicker.isSame(s,t)?(e.splice(a,1),i.views[i.currentView]._render(),i._setInputValue(),i.opts.onSelect&&i._triggerOnChange(),!0):void 0})},today:function(){this.silent=!0,this.view=this.opts.minView,this.silent=!1,this.date=new Date},clear:function(){this.selectedDates=[],this.views[this.currentView]._render(),this.opts.onSelect&&this._triggerOnChange()},update:function(t,i){var s=arguments.length;return 2==s?this.opts[t]=i:1==s&&"object"==typeof t&&(this.opts=e.extend(!0,this.opts,t)),this._createShortCuts(),this._syncWithMinMaxDates(),this._defineLocale(this.opts.language),this.nav._addButtonsIfNeed(),this.nav._render(),this.views[this.currentView]._render(),this.elIsInput&&!this.opts.inline&&(this._setPositionClasses(this.opts.position),this.visible&&this.setPosition(this.opts.position)),this.opts.classes&&this.$datepicker.addClass(this.opts.classes),this},_syncWithMinMaxDates:function(){var t=this.date.getTime();this.silent=!0,this.minTime>t&&(this.date=this.minDate),this.maxTime=this.minTime&&i<=this.maxTime,month:h>=this.minTime&&o<=this.maxTime,year:s.year>=a.year&&s.year<=n.year};return e?r[e]:r.day},_getDimensions:function(t){var e=t.offset();return{width:t.outerWidth(),height:t.outerHeight(),left:e.left,top:e.top}},_setPositionClasses:function(t){t=t.split(" ");var e=t[0],i=t[1],s="datepicker -"+e+"-"+i+"- -from-"+e+"-";this.visible&&(s+=" active"),this.$datepicker.removeAttr("class").addClass(s)},setPosition:function(t){t=t||this.opts.position;var e,i,s=this._getDimensions(this.$el),a=this._getDimensions(this.$datepicker),n=t.split(" "),h=this.opts.offset,o=n[0],r=n[1];switch(o){case"top":e=s.top-a.height-h;break;case"right":i=s.left+s.width+h;break;case"bottom":e=s.top+s.height+h;break;case"left":i=s.left-a.width-h}switch(r){case"top":e=s.top;break;case"right":i=s.left+s.width-a.width;break;case"bottom":e=s.top+s.height-a.height;break;case"left":i=s.left;break;case"center":/left|right/.test(o)?e=s.top+s.height/2-a.height/2:i=s.left+s.width/2-a.width/2}this.$datepicker.css({left:i,top:e})},show:function(){this.setPosition(this.opts.position),this.$datepicker.addClass("active"),this.visible=!0},hide:function(){this.$datepicker.removeClass("active").css({left:"-100000px"}),this.focused="",this.keys=[],this.inFocus=!1,this.visible=!1,this.$el.blur()},down:function(t){this._changeView(t,"down")},up:function(t){this._changeView(t,"up")},_changeView:function(t,e){t=t||this.focused||this.date;var i="up"==e?this.viewIndex+1:this.viewIndex-1;i>2&&(i=2),0>i&&(i=0),this.silent=!0,this.date=new Date(t.getFullYear(),t.getMonth(),1),this.silent=!1,this.view=this.viewIndexes[i]},_handleHotKey:function(t){var e,i,s,a=Datepicker.getParsedDate(this._getFocusedDate()),n=this.opts,h=!1,o=!1,r=!1,c=a.year,d=a.month,l=a.date;switch(t){case"ctrlRight":case"ctrlUp":d+=1,h=!0;break;case"ctrlLeft":case"ctrlDown":d-=1,h=!0;break;case"shiftRight":case"shiftUp":o=!0,c+=1;break;case"shiftLeft":case"shiftDown":o=!0,c-=1;break;case"altRight":case"altUp":r=!0,c+=10;break;case"altLeft":case"altDown":r=!0,c-=10;break;case"ctrlShiftUp":this.up()}s=Datepicker.getDaysCount(new Date(c,d)),i=new Date(c,d,l),l>s&&(l=s),i.getTime()this.maxTime&&(i=this.maxDate),this.focused=i,e=Datepicker.getParsedDate(i),h&&n.onChangeMonth&&n.onChangeMonth(e.month,e.year),o&&n.onChangeYear&&n.onChangeYear(e.year),r&&n.onChangeDecade&&n.onChangeDecade(this.curDecade)},_registerKey:function(t){var e=this.keys.some(function(e){return e==t});e||this.keys.push(t)},_unRegisterKey:function(t){var e=this.keys.indexOf(t);this.keys.splice(e,1)},_isHotKeyPressed:function(){var t,e=!1,i=this,s=this.keys.sort();for(var a in d)t=d[a],s.length==t.length&&t.every(function(t,e){return t==s[e]})&&(i._trigger("hotKey",a),e=!0);return e},_trigger:function(t,e){this.$el.trigger(t,e)},_focusNextCell:function(t,e){e=e||this.cellType;var i=Datepicker.getParsedDate(this._getFocusedDate()),s=i.year,a=i.month,n=i.date;if(!this._isHotKeyPressed()){switch(t){case 37:"day"==e?n-=1:"","month"==e?a-=1:"","year"==e?s-=1:"";break;case 38:"day"==e?n-=7:"","month"==e?a-=3:"","year"==e?s-=4:"";break;case 39:"day"==e?n+=1:"","month"==e?a+=1:"","year"==e?s+=1:"";break;case 40:"day"==e?n+=7:"","month"==e?a+=3:"","year"==e?s+=4:""}var h=new Date(s,a,n);h.getTime()this.maxTime&&(h=this.maxDate),this.focused=h}},_getFocusedDate:function(){var t=this.focused||this.selectedDates[this.selectedDates.length-1],e=this.parsedDate;if(!t)switch(this.view){case"days":t=new Date(e.year,e.month,(new Date).getDate());break;case"months":t=new Date(e.year,e.month,1);break;case"years":t=new Date(e.year,0,1)}return t},_getCell:function(t,e){e=e||this.cellType;var i,s=Datepicker.getParsedDate(t),a='.datepicker--cell[data-year="'+s.year+'"]';switch(e){case"month":a='[data-month="'+s.month+'"]';break;case"day":a+='[data-month="'+s.month+'"][data-date="'+s.date+'"]'}return i=this.views[this.currentView].$el.find(a),i.length?i:""},_onShowEvent:function(){this.visible||this.show()},_onBlur:function(){!this.inFocus&&this.visible&&this.hide()},_onMouseDownDatepicker:function(t){this.inFocus=!0},_onMouseUpDatepicker:function(t){this.inFocus=!1,this.$el.focus()},_onInput:function(){var t=this.$el.val();t||this.clear()},_onResize:function(){this.visible&&this.setPosition()},_onKeyDown:function(t){var e=t.which;if(this._registerKey(e),e>=37&&40>=e&&(t.preventDefault(),this._focusNextCell(e)),13==e&&this.focused){if(this._getCell(this.focused).hasClass("-disabled-"))return;if(this.view!=this.opts.minView)this.down();else{var i=this._isSelected(this.focused,this.cellType);i?i&&this.opts.toggleSelected&&this.removeDate(this.focused):this.selectDate(this.focused)}}27==e&&this.hide()},_onKeyUp:function(t){var e=t.which;this._unRegisterKey(e)},_onHotKey:function(t,e){this._handleHotKey(e)},set focused(t){if(!t&&this.focused){var e=this._getCell(this.focused);e.length&&e.removeClass("-focus-")}this._focused=t,this.date=t},get focused(){return this._focused},get parsedDate(){return Datepicker.getParsedDate(this.date)},set date(t){return t instanceof Date?(this.currentDate=t,this.inited&&!this.silent&&(this.views[this.view]._render(),this.nav._render(),this.visible&&this.elIsInput&&this.setPosition()),t):void 0},get date(){return this.currentDate},set view(t){return this.viewIndex=this.viewIndexes.indexOf(t),this.viewIndex<0?void 0:(this.prevView=this.currentView,this.currentView=t,this.inited&&(this.views[t]?this.views[t]._render():this.views[t]=new Datepicker.Body(this,t,this.opts),this.views[this.prevView].hide(),this.views[t].show(),this.nav._render(),this.opts.onChangeView&&this.opts.onChangeView(t),this.elIsInput&&this.visible&&this.setPosition()),t)},get view(){return this.currentView},get cellType(){return this.view.substring(0,this.view.length-1)},get minTime(){var t=Datepicker.getParsedDate(this.minDate);return new Date(t.year,t.month,t.date).getTime()},get maxTime(){var t=Datepicker.getParsedDate(this.maxDate);return new Date(t.year,t.month,t.date).getTime()},get curDecade(){return Datepicker.getDecade(this.date)}},Datepicker.getDaysCount=function(t){return new Date(t.getFullYear(),t.getMonth()+1,0).getDate()},Datepicker.getParsedDate=function(t){return{year:t.getFullYear(),month:t.getMonth(),fullMonth:t.getMonth()+1<10?"0"+(t.getMonth()+1):t.getMonth()+1,date:t.getDate(),fullDate:t.getDate()<10?"0"+t.getDate():t.getDate(),day:t.getDay()}},Datepicker.getDecade=function(t){var e=10*Math.floor(t.getFullYear()/10);return[e,e+9]},Datepicker.template=function(t,e){return t.replace(/#\{([\w]+)\}/g,function(t,i){return e[i]||0===e[i]?e[i]:void 0})},Datepicker.isSame=function(t,e,i){var s=Datepicker.getParsedDate(t),a=Datepicker.getParsedDate(e),n=i?i:"day",h={day:s.date==a.date&&s.month==a.month&&s.year==a.year,month:s.month==a.month&&s.year==a.year,year:s.year==a.year};return h[n]},Datepicker.language={ru:{days:["Воскресенье","Понедельник","Вторник","Среда","Четверг","Пятница","Суббота"],daysShort:["Вос","Пон","Вто","Сре","Чет","Пят","Суб"],daysMin:["Вс","Пн","Вт","Ср","Чт","Пт","Сб"],months:["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],monthsShort:["Янв","Фев","Мар","Апр","Май","Июн","Июл","Авг","Сен","Окт","Ноя","Дек"],today:"Сегодня",clear:"Очистить",dateFormat:"dd.mm.yyyy",firstDay:1}},e.fn[n]=function(t){return Datepicker.prototype[t]?void Datepicker.prototype[t].apply(this.data(n),Array.prototype.slice.call(arguments,1)):this.each(function(){if(e.data(this,n)){var i=e.data(this,n);i.opts=e.extend(!0,i.opts,t),i.update()}else e.data(this,n,new Datepicker(this,t))})},e(function(){e(h).datepicker()})}(window,jQuery),function(){var t={days:'
',months:'
',years:'
'},e=Datepicker;e.Body=function(t,e,i){this.d=t,this.type=e,this.opts=i,this.init()},e.Body.prototype={init:function(){this._buildBaseHtml(),this._render(),this._bindEvents()},_bindEvents:function(){this.$el.on("click",".datepicker--cell",$.proxy(this._onClickCell,this))},_buildBaseHtml:function(){this.$el=$(t[this.type]).appendTo(this.d.$content),this.$names=$(".datepicker--days-names",this.$el),this.$cells=$(".datepicker--cells",this.$el)},_getDayNamesHtml:function(t,e,i,s){return e=void 0!=e?e:t,i=i?i:"",s=void 0!=s?s:0,s>7?i:7==e?this._getDayNamesHtml(t,0,i,++s):(i+='
'+this.d.loc.daysMin[e]+"
",this._getDayNamesHtml(t,++e,i,++s))},_getDaysHtml:function(t){var i=e.getDaysCount(t),s=new Date(t.getFullYear(),t.getMonth(),1).getDay(),a=new Date(t.getFullYear(),t.getMonth(),i).getDay(),n=s-this.d.loc.firstDay,h=6-a+this.d.loc.firstDay;n=0>n?n+7:n,h=h>6?h-7:h;for(var o,r,c=-n+1,d="",l=c,p=i+h;p>=l;l++)r=t.getFullYear(),o=t.getMonth(),d+=this._getDayHtml(new Date(r,o,l));return d},_getDayHtml:function(t){var i="datepicker--cell datepicker--cell-day",s=new Date,a=e.getParsedDate(t),n={},h=a.date;return this.opts.onRenderCell&&(n=this.opts.onRenderCell(t,"day")||{},h=n.html?n.html:h,i+=n.classes?" "+n.classes:""),this.d.isWeekend(a.day)&&(i+=" -weekend-"),e.isSame(s,t)&&(i+=" -current-"),this.d.focused&&e.isSame(t,this.d.focused)&&(i+=" -focus-"),this.d._isSelected(t,"day")&&(i+=" -selected-"),(!this.d._isInRange(t)||n.disabled)&&(i+=" -disabled-"),a.month!=this.d.parsedDate.month&&(i+=" -other-month-",this.opts.selectOtherMonths||(i+=" -disabled-"),this.opts.showOtherMonths||(h="")),'
'+h+"
"},_getMonthsHtml:function(t){for(var i="",s=e.getParsedDate(t),a=0;12>a;)i+=this._getMonthHtml(new Date(s.year,a)),a++;return i},_getMonthHtml:function(t){var i="datepicker--cell datepicker--cell-month",s=e.getParsedDate(t),a=new Date,n=this.d.loc,h=n[this.opts.monthsFiled][s.month],o={};return this.opts.onRenderCell&&(o=this.opts.onRenderCell(t,"month")||{},h=o.html?o.html:h,i+=o.classes?" "+o.classes:""),e.isSame(a,t,"month")&&(i+=" -current-"),this.d._isSelected(t,"month")&&(i+=" -selected-"),this.d.focused&&e.isSame(t,this.d.focused,"month")&&(i+=" -focus-"),(!this.d._isInRange(t,"month")||o.disabled)&&(i+=" -disabled-"),'
'+h+"
"},_getYearsHtml:function(t){var i=(e.getParsedDate(t),e.getDecade(t)),s=i[0]-1,a="",n=s;for(n;n<=i[1]+1;n++)a+=this._getYearHtml(new Date(n,0));return a},_getYearHtml:function(t){var i="datepicker--cell datepicker--cell-year",s=e.getDecade(this.d.date),a=new Date,n=e.getParsedDate(t),h=n.year,o={};return this.opts.onRenderCell&&(o=this.opts.onRenderCell(t,"year")||{},h=o.html?o.html:h,i+=o.classes?" "+o.classes:""),(n.years[1])&&(i+=" -other-decade-",this.opts.selectOtherYears||(i+=" -disabled-"),this.opts.showOtherYears||(h="")),e.isSame(a,t,"year")&&(i+=" -current-"),this.d._isSelected(t,"year")&&(i+=" -selected-"),this.d.focused&&e.isSame(t,this.d.focused,"year")&&(i+=" -focus-"),(!this.d._isInRange(t,"year")||o.disabled)&&(i+=" -disabled-"),'
'+h+"
"},_renderTypes:{days:function(){var t=this._getDayNamesHtml(this.d.loc.firstDay),e=this._getDaysHtml(this.d.currentDate);this.$cells.html(e),this.$names.html(t)},months:function(){var t=this._getMonthsHtml(this.d.currentDate);this.$cells.html(t)},years:function(){var t=this._getYearsHtml(this.d.currentDate);this.$cells.html(t)}},_render:function(){this._renderTypes[this.type].bind(this)()},show:function(){this.$el.addClass("active"),this.acitve=!0},hide:function(){this.$el.removeClass("active"),this.active=!1},_handleClick:function(t){var e=t.data("date")||1,i=t.data("month")||0,s=t.data("year")||this.d.parsedDate.year;if(this.d.view!=this.opts.minView)return void this.d.down(new Date(s,i,e));var a=new Date(s,i,e),n=this.d._isSelected(a,this.d.cellType);n?n&&this.opts.toggleSelected&&this.d.removeDate(a):this.d.selectDate(a)},_onClickCell:function(t){var e=$(t.target).closest(".datepicker--cell");e.hasClass("-disabled-")||this._handleClick.bind(this)(e)}}}(),function(){var t='
#{prevHtml}
#{title}
#{nextHtml}
',e='
',i='#{label}';Datepicker.Navigation=function(t,e){this.d=t,this.opts=e,this.$buttonsContainer="",this.init()},Datepicker.Navigation.prototype={init:function(){this._buildBaseHtml(),this._bindEvents()},_bindEvents:function(){this.d.$nav.on("click",".datepicker--nav-action",$.proxy(this._onClickNavButton,this)),this.d.$nav.on("click",".datepicker--nav-title",$.proxy(this._onClickNavTitle,this)),this.d.$datepicker.on("click",".datepicker--button",$.proxy(this._onClickNavButton,this))},_buildBaseHtml:function(){this._render(),this._addButtonsIfNeed()},_addButtonsIfNeed:function(){this.opts.todayButton&&this._addButton("today"),this.opts.clearButton&&this._addButton("clear")},_render:function(){var e=this._getTitle(this.d.currentDate),i=Datepicker.template(t,$.extend({title:e},this.opts));this.d.$nav.html(i),"years"==this.d.view&&$(".datepicker--nav-title",this.d.$nav).addClass("-disabled-"),this.setNavStatus()},_getTitle:function(t){return this.d.formatDate(this.opts.navTitles[this.d.view],t)},_addButton:function(t){this.$buttonsContainer.length||this._addButtonsContainer();var e={action:t,label:this.d.loc[t]},s=Datepicker.template(i,e);this.$buttonsContainer.append(s)},_addButtonsContainer:function(){this.d.$datepicker.append(e),this.$buttonsContainer=$(".datepicker--buttons",this.d.$datepicker)},setNavStatus:function(){if((this.opts.minDate||this.opts.maxDate)&&this.opts.disableNavWhenOutOfRange){var t=this.d.parsedDate,e=t.month,i=t.year,s=t.date;switch(this.d.view){case"days":this.d._isInRange(new Date(i,e-1,s),"month")||this._disableNav("prev"),this.d._isInRange(new Date(i,e+1,s),"month")||this._disableNav("next");break;case"months":this.d._isInRange(new Date(i-1,e,s),"year")||this._disableNav("prev"),this.d._isInRange(new Date(i+1,e,s),"year")||this._disableNav("next");break;case"years":this.d._isInRange(new Date(i-10,e,s),"year")||this._disableNav("prev"),this.d._isInRange(new Date(i+10,e,s),"year")||this._disableNav("next")}}},_disableNav:function(t){$('[data-action="'+t+'"]',this.d.$nav).addClass("-disabled-")},_activateNav:function(t){$('[data-action="'+t+'"]',this.d.$nav).removeClass("-disabled-")},_onClickNavButton:function(t){var e=$(t.target).closest("[data-action]"),i=e.data("action");this.d[i]()},_onClickNavTitle:function(t){return $(t.target).hasClass("-disabled-")?void 0:"days"==this.d.view?this.d.view="months":void(this.d.view="years")}}}(); \ No newline at end of file diff --git a/docs/index-ru.html b/docs/index-ru.html index 6f167c0..62425a7 100644 --- a/docs/index-ru.html +++ b/docs/index-ru.html @@ -10,27 +10,8 @@ $('#my-element').datepicker([options]) // Доступ к экземпляру объекта $('#my-element').data('datepicker') -

Примеры

Инициализация с опциями по умолчанию

Пример
<input type='text' class='datepicker-here' />
-

Выбор нескольких дат

Передайте параметр{multipleDates: true}для выбора нескольких дат. Если требуется ограничить количество выбранных дат, то передайте необходимое число{multipleDates: 3}.

Пример
<input type="text"
+

Примеры

Инициализация с опциями по умолчанию

Пример
<input type='text' class='datepicker-here' />
+

Выбор нескольких дат

Передайте параметр{multipleDates: true}для выбора нескольких дат. Если требуется ограничить количество выбранных дат, то передайте необходимое число{multipleDates: 3}.

Пример
<input type="text"
 	class="datepicker-here"
 	data-multiple-dates="3"
 	data-multiple-dates-separator=", "
@@ -103,9 +84,9 @@ $('.my-datepicker').datepicker({
 	dateFormat: 'dd.mm.yyyy',
 	firstDay: 1
 };
-

Опции

inline

Типboolean

Значение по умолчаниюfalse

Если true, то календарь будет виден постоянно.

language

Типstring|object

Значение по умолчанию"ru"

Язык календаря. Если передается строка, то поиск языка будет осуществляться в объектеDatepicker.languageЕсли передан объект, то данные будут браться из него.

Если в объекте локализации не будет хватать каких то полей, то они будут взяты из языка по умолчанию.

startDate

ТипDate

Значение по умолчаниюnew Date()

Дата, которая будет отображаться при инициализации календаря.

firstDay

Типnumber

Значение по умолчанию""

Индекс дня, с которого начинается неделя. Возможные значение от 0 до 6, где 0 - воскресенье и 6 - суббота. +

Опции

classes

Типstring

Значение по умолчанию""

Дополнительные классы для календаря.

inline

Типboolean

Значение по умолчаниюfalse

Если true, то календарь будет виден постоянно.

language

Типstring|object

Значение по умолчанию"ru"

Язык календаря. Если передается строка, то поиск языка будет осуществляться в объектеDatepicker.languageЕсли передан объект, то данные будут браться из него.

Если в объекте локализации не будет хватать каких то полей, то они будут взяты из языка по умолчанию.

startDate

ТипDate

Значение по умолчаниюnew Date()

Дата, которая будет отображаться при инициализации календаря.

firstDay

Типnumber

Значение по умолчанию""

Индекс дня, с которого начинается неделя. Возможные значение от 0 до 6, где 0 - воскресенье и 6 - суббота. По умолчанию берется из локализации, если значение передать сюда, то оно будет иметь больший приоритет. -

weekends

Типarray

Значение по умолчанию[6, 0]

Массив индексов дней, которые будут считаться выходными днями. Им будет добавлен класс.-weekend-. По умолчанию это суббота и воскресенье.

dateFormat

Типstring

Значение по умолчанию""

Желаемый формат даты, кобминация из d, m, yyyy, D, M, и т.д. По умолчанию берется из локализации, если передать значение сюда, то оно будет иметь больший приоритет.

  • d- дата
  • dd- дата с лидирующем нулем
  • D- сокращенное наименование дня
  • DD- полное наименование дня
  • m- номер мясяца
  • mm- номер месяца с лидирующем нулем
  • M- сокращенное наименовение месяца
  • MM- полное наименовение месяца
  • yy- сокращенный номер года
  • yyyy- полный номер года
  • yyyy1- первый год декады, в которую входит текущий год
  • yyyy2- последний год декады, в которую входит текущий год

toggleSelected

Типboolean

Значение по умолчаниюtrue

Если true, то клик на выделенной дате снимет выделение.

position

Типstring

Значение по умолчанию"bottom left"

Позиционирование календаря отностиельно текстового поля. Первым значением задается основная ось позиционирования, +

weekends

Типarray

Значение по умолчанию[6, 0]

Массив индексов дней, которые будут считаться выходными днями. Им будет добавлен класс.-weekend-. По умолчанию это суббота и воскресенье.

dateFormat

Типstring

Значение по умолчанию""

Желаемый формат даты, кобминация из d, m, yyyy, D, M, и т.д. По умолчанию берется из локализации, если передать значение сюда, то оно будет иметь больший приоритет.

  • @- время в миллесекундах
  • d- дата
  • dd- дата с лидирующем нулем
  • D- сокращенное наименование дня
  • DD- полное наименование дня
  • m- номер мясяца
  • mm- номер месяца с лидирующем нулем
  • M- сокращенное наименовение месяца
  • MM- полное наименовение месяца
  • yy- сокращенный номер года
  • yyyy- полный номер года
  • yyyy1- первый год декады, в которую входит текущий год
  • yyyy2- последний год декады, в которую входит текущий год

altField

Типstring|jQuery

Значение по умолчанию""

Альтернативное поле воода в значение которого будут попадать выбранные даты с форматомaltFieldDateFormat.

altFieldDateFormat

Типstring

Значение по умолчанию"@"

Формат даты для альтернативного поля.

toggleSelected

Типboolean

Значение по умолчаниюtrue

Если true, то клик на выделенной дате снимет выделение.

keyboardNav

Типboolean

Значение по умолчаниюtrue

Если true, то по календарю можно будет осуществлять навигацию с помощью клавиатуры.

Сочетания клавиш:

  • Ctrl + → | ↑- переход на месяц вперед
  • Ctrl + ← | ↓- переход на месяц назад
  • Shift + → | ↑- переход на год вперед
  • Shift + ← | ↓- переход на год назад
  • Alt + → | ↑- переход на 10 лет вперед
  • Alt + ← | ↓- переход на 10 лет назад
  • Ctrl + Shift + ↑ | ↓- переход на следующий вид
  • Esc- закрывает календарь

position

Типstring

Значение по умолчанию"bottom left"

Позиционирование календаря отностиельно текстового поля. Первым значением задается основная ось позиционирования, воторым - положение на этой оси. Например{position: "right top"}- утсановит позицию клаендаря справа вверху от текстового поля.

offset

Типnumber

Значение по умолчанию12

Отступ от основной оси позиционирования.

view

Типstring

Значение по умолчанию"days"

Начальный вид календаря. Возможноые значения:

  • days- отображение дней месяца
  • months- отображение месяцев одного года
  • years- отображение годов одной декады

minView

Типstring

Значение по умолчанию"days"

Минимальное представление календаря, по наступлению которого, выбор ячейки приведет к ее активации, а не переходу к следующему виду. Возможные значения такие же как и у параметраview.

showOtherMonths

Типboolean

Значение по умолчаниюtrue

Если true, то будут отображаться дни других месяцев.

selectOtherMonths

Типboolean

Значение по умолчаниюtrue

Если true, то можно будет выбрать дни из других месяцев.

moveToOtherMonthsOnSelect

Типboolean

Значение по умолчаниюtrue

Если true, то при выборе дней из других месяца, будет осуществялться переход к этому месяцу.

showOtherYears

Типboolean

Значение по умолчаниюtrue

Если true, то при отображении декады, будут показаны годы из других декад.

selectOtherYears

Типboolean

Значение по умолчаниюtrue

Если true, то можно будет выбрать года из других декад

moveToOtherYearsOnSelect

Типboolean

Значение по умолчаниюtrue

Если true, то при выборе года из другой декады, будет осуществлен переход к этой декаде.

minDate

ТипDate

Значение по умолчанию""

Минимальная дата для возможности выбора. Все даты, идущее до нее нельзя будет активировать.

maxDate

ТипDate

Значение по умолчанию""

Максимальная дата для возможности выбора. Все даты, идущее после нее нельзя будет выбрать.

disableNavWhenOutOfRange

Типboolean

Значение по умолчаниюtrue

Если true, то при наступлении даты, которая была бы меньше минимально возможной или больше максимально возможной, деактвировались бы кнопки навигации 'вперед', 'назад'

multipleDates

Типboolean|number

Значение по умолчаниюfalse

Если true, то можно будет выбрать неограниченное количество дат. Если передать число, то количество выбираемых дат будет ограниченно этим числом.

multipleDatesSeparator

Типstring

Значение по умолчанию","

Разделитель дат, который будет использован при объеденения нескольких дат в одну строку.

todayButton

Типboolean

Значение по умолчаниюfalse

Если true, то будет отображена кнопка "Сегодня".

clearButton

Типboolean

Значение по умолчаниюfalse

Если true, то будет отображена кнопка "Очистить".

showEvent

Типstring

Значение по умолчанию"focus"

Тип события, по наступлению которого будет показан календарь.

autoClose

Типboolean

Значение по умолчаниюfalse

Если true, то при активации даты, календарь закроется.

prevHtml

Типstring

Значение по умолчанию<svg><path d="M 17,12 l -5,5 l 5,5"></path></svg>

Контент кнопки 'предыдущий месяц|год|декада'.

nextHtml

Типstring

Значение по умолчанию<svg><path d="M 14,12 l 5,5 l -5,5"></path></svg>

Контент кнопки 'следующий месяц|год|декада'.

navTitles

Типobject

Значение по умолчанию

navTitles = {
 	days: 'MM, <i>yyyy</i>',
diff --git a/docs/index.html b/docs/index.html
index a159a7d..0ffc65a 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -77,12 +77,12 @@ $('.my-datepicker').datepicker({
 	clear: 'Clear',
 	dateFormat: 'mm/dd/yy',
 	firstDay: 0
-};

Available localizations located indist/js/i18ndirectory.

Options

inline

Typeboolean

Defaultsfalse

If true, then datepicker will be always visible.

language

Typestring|object

Defaults"ru"

Datepicker's language. If string is passed, then language will be searched inDatepicker.languageobject. +};

Available localizations located indist/js/i18ndirectory.

Options

classes

Typestring

Defaults""

Extra css classes for datepicker.

inline

Typeboolean

Defaultsfalse

If true, then datepicker will be always visible.

language

Typestring|object

Defaults"ru"

Datepicker's language. If string is passed, then language will be searched inDatepicker.languageobject. If object is passed, then data will be taken from this object directly.

If some fields are missing, they will be taken from default localization object ('Russian').

startDate

TypeDate

Defaultsnew Date()

This date will be shown at first initialization.

firstDay

Typenumber

Defaults""

Day index from which week will be started. Possible values are from 0 to 6, where 0 - Sunday and 6 - Saturday. By default value is taken from current localization, but if it passed here then it will have higher priority.

weekends

Typearray

Defaults[6, 0]

Array of day's indexes which will be considered as weekends. Class.-weekend-will be added to relevant cells. -. By default its Saturday and Sunday.

dateFormat

Typestring

Defaults""

Desirable date format. It's combination of d, m, yyyy, D, M, etc. By default value is taken from current localization, but if it passed here, then it will have higher priority.

  • d- date number
  • dd- date with leading zero
  • D- short day name
  • DD- full day name
  • m- month number
  • mm- month number with leading zero
  • M- short month name
  • MM- full month name
  • yy- two digit year number
  • yyyy- four digit year number
  • yyyy1- first year of decade, which included current year
  • yyyy2- last year of decade, which included current year

toggleSelected

Typeboolean

Defaultstrue

If true, then clicking on selected cell will remove selection.

position

Typestring

Defaults"bottom left"

Position of datepicker relative to text input. First value is name of main axis, and second is position on that axis. +. By default its Saturday and Sunday.

dateFormat

Typestring

Defaults""

Desirable date format. It's combination of d, m, yyyy, D, M, etc. By default value is taken from current localization, but if it passed here, then it will have higher priority.

  • @- time in milliseconds
  • d- date number
  • dd- date with leading zero
  • D- short day name
  • DD- full day name
  • m- month number
  • mm- month number with leading zero
  • M- short month name
  • MM- full month name
  • yy- two digit year number
  • yyyy- four digit year number
  • yyyy1- first year of decade, which included current year
  • yyyy2- last year of decade, which included current year

altField

Typestring|jQuery

Defaults""

Alternative text input. UsealtFieldDateFormatfor date formatting.

altFieldDateFormat

Typestring

Defaults"@"

Date format for alternative field.

toggleSelected

Typeboolean

Defaultstrue

If true, then clicking on selected cell will remove selection.

keyboardNav

Typeboolean

Defaultstrue

If true, then one can navigate through calendar by keyboard.

Hot keys:

  • Ctrl + → | ↑- move one month forwards
  • Ctrl + ← | ↓- move one month backwards
  • Shift + → | ↑- move one year forwards
  • Shift + ← | ↓- move one year backwards
  • Alt + → | ↑- move 10 years forwards
  • Alt + ← | ↓- move 10 years backwards
  • Ctrl + Shift + ↑ | ↓- move to next view
  • Esc- hides datepicker

position

Typestring

Defaults"bottom left"

Position of datepicker relative to text input. First value is name of main axis, and second is position on that axis. For example{position: "right top"}- will set datepicker's position from right side on top of text input.

offset

Typenumber

Defaults12

Offset from the main positioning axes.

view

Typestring

Defaults"days"

Start datepicker view. Possible values are:

  • days- display days of one month
  • months- display months of one year
  • years- display years of one decade

minView

Typestring

Defaults"days"

Minimal datepicker's view, on that view selecting cells will not trigger rendering next view, instead it will activate it. -Possible values are the same as inview.

showOtherMonths

Typeboolean

Defaultstrue

If true, then days from other months will be visible.

selectOtherMonths

Typeboolean

Defaultstrue

If true, then one can select days form other months.

moveToOtherMonthsOnSelect

Typeboolean

Defaultstrue

If true, then selecting days from other month, will cause transition to that month.

showOtherYears

Typeboolean

Defaultstrue

If true, then years from other decades will be visible.

selectOtherYears

Typeboolean

Defaultstrue

If true, then on can select years from other decades

moveToOtherYearsOnSelect

Typeboolean

Defaultstrue

If true, then selecting year from other decade, will cause transition to that decade.

minDate

TypeDate

Defaults""

The minimum date for selection. All dates, running before it can't be activated.

maxDate

TypeDate

Defaults""

The maximum date for selection. All dates which comes after it cannot be selected.

disableNavWhenOutOfRange

Typeboolean

Defaultstrue

If true, then at the date, which would be less than minimum possible or more then maximum possible, navigation buttons ('forward', 'back') will be deactivated.

multipleDates

Typeboolean|number

Defaultsfalse

If true, then one can select unlimited dates. If number is passed, then amount of selected dates will be limited by it.

multipleDatesSeparator

Typestring

Defaults","

Dates separator, which will be used when concatenating dates to string.

todayButton

Typeboolean

Defaultsfalse

If true, then button "Today" will be visible.

clearButton

Typeboolean

Defaultsfalse

If true, then button "Clear" will be visible.

showEvent

Typestring

Defaults"focus"

Event type, on which datepicker should be shown.

autoClose

Typeboolean

Defaultsfalse

If true, when after date selection, datepicker will be closed.

prevHtml

Typestring

Defaults<svg><path d="M 17,12 l -5,5 l 5,5"></path></svg>

Contents of 'next' button.

nextHtml

Typestring

Defaults<svg><path d="M 14,12 l 5,5 l -5,5"></path></svg>

Contents of 'prev' button.

navTitles

Typeobject

Defaults

navTitles = {
+Possible values are the same as inview.

showOtherMonths

Typeboolean

Defaultstrue

If true, then days from other months will be visible.

selectOtherMonths

Typeboolean

Defaultstrue

If true, then one can select days form other months.

moveToOtherMonthsOnSelect

Typeboolean

Defaultstrue

If true, then selecting days from other month, will cause transition to that month.

showOtherYears

Typeboolean

Defaultstrue

If true, then years from other decades will be visible.

selectOtherYears

Typeboolean

Defaultstrue

If true, then on can select years from other decades

moveToOtherYearsOnSelect

Typeboolean

Defaultstrue

If true, then selecting year from other decade, will cause transition to that decade.

minDate

TypeDate

Defaults""

The minimum date for selection. All dates, running before it can't be activated.

maxDate

TypeDate

Defaults""

The maximum date for selection. All dates which comes after it cannot be selected.

disableNavWhenOutOfRange

Typeboolean

Defaultstrue

If true, then at the date, which would be less than minimum possible or more then maximum possible, navigation buttons ('forward', 'back') will be deactivated.

multipleDates

Typeboolean|number

Defaultsfalse

If true, then one can select unlimited dates. If number is passed, then amount of selected dates will be limited by it.

multipleDatesSeparator

Typestring

Defaults","

Dates separator, which will be used when concatenating dates to string.

todayButton

Typeboolean

Defaultsfalse

If true, then button "Today" will be visible.

clearButton

Typeboolean

Defaultsfalse

If true, then button "Clear" will be visible.

showEvent

Typestring

Defaults"focus"

Event type, on which datepicker should be shown.

autoClose

Typeboolean

Defaultsfalse

If true, then after date selection, datepicker will be closed.

prevHtml

Typestring

Defaults<svg><path d="M 17,12 l -5,5 l 5,5"></path></svg>

Contents of 'next' button.

nextHtml

Typestring

Defaults<svg><path d="M 14,12 l 5,5 l -5,5"></path></svg>

Contents of 'prev' button.

navTitles

Typeobject

Defaults

navTitles = {
 	  days: 'MM, <i>yyyy</i>',
 	  months: 'yyyy',
 	  years: 'yyyy1 - yyyy2'
@@ -94,7 +94,7 @@ Possible values are the same as inview
 if{multipleDates: true}, then it will be an array of js dates.
  • instobject- plugin instance.
  • onChangeMonth(month, year)

    Typefunction

    Defaultsnull

    Callback when months are changed.

    • monthnumber- month number (from 0 to 12), to which transition is done.
    • yearnumber- year, to which transition is done.

    onChangeYear(year)

    Typefunction

    Defaultsnull

    Callback when year is changed

    • yearnumber- year, to which transition is done.

    onChangeDecade(decade)

    Typefunction

    Defaultsnull

    Callback when decade is changed

    • decadearray- array which consists of two years: first year in decade and last year in decade.

    onChangeView(view)

    Typefunction

    Defaultsnull

    Callback when datepicker's view is changed

    • viewstring- view name, to which transition is done (days, months, years).

    onRenderCell(date, cellType)

    Typefunction

    Defaultsnull

    Callback when datepicker's cell is rendered.

    • dateDate- current cell date
    • cellTypestring- current cell type (day, month, year).

    The callback must return object which may consists of three fields:

    {
     	html: '', // Custom cell content
     	classes: '', // Extra css classes to cell
    -	disabled: '' // true/false, if true, when cell will be disabled
    +	disabled: '' // true/false, if true, then cell will be disabled
     }

    Example

    $('#my-datepicker').datepicker({
     	// Let's make a function which will add class 'my-class' to every 11 of the month
     	// and make these cells disabled.
    diff --git a/docs/jade/mixins/param.jade b/docs/jade/mixins/param.jade
    index 0579de6..3c50e0a 100644
    --- a/docs/jade/mixins/param.jade
    +++ b/docs/jade/mixins/param.jade
    @@ -1,5 +1,5 @@
     mixin param(content, type)
     	span.param-inline
    -		strong= content
    +		strong !{content}
     		if type
     			i= type
    diff --git a/docs/jade/pages/index-ru.jade b/docs/jade/pages/index-ru.jade
    index e1ddbd0..101f043 100644
    --- a/docs/jade/pages/index-ru.jade
    +++ b/docs/jade/pages/index-ru.jade
    @@ -66,7 +66,7 @@ block content
     		h3 Инициализация с опциями по умолчанию
     		+example
     			+example-content
    -				input(type='text' readonly)#test.datepicker-here
    +				input(type='text').datepicker-here
     			+example-code('html')
     				:code
     					
    @@ -229,6 +229,10 @@ block content
     	article
     		h2#options Опции
     
    +		.param
    +			+param-header('classes', 'string', '""')
    +			p Дополнительные классы для календаря.
    +
     		.param
     			+param-header('inline', 'boolean', 'false')
     			p Если true, то календарь будет виден постоянно.
    @@ -262,6 +266,9 @@ block content
     			+param-header('dateFormat', 'string', '""')
     			p Желаемый формат даты, кобминация из d, m, yyyy, D, M, и т.д.  По умолчанию берется из локализации, если передать значение сюда, то оно будет иметь больший приоритет.
     			ul
    +				li
    +					+param('@')
    +					| - время в миллесекундах
     				li
     					+param('d')
     					| - дата
    @@ -299,10 +306,50 @@ block content
     					+param('yyyy2')
     					| - последний год декады, в которую входит текущий год
     
    +		.param
    +			+param-header('altField', 'string|jQuery', '""')
    +			p Альтернативное поле воода в значение которого будут попадать выбранные даты с форматом
    +				+example-inline('altFieldDateFormat')
    +				|.
    +
    +		.param
    +			+param-header('altFieldDateFormat', 'string', '"@"')
    +			p Формат даты для альтернативного поля.
    +
     		.param
     			+param-header('toggleSelected', 'boolean', 'true')
     			p Если true, то клик на выделенной дате снимет выделение.
     
    +		.param
    +			+param-header('keyboardNav', 'boolean', 'true')
    +			p Если true, то по календарю можно будет осуществлять навигацию с помощью клавиатуры.
    +			p Сочетания клавиш:
    +			ul
    +				li
    +					+param('Ctrl + → | ↑')
    +					| - переход на месяц вперед
    +				li
    +					+param('Ctrl + ← | ↓')
    +					| - переход на месяц назад
    +				li
    +					+param('Shift + → | ↑')
    +					| - переход на год вперед
    +				li
    +					+param('Shift + ← | ↓')
    +					| - переход на год назад
    +				li
    +					+param('Alt + → | ↑')
    +					| - переход на 10 лет вперед
    +				li
    +					+param('Alt + ← | ↓')
    +					| - переход на 10 лет назад
    +				li
    +					+param('Ctrl + Shift + ↑ | ↓')
    +					| - переход на следующий вид
    +				li
    +					+param('Esc')
    +					| - закрывает календарь
    +
     		.param
     			+param-header('position', 'string', '"bottom left"')
     			p
    diff --git a/docs/jade/pages/index.jade b/docs/jade/pages/index.jade
    index 7ee261e..d2b43b5 100644
    --- a/docs/jade/pages/index.jade
    +++ b/docs/jade/pages/index.jade
    @@ -215,6 +215,10 @@ block content
     			| directory.
     	article
     		h2#options Options
    +		.param
    +			+param-header('classes', 'string', '""')
    +			p Extra css classes for datepicker.
    +
     		.param
     			+param-header('inline', 'boolean', 'false')
     			p If true, then datepicker will be always visible.
    @@ -245,6 +249,9 @@ block content
     			+param-header('dateFormat', 'string', '""')
     			p Desirable date format. It's combination of d, m, yyyy, D, M, etc. By default value is taken from current localization, but if it passed here, then it will have higher priority.
     			ul
    +				li
    +					+param('@')
    +					| - time in milliseconds
     				li
     					+param('d')
     					| - date number
    @@ -281,9 +288,49 @@ block content
     				li
     					+param('yyyy2')
     					| - last year of decade, which included current year
    +		.param
    +			+param-header('altField', 'string|jQuery', '""')
    +			p Alternative text input. Use
    +				+example-inline('altFieldDateFormat')
    +				| for date formatting.
    +		.param
    +			+param-header('altFieldDateFormat', 'string', '"@"')
    +			p Date format for alternative field.
    +
     		.param
     			+param-header('toggleSelected', 'boolean', 'true')
     			p If true, then clicking on selected cell will remove selection.
    +
    +		.param
    +			+param-header('keyboardNav', 'boolean', 'true')
    +			p If true, then one can navigate through calendar by keyboard.
    +			p Hot keys:
    +			ul
    +				li
    +					+param('Ctrl + → | ↑')
    +					| - move one month forwards
    +				li
    +					+param('Ctrl + ← | ↓')
    +					| - move one month backwards
    +				li
    +					+param('Shift + → | ↑')
    +					| - move one year forwards
    +				li
    +					+param('Shift + ← | ↓')
    +					| - move one year backwards
    +				li
    +					+param('Alt + → | ↑')
    +					| - move 10 years forwards
    +				li
    +					+param('Alt + ← | ↓')
    +					| - move 10 years backwards
    +				li
    +					+param('Ctrl + Shift + ↑ | ↓')
    +					| - move to next view
    +				li
    +					+param('Esc')
    +					| - hides datepicker
    +
     		.param
     			+param-header('position', 'string', '"bottom left"')
     			p
    @@ -358,7 +405,7 @@ block content
     			p Event type, on which datepicker should be shown.
     		.param
     			+param-header('autoClose', 'boolean', 'false')
    -			p If true, when after date selection, datepicker will be closed.
    +			p If true, then after date selection, datepicker will be closed.
     		.param
     			+param-header('prevHtml', 'string', '')
     			p Contents of 'next' button.
    @@ -453,7 +500,7 @@ block content
     				{
     					html: '', // Custom cell content
     					classes: '', // Extra css classes to cell
    -					disabled: '' // true/false, if true, when cell will be disabled
    +					disabled: '' // true/false, if true, then cell will be disabled
     				}
     			h4 Example
     			+example-code('js').
    diff --git a/src/js/datepicker.js b/src/js/datepicker.js
    index 61faff5..a98800a 100644
    --- a/src/js/datepicker.js
    +++ b/src/js/datepicker.js
    @@ -22,6 +22,7 @@ var Datepicker;
                 altField: '',
                 altFieldDateFormat: '@',
                 toggleSelected: true,
    +            keyboardNav: true,
     
                 position: 'bottom left',
                 offset: 12,
    @@ -59,7 +60,6 @@ var Datepicker;
                     months: 'yyyy',
                     years: 'yyyy1 - yyyy2'
                 },
    -            keyboardNav: true,
     
                 // events
                 onSelect: '',