From 139feac13f0561c5651abbc4b7e670e6d1838bdf Mon Sep 17 00:00:00 2001
From: Benjamin Albert The jQuery UI Month Picker Plugin is designed to allow user input for only a month and year when only that input is
required. Clicking on the year, allows the user to jump ahead or back 5 years at a time. Clicking anywhere on the
page, except on the month picker menu itself, will cause the month picker to hide. The Month Picker has lots of options
diff --git a/css/MonthPicker.css b/css/MonthPicker.css
index 1ad2129..888bfe1 100644
--- a/css/MonthPicker.css
+++ b/css/MonthPicker.css
@@ -1,6 +1,6 @@
/*
-The jQuery UI Month Picker Version 2.6
+The jQuery UI Month Picker Version 3.0-alpha1
https://github.com/KidSysco/jquery-ui-month-picker/
@@ -17,10 +17,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
*/
.month-picker {
- /*padding: 2px;*/
- background-color: #fff;
- /*width: 200px;*/
- display: none;
+ display: inline-block;
position: absolute;
z-index: 9999;
}
@@ -49,11 +46,13 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
font-size: 12px;
font-family: Verdana, Arial, sans-serif;
}
+.month-picker-year-table {
+ width: 100%;
+}
.month-picker-year-table .year-container {
width: 50px;
}
.month-picker-year-table .previous-year {
- /*width: 35px;*/
/*
In case the user's css reset the user agent stylesheet
this is often done in RTL pages.
@@ -61,7 +60,6 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
text-align: left;
}
.month-picker-year-table .next-year {
- /*width: 35px;*/
text-align: right;
}
diff --git a/demo/Demo.min.css b/demo/Demo.min.css
index 2cb98b9..0bd0ee4 100644
--- a/demo/Demo.min.css
+++ b/demo/Demo.min.css
@@ -1 +1 @@
-.month-picker .year-container-all,.option-link{cursor:pointer}.month-picker{width:200px;display:none;position:absolute;z-index:9999}.month-year-input{width:60px}.month-picker-year-table .year-container-all{text-align:center}.month-picker-year-table .year-container{margin:0 auto;width:50px}.month-picker-year-table .year,.month-picker-year-table .year-title{margin:3px;font-size:12px;font-family:Verdana,Arial,sans-serif}.month-picker-year-table .previous-year{width:35px;text-align:left}.month-picker-year-table .next-year{width:35px;text-align:right}.month-picker-year-table button{width:28px;width:1.8em;height:1.8em;text-align:center;cursor:pointer}.month-picker-year-table .year-container{text-align:center}.month-picker-month-table td{height:35px;text-align:center;font-size:12px}.month-picker-open-button{height:20px;width:20px;vertical-align:bottom}.month-picker-invalid-message{display:none;background-color:#ff0}.month-picker-disabled,.option-block{background-color:#e1e1e1}body{font-size:12px;font-family:Verdana,Arial,sans-serif}.option-block{display:none;padding:4px;border:1px solid #000}.option{margin:20px;border:1px solid Gray;padding:4px}.demo,.demo-position{background-color:#e1e1e1;padding:8px;border:1px solid Gray}.option-link{text-decoration:underline;color:#00f;font-weight:700}.option-link:hover{color:Red}.option-type{margin:0 25px}.demo-position{width:100%}.text-right{text-align:right}
\ No newline at end of file
+.month-picker .year-container-all,.option-link{cursor:pointer}.month-picker{display:inline-block;position:absolute;z-index:9999}.month-year-input{width:60px}.month-picker-header{margin:3px 3px 0}.month-picker-year-table .year-container-all{text-align:center}.month-picker-year-table .year-container{margin:0 auto}.month-picker-year-table .year,.month-picker-year-table .year-title{margin:3px;font-size:12px;font-family:Verdana,Arial,sans-serif}.month-picker-year-table{width:100%}.month-picker-year-table .year-container{width:50px}.month-picker-year-table .previous-year{text-align:left}.month-picker-year-table .next-year{text-align:right}.month-picker-year-table .next-year>button{margin-right:0}.month-picker-year-table button{width:28px;width:1.8em;height:1.8em;text-align:center;cursor:pointer}.month-picker-year-table .year-container{text-align:center}.month-picker-month-table td{padding:0;height:35px;text-align:center;font-size:12px}.month-picker-month-table button{width:55px;margin:3px}.month-picker-open-button{height:20px;width:20px;vertical-align:bottom}.month-picker-invalid-message{display:none;background-color:#ff0}.month-picker-disabled,.option-block{background-color:#e1e1e1}body{font-size:12px;font-family:Verdana,Arial,sans-serif}.option-block{display:none;padding:4px;border:1px solid #000}.option{margin:20px;border:1px solid Gray;padding:4px}.demo,.demo-position{background-color:#e1e1e1;padding:8px;border:1px solid Gray}.option-link{text-decoration:underline;color:#00f;font-weight:700}.option-link:hover{color:Red}.option-type{margin:0 25px}.demo-position{width:100%}.text-right{text-align:right}
\ No newline at end of file
diff --git a/demo/Demo.min.js b/demo/Demo.min.js
index 257eff4..0c12399 100644
--- a/demo/Demo.min.js
+++ b/demo/Demo.min.js
@@ -1 +1 @@
-!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a The jQuery UI Month Picker Plugin is designed to allow user input for only a month and year when only that input is
required. Clicking on the year, allows the user to jump ahead or back 5 years at a time. Clicking anywhere on the
page, except on the month picker menu itself, will cause the month picker to hide. The Month Picker has lots of options
From 1a7d29e08732552bce4c929bc8263d91b3d6676c Mon Sep 17 00:00:00 2001
From: Benjamin Albert
+
+ Example: The jQuery UI Month Picker Plugin is designed to allow user input for only a month and year when only that input is
-required. Clicking on the year, allows the user to jump ahead or back 5 years at a time. Clicking anywhere on the
-page, except on the month picker menu itself, will cause the month picker to hide. The Month Picker has lots of options
+ The jQuery UI Month Picker Plugin is designed to allow user input for only a month and year when only that input is
+required. Clicking on the year, allows the user to jump ahead or back 5 years at a time. Clicking anywhere on the
+page, except on the month picker menu itself, will cause the month picker to hide. The Month Picker has lots of options
for date validation, setting the start year, using an icon button, input masking, internationalization and localization and more. This plugin has been tested using the following configuration. Attach all required css and js files to the web page as follows... Attach all required css and js files to the web page as follows... This plugin can only be called on the text or the HTML 5 Month Input Types as follows. This plugin can only be called on the text or the HTML 5 Month Input Types as follows. NOTE: It might be possible to prevent the menu from closing by calling event.stopPropagation() in the click event that called the Open method.
+ NOTE: It might be possible to prevent the menu from closing by calling event.stopPropagation() in the click event that called the Open method.
However this is not supported and might stop working in future releases if we change the way the plugin handles events. To prevent the menu from hideing use the OnBeforeMenuClose event (example included) and call event.preventDefault() for the element triggering the event.
@@ -162,8 +162,8 @@ However this is not supported and might stop working in future releases i
Set the option upon init.
Disables past months upon init.
Disables future months upon init.
Set the option upon init.
Set the option upon init.
Set the option upon init.
Set the option upon init.
Set the option upon init.
Set the option upon init.
Set the option upon init.
-
+
Set the option upon init.
-
+
Set the option upon init.
-
+
Set the option upon init.
Set the option upon init.
To set the animation for closing the menu see the HideAnim option.
Set the option upon init.
To set the animation for opening the menu see the ShowAnim option.
Set the option upon init.
Supply a callback function to handle the event as an init option.
Supply a callback function to handle the event as an init option.
Supply a callback function to handle the event as an init option.
Supply a callback function to handle the event as an init option.
Supply a callback function to handle the event as an init option.
Supply a callback function to handle the event as an init option.
Supply a callback function to handle the event as an init option.
Supply a callback function to handle the event as an init option.
Supply a callback function to handle the event as an init option.
Supply a callback function to handle the event as an init option.
npm install grunt grunt test The jQuery UI Month Picker Plugin is designed to allow user input for only a month and year when only that input is
-required. Clicking on the year, allows the user to jump ahead or back 5 years at a time. Clicking anywhere on the
+required. Clicking on the year, allows the user to jump ahead or back 12 years at a time. Clicking anywhere on the
page, except on the month picker menu itself, will cause the month picker to hide. The Month Picker has lots of options
for date validation, setting the start year, using an icon button, input masking, internationalization and localization and more.
+Please read the 3.x Upgrade Guide
+ This plugin has been tested using the following configuration.' +
'
' +
'' +
' ' +
'' +
@@ -184,7 +184,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
' ' +
'
").appendTo(m);p.append(' ')}this._buttons=a("button",m).button(),i.on(H,function(a){return!1});var q=this,r="Month";a.each(["Min","Max"],function(a,b){q["_set"+b+r]=function(a){(q["_"+b+r]=j(q,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},q._setOption(b+r,q.options[b+r])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this._updateFieldEvents(),this.Destroy=this.destroy,k?this.Open():b.change(F(this._updateAlt,this))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===[null,""].indexOf(b)){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return parseInt(this._yearContainer.text(),10)},_setPickerYear:function(a){this._yearContainer.text(a||(new d).getFullYear())},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._yearContainerAll.css("cursor","pointer"),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=5,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._yearContainerAll.css("cursor","default"),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){var b=this._yearContainer;b.text(parseInt(b.text())+a,10),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){var b=this._yearContainer;b.text(parseInt(b.text())+a,10),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a,b,c,d){"use strict";function e(a){return a.getMonth()+12*a.getFullYear()}function f(a){return Math.floor(a/12)}function g(){a(this).addClass(t)}function h(a,b){return a[b?"on":"off"]("mousenter mouseout",g).toggleClass(t,b)}function i(a,b,c){return(!b||a>=b)&&(!c||c>=a)}function j(b,c){if(null===c)return c;if(c instanceof d)return e(c);if(a.isNumeric(c))return e(new d)+parseInt(c,10);var f=b._parseMonth(c);return f?e(f):l(c)}function k(a,b){return F(b.options[a]||E,b.element[0])}function l(a,b){var c=a.trim();c=c.replace(/y/i,'":"y"'),c=c.replace(/m/i,'":"m"');try{var f=JSON.parse('{"'+c.replace(/ /g,',"')+"}"),g={};for(var h in f)g[f[h]]=h;var i=e(new d);return i+=parseInt(g.m,10)||0,i+12*(parseInt(g.y,10)||0)}catch(j){return!1}}function m(b){return a(''+b.i18n.buttonText+"").button({text:!1,icons:{primary:b.ButtonIcon}})}function n(a,b){a.button("option",{icons:{primary:"ui-icon-circle-triangle-"+(b?"w":"e")}})}function o(a){return!a.is("input")}if(!(a&&a.ui&&a.ui.button&&a.ui.datepicker))return void alert(w+"The jQuery UI button and datepicker plug-ins must be loaded.");var p=a.fx.speeds,q=".MonthPicker",r="month-picker-disabled",s="ui-state-highlight",t="ui-state-active",u={my:"left top+1",at:"left bottom"},v={my:"right top+1",at:"right bottom"},w="MonthPicker Error: ",x=w+"The jQuery UI position plug-in must be loaded.",y=w+"Unsupported % option value, supported values are: ",z=w+'"_" is not a valid %Month value.',A=null,B=!!a.ui.position,C={Animation:["slideToggle","fadeToggle","none"],ShowAnim:["fadeIn","slideDown","none"],HideAnim:["fadeOut","slideUp","none"]},D={ValidationErrorMessage:"_createValidationMessage",Disabled:"_setDisabledState",ShowIcon:"_updateButton",Button:"_updateButton",ShowOn:"_updateFieldEvents",IsRTL:"_setRTL",AltFormat:"_updateAlt",AltField:"_updateAlt",StartYear:"_setPickerYear",MinMonth:"_setMinMonth",MaxMonth:"_setMaxMonth",SelectedMonth:"_setSelectedMonth"},E=a.noop,F=a.proxy,G=a.datepicker,H="click"+q;a.MonthPicker={VERSION:"3.0-alpha1",i18n:{year:"Year",prevYear:"Previous Year",nextYear:"Next Year",next5Years:"Jump Forward 5 Years",prev5Years:"Jump Back 5 Years",nextLabel:"Next",prevLabel:"Prev",buttonText:"Open Month Chooser",jumpYears:"Jump Years",months:["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sep.","Oct.","Nov.","Dec."]}};var I=' ").appendTo(m);p.append(' ')}this._buttons=a("button",m).button(),i.on(H,function(a){return!1});var q=this,r="Month";a.each(["Min","Max"],function(a,b){q["_set"+b+r]=function(a){(q["_"+b+r]=j(q,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},q._setOption(b+r,q.options[b+r])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===[null,""].indexOf(b)){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return parseInt(this._yearContainer.text(),10)},_setPickerYear:function(a){this._yearContainer.text(a||(new d).getFullYear())},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._yearContainerAll.css("cursor","pointer"),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=5,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._yearContainerAll.css("cursor","default"),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){var b=this._yearContainer;b.text(parseInt(b.text())+a,10),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){var b=this._yearContainer;b.text(parseInt(b.text())+a,10),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/README.md b/README.md
index d15ed76..2a1acc8 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
- The jQuery UI Month Picker Version 2.8.1
+The jQuery UI Month Picker Version 3.0-alpha1
").appendTo(m);p.append(' ')}this._buttons=a("button",m).button(),i.on(H,function(a){return!1});var q=this,r="Month";a.each(["Min","Max"],function(a,b){q["_set"+b+r]=function(a){(q["_"+b+r]=j(q,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},q._setOption(b+r,q.options[b+r])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this._updateFieldEvents(),this.Destroy=this.destroy,k?this.Open():b.change(F(this._updateAlt,this))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===[null,""].indexOf(b)){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return parseInt(this._yearContainer.text(),10)},_setPickerYear:function(a){this._yearContainer.text(a||(new d).getFullYear())},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._yearContainerAll.css("cursor","pointer"),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=5,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._yearContainerAll.css("cursor","default"),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){var b=this._yearContainer;b.text(parseInt(b.text())+a,10),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){var b=this._yearContainer;b.text(parseInt(b.text())+a,10),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(m);p.append(' ')}this._buttons=a("button",m).button(),i.on(H,function(a){return!1});var q=this,r="Month";a.each(["Min","Max"],function(a,b){q["_set"+b+r]=function(a){(q["_"+b+r]=j(q,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},q._setOption(b+r,q.options[b+r])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===[null,""].indexOf(b)){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return parseInt(this._yearContainer.text(),10)},_setPickerYear:function(a){this._yearContainer.text(a||(new d).getFullYear())},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._yearContainerAll.css("cursor","pointer"),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=5,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._yearContainerAll.css("cursor","default"),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){var b=this._yearContainer;b.text(parseInt(b.text())+a,10),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){var b=this._yearContainer;b.text(parseInt(b.text())+a,10),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/test/test.js b/test/test.js
index 6bcf776..f7c03e9 100644
--- a/test/test.js
+++ b/test/test.js
@@ -122,7 +122,8 @@ if ($.ui.position) {
collision: 'fit flip'
},
OnAfterMenuOpen: function () {
- var _lastPointFullyVisibleX = _windowWidth - 200;
+ var _meun = $(MonthPicker_PositionDemo);
+ var _lastPointFullyVisibleX = _windowWidth - _meun.width();
var _lastPointFullyVisibleY = _windowHeight - _pickerMenu.height();
assert.equal(_pickerMenu.css('display'), 'block', '#PositionDemo responded to a text input click event and showed the menu.');
assert.ok(_pickerMenu.position().left <= _lastPointFullyVisibleX, "#PositionDemo does not overlap the right window boundary on the X axis.");
@@ -363,21 +364,19 @@ QUnit.test('Inline menu', function(assert) {
var menu = $(MonthPicker_InlineMenuDiv);
- assert.ok(menu.is(':visible'), 'The menu is visible without having to call the Open method');
-
+ assert.ok(menu.width() <= 200, 'The menu is visible and has the expected width');
$(document.body).trigger('click');
assert.ok(menu.is(':visible'), 'The menu is still visible after clicking outside the menu');
- //var buttons = menu.find('.month-picker-month-table button');
menu.find('.button-1').trigger('click');
assert.ok(menu.is(':visible'), 'The menu is still visible after choosing a month');
assert.notOk($("#MonthPicker_Button_InlineMenuDiv").length, 'The default button was not created');
- //field.MonthPicker('destroy');
+ field.MonthPicker('destroy');
});
QUnit.test('SelectedMonth option', function(assert) {
@@ -399,7 +398,7 @@ QUnit.test('SelectedMonth option', function(assert) {
var date = field.MonthPicker('GetSelectedDate');
assert.ok( menu.find('.button-1').is('.ui-state-active'), 'January is selected after changing the SelectedMonth');
- //field.MonthPicker('Destroy');
+ field.MonthPicker('Destroy');
});
// Makes sure that all events are triggered as expected.
@@ -612,10 +611,11 @@ QUnit.test('Right to left', function (assert) {
assert.ok(nextYearButton.find('span.ui-icon-circle-triangle-w').length, 'Next button is pointed west');
// Make sure the menu opens to the right of the field.
+ //alert(field.position().left - menu.position().left);
var opendToTheRight = (field.position().left - menu.position().left) > 100;
assert.ok(opendToTheRight, 'The menu opened to the right of rhe field');
- field.MonthPicker('Close');
+ //field.MonthPicker('Close');
});
QUnit.test('Toggle method', function (assert) {
From 30d32736cc9a98c41b6bbf5357dcb752642a2901 Mon Sep 17 00:00:00 2001
From: Benjamin Albert The jQuery UI Month Picker Version 3.0-alpha2
+[](https://travis-ci.org/benjamin-albert/jquery-ui-month-picker)
+[](http://gruntjs.com/)
+
' +
+ '
' +
'
' +
'' +
'' +
' ' +
' ' +
@@ -188,9 +185,9 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
' ' +
+ '
' +
'
").appendTo(m);p.append(' ')}this._buttons=a("button",m).button(),i.on(H,function(a){return!1});var q=this,r="Month";a.each(["Min","Max"],function(a,b){q["_set"+b+r]=function(a){(q["_"+b+r]=j(q,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},q._setOption(b+r,q.options[b+r])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===[null,""].indexOf(b)){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return parseInt(this._yearContainer.text(),10)},_setPickerYear:function(a){this._yearContainer.text(a||(new d).getFullYear())},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._yearContainerAll.css("cursor","pointer"),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=5,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._yearContainerAll.css("cursor","default"),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){var b=this._yearContainer;b.text(parseInt(b.text())+a,10),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){var b=this._yearContainer;b.text(parseInt(b.text())+a,10),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a,b,c,d){"use strict";function e(a){return a.getMonth()+12*a.getFullYear()}function f(a){return Math.floor(a/12)}function g(){a(this).addClass(t)}function h(a,b){return a[b?"on":"off"]("mousenter mouseout",g).toggleClass(t,b)}function i(a,b,c){return(!b||a>=b)&&(!c||c>=a)}function j(b,c){if(null===c)return c;if(c instanceof d)return e(c);if(a.isNumeric(c))return e(new d)+parseInt(c,10);var f=b._parseMonth(c);return f?e(f):l(c)}function k(a,b){return F(b.options[a]||E,b.element[0])}function l(a,b){var c=a.trim();c=c.replace(/y/i,'":"y"'),c=c.replace(/m/i,'":"m"');try{var f=JSON.parse('{"'+c.replace(/ /g,',"')+"}"),g={};for(var h in f)g[f[h]]=h;var i=e(new d);return i+=parseInt(g.m,10)||0,i+12*(parseInt(g.y,10)||0)}catch(j){return!1}}function m(b){return a(''+b.i18n.buttonText+"").button({text:!1,icons:{primary:b.ButtonIcon}})}function n(a,b){a.button("option",{icons:{primary:"ui-icon-circle-triangle-"+(b?"w":"e")}})}function o(a){return!a.is("input")}if(!(a&&a.ui&&a.ui.button&&a.ui.datepicker))return void alert(w+"The jQuery UI button and datepicker plug-ins must be loaded.");var p=a.fx.speeds,q=".MonthPicker",r="month-picker-disabled",s="ui-state-highlight",t="ui-state-active",u={my:"left top+1",at:"left bottom"},v={my:"right top+1",at:"right bottom"},w="MonthPicker Error: ",x=w+"The jQuery UI position plug-in must be loaded.",y=w+"Unsupported % option value, supported values are: ",z=w+'"_" is not a valid %Month value.',A=null,B=!!a.ui.position,C={Animation:["slideToggle","fadeToggle","none"],ShowAnim:["fadeIn","slideDown","none"],HideAnim:["fadeOut","slideUp","none"]},D={ValidationErrorMessage:"_createValidationMessage",Disabled:"_setDisabledState",ShowIcon:"_updateButton",Button:"_updateButton",ShowOn:"_updateFieldEvents",IsRTL:"_setRTL",AltFormat:"_updateAlt",AltField:"_updateAlt",StartYear:"_setPickerYear",MinMonth:"_setMinMonth",MaxMonth:"_setMaxMonth",SelectedMonth:"_setSelectedMonth"},E=a.noop,F=a.proxy,G=a.datepicker,H="click"+q;a.MonthPicker={VERSION:"3.0-alpha3",i18n:{year:"Year",prevYear:"Previous Year",nextYear:"Next Year",next5Years:"Jump Forward 5 Years",prev5Years:"Jump Back 5 Years",nextLabel:"Next",prevLabel:"Prev",buttonText:"Open Month Chooser",jumpYears:"Jump Years",months:["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sep.","Oct.","Nov.","Dec."]}};var I=' ").appendTo(m);p.append(' ')}this._buttons=a("button",m).button(),i.on(H,function(a){return!1});var q=this,r="Month";a.each(["Min","Max"],function(a,b){q["_set"+b+r]=function(a){(q["_"+b+r]=j(q,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},q._setOption(b+r,q.options[b+r])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===[null,""].indexOf(b)){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return parseInt(this._yearContainer.text(),10)},_setPickerYear:function(a){this._yearContainer.text(a||(new d).getFullYear())},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._yearContainerAll.css("cursor","pointer"),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=5,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._yearContainerAll.css("cursor","default"),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){var b=this._yearContainer;b.text(parseInt(b.text())+a,10),this.element.focus();var c=this;setTimeout(function(){var b=a>0?c._nextButton:c._prevButton;b.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){var b=this._yearContainer;b.text(parseInt(b.text())+a,10),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/README.md b/README.md
index f7fe4cc..d0099c5 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
- The jQuery UI Month Picker Version 3.0-alpha2
+The jQuery UI Month Picker Version 3.0-alpha3
[](https://travis-ci.org/benjamin-albert/jquery-ui-month-picker)
[](http://gruntjs.com/)
diff --git a/css/MonthPicker.css b/css/MonthPicker.css
index 8203dd3..741d18a 100644
--- a/css/MonthPicker.css
+++ b/css/MonthPicker.css
@@ -21,9 +21,6 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
position: absolute;
z-index: 9999;
}
-.month-year-input {
- width: 60px;
-}
.month-picker .year-container-all {
cursor: pointer;
}
@@ -39,7 +36,6 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
.month-picker-year-table a {
border: 1px solid transparent;
}
-
.month-picker-year-table .year-title {
margin: 3px;
font-size: 12px;
@@ -56,25 +52,28 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
.month-picker-year-table .year-container {
width: 50px;
}
-.month-picker-year-table .previous-year {
+.month-picker-year-table .previous-year>a {
/*
In case the user's css reset the user agent stylesheet
this is often done in RTL pages.
*/
- text-align: left;
+ /*text-align: left;*/
+ float: left;
}
-.month-picker-year-table .next-year {
- text-align: right;
+.month-picker-year-table .next-year>a {
+ /*text-align: right;*/
+ float: right;
}
-.month-picker-year-table .next-year>button {
- margin-right: 0;
+.month-picker-year-table td {
+ padding: 0px;
}
.month-picker-year-table /*button*/ a {
- width: 28px;
- width: 1.8em;
- height: 1.8em;
+ /*width: 28px;*/
+ margin: 0px;
+ width: 1.5em;
+ height: 1.5em;
text-align: center;
cursor: pointer;
}
diff --git a/demo/Demo.min.css b/demo/Demo.min.css
index 0bd0ee4..d66cfad 100644
--- a/demo/Demo.min.css
+++ b/demo/Demo.min.css
@@ -1 +1 @@
-.month-picker .year-container-all,.option-link{cursor:pointer}.month-picker{display:inline-block;position:absolute;z-index:9999}.month-year-input{width:60px}.month-picker-header{margin:3px 3px 0}.month-picker-year-table .year-container-all{text-align:center}.month-picker-year-table .year-container{margin:0 auto}.month-picker-year-table .year,.month-picker-year-table .year-title{margin:3px;font-size:12px;font-family:Verdana,Arial,sans-serif}.month-picker-year-table{width:100%}.month-picker-year-table .year-container{width:50px}.month-picker-year-table .previous-year{text-align:left}.month-picker-year-table .next-year{text-align:right}.month-picker-year-table .next-year>button{margin-right:0}.month-picker-year-table button{width:28px;width:1.8em;height:1.8em;text-align:center;cursor:pointer}.month-picker-year-table .year-container{text-align:center}.month-picker-month-table td{padding:0;height:35px;text-align:center;font-size:12px}.month-picker-month-table button{width:55px;margin:3px}.month-picker-open-button{height:20px;width:20px;vertical-align:bottom}.month-picker-invalid-message{display:none;background-color:#ff0}.month-picker-disabled,.option-block{background-color:#e1e1e1}body{font-size:12px;font-family:Verdana,Arial,sans-serif}.option-block{display:none;padding:4px;border:1px solid #000}.option{margin:20px;border:1px solid Gray;padding:4px}.demo,.demo-position{background-color:#e1e1e1;padding:8px;border:1px solid Gray}.option-link{text-decoration:underline;color:#00f;font-weight:700}.option-link:hover{color:Red}.option-type{margin:0 25px}.demo-position{width:100%}.text-right{text-align:right}
\ No newline at end of file
+.month-picker .year-container-all,.option-link{cursor:pointer}.month-picker{display:inline-block;position:absolute;z-index:9999}.month-picker-header{margin:3px 3px 0}.month-picker-year-table .year-container-all{text-align:center}.month-picker-year-table .year-container{margin:0 auto}.month-picker-year-table .year,.month-picker-year-table .year-title{margin:3px;font-size:12px;font-family:Verdana,Arial,sans-serif}.month-picker-year-table{width:100%}.month-picker-year-table .year-container{width:50px;text-align:center}.month-picker-year-table .previous-year>a{float:left}.month-picker-year-table .next-year>a{float:right}.month-picker-year-table td{padding:0}.month-picker-year-table a{border:1px solid transparent;margin:0;width:1.5em;height:1.5em;text-align:center;cursor:pointer}.month-picker-month-table td{padding:0;height:35px;text-align:center;font-size:12px}.month-picker-month-table button{width:55px;margin:3px}.month-picker-open-button{height:20px;width:20px;vertical-align:bottom}.month-picker-invalid-message{display:none;background-color:#ff0}.month-picker-disabled,.option-block{background-color:#e1e1e1}body{font-size:12px;font-family:Verdana,Arial,sans-serif}.option-block{display:none;padding:4px;border:1px solid #000}.option{margin:20px;border:1px solid Gray;padding:4px}.demo,.demo-position{background-color:#e1e1e1;padding:8px;border:1px solid Gray}.option-link{text-decoration:underline;color:#00f;font-weight:700}.option-link:hover{color:Red}.option-type{margin:0 25px}.demo-position{width:100%}.text-right{text-align:right}
\ No newline at end of file
diff --git a/demo/Demo.min.js b/demo/Demo.min.js
index d0a4379..4376acd 100644
--- a/demo/Demo.min.js
+++ b/demo/Demo.min.js
@@ -1 +1 @@
-!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a").appendTo(m);p.append(' ')}this._buttons=a("button",m).button(),i.on(H,function(a){return!1});var q=this,r="Month";a.each(["Min","Max"],function(a,b){q["_set"+b+r]=function(a){(q["_"+b+r]=j(q,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},q._setOption(b+r,q.options[b+r])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===[null,""].indexOf(b)){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return parseInt(this._yearContainer.text(),10)},_setPickerYear:function(a){this._yearContainer.text(a||(new d).getFullYear())},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._yearContainerAll.css("cursor","pointer"),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=5,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._yearContainerAll.css("cursor","default"),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){var b=this._yearContainer;b.text(parseInt(b.text())+a,10),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){var b=this._yearContainer;b.text(parseInt(b.text())+a,10),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(m);p.append(' ')}this._buttons=a("button",m).button(),i.on(H,function(a){return!1});var q=this,r="Month";a.each(["Min","Max"],function(a,b){q["_set"+b+r]=function(a){(q["_"+b+r]=j(q,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},q._setOption(b+r,q.options[b+r])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===[null,""].indexOf(b)){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return parseInt(this._yearContainer.text(),10)},_setPickerYear:function(a){this._yearContainer.text(a||(new d).getFullYear())},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._yearContainerAll.css("cursor","pointer"),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=5,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._yearContainerAll.css("cursor","default"),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){var b=this._yearContainer;b.text(parseInt(b.text())+a,10),this.element.focus();var c=this;setTimeout(function(){var b=a>0?c._nextButton:c._prevButton;b.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){var b=this._yearContainer;b.text(parseInt(b.text())+a,10),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/test/test.html b/test/test.html
index ff57015..5774922 100644
--- a/test/test.html
+++ b/test/test.html
@@ -3,7 +3,7 @@
+
+
+
+
+
\ No newline at end of file
From fc99cc497bd8e0feebe6d49ff2118e1808f0ac35 Mon Sep 17 00:00:00 2001
From: Benjamin Albert ' +
'
' +
' ' +
@@ -187,7 +191,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
'' +
' ' +
+ /*
' ' +
'' +
' ' +
'
').appendTo($table) : $tr;
$tr.append(' ');
}
-
+
this._buttons = $('button', $table).button();
-
+
_menu.on(click, function (event) {
return false;
});
- // Checks and initailizes Min/MaxMonth properties
+ // Checks and initailizes Min/MaxMonth properties
// (creates _setMinMonth and _setMaxMonth methods).
var me = this, Month = 'Month';
$.each(['Min', 'Max'], function(i, type) {
@@ -368,22 +400,22 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
alert(_badMinMaxVal.replace(/%/, type).replace(/_/, val));
}
};
-
+
me._setOption(type + Month, me.options[type + Month]);
});
-
+
var _selMonth = _opts.SelectedMonth;
if (_selMonth !== void 0) {
var month = _encodeMonth(this, _selMonth);
_el.val( this._formatMonth(new Date( _toYear(month), month % 12, 1)) );
}
-
+
this._updateAlt();
-
+
this._setUseInputMask();
this._setDisabledState();
this.Destroy = this.destroy;
-
+
if (isInline) {
this.Open();
} else {
@@ -395,11 +427,11 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
},
/****** Publicly Accessible API functions ******/
-
+
GetSelectedDate: function () {
return this._parseMonth();
},
-
+
GetSelectedYear: function () {
var date = this.GetSelectedDate();
return date ? date.getFullYear() : NaN;
@@ -409,17 +441,17 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
var date = this.GetSelectedDate();
return date ? date.getMonth()+1 : NaN;
},
-
+
Validate: function() {
var _date = this.GetSelectedDate();
-
+
if (this.options.ValidationErrorMessage !== null && !this.options.Disabled) {
this._validationMessage.toggle(!_date);
}
-
+
return _date;
},
-
+
GetSelectedMonthYear: function () {
var date = this.Validate();
return date ? (date.getMonth() + 1) + '/' + date.getFullYear() : null;
@@ -445,11 +477,11 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
this.element.val('');
this._validationMessage.hide();
},
-
+
Toggle: function (event) {
return this._visible ? this.Close(event) : this.Open(event);
},
-
+
Open: function (event) {
var _elem = this.element, _opts = this.options;
if (!_opts.Disabled && !this._visible) {
@@ -458,13 +490,13 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
if (_event('OnBeforeMenuOpen', this)(event) === false || event.isDefaultPrevented()) {
return false;
}
-
+
this._visible = true;
this._ajustYear(_opts);
var _menu = this._monthPickerMenu;
this._showMonths();
-
+
if (_isInline(_elem)) {
_menu.css('position', 'static').show();
_event('OnAfterMenuOpen', this)();
@@ -473,22 +505,22 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
if (_openedInstance) {
_openedInstance.Close(event);
}
-
+
_openedInstance = this;
-
+
$(document).on(click + this.uuid, $proxy(this.Close, this))
.on('keydown' + _eventsNs + this.uuid, $proxy(this._keyDown, this));
-
+
// Trun off validation so that clicking one of the months
// won't blur the input field and trogger vlaidation
// befroe the month was chosen (click event was triggered).
// It is turned back on when Hide() is called.
_elem.off('blur' + _eventsNs).focus();
-
+
var _anim = _opts.ShowAnim || _opts.Animation,
_noAnim = _anim === 'none';
-
- // jQuery UI overrides jQuery.show and dosen't
+
+ // jQuery UI overrides jQuery.show and dosen't
// call the start callback.
// see: http://api.jqueryui.com/show/
_menu[ _noAnim ? 'fadeIn' : _anim ]({
@@ -498,30 +530,30 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
});
}
}
-
+
return false;
},
-
- Close: function (event) {
+
+ Close: function (event) {
var _elem = this.element;
if (!_isInline(_elem) && this._visible) {
- var _menu = this._monthPickerMenu,
+ var _menu = this._monthPickerMenu,
_opts = this.options;
-
+
event = event || $.Event();
if (_event('OnBeforeMenuClose', this)(event) === false || event.isDefaultPrevented()) {
return;
}
-
+
this._visible = false;
_openedInstance = null;
$(document).off('keydown' + _eventsNs + this.uuid)
.off(click + this.uuid);
-
+
this.Validate();
_elem.on('blur' + _eventsNs, $proxy(this.Validate, this));
var _callback = _event('OnAfterMenuClose', this);
-
+
var _anim = _opts.HideAnim || _opts.Animation;
if (_anim === 'none') {
_menu.hide(0, _callback);
@@ -530,13 +562,13 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
}
}
},
-
+
/**
* Methods the user can override to use a third party library
* such as http://momentjs.com for parsing and formatting months.
*/
MonthInputFormat: 'yy-mm',
-
+
ParseMonth: function (str, format) {
try {
return $datepicker.parseDate('dd' + format, '01' + str);
@@ -544,7 +576,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
return null;
}
},
-
+
FormatMonth: function (date, format) {
try {
return $datepicker.formatDate(format, date) || null;
@@ -552,18 +584,18 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
return null;
}
},
-
+
/****** Private and Misc Utility functions ******/
-
- _setSelectedMonth: function (_selMonth) {
+
+ _setSelectedMonth: function (_selMonth) {
var month = _encodeMonth(this, _selMonth), _el = this.element;
-
+
if (!month) {
_el.val( '' );
} else {
_el.val( this._formatMonth( new Date( _toYear(month), month % 12, 1)) );
}
-
+
this._ajustYear(this.options);
this._showMonths();
},
@@ -571,21 +603,21 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
_i18n: function(str) {
return this.options.i18n[str] || $.MonthPicker.i18n[str];
},
-
+
_parseMonth: function (str, format) {
return this.ParseMonth(str || this.element.val(), format || this.options.MonthFormat);
},
-
+
_formatMonth: function (date, format) {
return this.FormatMonth(date || this._parseMonth(), format || this.options.MonthFormat);
},
_updateButton: function () {
var isDisabled = this.options.Disabled;
-
+
this._createButton();
-
- // If the button is a jQuery UI button,
+
+ // If the button is a jQuery UI button,
// plain HTML button or an input we support disable it,
// otherwise the user must handle the diabled state
// by creating an appropriate button by passing
@@ -604,14 +636,14 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
_createButton: function () {
var _elem = this.element, _opts = this.options;
if (_isInline(_elem)) return;
-
+
var _oldButton = this._monthPickerButton.off(_eventsNs);
var _btnOpt = _opts.ShowIcon ? _opts.Button : false;
-
+
if ($.isFunction(_btnOpt)) {
_btnOpt = _btnOpt.call(_elem[0], $.extend(true, {i18n: $.MonthPicker.i18n}, this.options));
}
-
+
var _removeOldBtn = false;
this._monthPickerButton = ( _btnOpt instanceof $ ? _btnOpt : $(_btnOpt) )
.each(function() {
@@ -621,11 +653,11 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
}
})
.on(click, $proxy(this.Toggle, this));
-
+
if (this._removeOldBtn) {
_oldButton.remove();
}
-
+
this._removeOldBtn = _removeOldBtn;
},
@@ -644,18 +676,18 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
var _button = this._monthPickerButton;
this._validationMessage = _msgEl.insertAfter(_button.length ? _button : _elem);
-
+
_elem.on('blur' + _eventsNs, $proxy(this.Validate, this));
} else {
this._validationMessage.remove();
}
},
-
+
_setRTL: function(value) {
_applyArrowButton(this._prevButton, !value);
_applyArrowButton(this._nextButton, value);
},
-
+
_keyDown: function (event) {
// Don't use $.ui.keyCode to help minification.
switch (event.keyCode) {
@@ -671,7 +703,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
break;
}
},
-
+
_duration: function() {
var _dur = this.options.Duration;
@@ -681,16 +713,16 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
return _dur in _speeds ? _speeds[ _dur ] : _speeds._default;
},
-
+
_position: _hasPosition ?
function($menu) {
var _defauts = this.options.IsRTL ? _RTL_defaultPos : _defaultPos;
var _posOpts = $.extend(_defauts, this.options.Position);
-
+
return $menu.position($.extend({of: this.element}, _posOpts));
} :
function($menu) {
- var _el = this.element,
+ var _el = this.element,
_css = { top: (_el.offset().top + _el.height() + 7) + 'px' };
if (this.options.IsRTL) {
@@ -698,14 +730,14 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
} else {
_css.left = _el.offset().left + 'px';
}
-
+
return $menu.css(_css);
},
-
+
_setUseInputMask: function () {
if (!this._isMonthInputType) {
try {
- if (this.options.UseInputMask) {
+ if (this.options.UseInputMask) {
this.element.mask( this._formatMonth(new Date).replace(/\d/g, 9) );
} else {
this.element.unmask();
@@ -716,21 +748,21 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
_setDisabledState: function () {
var isDisabled = this.options.Disabled, _elem = this.element;
-
+
// Disable the associated input field.
_elem[0].disabled = isDisabled;
_elem.toggleClass(_disabledClass, isDisabled);
-
+
if (isDisabled) {
this._validationMessage.hide();
}
-
+
this.Close();
this._updateButton();
_event('OnAfterSetDisabled', this)(isDisabled);
},
-
+
_getPickerYear: function () {
return parseInt(this._yearContainer.text(), 10);
},
@@ -746,15 +778,15 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
_field.val(this._formatMonth(date, this.options.AltFormat));
}
},
-
+
_chooseMonth: function (month) {
var date = new Date(this._getPickerYear(), month-1);
this.element.val(this._formatMonth( date )).blur();
this._updateAlt(0, date);
-
+
_setActive( this._selectedBtn, false );
this._selectedBtn = _setActive( $(this._buttons[month-1]), true );
-
+
_event('OnAfterChooseMonth', this)(date);
},
@@ -768,7 +800,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
_showMonths: function () {
var _months = this._i18n('months');
-
+
this._prevButton
.attr('title', this._i18n('prevYear'))
.off(click)
@@ -780,7 +812,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
.on(click, $proxy(this._addToYear, this, 1));
this._yearContainerAll.css('cursor', 'pointer');
-
+
this._buttons.off(_eventsNs);
var me = this, _onMonthClick = $proxy(me._onMonthClick, me);
@@ -789,7 +821,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
.on(click, {month: index+1}, _onMonthClick )
.button('option', 'label', monthName);
});
-
+
this._decorateButtons();
},
@@ -806,7 +838,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
_firstYear = (_currYear + _yearDifferential),
AMOUNT_TO_ADD = 5,
_thisYear = new Date().getFullYear();
-
+
var _minDate = this._MinMonth;
var _maxDate = this._MaxMonth;
var _minYear = _minDate ? _toYear(_minDate) : 0;
@@ -827,53 +859,53 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
this._buttons.off(_eventsNs);
_setActive( this._selectedBtn, false );
-
+
var _selYear = this.GetSelectedYear();
var _onClick = $proxy(this._onYearClick, this);
var _todayWithinBounds = _between(_thisYear, _minYear, _maxYear);
var _selWithinBounds = _between(_selYear, _minYear, _maxYear);
-
+
for (var _counter = 0; _counter < 12; _counter++) {
var _year = _currYear + _yearDifferential;
-
+
var _btn = $( this._buttons[_counter] ).button({
disabled: !_between(_year, _minYear, _maxYear),
label: _year
})
.toggleClass(_todayClass, _year === _thisYear && _todayWithinBounds) // Heighlight the current year.
.on(click, { year: _year }, _onClick )
-
+
// Heighlight the selected year.
if (_selWithinBounds && _selYear && _selYear === _year) {
this._selectedBtn = _setActive( _btn , true );
}
-
+
_yearDifferential++;
}
},
-
+
_onMonthClick: function(event) {
this._chooseMonth(event.data.month);
this.Close(event);
},
-
+
_onYearClick: function(event) {
this._chooseYear(event.data.year);
},
-
+
_addToYear: function(amount) {
var _year = this._yearContainer;
_year.text(parseInt(_year.text()) + amount, 10);
this.element.focus();
-
+
var me = this;
setTimeout(function() {
var _btn = amount > 0 ? me._nextButton : me._prevButton;
_btn.addClass('ui-state-hover');
}, 1);
-
+
this._decorateButtons();
-
+
_event('OnAfter' + (amount > 0 ? 'Next' : 'Previous') + 'Year', this)();
},
@@ -885,7 +917,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
_event('OnAfter' + (amount > 0 ? 'Next' : 'Previous') + 'Years', this)();
},
-
+
_ajustYear: function(_opts) {
var _year = _opts.StartYear || this.GetSelectedYear() || new Date().getFullYear();
if (this._MinMonth !== null) {
@@ -894,32 +926,32 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
if (this._MaxMonth !== null) {
_year = Math.min(_toYear(this._MaxMonth), _year);
}
-
+
this._setPickerYear( _year );
},
-
+
_decorateButtons: function() {
var _curYear = this._getPickerYear(), _todaysMonth = _toMonth(new Date),
_minDate = this._MinMonth, _maxDate = this._MaxMonth;
-
+
// Heighlight the selected month.
_setActive( this._selectedBtn, false );
var _sel = this.GetSelectedDate();
var _withinBounds = _between(_sel ? _toMonth(_sel) : null, _minDate, _maxDate);
-
+
if (_sel && _sel.getFullYear() === _curYear) {
this._selectedBtn = _setActive( $(this._buttons[_sel.getMonth()]) , _withinBounds );
- }
-
+ }
+
// Disable the next/prev button if we've reached the min/max year.
this._prevButton.button('option', 'disabled', _minDate && _curYear == _toYear(_minDate));
this._nextButton.button('option', 'disabled', _maxDate && _curYear == _toYear(_maxDate));
-
+
for (var i = 0; i < 12; i++) {
- // Disable the button if the month is not between the
+ // Disable the button if the month is not between the
// min and max interval.
var _month = (_curYear * 12) + i, _isBetween = _between(_month, _minDate, _maxDate);
-
+
$(this._buttons[i])
.button({ disabled: !_isBetween })
.toggleClass(_todayClass, _isBetween && _month == _todaysMonth); // Highlights today's month.
diff --git a/css/MonthPicker.css b/css/MonthPicker.css
index 741d18a..4682d1c 100644
--- a/css/MonthPicker.css
+++ b/css/MonthPicker.css
@@ -1,6 +1,6 @@
/*
-The jQuery UI Month Picker Version 3.0-alpha1
+The jQuery UI Month Picker Version 3.0-alpha4
https://github.com/KidSysco/jquery-ui-month-picker/
@@ -53,7 +53,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
width: 50px;
}
.month-picker-year-table .previous-year>a {
- /*
+ /*
In case the user's css reset the user agent stylesheet
this is often done in RTL pages.
*/
@@ -77,6 +77,14 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
text-align: center;
cursor: pointer;
}
+.year-container-all a {
+ width: 100%;
+}
+
+.month-picker-year-table .year-container-all span {
+ padding: inherit; /*padding-bottom: 0 inherit;*/
+ }
+
.month-picker-year-table .year-container {
text-align: center;
}
From 1f677231b9ff0985f7a638b87e942d6c2930e11a Mon Sep 17 00:00:00 2001
From: Benjamin Albert The jQuery UI Month Picker Version 3.0-alpha3
+The jQuery UI Month Picker Version 3.0-alpha4
[](https://travis-ci.org/benjamin-albert/jquery-ui-month-picker)
[](http://gruntjs.com/)
From b1781322e2a33b69bcb298d6fe939506409cb8cf Mon Sep 17 00:00:00 2001
From: Benjamin Albert ' +
'
' +
'' +
- '' +
' ' +
'' +
- ' ' +
+ ' ' +
/*
' ';
}
});
-
+
// Make the image was properly construted and is visible in the expected location.
// NOTE: We don't check that the image is visible because it isn't visible
// until it was loaded.
assert.equal($(ImgButton).prev()[0], ImgButtonField, 'The image button was placed near the associated input field.');
assert.equal($(ImgButton).attr('src'), 'calendar.gif', 'The button has the enabled image.');
-
+
// Click the image and make sure the menu opens.
$(ImgButton).trigger('click');
assert.ok($(MonthPicker_ImgButtonField).is(":visible"), 'Clicking the plain button opened the correct menu.');
assert.equal($('.month-picker').filter(':visible').length, 1, 'There is only one menu opened.');
-
- // Disable the field (which implicitly closes the menu)
+
+ // Disable the field (which implicitly closes the menu)
// and make sure the button is also disabled.
$(ImgButtonField).MonthPicker('Disable');
@@ -741,7 +739,7 @@ QUnit.test('Img tag tests', function (assert) {
assert.equal($(ImgButton).attr('src'), 'calendar-disabled.gif', 'The button has the disabled image.');
assert.equal($('.ImgButton').length, 1, "There's only one image button in the DOM.");
-
+
// Make sure clicking the button doesn't open the menu.
$(ImgButton).trigger('click');
assert.ok($(MonthPicker_ImgButtonField).is(':hidden'), "Clicking the button didn't open the menu.");
@@ -756,7 +754,7 @@ QUnit.test('Existing element tests', function (assert) {
// Creats a month picker with an existing external element as a button.
$(ExistingButtonField).MonthPicker({
Animation: 'none', // Disable animation to make sure opening and closing the menu is synchronous.
-
+
Button: function (options) {
var enabledButton = $(this).next().hide();
var disabledButton = $(enabledButton).next().hide();
@@ -764,17 +762,17 @@ QUnit.test('Existing element tests', function (assert) {
return options.Disabled ? disabledButton.show() : enabledButton.show();
}
});
-
+
// Make sure only the enabled element is visible.
assert.ok($(ExistingButton).is(':visible'), 'The enabled element is visible.');
assert.ok($(DisabledExistingButton).is(':hidden'), 'The disabled element is hidden.');
-
+
// Click the element and make sure the menu opens.
$(ExistingButton).trigger('click');
assert.ok($(MonthPicker_ExistingButtonField).is(":visible"), 'Clicking the plain button opened the correct menu.');
assert.equal($('.month-picker').filter(':visible').length, 1, 'There is only one menu opened.');
-
- // Disable the field (which implicitly closes the menu)
+
+ // Disable the field (which implicitly closes the menu)
// and make sure the button is also disabled.
$(ExistingButtonField).MonthPicker('Disable');
assert.ok($(ExistingButtonField).is(':disabled'), 'The input field was disabled.');
@@ -782,66 +780,66 @@ QUnit.test('Existing element tests', function (assert) {
assert.ok($(DisabledExistingButton).is(':visible'), 'The disabled element is visible.');
assert.ok($(MonthPicker_ExistingButtonField).is(':hidden'), 'The menu was closed.');
-
+
// Make sure clicking the disabled element doesn't open the menu.
$(DisabledExistingButton).trigger('click');
assert.ok($(MonthPicker_ExistingButtonField).is(':hidden'), "Clicking the disabled element didn't open the menu.");
-
+
// Re-enable the menu and make sure it opens when you click on the fit
$(ExistingButtonField).MonthPicker('Enable');
$(ExistingButton).trigger('click');
assert.ok($(MonthPicker_ExistingButtonField).is(':visible'), "Clicking the enabled element after re-enabling opend the menu");
-
+
// Close the menu to make sure that clicking the button the click event.
// In case it wasen't removed triggering a click should throw an error.
$(ExistingButtonField).MonthPicker('Close');
-
- // Make sure we don't remove existing elements when the plugin is destroyed.
+
+ // Make sure we don't remove existing elements when the plugin is destroyed.
$(ExistingButtonField).MonthPicker('destroy');
assert.equal($("#MonthPicker_ExistingButtonField").length, 0, 'The meun was removed from the DOM');
assert.ok(ExistingButton, 'The existing button was not removed from the DOM');
-
+
// Make sure that clicking the existing element after destroying
- // the plugin doesn't thorw an error.
+ // the plugin doesn't thorw an error.
$(ExistingButton).trigger('click');
});
QUnit.test('Change selector after init', function (assert) {
- // In this test we are going to change the Button option to a jQuery selector
+ // In this test we are going to change the Button option to a jQuery selector
// aftet the plugin was initialized.
$(SelectorButtonField).MonthPicker({
Animation: 'none', // Disable animation to make sure opening and closing the menu is synchronous.
-
+
Button: '#SelectorButton'
});
-
+
// Click the element and make sure the menu opens.
$(SelectorButton).trigger('click');
assert.ok($(MonthPicker_SelectorButtonField).is(":visible"), 'Clicking the button opened the correct menu.');
assert.equal($('.month-picker').filter(':visible').length, 1, 'There is only one menu opened.');
-
+
// Close the menu and change the button after initialization.
$(SelectorButtonField).MonthPicker('Close');
$(SelectorButtonField).MonthPicker('option', 'Button', '#OtherSelectorButton');
-
+
// Make sure the buttons remain untouched.
assert.ok($(SelectorButton).is(':visible'), 'The enabled element was not touched.');
-
+
// Make sure clicking the old button doesn't open the menu (the event listeners were removed).
$(SelectorButton).trigger('click');
assert.ok($(MonthPicker_SelectorButtonField).is(":hidden"), "Clicking the old button didn't open the menu");
-
+
// Make sure clicking the new button opens the menu.
$(OtherSelectorButton).trigger('click');
assert.ok($(MonthPicker_SelectorButtonField).is(":visible"), 'Clicking the other button opened the correct menu.');
-
+
// Close the menu to make sure that clicking the button the click event.
// In case it wasen't removed triggering a click should throw an error.
$(SelectorButtonField).MonthPicker('Close');
-
+
// Destroy the plugin and make sure the event listeners were removed.
$(SelectorButtonField).MonthPicker('destroy');
@@ -853,7 +851,7 @@ QUnit.test('Disable button', function (assert) {
// Create a month picker and make sure that clicking the input field opens the menu.
var field = $(NoButtonField).MonthPicker({
Animation: 'none', // Disable animation to make sure opening and closing the menu is synchronous.
-
+
Button: false
});
@@ -868,34 +866,34 @@ QUnit.test('Disable button', function (assert) {
// Make pressing tab closes the menu.
field.trigger($.Event( "keydown", { keyCode: $.ui.keyCode.TAB } ));
assert.notOk(menu.is(':visible'), 'The menu was closed by pressing tab');
-
+
// Make sure that clicking the input field opens the menu.
$(NoButtonField).trigger('click');
assert.ok(menu.is(':visible'), 'Clicking the input field opened the correct menu.');
-
+
// Don't leave the menu open (not really necessary).
$(NoButtonField).MonthPicker('Disable');
-
+
// Make sure clicking the input field when it's disabled doesn't open the menu.
$(NoButtonField).trigger('click');
assert.ok(menu.is(':hidden'), 'Clicking the input field did not open the menu.');
-
+
// Don't leave the menu open (not really necessary).
$(NoButtonField).MonthPicker('Enable');
-
+
// Fails the test if the menu was closed after clicking the input field again.
$(NoButtonField).MonthPicker({
OnBeforeMenuClose: function () {
assert.notOk(true, "The menu shouldn't closed after clicking the input field again.");
}
});
-
+
// Make sure that clicking the input field still opens the menu.
$(NoButtonField).trigger('click');
assert.ok(menu.is(':visible'), 'Clicking the input field still openes the correct menu.');
$(NoButtonField).trigger('click');
-
+
// Don't leave the menu open (not really necessary).
$(NoButtonField).MonthPicker('ClearAllCallbacks');
$(NoButtonField).MonthPicker('Close');
@@ -907,20 +905,20 @@ QUnit.test('ShowOn both', function (assert) {
Button: '',
ShowOn: 'both'
});
-
+
field.trigger('click');
-
+
var menu = $(MonthPicker_ShowOnBothField);
-
+
assert.ok(menu.is(':visible'), 'The menu was opened by clicking on the input field');
-
+
field.MonthPicker('Close');
-
+
assert.ok(!menu.is(':visible'), 'The menu was closed');
-
+
$(ShowOnBtn).trigger('click');
assert.ok(menu.is(':visible'), 'The menu was opened by clicking on the button');
-
+
field.MonthPicker('Close');
assert.notOk(menu.is(':visible'), 'The menu was closed');
@@ -938,69 +936,69 @@ QUnit.module("Min/MaxMonth");
QUnit.test('Month buttons are disabled', function (assert) {
var field = $(RistrictMonthField).val('12/2015').MonthPicker({
Animation: 'none', // Disable animation to make sure opening and closing the menu is synchronous.
-
+
MinMonth: '10/2015'
});
-
+
field.MonthPicker('Open');
-
+
var menu = $(MonthPicker_RistrictMonthField);
var previousYearButton = menu.find('.previous-year>a');
var nextYearButton = menu.find('.next-year>a');
-
+
// Try to click the disabled buttons.
var buttons = menu.find('.month-picker-month-table button');
$(buttons.slice(0, 8)).trigger('click');
-
+
assert.ok(previousYearButton.is('.ui-button-disabled'), 'The previous year button is disabled');
-
- // Make sure that the date didn't change as a
+
+ // Make sure that the date didn't change as a
// result of clicking the disabled button.
var selectedMonth = field.MonthPicker('GetSelectedDate');
assert.equal( selectedMonth.getFullYear(), 2015, 'The selected year is still 2015');
assert.equal( selectedMonth.getMonth() + 1, 12, 'The selected month is still December');
assert.equal( field.val(), '12/2015', 'The input field still has the value 12/2015' );
-
+
// Make sure we can still go to the next year.
nextYearButton.trigger('click');
var pickerYear = parseInt(menu.find('.year').text(), 10);
assert.equal(pickerYear, 2016, 'Clicking next year changed the year to 2016');
-
+
// Make none of the buttons are disabled.
assert.ok( !menu.find('button').is('.ui-button-disabled'), 'None of the buttons are disabled');
-
+
// Make sure clicking the first button selected January 2016.
menu.find('.button-1').trigger('click');
var selectedMonth = field.MonthPicker('GetSelectedDate');
assert.equal( selectedMonth.getFullYear(), 2016, 'The selected year is still 2016');
assert.equal( selectedMonth.getMonth() + 1, 1, 'The selected month is still January');
assert.equal( field.val(), '01/2016', 'The input field has the value 01/2016' );
-
+
// Make sure we can only go back to 2015 a.k.a the minimum year.
previousYearButton.trigger('click');
previousYearButton.trigger('click');
-
+
var pickerYear = parseInt(menu.find('.year').text(), 10);
assert.equal(pickerYear, 2015, 'clicking previous year tweice keept the year at 2015');
-
+
// Make sure that month buttons before October (the minimum month)
// are still disabled after navigating back to 2015
- // by clicking the buttons and checking that the
+ // by clicking the buttons and checking that the
// selected date didn't change.
$(buttons.slice(0, 8)).trigger('click');
-
+
var selectedMonth = field.MonthPicker('GetSelectedDate');
assert.equal( selectedMonth.getFullYear(), 2016, "Clciking the buttons didn't change the selected year");
assert.equal( selectedMonth.getMonth() + 1, 1, "Clciking the buttons didn't change the selected month");
assert.equal( field.val(), '01/2016', "Clciking the buttons didn't change the fields value" );
-
+
// Make sure the buttons after October (the minumum month) are enabled.
var buttonsDisabled = $( buttons.slice(9) ).is('.ui-button-disabled');
assert.notOk(buttonsDisabled, 'All buttons after the minumum month are enabled');
// Make sure clicking October (the minumum month) works as expected.
$(buttons[9]).trigger('click');
-
+
var selectedMonth = field.MonthPicker('GetSelectedDate');
assert.equal( selectedMonth.getFullYear(), 2015, 'Clciking the minimum month chose the correct year');
assert.equal( selectedMonth.getMonth() + 1, 10, 'Clciking the minimum month chose the correct month');
@@ -1014,10 +1012,10 @@ QUnit.test('Month buttons are disabled', function (assert) {
QUnit.test('Year buttons are disabled', function (assert) {
var field = $(RistrictMonthField).val('02/2015').MonthPicker({
Animation: 'none', // Disable animation to make sure opening and closing the menu is synchronous.
-
+
MaxMonth: '10/2015'
});
-
+
field.MonthPicker('Open');
var menu = $(MonthPicker_RistrictMonthField);
@@ -1082,7 +1080,7 @@ QUnit.test('Year buttons are disabled', function (assert) {
// Check if we still have diabled button.
if (!buttons.is('.ui-button-disabled')) {
- // We don't have disabled buttons, make sure both next and previous
+ // We don't have disabled buttons, make sure both next and previous
// years buttons are enabled.
assert.ok(!previousYearsButton.is('.ui-button-disabled'), 'previous year button is enabled');
assert.ok(!nextYearsButton.is('.ui-button-disabled'), 'next year button is enabled');
@@ -1090,7 +1088,7 @@ QUnit.test('Year buttons are disabled', function (assert) {
}
}
- // Make sure we didn't click back 10 times and we
+ // Make sure we didn't click back 10 times and we
// still have disabled buttons.
assert.ok(!buttons.is('.ui-button-disabled'), 'All year buttons are enabled after clicking previous years ' + i + ' times');
@@ -1141,74 +1139,74 @@ QUnit.test('Year buttons are disabled', function (assert) {
// Here we make sure that if the user types in a year
// that is outside the restricted range the menu will
// open in the closest year that is within range, for example:
-//
+//
// If the MinMonth is: 10/2015 and the user types in 11/2020
// the menu will open and show the year 2015.
//
// This test purposely juggles between types to ensure
// that passing in different types before and after init works
-// as expected.
+// as expected.
QUnit.test('Menu opens within range', function (assert) {
var field = $(RistrictMonthField).MonthPicker({
Animation: 'none', // Disable animation to make sure opening and closing the menu is synchronous.
-
+
MinMonth: '01/2013',
MaxMonth: new Date(2016, 11 - 1)
});
-
+
var menu = $(MonthPicker_RistrictMonthField);
-
- // Make sure the menu opens in the year 2013 even if the user
+
+ // Make sure the menu opens in the year 2013 even if the user
// types in 02/2010.
field.val('02/2010');
field.MonthPicker('Open');
-
+
assert.equal(menu.find('.year').text(), 2013, 'The menu opend at the minimum year (2013) and not 2010' );
-
+
field.MonthPicker('Close');
-
- // Make sure the menu opens in the year 2016 even if the user
+
+ // Make sure the menu opens in the year 2016 even if the user
// types in 02/2020.
field.val('12/2020');
field.MonthPicker('Open');
-
+
assert.equal(menu.find('.year').text(), 2016, 'The menu opend at the maximum year (2016) and not 2020' );
-
+
field.MonthPicker('Close');
-
+
// Make sure that the menu will open at the year 2018
// If we change the MaxMonth option.
field.MonthPicker('option', 'MaxMonth', '12/2018');
field.MonthPicker('Open');
-
+
assert.equal(menu.find('.year').text(), 2018, 'The menu opend at the year 2018 after changing the MaxMonth option' );
-
+
field.MonthPicker('Close');
-
- // Make sure the menu opens at the the selected year if the MaxMonth
+
+ // Make sure the menu opens at the the selected year if the MaxMonth
// is greater than the selected month.
field.MonthPicker('option', 'MaxMonth', new Date(2021, 12 - 1));
field.MonthPicker('Open');
-
+
assert.equal(menu.find('.year').text(), 2020, 'The menu opend at the the selected year 2020 after' );
-
+
field.MonthPicker('Close');
-
+
field.MonthPicker('option', 'MinMonth', new Date(2010, 12 - 1));
field.val('02/2009');
field.MonthPicker('Open');
-
+
assert.equal(menu.find('.year').text(), 2010, 'The menu opend at the year 2010 after chagnig the MinMonth option' );
-
+
field.MonthPicker('Close');
-
+
// Make sure the menu opens at the selected year the MinMonth option
// to soemthing smaller than the selected month.
field.MonthPicker('option', 'MinMonth', new Date(2008, 04));
field.MonthPicker('Open');
-
+
assert.equal(menu.find('.year').text(), 2009, 'The menu opend at the selected year after changing the MinMonth option again' );
-
+
// Destroy the plugin so we can use the field over again
// in another Min/MaxMonth test.
field.MonthPicker('destroy');
@@ -1218,55 +1216,55 @@ QUnit.test('Today and selected months are highlighted', function (assert) {
var field = $(highlightedField).MonthPicker({
Animation: 'none' // Disable animation to make sure opening and closing the menu is synchronous.
});
-
+
field.val('05/' + _today.getFullYear());
-
+
field.MonthPicker('Open');
var menu = $(MonthPicker_highlightedField);
-
+
var buttons = menu.find('.month-picker-month-table button');
-
+
var todaysButton = $(buttons[new Date().getMonth()]);
var nextYearButton = menu.find('.next-year>a');
var previousYearButton = menu.find('.previous-year>a');
-
+
assert.ok(todaysButton.is('.ui-state-highlight'), "Today's month is highlighted");
-
+
var selectedButton = buttons.filter('.ui-state-active');
assert.equal( selectedButton.length, 1, 'There is one selected button');
assert.equal( selectedButton[0], buttons[4], 'The selected month is highlighted');
-
+
nextYearButton.trigger('click');
-
+
assert.notOk(todaysButton.is('.ui-state-highlight'), 'Going to the next year removed highlighting');
-
+
var selectedButton = buttons.filter('.ui-state-active');
assert.equal( selectedButton.length, 0, 'Going to the next year removed the selected highlighting');
-
+
previousYearButton.trigger('click');
-
+
assert.ok(todaysButton.is('.ui-state-highlight'), 'Returning to this year returnd the highlighting');
-
+
var selectedButton = buttons.filter('.ui-state-active');
assert.equal( selectedButton.length, 1, 'There is one selected button');
assert.equal( selectedButton[0], buttons[4], 'The selected month is highlighted');
-
+
menu.find('.year').trigger('click');
-
+
var selectdBtn = buttons.filter('.ui-state-active');
assert.equal( selectdBtn.button( "option", "label" ), _today.getFullYear(), 'The selected year is highlighted');
-
+
var todayBtn = buttons.filter('.ui-state-highlight');
assert.equal( todayBtn.button( "option", "label" ), _today.getFullYear(), "Today's year is highlighted");
-
+
field.MonthPicker('Close');
field.MonthPicker({MinMonth: 1});
-
+
field.MonthPicker('Open');
-
+
var selectedButton = buttons.filter('.ui-state-highlight');
assert.equal( selectedButton.length, 0, "Today is not highlighted because it's before the min month");
-
+
var selectedButton = buttons.filter('.ui-state-active');
assert.equal( selectedButton.length, 0, 'The selected mont is also not heighlighted');
});
@@ -1274,27 +1272,27 @@ QUnit.test('Today and selected months are highlighted', function (assert) {
QUnit.test('Number of months from today', function (assert) {
var field = $(RistrictMonthField).MonthPicker({
Animation: 'none', // Disable animation to make sure opening and closing the menu is synchronous.
-
- MinMonth: 0,
+
+ MinMonth: 0,
MaxMonth: 16
});
-
+
// Make sure the menu will open on the current month.
field.val($.datepicker.formatDate('mm/yy', new Date));
-
+
field.MonthPicker('Open');
-
+
var menu = $(MonthPicker_RistrictMonthField);
// Make sure we are in years view.
var buttons = menu.find('.month-picker-month-table button');
var nextYearButton = menu.find('.next-year>a');
var previousYearButton = menu.find('.previous-year>a');
-
+
var enabledMonths = 0;
-
+
// Make sure that 16 buttons + 1 for today are disabled.
- //
+ //
// Keep clicking next until the next year button is disabled
// We count to 10 to avoid an infinite loop in case there's
// a bug where the next button is not disabled.
@@ -1305,23 +1303,23 @@ QUnit.test('Number of months from today', function (assert) {
nextYearButton.trigger('click');
}
assert.equal(enabledMonths, 17, 'Today + 16 month buttons are enabled');
-
+
field.MonthPicker('Close');
-
+
// Make sure that 20 buttons + 1 for today are disabled.
field.MonthPicker({MinMonth: -20, MaxMonth: 0});
field.MonthPicker('Open');
enabledMonths = 0;
-
+
hasNext = previousYearButton.is(':not(.ui-button-disabled)');
-
+
for (var i = 0; hasNext && i < 10; i++) {
hasNext = previousYearButton.is(':not(.ui-button-disabled)');
enabledMonths += buttons.not('.ui-button-disabled').length;
previousYearButton.trigger('click');
}
assert.equal(enabledMonths, 21, 'Today + 20 month buttons are enabled');
-
+
// Destroy the plugin so we can use the field over again
// in another Min/MaxMonth test.
field.MonthPicker('destroy');
@@ -1330,16 +1328,16 @@ QUnit.test('Number of months from today', function (assert) {
QUnit.test('Relative month periods', function (assert) {
var field = $(RistrictMonthField).MonthPicker({
Animation: 'none', // Disable animation to make sure opening and closing the menu is synchronous.
-
+
MinMonth: '+1Y -12m', // a.k.a 0 months (this month).
MaxMonth: '6M +1y' // a.k.a 18 months.
});
-
+
// Make sure the menu will open on the current month.
field.val($.datepicker.formatDate('mm/yy', new Date));
-
+
field.MonthPicker('Open');
-
+
var menu = $(MonthPicker_RistrictMonthField);
// Make sure we are in years view.
@@ -1347,9 +1345,9 @@ QUnit.test('Relative month periods', function (assert) {
var nextYearButton = menu.find('.next-year>a');
var previousYearButton = menu.find('.previous-year>a');
var enabledMonths = 0;
-
+
// Make sure that 18 buttons + 1 for today are disabled.
- //
+ //
// Keep clicking next until the next year button is disabled
// We count to 10 to avoid an infinite loop in case there's
// a bug where the next button is not disabled.
@@ -1360,23 +1358,23 @@ QUnit.test('Relative month periods', function (assert) {
nextYearButton.trigger('click');
}
assert.equal(enabledMonths, 19, 'Today + 18 month buttons are enabled');
-
+
field.MonthPicker('Close');
-
+
// Make sure that 24 buttons + 1 for today are disabled.
field.MonthPicker({MinMonth: '-2y', MaxMonth: '0M'});
field.MonthPicker('Open');
enabledMonths = 0;
-
+
hasNext = previousYearButton.is(':not(.ui-button-disabled)');
-
+
for (var i = 0; hasNext && i < 10; i++) {
hasNext = previousYearButton.is(':not(.ui-button-disabled)');
enabledMonths += buttons.not('.ui-button-disabled').length;
previousYearButton.trigger('click');
}
assert.equal(enabledMonths, 25, 'Today + 24 month buttons are enabled');
-
+
// Destroy the plugin so we can use the field over again
// in another Min/MaxMonth test.
field.MonthPicker('destroy');
@@ -1385,27 +1383,27 @@ QUnit.test('Relative month periods', function (assert) {
QUnit.test('JavaScript Date objects', function (assert) {
var field = $(RistrictMonthField).MonthPicker({
Animation: 'none', // Disable animation to make sure opening and closing the menu is synchronous.
-
+
MinMonth: new Date(2015, 2 - 1),
MaxMonth: new Date(2015, 11 - 1)
});
-
+
field.val('05/2015');
-
+
var menu = $(MonthPicker_RistrictMonthField);
var buttons = menu.find('.month-picker-month-table button');
-
+
field.MonthPicker('Open');
assert.equal(buttons.not('.ui-button-disabled').length, 10, '10 month buttons are enabled');
-
+
field.MonthPicker('Close');
field.MonthPicker('option', 'MinMonth', new Date(2016, 1 - 1));
field.MonthPicker('option', 'MaxMonth', new Date(2016, 6 - 1));
-
+
field.MonthPicker('Open');
assert.equal(menu.find('.year').text(), 2016, 'The menu opend at the expected year 2015');
assert.equal(buttons.not('.ui-button-disabled').length, 6, '12 month buttons are enabled');
-
+
// Destroy the plugin so we can use the field over again
// in another Min/MaxMonth test.
field.MonthPicker('destroy');
From dcbb7301739ccacb20aefc04874b12f22e53e831 Mon Sep 17 00:00:00 2001
From: Benjamin Albert
").appendTo(m);p.append(' ')}this._buttons=a("button",m).button(),i.on(H,function(a){return!1});var q=this,r="Month";a.each(["Min","Max"],function(a,b){q["_set"+b+r]=function(a){(q["_"+b+r]=j(q,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},q._setOption(b+r,q.options[b+r])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return parseInt(this._yearContainer.text(),10)},_setPickerYear:function(a){this._yearContainer.text(a||(new d).getFullYear())},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._yearContainerAll.css("cursor","pointer"),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=5,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._yearContainerAll.css("cursor","default"),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){var b=this._yearContainer;b.text(parseInt(b.text())+a,10),this.element.focus();var c=this;setTimeout(function(){var b=a>0?c._nextButton:c._prevButton;b.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){var b=this._yearContainer;b.text(parseInt(b.text())+a,10),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a,b,c,d){"use strict";function e(a){return a.getMonth()+12*a.getFullYear()}function f(a){return Math.floor(a/12)}function g(){a(this).addClass(t)}function h(a,b){return a[b?"on":"off"]("mousenter mouseout",g).toggleClass(t,b)}function i(a,b,c){return(!b||a>=b)&&(!c||c>=a)}function j(b,c){if(null===c)return c;if(c instanceof d)return e(c);if(a.isNumeric(c))return e(new d)+parseInt(c,10);var f=b._parseMonth(c);return f?e(f):l(c)}function k(a,b){return F(b.options[a]||E,b.element[0])}function l(b,c){var f=a.trim(b);f=f.replace(/y/i,'":"y"'),f=f.replace(/m/i,'":"m"');try{var g=JSON.parse('{"'+f.replace(/ /g,',"')+"}"),h={};for(var i in g)h[g[i]]=i;var j=e(new d);return j+=parseInt(h.m,10)||0,j+12*(parseInt(h.y,10)||0)}catch(k){return!1}}function m(b){return a(''+b.i18n.buttonText+"").button({text:!1,icons:{primary:b.ButtonIcon}})}function n(a,b){a.button("option",{icons:{primary:"ui-icon-circle-triangle-"+(b?"w":"e")}})}function o(a){return!a.is("input")}if(!(a&&a.ui&&a.ui.button&&a.ui.datepicker))return void alert(w+"The jQuery UI button and datepicker plug-ins must be loaded.");var p=a.fx.speeds,q=".MonthPicker",r="month-picker-disabled",s="ui-state-highlight",t="ui-state-active",u={my:"left top+1",at:"left bottom"},v={my:"right top+1",at:"right bottom"},w="MonthPicker Error: ",x=w+"The jQuery UI position plug-in must be loaded.",y=w+"Unsupported % option value, supported values are: ",z=w+'"_" is not a valid %Month value.',A=null,B=!!a.ui.position,C={Animation:["slideToggle","fadeToggle","none"],ShowAnim:["fadeIn","slideDown","none"],HideAnim:["fadeOut","slideUp","none"]},D={ValidationErrorMessage:"_createValidationMessage",Disabled:"_setDisabledState",ShowIcon:"_updateButton",Button:"_updateButton",ShowOn:"_updateFieldEvents",IsRTL:"_setRTL",AltFormat:"_updateAlt",AltField:"_updateAlt",StartYear:"_setPickerYear",MinMonth:"_setMinMonth",MaxMonth:"_setMaxMonth",SelectedMonth:"_setSelectedMonth"},E=a.noop,F=a.proxy,G=a.datepicker,H="click"+q;a.MonthPicker={VERSION:"3.0-alpha4",i18n:{year:"Year",prevYear:"Previous Year",nextYear:"Next Year",next5Years:"Jump Forward 5 Years",prev5Years:"Jump Back 5 Years",nextLabel:"Next",prevLabel:"Prev",buttonText:"Open Month Chooser",jumpYears:"Jump Years",months:["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sep.","Oct.","Nov.","Dec."]}};var I=' ").appendTo(t);v.append(' ')}this._buttons=a("button",t).button(),i.on(H,function(a){return!1});var A=this,D="Month";a.each(["Min","Max"],function(a,b){A["_set"+b+D]=function(a){(A["_"+b+D]=j(A,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},A._setOption(b+D,A.options[b+D])});var E=e.SelectedMonth;if(void 0!==E){var G=j(this,E);b.val(this._formatMonth(new d(f(G),G%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.button({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=5,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus();var b=this;setTimeout(function(){var c=a>0?b._nextButton:b._prevButton;c.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._setPickerYear(this._getPickerYear()+a),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/demo/Demo.min.css b/demo/Demo.min.css
index d66cfad..24ba688 100644
--- a/demo/Demo.min.css
+++ b/demo/Demo.min.css
@@ -1 +1 @@
-.month-picker .year-container-all,.option-link{cursor:pointer}.month-picker{display:inline-block;position:absolute;z-index:9999}.month-picker-header{margin:3px 3px 0}.month-picker-year-table .year-container-all{text-align:center}.month-picker-year-table .year-container{margin:0 auto}.month-picker-year-table .year,.month-picker-year-table .year-title{margin:3px;font-size:12px;font-family:Verdana,Arial,sans-serif}.month-picker-year-table{width:100%}.month-picker-year-table .year-container{width:50px;text-align:center}.month-picker-year-table .previous-year>a{float:left}.month-picker-year-table .next-year>a{float:right}.month-picker-year-table td{padding:0}.month-picker-year-table a{border:1px solid transparent;margin:0;width:1.5em;height:1.5em;text-align:center;cursor:pointer}.month-picker-month-table td{padding:0;height:35px;text-align:center;font-size:12px}.month-picker-month-table button{width:55px;margin:3px}.month-picker-open-button{height:20px;width:20px;vertical-align:bottom}.month-picker-invalid-message{display:none;background-color:#ff0}.month-picker-disabled,.option-block{background-color:#e1e1e1}body{font-size:12px;font-family:Verdana,Arial,sans-serif}.option-block{display:none;padding:4px;border:1px solid #000}.option{margin:20px;border:1px solid Gray;padding:4px}.demo,.demo-position{background-color:#e1e1e1;padding:8px;border:1px solid Gray}.option-link{text-decoration:underline;color:#00f;font-weight:700}.option-link:hover{color:Red}.option-type{margin:0 25px}.demo-position{width:100%}.text-right{text-align:right}
\ No newline at end of file
+.month-picker{display:inline-block;position:absolute;z-index:9999}.month-picker-header{margin:3px 3px 0}.month-picker-year-table .jump-years{text-align:center}.month-picker-year-table .year,.month-picker-year-table .year-title{margin:3px;font-size:12px;font-family:Verdana,Arial,sans-serif}.month-picker-year-table{width:100%}.month-picker-year-table .previous-year>a{float:left}.month-picker-year-table .next-year>a{float:right}.month-picker-year-table td{padding:0}.month-picker-year-table a{border:1px solid transparent;margin:0;width:1.5em;height:1.5em;text-align:center;cursor:pointer}.jump-years a{width:100%}.month-picker-year-table .jump-years span{padding:inherit}.month-picker-month-table td{padding:0;height:35px;text-align:center;font-size:12px}.month-picker-month-table button{width:55px;margin:3px}.month-picker-open-button{height:20px;width:20px;vertical-align:bottom}.month-picker-invalid-message{display:none;background-color:#ff0}.month-picker-disabled,.option-block{background-color:#e1e1e1}body{font-size:12px;font-family:Verdana,Arial,sans-serif}.option-block{display:none;padding:4px;border:1px solid #000}.option{margin:20px;border:1px solid Gray;padding:4px}.demo,.demo-position{background-color:#e1e1e1;padding:8px;border:1px solid Gray}.option-link{text-decoration:underline;color:#00f;cursor:pointer;font-weight:700}.option-link:hover{color:Red}.option-type{margin:0 25px}.demo-position{width:100%}.text-right{text-align:right}
\ No newline at end of file
diff --git a/demo/Demo.min.js b/demo/Demo.min.js
index 5eccb6f..7b44fa5 100644
--- a/demo/Demo.min.js
+++ b/demo/Demo.min.js
@@ -1 +1 @@
-!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(m);p.append(' ')}this._buttons=a("button",m).button(),i.on(H,function(a){return!1});var q=this,r="Month";a.each(["Min","Max"],function(a,b){q["_set"+b+r]=function(a){(q["_"+b+r]=j(q,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},q._setOption(b+r,q.options[b+r])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return parseInt(this._yearContainer.text(),10)},_setPickerYear:function(a){this._yearContainer.text(a||(new d).getFullYear())},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._yearContainerAll.css("cursor","pointer"),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=5,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._yearContainerAll.css("cursor","default"),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){var b=this._yearContainer;b.text(parseInt(b.text())+a,10),this.element.focus();var c=this;setTimeout(function(){var b=a>0?c._nextButton:c._prevButton;b.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){var b=this._yearContainer;b.text(parseInt(b.text())+a,10),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(t);v.append(' ')}this._buttons=a("button",t).button(),i.on(H,function(a){return!1});var A=this,D="Month";a.each(["Min","Max"],function(a,b){A["_set"+b+D]=function(a){(A["_"+b+D]=j(A,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},A._setOption(b+D,A.options[b+D])});var E=e.SelectedMonth;if(void 0!==E){var G=j(this,E);b.val(this._formatMonth(new d(f(G),G%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.button({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=5,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus();var b=this;setTimeout(function(){var c=a>0?b._nextButton:b._prevButton;c.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._setPickerYear(this._getPickerYear()+a),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/test/test.js b/test/test.js
index 577f9e8..822616d 100644
--- a/test/test.js
+++ b/test/test.js
@@ -1165,7 +1165,7 @@ QUnit.test('Menu opens within range', function (assert) {
field.val('02/2010');
field.MonthPicker('Open');
- assert.equal(menu.find('.year').text(), 2013, 'The menu opend at the minimum year (2013) and not 2010' );
+ assert.equal(_getPickerYear(menu), 2013, 'The menu opend at the minimum year (2013) and not 2010' );
field.MonthPicker('Close');
@@ -1174,7 +1174,7 @@ QUnit.test('Menu opens within range', function (assert) {
field.val('12/2020');
field.MonthPicker('Open');
- assert.equal(menu.find('.year').text(), 2016, 'The menu opend at the maximum year (2016) and not 2020' );
+ assert.equal(_getPickerYear(menu), 2016, 'The menu opend at the maximum year (2016) and not 2020' );
field.MonthPicker('Close');
@@ -1183,7 +1183,7 @@ QUnit.test('Menu opens within range', function (assert) {
field.MonthPicker('option', 'MaxMonth', '12/2018');
field.MonthPicker('Open');
- assert.equal(menu.find('.year').text(), 2018, 'The menu opend at the year 2018 after changing the MaxMonth option' );
+ assert.equal(_getPickerYear(menu), 2018, 'The menu opend at the year 2018 after changing the MaxMonth option' );
field.MonthPicker('Close');
@@ -1192,7 +1192,7 @@ QUnit.test('Menu opens within range', function (assert) {
field.MonthPicker('option', 'MaxMonth', new Date(2021, 12 - 1));
field.MonthPicker('Open');
- assert.equal(menu.find('.year').text(), 2020, 'The menu opend at the the selected year 2020 after' );
+ assert.equal(_getPickerYear(menu), 2020, 'The menu opend at the the selected year 2020 after' );
field.MonthPicker('Close');
@@ -1200,7 +1200,7 @@ QUnit.test('Menu opens within range', function (assert) {
field.val('02/2009');
field.MonthPicker('Open');
- assert.equal(menu.find('.year').text(), 2010, 'The menu opend at the year 2010 after chagnig the MinMonth option' );
+ assert.equal(_getPickerYear(menu), 2010, 'The menu opend at the year 2010 after chagnig the MinMonth option' );
field.MonthPicker('Close');
@@ -1209,7 +1209,7 @@ QUnit.test('Menu opens within range', function (assert) {
field.MonthPicker('option', 'MinMonth', new Date(2008, 04));
field.MonthPicker('Open');
- assert.equal(menu.find('.year').text(), 2009, 'The menu opend at the selected year after changing the MinMonth option again' );
+ assert.equal(_getPickerYear(menu), 2009, 'The menu opend at the selected year after changing the MinMonth option again' );
// Destroy the plugin so we can use the field over again
// in another Min/MaxMonth test.
@@ -1253,7 +1253,7 @@ QUnit.test('Today and selected months are highlighted', function (assert) {
assert.equal( selectedButton.length, 1, 'There is one selected button');
assert.equal( selectedButton[0], buttons[4], 'The selected month is highlighted');
- menu.find('.year').trigger('click');
+ menu.find('.jump-years a').trigger('click');
var selectdBtn = buttons.filter('.ui-state-active');
assert.equal( selectdBtn.button( "option", "label" ), _today.getFullYear(), 'The selected year is highlighted');
@@ -1405,7 +1405,7 @@ QUnit.test('JavaScript Date objects', function (assert) {
field.MonthPicker('option', 'MaxMonth', new Date(2016, 6 - 1));
field.MonthPicker('Open');
- assert.equal(menu.find('.year').text(), 2016, 'The menu opend at the expected year 2015');
+ assert.equal(_getPickerYear(menu), 2016, 'The menu opend at the expected year 2015');
assert.equal(buttons.not('.ui-button-disabled').length, 6, '12 month buttons are enabled');
// Destroy the plugin so we can use the field over again
From 622428924c7646622ae8c47fa0a724f7e94ae15b Mon Sep 17 00:00:00 2001
From: Benjamin Albert ' +
'
' +
@@ -330,43 +355,14 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
$(_markup).appendTo(_menu);
(_menu).appendTo( isInline ? _el : document.body );
- //$('.year-title', _menu).text(this._i18n('year'));
-
var jumpYears =
$('.jump-years', _menu)
.attr('title', this._i18n('jumpYears'))
.click($proxy(this._showYearsClickHandler, this));
- this._jumpYearsButton = jumpYears.find('a').css({'cursor': 'default','fontWeight':'bold'}).button().removeClass('ui-state-default');
-
-
- var tOut = null, speed = 125, _yca = jumpYears[0];
- var _prevText;
- var that = this;
-/*_menu.find('.month-picker-year-table').*/$(_yca).mouseover(function(e) {
- var me = this;
- //if ($.contains(_yca, e.target)) {
-tOut = setTimeout(function() {
- tOut = null;
- /*$(".year-container-all span", me)*/$("span", me).animate({ opacity: .45 },{
- duration: speed,
- complete: function() {
- _prevText=$(/*".year-container-all*/"span", me).text();
- $(/*".year-container-all*/"span", me).animate({opacity: 1}, speed).text(that._i18n('jumpYears'));
- }
- });
-}, 175); //} else $("a", me).addClass('ui-state-default') ;
-}).mouseout(function(e) {
-if (tOut) return clearTimeout(tOut);
-var me = this;
-//if ($.contains(_yca, e.target)) {
- $(/*".year-container-all*/ "span", me).animate({ opacity: .45 },{
- duration: speed,
- complete: function() {
- $("span", me).text(_prevText).animate({opacity: 1}, speed);
- }
- }); //} else $("a", me).removeClass('ui-state-default') ;
-});
+ this._jumpYearsButton = jumpYears.find('a').css({'cursor': 'default','fontWeight':'bold'}).button().removeClass('ui-state-default');
+
+ _applyFadeShowYears.call(this, jumpYears);
this._createValidationMessage();
diff --git a/MonthPicker.min.js b/MonthPicker.min.js
index 33b5583..b426e10 100644
--- a/MonthPicker.min.js
+++ b/MonthPicker.min.js
@@ -1 +1 @@
-!function(a,b,c,d){"use strict";function e(a){return a.getMonth()+12*a.getFullYear()}function f(a){return Math.floor(a/12)}function g(){a(this).addClass(t)}function h(a,b){return a[b?"on":"off"]("mousenter mouseout",g).toggleClass(t,b)}function i(a,b,c){return(!b||a>=b)&&(!c||c>=a)}function j(b,c){if(null===c)return c;if(c instanceof d)return e(c);if(a.isNumeric(c))return e(new d)+parseInt(c,10);var f=b._parseMonth(c);return f?e(f):l(c)}function k(a,b){return F(b.options[a]||E,b.element[0])}function l(b,c){var f=a.trim(b);f=f.replace(/y/i,'":"y"'),f=f.replace(/m/i,'":"m"');try{var g=JSON.parse('{"'+f.replace(/ /g,',"')+"}"),h={};for(var i in g)h[g[i]]=i;var j=e(new d);return j+=parseInt(h.m,10)||0,j+12*(parseInt(h.y,10)||0)}catch(k){return!1}}function m(b){return a(''+b.i18n.buttonText+"").button({text:!1,icons:{primary:b.ButtonIcon}})}function n(a,b){a.button("option",{icons:{primary:"ui-icon-circle-triangle-"+(b?"w":"e")}})}function o(a){return!a.is("input")}if(!(a&&a.ui&&a.ui.button&&a.ui.datepicker))return void alert(w+"The jQuery UI button and datepicker plug-ins must be loaded.");var p=a.fx.speeds,q=".MonthPicker",r="month-picker-disabled",s="ui-state-highlight",t="ui-state-active",u={my:"left top+1",at:"left bottom"},v={my:"right top+1",at:"right bottom"},w="MonthPicker Error: ",x=w+"The jQuery UI position plug-in must be loaded.",y=w+"Unsupported % option value, supported values are: ",z=w+'"_" is not a valid %Month value.',A=null,B=!!a.ui.position,C={Animation:["slideToggle","fadeToggle","none"],ShowAnim:["fadeIn","slideDown","none"],HideAnim:["fadeOut","slideUp","none"]},D={ValidationErrorMessage:"_createValidationMessage",Disabled:"_setDisabledState",ShowIcon:"_updateButton",Button:"_updateButton",ShowOn:"_updateFieldEvents",IsRTL:"_setRTL",AltFormat:"_updateAlt",AltField:"_updateAlt",StartYear:"_setPickerYear",MinMonth:"_setMinMonth",MaxMonth:"_setMaxMonth",SelectedMonth:"_setSelectedMonth"},E=a.noop,F=a.proxy,G=a.datepicker,H="click"+q;a.MonthPicker={VERSION:"3.0-alpha4",i18n:{year:"Year",prevYear:"Previous Year",nextYear:"Next Year",next5Years:"Jump Forward 5 Years",prev5Years:"Jump Back 5 Years",nextLabel:"Next",prevLabel:"Prev",buttonText:"Open Month Chooser",jumpYears:"Jump Years",months:["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sep.","Oct.","Nov.","Dec."]}};var I='' +
' ' +
'' +
- ' ' +
- /*
- ' ' +
' ' +
' ").appendTo(t);v.append(' ')}this._buttons=a("button",t).button(),i.on(H,function(a){return!1});var A=this,D="Month";a.each(["Min","Max"],function(a,b){A["_set"+b+D]=function(a){(A["_"+b+D]=j(A,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},A._setOption(b+D,A.options[b+D])});var E=e.SelectedMonth;if(void 0!==E){var G=j(this,E);b.val(this._formatMonth(new d(f(G),G%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.button({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=5,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus();var b=this;setTimeout(function(){var c=a>0?b._nextButton:b._prevButton;c.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._setPickerYear(this._getPickerYear()+a),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a,b,c,d){"use strict";function e(a){return a.getMonth()+12*a.getFullYear()}function f(a){return Math.floor(a/12)}function g(){a(this).addClass(u)}function h(a,b){return a[b?"on":"off"]("mousenter mouseout",g).toggleClass(u,b)}function i(a,b,c){return(!b||a>=b)&&(!c||c>=a)}function j(b,c){if(null===c)return c;if(c instanceof d)return e(c);if(a.isNumeric(c))return e(new d)+parseInt(c,10);var f=b._parseMonth(c);return f?e(f):l(c)}function k(a,b){return G(b.options[a]||F,b.element[0])}function l(b,c){var f=a.trim(b);f=f.replace(/y/i,'":"y"'),f=f.replace(/m/i,'":"m"');try{var g=JSON.parse('{"'+f.replace(/ /g,',"')+"}"),h={};for(var i in g)h[g[i]]=i;var j=e(new d);return j+=parseInt(h.m,10)||0,j+12*(parseInt(h.y,10)||0)}catch(k){return!1}}function m(b){return a(''+b.i18n.buttonText+"").button({text:!1,icons:{primary:b.ButtonIcon}})}function n(a,b){a.button("option",{icons:{primary:"ui-icon-circle-triangle-"+(b?"w":"e")}})}function o(a){return!a.is("input")}function p(b){var c,d=null,e=125,f=this;b.mouseover(function(b){var g=this;d=setTimeout(function(){d=null,a("span",g).animate({opacity:.45},{duration:e,complete:function(){c=a("span",g).text(),a("span",g).animate({opacity:1},e).text(f._i18n("jumpYears"))}})},175)}).mouseout(function(b){if(d)return clearTimeout(d);var f=this;a("span",f).animate({opacity:.45},{duration:e,complete:function(){a("span",f).text(c).animate({opacity:1},e)}})})}if(!(a&&a.ui&&a.ui.button&&a.ui.datepicker))return void alert(x+"The jQuery UI button and datepicker plug-ins must be loaded.");var q=a.fx.speeds,r=".MonthPicker",s="month-picker-disabled",t="ui-state-highlight",u="ui-state-active",v={my:"left top+1",at:"left bottom"},w={my:"right top+1",at:"right bottom"},x="MonthPicker Error: ",y=x+"The jQuery UI position plug-in must be loaded.",z=x+"Unsupported % option value, supported values are: ",A=x+'"_" is not a valid %Month value.',B=null,C=!!a.ui.position,D={Animation:["slideToggle","fadeToggle","none"],ShowAnim:["fadeIn","slideDown","none"],HideAnim:["fadeOut","slideUp","none"]},E={ValidationErrorMessage:"_createValidationMessage",Disabled:"_setDisabledState",ShowIcon:"_updateButton",Button:"_updateButton",ShowOn:"_updateFieldEvents",IsRTL:"_setRTL",AltFormat:"_updateAlt",AltField:"_updateAlt",StartYear:"_setPickerYear",MinMonth:"_setMinMonth",MaxMonth:"_setMaxMonth",SelectedMonth:"_setSelectedMonth"},F=a.noop,G=a.proxy,H=a.datepicker,I="click"+r;a.MonthPicker={VERSION:"3.0-alpha4",i18n:{year:"Year",prevYear:"Previous Year",nextYear:"Next Year",next5Years:"Jump Forward 5 Years",prev5Years:"Jump Back 5 Years",nextLabel:"Next",prevLabel:"Prev",buttonText:"Open Month Chooser",jumpYears:"Jump Years",months:["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sep.","Oct.","Nov.","Dec."]}};var J=' ").appendTo(n);r.append(' ')}this._buttons=a("button",n).button(),i.on(I,function(a){return!1});var s=this,t="Month";a.each(["Min","Max"],function(a,b){s["_set"+b+t]=function(a){(s["_"+b+t]=j(s,a))===!1&&alert(A.replace(/%/,b).replace(/_/,a))},s._setOption(b+t,s.options[b+t])});var u=e.SelectedMonth;if(void 0!==u){var v=j(this,u);b.val(this._formatMonth(new d(f(v),v%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(G(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=F)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{B&&B.Close(b),B=this,a(c).on(I+this.uuid,G(this.Close,this)).on("keydown"+r+this.uuid,G(this._keyDown,this)),d.off("blur"+r).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:G(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,B=null,a(c).off("keydown"+r+this.uuid).off(I+this.uuid),this.Validate(),d.on("blur"+r,G(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return H.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return H.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(r),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(I,G(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=I+" focus"+r;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,G(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+r,G(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in q?q[b]:q._default},_position:C?function(b){var c=this.options.IsRTL?w:v,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(s,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.button({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(t),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(I).on(I,G(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(I).on(I,G(this._addToYear,this,1)),this._buttons.off(r);var c=this,d=G(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(I,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(t),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=5,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(I).on(I,G(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(I).on(I,G(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._buttons.off(r),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=G(this._onYearClick,this),q=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(t,v===j&&q).on(I,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus();var b=this;setTimeout(function(){var c=a>0?b._nextButton:b._prevButton;c.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._setPickerYear(this._getPickerYear()+a),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(t,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/demo/Demo.min.js b/demo/Demo.min.js
index 7b44fa5..60b11f8 100644
--- a/demo/Demo.min.js
+++ b/demo/Demo.min.js
@@ -1 +1 @@
-!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(t);v.append(' ')}this._buttons=a("button",t).button(),i.on(H,function(a){return!1});var A=this,D="Month";a.each(["Min","Max"],function(a,b){A["_set"+b+D]=function(a){(A["_"+b+D]=j(A,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},A._setOption(b+D,A.options[b+D])});var E=e.SelectedMonth;if(void 0!==E){var G=j(this,E);b.val(this._formatMonth(new d(f(G),G%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.button({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=5,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus();var b=this;setTimeout(function(){var c=a>0?b._nextButton:b._prevButton;c.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._setPickerYear(this._getPickerYear()+a),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(n);r.append(' ')}this._buttons=a("button",n).button(),i.on(I,function(a){return!1});var s=this,t="Month";a.each(["Min","Max"],function(a,b){s["_set"+b+t]=function(a){(s["_"+b+t]=j(s,a))===!1&&alert(A.replace(/%/,b).replace(/_/,a))},s._setOption(b+t,s.options[b+t])});var u=e.SelectedMonth;if(void 0!==u){var v=j(this,u);b.val(this._formatMonth(new d(f(v),v%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(G(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=F)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{B&&B.Close(b),B=this,a(c).on(I+this.uuid,G(this.Close,this)).on("keydown"+r+this.uuid,G(this._keyDown,this)),d.off("blur"+r).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:G(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,B=null,a(c).off("keydown"+r+this.uuid).off(I+this.uuid),this.Validate(),d.on("blur"+r,G(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return H.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return H.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(r),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(I,G(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=I+" focus"+r;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,G(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+r,G(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in q?q[b]:q._default},_position:C?function(b){var c=this.options.IsRTL?w:v,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(s,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.button({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(t),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(I).on(I,G(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(I).on(I,G(this._addToYear,this,1)),this._buttons.off(r);var c=this,d=G(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(I,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(t),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=5,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(I).on(I,G(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(I).on(I,G(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._buttons.off(r),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=G(this._onYearClick,this),q=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(t,v===j&&q).on(I,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus();var b=this;setTimeout(function(){var c=a>0?b._nextButton:b._prevButton;c.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._setPickerYear(this._getPickerYear()+a),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(t,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
From 3dc868aa0bd9e2cfabc9c1c685ce75bd2c9fa534 Mon Sep 17 00:00:00 2001
From: Benjamin Albert ").appendTo(n);r.append(' ')}this._buttons=a("button",n).button(),i.on(I,function(a){return!1});var s=this,t="Month";a.each(["Min","Max"],function(a,b){s["_set"+b+t]=function(a){(s["_"+b+t]=j(s,a))===!1&&alert(A.replace(/%/,b).replace(/_/,a))},s._setOption(b+t,s.options[b+t])});var u=e.SelectedMonth;if(void 0!==u){var v=j(this,u);b.val(this._formatMonth(new d(f(v),v%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(G(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=F)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{B&&B.Close(b),B=this,a(c).on(I+this.uuid,G(this.Close,this)).on("keydown"+r+this.uuid,G(this._keyDown,this)),d.off("blur"+r).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:G(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,B=null,a(c).off("keydown"+r+this.uuid).off(I+this.uuid),this.Validate(),d.on("blur"+r,G(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return H.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return H.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(r),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(I,G(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=I+" focus"+r;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,G(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+r,G(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in q?q[b]:q._default},_position:C?function(b){var c=this.options.IsRTL?w:v,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(s,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.button({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(t),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(I).on(I,G(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(I).on(I,G(this._addToYear,this,1)),this._buttons.off(r);var c=this,d=G(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(I,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(t),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=5,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(I).on(I,G(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(I).on(I,G(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._buttons.off(r),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=G(this._onYearClick,this),q=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(t,v===j&&q).on(I,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus();var b=this;setTimeout(function(){var c=a>0?b._nextButton:b._prevButton;c.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._setPickerYear(this._getPickerYear()+a),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(t,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a,b,c,d){"use strict";function e(a){return a.getMonth()+12*a.getFullYear()}function f(a){return Math.floor(a/12)}function g(){a(this).addClass(u)}function h(a,b){return a[b?"on":"off"]("mousenter mouseout",g).toggleClass(u,b)}function i(a,b,c){return(!b||a>=b)&&(!c||c>=a)}function j(b,c){if(null===c)return c;if(c instanceof d)return e(c);if(a.isNumeric(c))return e(new d)+parseInt(c,10);var f=b._parseMonth(c);return f?e(f):l(c)}function k(a,b){return G(b.options[a]||F,b.element[0])}function l(b,c){var f=a.trim(b);f=f.replace(/y/i,'":"y"'),f=f.replace(/m/i,'":"m"');try{var g=JSON.parse('{"'+f.replace(/ /g,',"')+"}"),h={};for(var i in g)h[g[i]]=i;var j=e(new d);return j+=parseInt(h.m,10)||0,j+12*(parseInt(h.y,10)||0)}catch(k){return!1}}function m(b){return a(''+b.i18n.buttonText+"").button({text:!1,icons:{primary:b.ButtonIcon}})}function n(a,b){a.button("option",{icons:{primary:"ui-icon-circle-triangle-"+(b?"w":"e")}})}function o(a){return!a.is("input")}function p(b){var c,d=null,e=125,f=this;b.mouseover(function(b){var g=this;d=setTimeout(function(){d=null,a("span",g).animate({opacity:.45},{duration:e,complete:function(){c=a("span",g).text(),a("span",g).animate({opacity:1},e).text(f._i18n("jumpYears"))}})},175)}).mouseout(function(b){if(d)return clearTimeout(d);var f=this;a("span",f).animate({opacity:.45},{duration:e,complete:function(){a("span",f).text(c).animate({opacity:1},e)}})})}if(!(a&&a.ui&&a.ui.button&&a.ui.datepicker))return void alert(x+"The jQuery UI button and datepicker plug-ins must be loaded.");var q=a.fx.speeds,r=".MonthPicker",s="month-picker-disabled",t="ui-state-highlight",u="ui-state-active",v={my:"left top+1",at:"left bottom"},w={my:"right top+1",at:"right bottom"},x="MonthPicker Error: ",y=x+"The jQuery UI position plug-in must be loaded.",z=x+"Unsupported % option value, supported values are: ",A=x+'"_" is not a valid %Month value.',B=null,C=!!a.ui.position,D={Animation:["slideToggle","fadeToggle","none"],ShowAnim:["fadeIn","slideDown","none"],HideAnim:["fadeOut","slideUp","none"]},E={ValidationErrorMessage:"_createValidationMessage",Disabled:"_setDisabledState",ShowIcon:"_updateButton",Button:"_updateButton",ShowOn:"_updateFieldEvents",IsRTL:"_setRTL",AltFormat:"_updateAlt",AltField:"_updateAlt",StartYear:"_setPickerYear",MinMonth:"_setMinMonth",MaxMonth:"_setMaxMonth",SelectedMonth:"_setSelectedMonth"},F=a.noop,G=a.proxy,H=a.datepicker,I="click"+r;a.MonthPicker={VERSION:"3.0-alpha4",i18n:{year:"Year",prevYear:"Previous Year",nextYear:"Next Year",next5Years:"Jump Forward 5 Years",prev5Years:"Jump Back 5 Years",nextLabel:"Next",prevLabel:"Prev",buttonText:"Open Month Chooser",jumpYears:"Jump Years",months:["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sep.","Oct.","Nov.","Dec."]}};var J=' ").appendTo(n);r.append(' ')}this._buttons=a("button",n).button(),i.on(I,function(a){return!1});var s=this,t="Month";a.each(["Min","Max"],function(a,b){s["_set"+b+t]=function(a){(s["_"+b+t]=j(s,a))===!1&&alert(A.replace(/%/,b).replace(/_/,a))},s._setOption(b+t,s.options[b+t])});var u=e.SelectedMonth;if(void 0!==u){var v=j(this,u);b.val(this._formatMonth(new d(f(v),v%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(G(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=F)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{B&&B.Close(b),B=this,a(c).on(I+this.uuid,G(this.Close,this)).on("keydown"+r+this.uuid,G(this._keyDown,this)),d.off("blur"+r).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:G(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,B=null,a(c).off("keydown"+r+this.uuid).off(I+this.uuid),this.Validate(),d.on("blur"+r,G(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return H.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return H.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(r),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(I,G(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=I+" focus"+r;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,G(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+r,G(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in q?q[b]:q._default},_position:C?function(b){var c=this.options.IsRTL?w:v,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(s,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.button({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(t),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(I).on(I,G(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(I).on(I,G(this._addToYear,this,1)),this._buttons.off(r);var c=this,d=G(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(I,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(t),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(I).on(I,G(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(I).on(I,G(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._buttons.off(r),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=G(this._onYearClick,this),q=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(t,v===j&&q).on(I,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus();var b=this;setTimeout(function(){var c=a>0?b._nextButton:b._prevButton;c.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._setPickerYear(this._getPickerYear()+a),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(t,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/demo/Demo.min.js b/demo/Demo.min.js
index 60b11f8..2c01719 100644
--- a/demo/Demo.min.js
+++ b/demo/Demo.min.js
@@ -1 +1 @@
-!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(n);r.append(' ')}this._buttons=a("button",n).button(),i.on(I,function(a){return!1});var s=this,t="Month";a.each(["Min","Max"],function(a,b){s["_set"+b+t]=function(a){(s["_"+b+t]=j(s,a))===!1&&alert(A.replace(/%/,b).replace(/_/,a))},s._setOption(b+t,s.options[b+t])});var u=e.SelectedMonth;if(void 0!==u){var v=j(this,u);b.val(this._formatMonth(new d(f(v),v%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(G(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=F)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{B&&B.Close(b),B=this,a(c).on(I+this.uuid,G(this.Close,this)).on("keydown"+r+this.uuid,G(this._keyDown,this)),d.off("blur"+r).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:G(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,B=null,a(c).off("keydown"+r+this.uuid).off(I+this.uuid),this.Validate(),d.on("blur"+r,G(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return H.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return H.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(r),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(I,G(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=I+" focus"+r;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,G(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+r,G(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in q?q[b]:q._default},_position:C?function(b){var c=this.options.IsRTL?w:v,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(s,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.button({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(t),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(I).on(I,G(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(I).on(I,G(this._addToYear,this,1)),this._buttons.off(r);var c=this,d=G(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(I,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(t),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=5,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(I).on(I,G(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(I).on(I,G(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._buttons.off(r),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=G(this._onYearClick,this),q=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(t,v===j&&q).on(I,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus();var b=this;setTimeout(function(){var c=a>0?b._nextButton:b._prevButton;c.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._setPickerYear(this._getPickerYear()+a),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(t,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(n);r.append(' ')}this._buttons=a("button",n).button(),i.on(I,function(a){return!1});var s=this,t="Month";a.each(["Min","Max"],function(a,b){s["_set"+b+t]=function(a){(s["_"+b+t]=j(s,a))===!1&&alert(A.replace(/%/,b).replace(/_/,a))},s._setOption(b+t,s.options[b+t])});var u=e.SelectedMonth;if(void 0!==u){var v=j(this,u);b.val(this._formatMonth(new d(f(v),v%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(G(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=F)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{B&&B.Close(b),B=this,a(c).on(I+this.uuid,G(this.Close,this)).on("keydown"+r+this.uuid,G(this._keyDown,this)),d.off("blur"+r).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:G(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,B=null,a(c).off("keydown"+r+this.uuid).off(I+this.uuid),this.Validate(),d.on("blur"+r,G(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return H.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return H.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(r),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(I,G(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=I+" focus"+r;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,G(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+r,G(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in q?q[b]:q._default},_position:C?function(b){var c=this.options.IsRTL?w:v,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(s,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.button({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(t),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(I).on(I,G(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(I).on(I,G(this._addToYear,this,1)),this._buttons.off(r);var c=this,d=G(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(I,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(t),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(I).on(I,G(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(I).on(I,G(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._buttons.off(r),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=G(this._onYearClick,this),q=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(t,v===j&&q).on(I,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus();var b=this;setTimeout(function(){var c=a>0?b._nextButton:b._prevButton;c.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._setPickerYear(this._getPickerYear()+a),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(t,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/test/test.js b/test/test.js
index 822616d..f2a084b 100644
--- a/test/test.js
+++ b/test/test.js
@@ -87,13 +87,13 @@ QUnit.test('HTML 5 & Formatting Tests', function (assert) {
ShowIcon: false,
StartYear: 2027,
OnAfterMenuOpen: function () {
- assert.equal(_pickerMenu.css('display'), 'block', '#Html5 responded to a text input click event and showed the menu.');
+ assert.ok(_pickerMenu.is(':visible'), '#Html5 responded to a text input click event and showed the menu.');
$('.button-1', _pickerMenu).trigger($.Event('click'));
done();
done = assert.async();
},
OnAfterMenuClose: function () {
- assert.equal(_pickerMenu.css('display'), 'none', '#Html5 responded to a button click event by closing the menu.');
+ assert.notOk(_pickerMenu.is(':visible'), '#Html5 responded to a button click event by closing the menu.');
assert.equal(_picker.MonthPicker('GetSelectedYear'), '2027', '#Html5 showed and selected the correct override start year of 2027.');
assert.equal(_picker.MonthPicker('GetSelectedMonth'), '01', '#Html5 showed and selected the correct month of 01.');
// destroy the monthpicker and re-create it so it doesnt fire anymore qunit events upon being used.
@@ -129,7 +129,7 @@ if ($.ui.position) {
var _meun = $(MonthPicker_PositionDemo);
var _lastPointFullyVisibleX = _windowWidth - _meun.width();
var _lastPointFullyVisibleY = _windowHeight - _pickerMenu.height();
- assert.equal(_pickerMenu.css('display'), 'block', '#PositionDemo responded to a text input click event and showed the menu.');
+ assert.ok(_pickerMenu.is(":visible"), '#PositionDemo responded to a text input click event and showed the menu.');
assert.ok(_pickerMenu.position().left <= _lastPointFullyVisibleX, "#PositionDemo does not overlap the right window boundary on the X axis.");
assert.ok(_pickerMenu.position().left > 0, "#PositionDemo does not overlap the left window boundary on the X axis.");
assert.ok(_pickerMenu.position().top <= _lastPointFullyVisibleY, "#PositionDemo does not overlap the bottom window boundary on the Y axis.");
@@ -139,7 +139,7 @@ if ($.ui.position) {
done = assert.async();
},
OnAfterMenuClose: function () {
- assert.equal(_pickerMenu.css('display'), 'none', '#PositionDemo responded to a button click event by closing the menu.');
+ assert.notOk(_pickerMenu.is(':visible'), '#PositionDemo responded to a button click event by closing the menu.');
// destroy the monthpicker and re-create it so it doesnt fire anymore qunit events upon being used.
$('#PositionDemo').MonthPicker('destroy');
assert.ok($('#MonthPicker_PositionDemo').length === 0, "#PositionDemo has been destroyed.");
@@ -168,7 +168,7 @@ QUnit.test('Override Start Year Tests', function (assert) {
ShowIcon: false,
StartYear: 2023,
OnAfterMenuOpen: function () {
- assert.equal(_pickerMenu.css('display'), 'block', '#OverrideStartYear responded to a text input click event and showed the menu.');
+ assert.ok(_pickerMenu.is(':visible'), '#OverrideStartYear responded to a text input click event and showed the menu.');
$('.button-1', _pickerMenu).trigger($.Event('click'));
done();
done = assert.async();
@@ -187,7 +187,6 @@ QUnit.test('Override Start Year Tests', function (assert) {
}
});
- assert.ok($('#MonthPicker_OverrideStartYear').length === 1, "#OverrideStartYear has been initialized for demo purposes.");
var _pickerMenu = $('#MonthPicker_OverrideStartYear');
_picker.trigger($.Event('click'));
done = assert.async();
@@ -198,7 +197,7 @@ QUnit.test('Start Year Option Tests', function (assert) {
var _picker = $('#StartYearDemo').MonthPicker({
ShowIcon: false,
OnAfterMenuOpen: function () {
- assert.equal(_pickerMenu.css('display'), 'block', '#StartYearDemo responded to a text input click event and showed the menu.');
+ assert.ok(_pickerMenu.is(':visible'), '#StartYearDemo responded to a text input click event and showed the menu.');
assert.equal(parseInt(_picker.MonthPicker('GetSelectedYear'), 10), 2025, '#StartYearDemo defaulted to 2025, the year specified in the textbox.');
_picker.MonthPicker('option', 'StartYear', 2095);
assert.equal(_getPickerYear(_pickerMenu), 2095, '#StartYearDemo switched the year to 2095 after init.');
@@ -208,23 +207,22 @@ QUnit.test('Start Year Option Tests', function (assert) {
done = assert.async();
},
OnAfterMenuClose: function () {
- assert.equal(_pickerMenu.css('display'), 'none', '#StartYearDemo responded to a button click event by closing the menu.');
+ assert.notOk(_pickerMenu.is(':visible'), '#StartYearDemo responded to a button click event by closing the menu.');
$('#StartYearDemo').MonthPicker('destroy');
assert.ok($('#MonthPicker_StartYearDemo').length === 0, "#StartYearDemo has been destroyed.");
$('#StartYearDemo').val('1/2025').MonthPicker({
ShowIcon: false,
OnAfterMenuOpen: function () {
-
// get the picker menu again because it was removed from the dom upon destroying StartYearDemo.
_pickerMenu = $('#MonthPicker_StartYearDemo');
- assert.equal(_pickerMenu.css('display'), 'block', '#StartYearDemo responded to a text input click event and showed the menu.');
+ assert.ok(_pickerMenu.is(':visible'), '#StartYearDemo responded to a text input click event and showed the menu.');
assert.equal(parseInt(_picker.MonthPicker('GetSelectedYear'), 10), 2025, '#StartYearDemo defaulted to 2025, the year specified in the textbox.');
_picker.MonthPicker('Close');
done();
done = assert.async();
},
OnAfterMenuClose: function () {
- assert.equal(_pickerMenu.css('display'), 'none', '#StartYearDemo responded to a button click event by closing the menu.');
+ assert.notOk(_pickerMenu.is(':visible'), '#StartYearDemo responded to a button click event by closing the menu.');
_picker.MonthPicker('destroy');
// get the picker menu again because it was removed from the dom upon destroying StartYearDemo.
assert.ok($('#MonthPicker_StartYearDemo').length === 0, "#StartYearDemo has been destroyed again.");
@@ -310,7 +308,7 @@ QUnit.test('Digital Bush Tests', function (assert) {
assert.equal($('#MonthPicker_Validation_DigitalBushBoth').css('display'), 'inline', '#DigitalBushBoth showed a validation message about a bad date.');
$('#DigitalBushBoth').MonthPicker('Clear');
- assert.equal($('#MonthPicker_Validation_DigitalBushBoth').css('display'), 'none', '#DigitalBushBoth cleared the validation error message using the Clear() API call.');
+ assert.ok($('#MonthPicker_Validation_DigitalBushBoth').is(':hidden'), '#DigitalBushBoth cleared the validation error message using the Clear() API call.');
});
QUnit.test('Only one open menu', function (assert) {
From f013d7fd108ccdf087d265960467eccd8334f987 Mon Sep 17 00:00:00 2001
From: Benjamin Albert ").appendTo(n);r.append(' ')}this._buttons=a("button",n).button(),i.on(I,function(a){return!1});var s=this,t="Month";a.each(["Min","Max"],function(a,b){s["_set"+b+t]=function(a){(s["_"+b+t]=j(s,a))===!1&&alert(A.replace(/%/,b).replace(/_/,a))},s._setOption(b+t,s.options[b+t])});var u=e.SelectedMonth;if(void 0!==u){var v=j(this,u);b.val(this._formatMonth(new d(f(v),v%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(G(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=F)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{B&&B.Close(b),B=this,a(c).on(I+this.uuid,G(this.Close,this)).on("keydown"+r+this.uuid,G(this._keyDown,this)),d.off("blur"+r).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:G(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,B=null,a(c).off("keydown"+r+this.uuid).off(I+this.uuid),this.Validate(),d.on("blur"+r,G(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return H.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return H.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(r),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(I,G(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=I+" focus"+r;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,G(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+r,G(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in q?q[b]:q._default},_position:C?function(b){var c=this.options.IsRTL?w:v,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(s,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.button({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(t),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(I).on(I,G(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(I).on(I,G(this._addToYear,this,1)),this._buttons.off(r);var c=this,d=G(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(I,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(t),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(I).on(I,G(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(I).on(I,G(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._buttons.off(r),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=G(this._onYearClick,this),q=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(t,v===j&&q).on(I,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus();var b=this;setTimeout(function(){var c=a>0?b._nextButton:b._prevButton;c.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._setPickerYear(this._getPickerYear()+a),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(t,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a,b,c,d){"use strict";function e(a){return a.getMonth()+12*a.getFullYear()}function f(a){return Math.floor(a/12)}function g(){a(this).addClass(u)}function h(a,b){return a[b?"on":"off"]("mousenter mouseout",g).toggleClass(u,b)}function i(a,b,c){return(!b||a>=b)&&(!c||c>=a)}function j(b,c){if(null===c)return c;if(c instanceof d)return e(c);if(a.isNumeric(c))return e(new d)+parseInt(c,10);var f=b._parseMonth(c);return f?e(f):l(c)}function k(a,b){return G(b.options[a]||F,b.element[0])}function l(b,c){var f=a.trim(b);f=f.replace(/y/i,'":"y"'),f=f.replace(/m/i,'":"m"');try{var g=JSON.parse('{"'+f.replace(/ /g,',"')+"}"),h={};for(var i in g)h[g[i]]=i;var j=e(new d);return j+=parseInt(h.m,10)||0,j+12*(parseInt(h.y,10)||0)}catch(k){return!1}}function m(b){return a(''+b.i18n.buttonText+"").button({text:!1,icons:{primary:b.ButtonIcon}})}function n(a,b){a.button("option",{icons:{primary:"ui-icon-circle-triangle-"+(b?"w":"e")}})}function o(a){return!a.is("input")}function p(b){var c,d=null,e=125,f=this;b.mouseover(function(b){var g=this;d=setTimeout(function(){d=null,a("span",g).animate({opacity:.45},{duration:e,complete:function(){c=a("span",g).text(),a("span",g).animate({opacity:1},e).text(f._i18n("jumpYears"))}})},175)}).mouseout(function(b){if(d)return clearTimeout(d);var f=this;a("span",f).animate({opacity:.45},{duration:e,complete:function(){a("span",f).text(c).animate({opacity:1},e)}})})}if(!(a&&a.ui&&a.ui.button&&a.ui.datepicker))return void alert(x+"The jQuery UI button and datepicker plug-ins must be loaded.");var q=a.fx.speeds,r=".MonthPicker",s="month-picker-disabled",t="ui-state-highlight",u="ui-state-active",v={my:"left top+1",at:"left bottom"},w={my:"right top+1",at:"right bottom"},x="MonthPicker Error: ",y=x+"The jQuery UI position plug-in must be loaded.",z=x+"Unsupported % option value, supported values are: ",A=x+'"_" is not a valid %Month value.',B=null,C=!!a.ui.position,D={Animation:["slideToggle","fadeToggle","none"],ShowAnim:["fadeIn","slideDown","none"],HideAnim:["fadeOut","slideUp","none"]},E={ValidationErrorMessage:"_createValidationMessage",Disabled:"_setDisabledState",ShowIcon:"_updateButton",Button:"_updateButton",ShowOn:"_updateFieldEvents",IsRTL:"_setRTL",AltFormat:"_updateAlt",AltField:"_updateAlt",StartYear:"_setPickerYear",MinMonth:"_setMinMonth",MaxMonth:"_setMaxMonth",SelectedMonth:"_setSelectedMonth"},F=a.noop,G=a.proxy,H=a.datepicker,I="click"+r;a.MonthPicker={VERSION:"3.0-alpha4",i18n:{year:"Year",prevYear:"Previous Year",nextYear:"Next Year",next5Years:"Jump Forward 5 Years",prev5Years:"Jump Back 5 Years",nextLabel:"Next",prevLabel:"Prev",buttonText:"Open Month Chooser",jumpYears:"Jump Years",months:["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sep.","Oct.","Nov.","Dec."]}};var J=' ").appendTo(n);r.append(' ')}this._buttons=a("button",n).button(),i.on(I,function(a){return!1});var s=this,t="Month";a.each(["Min","Max"],function(a,b){s["_set"+b+t]=function(a){(s["_"+b+t]=j(s,a))===!1&&alert(A.replace(/%/,b).replace(/_/,a))},s._setOption(b+t,s.options[b+t])});var u=e.SelectedMonth;if(void 0!==u){var v=j(this,u);b.val(this._formatMonth(new d(f(v),v%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(G(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=F)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{B&&B.Close(b),B=this,a(c).on(I+this.uuid,G(this.Close,this)).on("keydown"+r+this.uuid,G(this._keyDown,this)),d.off("blur"+r).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:G(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,B=null,a(c).off("keydown"+r+this.uuid).off(I+this.uuid),this.Validate(),d.on("blur"+r,G(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return H.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return H.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(r),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(I,G(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=I+" focus"+r;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,G(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+r,G(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in q?q[b]:q._default},_position:C?function(b){var c=this.options.IsRTL?w:v,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(s,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.button({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(t),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(I).on(I,G(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(I).on(I,G(this._addToYear,this,1)),this._buttons.off(r);var c=this,d=G(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(I,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(t),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(I).on(I,G(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(I).on(I,G(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._buttons.off(r),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=G(this._onYearClick,this),q=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(t,v===j&&q).on(I,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus();var b=this;setTimeout(function(){var c=a>0?b._nextButton:b._prevButton;c.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._setPickerYear(this._getPickerYear()+a),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(t,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/demo/Demo.min.js b/demo/Demo.min.js
index 2c01719..0bbb020 100644
--- a/demo/Demo.min.js
+++ b/demo/Demo.min.js
@@ -1 +1 @@
-!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(n);r.append(' ')}this._buttons=a("button",n).button(),i.on(I,function(a){return!1});var s=this,t="Month";a.each(["Min","Max"],function(a,b){s["_set"+b+t]=function(a){(s["_"+b+t]=j(s,a))===!1&&alert(A.replace(/%/,b).replace(/_/,a))},s._setOption(b+t,s.options[b+t])});var u=e.SelectedMonth;if(void 0!==u){var v=j(this,u);b.val(this._formatMonth(new d(f(v),v%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(G(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=F)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{B&&B.Close(b),B=this,a(c).on(I+this.uuid,G(this.Close,this)).on("keydown"+r+this.uuid,G(this._keyDown,this)),d.off("blur"+r).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:G(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,B=null,a(c).off("keydown"+r+this.uuid).off(I+this.uuid),this.Validate(),d.on("blur"+r,G(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return H.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return H.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(r),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(I,G(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=I+" focus"+r;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,G(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+r,G(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in q?q[b]:q._default},_position:C?function(b){var c=this.options.IsRTL?w:v,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(s,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.button({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(t),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(I).on(I,G(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(I).on(I,G(this._addToYear,this,1)),this._buttons.off(r);var c=this,d=G(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(I,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(t),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(I).on(I,G(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(I).on(I,G(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._buttons.off(r),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=G(this._onYearClick,this),q=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(t,v===j&&q).on(I,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus();var b=this;setTimeout(function(){var c=a>0?b._nextButton:b._prevButton;c.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._setPickerYear(this._getPickerYear()+a),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(t,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(n);r.append(' ')}this._buttons=a("button",n).button(),i.on(I,function(a){return!1});var s=this,t="Month";a.each(["Min","Max"],function(a,b){s["_set"+b+t]=function(a){(s["_"+b+t]=j(s,a))===!1&&alert(A.replace(/%/,b).replace(/_/,a))},s._setOption(b+t,s.options[b+t])});var u=e.SelectedMonth;if(void 0!==u){var v=j(this,u);b.val(this._formatMonth(new d(f(v),v%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(G(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=F)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{B&&B.Close(b),B=this,a(c).on(I+this.uuid,G(this.Close,this)).on("keydown"+r+this.uuid,G(this._keyDown,this)),d.off("blur"+r).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:G(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,B=null,a(c).off("keydown"+r+this.uuid).off(I+this.uuid),this.Validate(),d.on("blur"+r,G(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return H.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return H.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(r),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(I,G(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=I+" focus"+r;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,G(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+r,G(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in q?q[b]:q._default},_position:C?function(b){var c=this.options.IsRTL?w:v,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(s,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.button({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(t),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(I).on(I,G(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(I).on(I,G(this._addToYear,this,1)),this._buttons.off(r);var c=this,d=G(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(I,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(t),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(I).on(I,G(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(I).on(I,G(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._buttons.off(r),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=G(this._onYearClick,this),q=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(t,v===j&&q).on(I,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus();var b=this;setTimeout(function(){var c=a>0?b._nextButton:b._prevButton;c.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._setPickerYear(this._getPickerYear()+a),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(t,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/test/test.js b/test/test.js
index f2a084b..53d805a 100644
--- a/test/test.js
+++ b/test/test.js
@@ -404,7 +404,7 @@ QUnit.test('Inline menu', function(assert) {
assert.notOk($("#MonthPicker_Button_InlineMenuDiv").length, 'The default button was not created');
- //field.MonthPicker('destroy');
+ field.MonthPicker('destroy');
});
QUnit.test('SelectedMonth option', function(assert) {
From 5bfcc700c77aaea6ff32f8d93236ed9cc48b6544 Mon Sep 17 00:00:00 2001
From: Benjamin Albert The jQuery UI Month Picker Version 3.0-alpha4
+The jQuery UI Month Picker Version 3.0-alpha5
[](https://travis-ci.org/benjamin-albert/jquery-ui-month-picker)
[](http://gruntjs.com/)
-Prerequisites
Installation
-
<link href="http://code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css" media="all" rel="stylesheet" type="text/css" />
<link href="css/MonthPicker.css" media="all" rel="stylesheet" type="text/css" />
@@ -39,7 +39,7 @@ for date validation, setting the start year, using an icon button, input masking
Source Code Example
-
$('#TextBox1').MonthPicker({ StartYear: 2020, ShowIcon: false });
$('input[type=month]').MonthPicker().css('backgroundColor', 'lightyellow');
@@ -72,7 +72,7 @@ You can create an inline month picker menu by calling the month picker function
$('div').MonthPicker({
SelectedMonth: '+1y -3M', // Set the selected month.
AltField: '#hiddenInput' // Populate a hidden field and send to send the selected value to the server.
-
+
OnAfterChooseMonth: function(selectedDate) {
// Do something with selected JavaScript date.
// console.log(selectedDate);
@@ -128,7 +128,7 @@ NOTE: This method is not affected by the MonthForm
The menu will immediately close itself, you can prevent the menu from closing using the
OnBeforeMenuClose event (example included) and calling event.preventDefault() for the element triggering the event.
-$('.selector').MonthPicker({ Disabled: true });
-
- Get or set the option, after init.
+
+ Get or set the option, after init.
//getter
var disabled = $('.selector').MonthPicker('option', 'Disabled');
@@ -193,8 +193,8 @@ $('.selector').MonthPicker('option', 'Disabled', true );
$('.selector').MonthPicker({ MinMonth: 0 });
-
- Get or set the option, after init.
+
+ Get or set the option, after init.
//getter
var minMonth = $('.selector').MonthPicker('option', 'MinMonth');
@@ -225,8 +225,8 @@ $('.selector').MonthPicker('option', 'MinMonth', '+1y +3m');
$('.selector').MonthPicker({ MaxMonth: 0 });
-
- Get or set the option, after init.
+
+ Get or set the option, after init.
//getter
var minMonth = $('.selector').MonthPicker('option', 'MaxMonth');
@@ -239,7 +239,7 @@ $('.selector').MonthPicker('option', 'MaxMonth', '+1y +3m');
Button
- Types:
+ Types:
Since: 2.5
- Default:
+ Default:
// Creates the default button.
Button: function(options) {
@@ -272,14 +272,14 @@ If you just want to use a different showOn: 'both' option.
-$('.selector').MonthPicker({
+$('.selector').MonthPicker({
Button: '<button type="button" class="ui-datepicker-trigger">...</button>'
});
Create a button out of an image.
-$('.selector').MonthPicker({
+$('.selector').MonthPicker({
Button: '<img src="images/calendar.gif" title="Select date" />'
});
@@ -300,7 +300,7 @@ $('.selector').MonthPicker({
<img src="images/{{ButtonIcon}}{{#if Disabled}}-disabled{{/if}}.gif" title="{{i18n.buttonText}}" />
</script>
<script>
-$('.selector').MonthPicker({
+$('.selector').MonthPicker({
Button: Handlebars.compile( $('#template').html() )
});
</script>
@@ -309,7 +309,7 @@ $('.selector').MonthPicker({
Assign an existing element with a class of button that immediately follows
the associated input field as a button.
-$('.selector').MonthPicker({
+$('.selector').MonthPicker({
Button: function() {
return $(this).next('.button');
}
@@ -318,12 +318,12 @@ $('.selector').MonthPicker({
Assign a specific element with the class button.
-$('.selector').MonthPicker({
+$('.selector').MonthPicker({
Button: '.button'
});
- Get or set the option, after init.
+ Get or set the option, after init.
//getter
var button = $('.selector').MonthPicker('option', 'Button');
@@ -364,8 +364,8 @@ If the button is not one of the elements above then you have to disable the elem
Set the option upon init.
$('.selector').MonthPicker({ SelectedMonth: 0 });
-
- Get or set the option, after init.
+
+ Get or set the option, after init.
//getter
var minMonth = $('.selector').MonthPicker('option', 'SelectedMonth');
@@ -384,8 +384,8 @@ $('.selector').MonthPicker('option', 'SelectedMonth', '+1y -3m');
$('.selector').MonthPicker({ ShowIcon: true });
-
- Get or set the option, after init.
+
+ Get or set the option, after init.
//getter
var disabled = $('.selector').MonthPicker('option', 'ShowIcon');
@@ -399,14 +399,14 @@ $('.selector').MonthPicker('option', 'ShowIcon', false );
ButtonIcon
Type: String
Default: ui-icon-calculator
-
+
Allows setting a different primary icon class name for the default icon. Feel free to use this option in your custom buttons as show in the Button option examples.
$('.selector').MonthPicker({ ButtonIcon: 'ui-icon-clock' });
-
- Get or set the option, after init.
+
+ Get or set the option, after init.
//getter
var image = $('.selector').MonthPicker('option', 'ButtonIcon');
@@ -426,8 +426,8 @@ $('.selector').MonthPicker('option', 'ButtonIcon', false );
$('.selector').MonthPicker({ ShowOn: 'both' });
-
- Get or set the option, after init.
+
+ Get or set the option, after init.
//getter
var ShowOn = $('.selector').MonthPicker('option', 'ShowOn');
@@ -451,8 +451,8 @@ $('.selector').MonthPicker('option', 'ShowOn', 'both' );
$('.selector').MonthPicker({ IsRTL: true });
-
- Get or set the option, after init.
+
+ Get or set the option, after init.
//getter
var IsRTL = $('.selector').MonthPicker('option', 'IsRTL');
@@ -471,8 +471,8 @@ $('.selector').MonthPicker('option', 'IsRTL', true );
$('.selector').MonthPicker({ StartYear: 2023 });
-
- Get or set the option, after init.
+
+ Get or set the option, after init.
//getter
var disabled = $('.selector').MonthPicker('option', 'StartYear');
@@ -491,8 +491,8 @@ $('.selector').MonthPicker('option', 'StartYear', false );
$('.selector').MonthPicker({ ValidationErrorMessage: 'Invalid Date!' });
-
- Get or set the option, after init.
+
+ Get or set the option, after init.
//getter
var disabled = $('.selector').MonthPicker('option', 'ValidationErrorMessage');
@@ -511,11 +511,11 @@ $('.selector').MonthPicker('option', 'ValidationErrorMessage', null );
// Results in December, 2015
$('.selector').MonthPicker({ MonthFormat: 'MM, yy' });
-
- Get or set the option, after init.
+
+ Get or set the option, after init.
//getter
var disabled = $('.selector').MonthPicker('option', 'MonthFormat');
@@ -528,30 +528,30 @@ The following example shows how to use the popular
$.widget('MyOrg.MomentMonthPicker', $.KidSysco.MonthPicker, {
-
+
// Set the default format.
options: {
MonthFormat: 'MM/YYYY',
},
-
+
// Set the format to use with the HTML 5 month input.
MonthInputFormat: 'YYYY-MM',
-
+
/**
* @param str {String} A string representing a date in the given format.
* @param format {String} The format used to parse the str argument.
- *
+ *
* @returns {Date} A JavaScript date.
*/
ParseMonth: function(str, format) {
var wrapper = moment(str, format);
return wrapper.isValid() ? wrapper.toDate() : null;
},
-
+
/**
* @param date {Date} A string representing a date in the given format.
* @param format {String} The format to use to convert the date to a string.
- *
+ *
* @returns {String} A string representing a date in the given format.
*/
FormatMonth: function(date, format) {
@@ -581,11 +581,11 @@ $('.selector').MomentMonthPicker({
$('.selector').MonthPicker({ AltField: '#field' });
-
- Get or set the option, after init.
+
+ Get or set the option, after init.
//getter
var disabled = $('.selector').MonthPicker('option', 'AltField');
@@ -603,11 +603,11 @@ $('.selector').MonthPicker('option', 'AltField': '#OtherField' );
$('.selector').MonthPicker({ AltFormat: "yy-mm" });
-
- Get or set the option, after init.
+
+ Get or set the option, after init.
//getter
var disabled = $('.selector').MonthPicker('option', 'AltFormat');
@@ -632,8 +632,8 @@ In version 2.4 and later the mask is constructed according to the
-
- Get or set the option, after init.
+
+ Get or set the option, after init.
//getter
var disabled = $('.selector').MonthPicker('option', 'UseInputMask');
@@ -659,8 +659,8 @@ $('.selector').MonthPicker('option', 'UseInputMask', false );
$('.selector').MonthPicker({ Animation: 'slideToggle' });
-
- Get or set the option, after init.
+
+ Get or set the option, after init.
//getter
var Animation = $('.selector').MonthPicker('option', 'Animation');
@@ -685,14 +685,14 @@ $('.selector').MonthPicker('option', 'Animation', 'slideToggle' );
$('.selector').MonthPicker({ Duration: 'fast' });
-
- Get or set the option, after init.
+
+ Get or set the option, after init.
//getter
var Duration = $('.selector').MonthPicker('option', 'Duration');
@@ -714,7 +714,7 @@ $('.selector').MonthPicker('option', 'Duration', 'fast' );
If you want to have the same animation for both opening and closing the menu use
the Animation option instead.
-
+
$('.selector').MonthPicker({ ShowAnim: 'slideDown' });
-
- Get or set the option, after init.
+
+ Get or set the option, after init.
//getter
var ShowAnim = $('.selector').MonthPicker('option', 'ShowAnim');
@@ -745,7 +745,7 @@ $('.selector').MonthPicker('option', 'ShowAnim', 'slideDown' );
If you want to have the same animation for both opening and closing the menu use
the Animation option instead.
-
+
$('.selector').MonthPicker({ HideAnim: 'slideUp' });
-
- Get or set the option, after init.
+
+ Get or set the option, after init.
//getter
var HideAnim = $('.selector').MonthPicker('option', 'HideAnim');
@@ -791,8 +791,8 @@ $('.selector').MonthPicker({
}
});
-
- Get or set the option, after init.
+
+ Get or set the option, after init.
//getter
var position = $('.selector').MonthPicker('option', 'Position');
@@ -822,8 +822,8 @@ $('.selector').MonthPicker({
}
});
-
- Get or set the callback function, after init.
+
+ Get or set the callback function, after init.
//getter
var callback = $('.selector').MonthPicker('option', 'OnBeforeMenuOpen');
@@ -842,8 +842,8 @@ $('.selector').MonthPicker('option', 'OnBeforeMenuOpen', function(){ ... } );
$('.selector').MonthPicker({ OnAfterMenuOpen: function(){ ... } });
-
- Get or set the callback function, after init.
+
+ Get or set the callback function, after init.
//getter
var disabled = $('.selector').MonthPicker('option', 'OnAfterMenuOpen');
@@ -864,10 +864,10 @@ $('.selector').MonthPicker('option', 'OnAfterMenuOpen', function(){ ... } );
$('.selector').MonthPicker({
OnBeforeMenuClose: function(event){
- // Prevent the menu from closing when clicking on
+ // Prevent the menu from closing when clicking on
// the external button or one of it's child nodes.
//
- // Note: The first argument of $.contains() must be a DOM element,
+ // Note: The first argument of $.contains() must be a DOM element,
// not a jQuery object or plain JavaScript object.
if ( $.contains($('#extarnal_button')[0], event.target) ) {
event.preventDefault();
@@ -875,8 +875,8 @@ $('.selector').MonthPicker({
}
});
-
- Get or set the callback function, after init.
+
+ Get or set the callback function, after init.
//getter
var callback = $('.selector').MonthPicker('option', 'OnBeforeMenuClose');
@@ -895,8 +895,8 @@ $('.selector').MonthPicker('option', 'OnBeforeMenuClose', function(){ ... } );
$('.selector').MonthPicker({ OnAfterMenuClose: function(){ ... } });
-
- Get or set the callback function, after init.
+
+ Get or set the callback function, after init.
//getter
var disabled = $('.selector').MonthPicker('option', 'OnAfterMenuClose');
@@ -917,12 +917,12 @@ $('.selector').MonthPicker('option', 'OnAfterNextYear', function(){ ... } );
$('.selector').MonthPicker({
OnAfterSetDisabled: function(isDisabled){
-
+
}
});
-
- Get or set the callback function, after init.
+
+ Get or set the callback function, after init.
//getter
var callback = $('.selector').MonthPicker('option', 'OnAfterSetDisabled');
@@ -941,8 +941,8 @@ $('.selector').MonthPicker('option', 'OnAfterSetDisabled', function(){ ... } );
$('.selector').MonthPicker({ OnAfterNextYear: function(){ ... } });
-
- Get or set the callback function, after init.
+
+ Get or set the callback function, after init.
//getter
var disabled = $('.selector').MonthPicker('option', 'OnAfterNextYear');
@@ -961,8 +961,8 @@ $('.selector').MonthPicker('option', 'OnAfterNextYear', function(){ ... } );
$('.selector').MonthPicker({ OnAfterNextYears: function(){ ... } });
-
- Get or set the callback function, after init.
+
+ Get or set the callback function, after init.
//getter
var disabled = $('.selector').MonthPicker('option', 'OnAfterNextYears');
@@ -981,8 +981,8 @@ $('.selector').MonthPicker('option', 'OnAfterNextYears', function(){ ... } );
$('.selector').MonthPicker({ OnAfterPreviousYear: function(){ ... } });
-
- Get or set the callback function, after init.
+
+ Get or set the callback function, after init.
//getter
var disabled = $('.selector').MonthPicker('option', 'OnAfterPreviousYear');
@@ -1001,8 +1001,8 @@ $('.selector').MonthPicker('option', 'OnAfterPreviousYear', function(){ ... } );
$('.selector').MonthPicker({ OnAfterPreviousYears: function(){ ... } });
-
- Get or set the callback function, after init.
+
+ Get or set the callback function, after init.
//getter
var disabled = $('.selector').MonthPicker('option', 'OnAfterPreviousYears');
@@ -1021,8 +1021,8 @@ $('.selector').MonthPicker('option', 'OnAfterPreviousYears', function(){ ... } )
$('.selector').MonthPicker({ OnAfterChooseMonth: function(){ ... } });
-
- Get or set the callback function, after init.
+
+ Get or set the callback function, after init.
//getter
var disabled = $('.selector').MonthPicker('option', 'OnAfterChooseMonth');
@@ -1041,8 +1041,8 @@ $('.selector').MonthPicker('option', 'OnAfterChooseMonth', function(){ ... } );
$('.selector').MonthPicker({ OnAfterChooseMonths: function(){ ... } });
-
- Get or set the callback function, after init.
+
+ Get or set the callback function, after init.
//getter
var disabled = $('.selector').MonthPicker('option', 'OnAfterChooseMonths');
@@ -1061,8 +1061,8 @@ $('.selector').MonthPicker('option', 'OnAfterChooseMonths', function(){ ... } );
$('.selector').MonthPicker({ OnAfterChooseYear: function(){ ... } });
-
- Get or set the callback function, after init.
+
+ Get or set the callback function, after init.
//getter
var disabled = $('.selector').MonthPicker('option', 'OnAfterChooseYear');
@@ -1081,8 +1081,8 @@ $('.selector').MonthPicker('option', 'OnAfterChooseYear', function(){ ... } );
$('.selector').MonthPicker({ OnAfterChooseYears: function(){ ... } });
-
- Get or set the callback function, after init.
+
+ Get or set the callback function, after init.
//getter
var disabled = $('.selector').MonthPicker('option', 'OnAfterChooseYears');
@@ -1106,5 +1106,3 @@ If the value is undefined you are using an old version (2.3 and under).
This command will install all required dependencies including all resources needed from Bower.
This command will re-compile minified versions of the .js and .css codes before running both through the QUnit tests tests in a headless PhantomJS instance.
This command will simply re-run all QUnit tests in a headless PhantomJS instance.").appendTo(n);r.append(' ')}this._buttons=a("button",n).button(),i.on(I,function(a){return!1});var s=this,t="Month";a.each(["Min","Max"],function(a,b){s["_set"+b+t]=function(a){(s["_"+b+t]=j(s,a))===!1&&alert(A.replace(/%/,b).replace(/_/,a))},s._setOption(b+t,s.options[b+t])});var u=e.SelectedMonth;if(void 0!==u){var v=j(this,u);b.val(this._formatMonth(new d(f(v),v%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(G(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=F)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{B&&B.Close(b),B=this,a(c).on(I+this.uuid,G(this.Close,this)).on("keydown"+r+this.uuid,G(this._keyDown,this)),d.off("blur"+r).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:G(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,B=null,a(c).off("keydown"+r+this.uuid).off(I+this.uuid),this.Validate(),d.on("blur"+r,G(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return H.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return H.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(r),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(I,G(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=I+" focus"+r;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,G(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+r,G(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in q?q[b]:q._default},_position:C?function(b){var c=this.options.IsRTL?w:v,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(s,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.button({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(t),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(I).on(I,G(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(I).on(I,G(this._addToYear,this,1)),this._buttons.off(r);var c=this,d=G(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(I,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(t),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(I).on(I,G(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(I).on(I,G(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._buttons.off(r),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=G(this._onYearClick,this),q=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(t,v===j&&q).on(I,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus();var b=this;setTimeout(function(){var c=a>0?b._nextButton:b._prevButton;c.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._setPickerYear(this._getPickerYear()+a),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(t,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a,b,c,d){"use strict";function e(a){return a.getMonth()+12*a.getFullYear()}function f(a){return Math.floor(a/12)}function g(){a(this).addClass(t)}function h(a,b){return a[b?"on":"off"]("mousenter mouseout",g).toggleClass(t,b)}function i(a,b,c){return(!b||a>=b)&&(!c||c>=a)}function j(b,c){if(null===c)return c;if(c instanceof d)return e(c);if(a.isNumeric(c))return e(new d)+parseInt(c,10);var f=b._parseMonth(c);return f?e(f):l(c)}function k(a,b){return F(b.options[a]||E,b.element[0])}function l(b,c){var f=a.trim(b);f=f.replace(/y/i,'":"y"'),f=f.replace(/m/i,'":"m"');try{var g=JSON.parse('{"'+f.replace(/ /g,',"')+"}"),h={};for(var i in g)h[g[i]]=i;var j=e(new d);return j+=parseInt(h.m,10)||0,j+12*(parseInt(h.y,10)||0)}catch(k){return!1}}function m(b){return a(''+b.i18n.buttonText+"").button({text:!1,icons:{primary:b.ButtonIcon}})}function n(a,b){a.button("option",{icons:{primary:"ui-icon-circle-triangle-"+(b?"w":"e")}})}function o(a){return!a.is("input")}if(!(a&&a.ui&&a.ui.button&&a.ui.datepicker))return void alert(w+"The jQuery UI button and datepicker plug-ins must be loaded.");var p=a.fx.speeds,q=".MonthPicker",r="month-picker-disabled",s="ui-state-highlight",t="ui-state-active",u={my:"left top+1",at:"left bottom"},v={my:"right top+1",at:"right bottom"},w="MonthPicker Error: ",x=w+"The jQuery UI position plug-in must be loaded.",y=w+"Unsupported % option value, supported values are: ",z=w+'"_" is not a valid %Month value.',A=null,B=!!a.ui.position,C={Animation:["slideToggle","fadeToggle","none"],ShowAnim:["fadeIn","slideDown","none"],HideAnim:["fadeOut","slideUp","none"]},D={ValidationErrorMessage:"_createValidationMessage",Disabled:"_setDisabledState",ShowIcon:"_updateButton",Button:"_updateButton",ShowOn:"_updateFieldEvents",IsRTL:"_setRTL",AltFormat:"_updateAlt",AltField:"_updateAlt",StartYear:"_setPickerYear",MinMonth:"_setMinMonth",MaxMonth:"_setMaxMonth",SelectedMonth:"_setSelectedMonth"},E=a.noop,F=a.proxy,G=a.datepicker,H="click"+q;a.MonthPicker={VERSION:"3.0-alpha5",i18n:{year:"Year",prevYear:"Previous Year",nextYear:"Next Year",next5Years:"Jump Forward 5 Years",prev5Years:"Jump Back 5 Years",nextLabel:"Next",prevLabel:"Prev",buttonText:"Open Month Chooser",jumpYears:"Jump Years",months:["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sep.","Oct.","Nov.","Dec."]}};var I=' ").appendTo(n);q.append(' ')}this._buttons=a("button",n).button(),i.on(H,function(a){return!1});var r=this,s="Month";a.each(["Min","Max"],function(a,b){r["_set"+b+s]=function(a){(r["_"+b+s]=j(r,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},r._setOption(b+s,r.options[b+s])});var t=e.SelectedMonth;if(void 0!==t){var u=j(this,t);b.val(this._formatMonth(new d(f(u),u%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyFadeShowYears:function(b){var c,d=125,e=this;this._jumpYearsButton.on("mouseenter"+q+"-j",function(b){var f=this;e.tOut=setTimeout(function(){e.tOut=null,a("span",f).animate({opacity:.45},{duration:d,complete:function(){e._backToYear||(c=a("span",f).text(),a("span",f).animate({opacity:1},d).text(e._i18n("jumpYears")))}})},175)}).on("mouseleave"+q+"-j",function(b){if(e.tOut)return clearTimeout(e.tOut);var f=this;a("span",f).animate({opacity:.45},{duration:d,complete:function(){a("span",f).text(c).animate({opacity:1},d)}})})},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.button({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),this._jumpYearsButton.button({label:"Year "+c}),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),this._backToYear?(this._setPickerYear(this._backToYear),this._applyFadeShowYears(),this._showMonths(),this._backToYear=0):(clearTimeout(this.tOut),this._jumpYearsButton.off(q+"-j"),this._jumpYearsButton.button({label:"Back to "+this._getPickerYear()}),this._jumpYearsButton.find("span").stop().css({opacity:1}),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)())},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus();var b=this;setTimeout(function(){var c=a>0?b._nextButton:b._prevButton;c.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/demo/Demo.min.js b/demo/Demo.min.js
index 0bbb020..efbaccb 100644
--- a/demo/Demo.min.js
+++ b/demo/Demo.min.js
@@ -1 +1 @@
-!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(n);r.append(' ')}this._buttons=a("button",n).button(),i.on(I,function(a){return!1});var s=this,t="Month";a.each(["Min","Max"],function(a,b){s["_set"+b+t]=function(a){(s["_"+b+t]=j(s,a))===!1&&alert(A.replace(/%/,b).replace(/_/,a))},s._setOption(b+t,s.options[b+t])});var u=e.SelectedMonth;if(void 0!==u){var v=j(this,u);b.val(this._formatMonth(new d(f(v),v%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(G(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=F)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{B&&B.Close(b),B=this,a(c).on(I+this.uuid,G(this.Close,this)).on("keydown"+r+this.uuid,G(this._keyDown,this)),d.off("blur"+r).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:G(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,B=null,a(c).off("keydown"+r+this.uuid).off(I+this.uuid),this.Validate(),d.on("blur"+r,G(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return H.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return H.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(r),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(I,G(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=I+" focus"+r;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,G(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+r,G(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in q?q[b]:q._default},_position:C?function(b){var c=this.options.IsRTL?w:v,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(s,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.button({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=new d(this._getPickerYear(),b-1);this.element.val(this._formatMonth(c)).blur(),this._updateAlt(0,c),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(c)},_chooseYear:function(a){this._setPickerYear(a),this._buttons.removeClass(t),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(I).on(I,G(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(I).on(I,G(this._addToYear,this,1)),this._buttons.off(r);var c=this,d=G(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(I,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(t),this._showYears(),k("OnAfterChooseYears",this)()},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(I).on(I,G(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(I).on(I,G(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._buttons.off(r),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=G(this._onYearClick,this),q=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(t,v===j&&q).on(I,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus();var b=this;setTimeout(function(){var c=a>0?b._nextButton:b._prevButton;c.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._setPickerYear(this._getPickerYear()+a),this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(t,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(n);q.append(' ')}this._buttons=a("button",n).button(),i.on(H,function(a){return!1});var r=this,s="Month";a.each(["Min","Max"],function(a,b){r["_set"+b+s]=function(a){(r["_"+b+s]=j(r,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},r._setOption(b+s,r.options[b+s])});var t=e.SelectedMonth;if(void 0!==t){var u=j(this,t);b.val(this._formatMonth(new d(f(u),u%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyFadeShowYears:function(b){var c,d=125,e=this;this._jumpYearsButton.on("mouseenter"+q+"-j",function(b){var f=this;e.tOut=setTimeout(function(){e.tOut=null,a("span",f).animate({opacity:.45},{duration:d,complete:function(){e._backToYear||(c=a("span",f).text(),a("span",f).animate({opacity:1},d).text(e._i18n("jumpYears")))}})},175)}).on("mouseleave"+q+"-j",function(b){if(e.tOut)return clearTimeout(e.tOut);var f=this;a("span",f).animate({opacity:.45},{duration:d,complete:function(){a("span",f).text(c).animate({opacity:1},d)}})})},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.button("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.button({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),this._jumpYearsButton.button({label:"Year "+c}),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).button("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),this._backToYear?(this._setPickerYear(this._backToYear),this._applyFadeShowYears(),this._showMonths(),this._backToYear=0):(clearTimeout(this.tOut),this._jumpYearsButton.off(q+"-j"),this._jumpYearsButton.button({label:"Back to "+this._getPickerYear()}),this._jumpYearsButton.find("span").stop().css({opacity:1}),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)())},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).button("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).button("option","disabled",n&&e+12-1>n),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).button({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus();var b=this;setTimeout(function(){var c=a>0?b._nextButton:b._prevButton;c.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.button("option","disabled",g&&b==f(g)),this._nextButton.button("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).button({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
From 236da1af4e3574ea84b50e9251fb966d92eb331e Mon Sep 17 00:00:00 2001
From: Benjamin Albert ' +
'
").appendTo(n);q.append(' ')}this._buttons=a("button",n).jqueryUIButton(),i.on(H,function(a){return!1});var r=this,s="Month";a.each(["Min","Max"],function(a,b){r["_set"+b+s]=function(a){(r["_"+b+s]=j(r,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},r._setOption(b+s,r.options[b+s])});var t=e.SelectedMonth;if(void 0!==t){var u=j(this,t);b.val(this._formatMonth(new d(f(u),u%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyFadeShowYears:function(b){var c,d=125,e=this;this._jumpYearsButton.on("mouseenter"+q+"-j",function(b){var f=this;e.tOut=setTimeout(function(){e.tOut=null,a("span",f).animate({opacity:.45},{duration:d,complete:function(){e._backToYear||(c=a("span",f).text(),a("span",f).animate({opacity:1},d).text(e._i18n("jumpYears")))}})},175)}).on("mouseleave"+q+"-j",function(b){if(e.tOut)return clearTimeout(e.tOut);var f=this;a("span",f).animate({opacity:.45},{duration:d,complete:function(){a("span",f).text(c).animate({opacity:1},d)}})})},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),this._jumpYearsButton.jqueryUIButton({label:"Year "+c}),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),this._backToYear?(this._setPickerYear(this._backToYear),this._applyFadeShowYears(),this._showMonths(),this._backToYear=0):(clearTimeout(this.tOut),this._jumpYearsButton.off(q+"-j"),this._jumpYearsButton.jqueryUIButton({label:"Back to "+this._getPickerYear()}),this._jumpYearsButton.find("span").stop().css({opacity:1}),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)())},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).jqueryUIButton("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).jqueryUIButton("option","disabled",n&&e+12-1>n),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus();var b=this;setTimeout(function(){var c=a>0?b._nextButton:b._prevButton;c.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.jqueryUIButton("option","disabled",g&&b==f(g)),this._nextButton.jqueryUIButton("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a,b,c,d){"use strict";function e(a){return a.getMonth()+12*a.getFullYear()}function f(a){return Math.floor(a/12)}function g(){a(this).addClass(t)}function h(a,b){return a[b?"on":"off"]("mousenter mouseout",g).toggleClass(t,b)}function i(a,b,c){return(!b||a>=b)&&(!c||c>=a)}function j(b,c){if(null===c)return c;if(c instanceof d)return e(c);if(a.isNumeric(c))return e(new d)+parseInt(c,10);var f=b._parseMonth(c);return f?e(f):l(c)}function k(a,b){return F(b.options[a]||E,b.element[0])}function l(b,c){var f=a.trim(b);f=f.replace(/y/i,'":"y"'),f=f.replace(/m/i,'":"m"');try{var g=JSON.parse('{"'+f.replace(/ /g,',"')+"}"),h={};for(var i in g)h[g[i]]=i;var j=e(new d);return j+=parseInt(h.m,10)||0,j+12*(parseInt(h.y,10)||0)}catch(k){return!1}}function m(b){return a(''+b.i18n.buttonText+"").jqueryUIButton({text:!1,icons:{primary:b.ButtonIcon}})}function n(a,b){a.jqueryUIButton("option",{icons:{primary:"ui-icon-circle-triangle-"+(b?"w":"e")}})}function o(a){return!a.is("input")}if(!(a&&a.ui&&a.ui.button&&a.ui.datepicker))return void alert(w+"The jQuery UI button and datepicker plug-ins must be loaded.");a.widget.bridge("jqueryUIButton",a.ui.button);var p=a.fx.speeds,q=".MonthPicker",r="month-picker-disabled",s="ui-state-highlight",t="ui-state-active",u={my:"left top+1",at:"left bottom"},v={my:"right top+1",at:"right bottom"},w="MonthPicker Error: ",x=w+"The jQuery UI position plug-in must be loaded.",y=w+"Unsupported % option value, supported values are: ",z=w+'"_" is not a valid %Month value.',A=null,B=!!a.ui.position,C={Animation:["slideToggle","fadeToggle","none"],ShowAnim:["fadeIn","slideDown","none"],HideAnim:["fadeOut","slideUp","none"]},D={ValidationErrorMessage:"_createValidationMessage",Disabled:"_setDisabledState",ShowIcon:"_updateButton",Button:"_updateButton",ShowOn:"_updateFieldEvents",IsRTL:"_setRTL",AltFormat:"_updateAlt",AltField:"_updateAlt",StartYear:"_setPickerYear",MinMonth:"_setMinMonth",MaxMonth:"_setMaxMonth",SelectedMonth:"_setSelectedMonth"},E=a.noop,F=a.proxy,G=a.datepicker,H="click"+q;a.MonthPicker={VERSION:"3.0-beta1",i18n:{year:"Year",prevYear:"Previous Year",nextYear:"Next Year",next5Years:"Jump Forward 5 Years",prev5Years:"Jump Back 5 Years",nextLabel:"Next",prevLabel:"Prev",buttonText:"Open Month Chooser",jumpYears:"Jump Years",months:["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sep.","Oct.","Nov.","Dec."]}};var I=' ").appendTo(n);q.append(' ')}this._buttons=a("button",n).jqueryUIButton(),i.on(H,function(a){return!1});var r=this,s="Month";a.each(["Min","Max"],function(a,b){r["_set"+b+s]=function(a){(r["_"+b+s]=j(r,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},r._setOption(b+s,r.options[b+s])});var t=e.SelectedMonth;if(void 0!==t){var u=j(this,t);b.val(this._formatMonth(new d(f(u),u%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyFadeShowYears:function(b){var c,d=125,e=this;this._jumpYearsButton.on("mouseenter"+q+"-j",function(b){var f=this;e.tOut=setTimeout(function(){e.tOut=null,a("span",f).animate({opacity:.45},{duration:d,complete:function(){e._backToYear||(c=a("span",f).text(),a("span",f).animate({opacity:1},d).text(e._i18n("jumpYears")))}})},175)}).on("mouseleave"+q+"-j",function(b){if(e.tOut)return clearTimeout(e.tOut);var f=this;a("span",f).animate({opacity:.45},{duration:d,complete:function(){a("span",f).text(c).animate({opacity:1},d)}})})},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),this._jumpYearsButton.jqueryUIButton({label:"Year "+c}),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),this._backToYear?(this._setPickerYear(this._backToYear),this._applyFadeShowYears(),this._showMonths(),this._backToYear=0):(clearTimeout(this.tOut),this._jumpYearsButton.off(q+"-j"),this._jumpYearsButton.jqueryUIButton({label:"Back to "+this._getPickerYear()}),this._jumpYearsButton.find("span").stop().css({opacity:1}),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)())},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).jqueryUIButton("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).jqueryUIButton("option","disabled",n&&e+12-1>n),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.jqueryUIButton("option","disabled",g&&b==f(g)),this._nextButton.jqueryUIButton("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/README.md b/README.md
index 1c71e29..701d05c 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
- The jQuery UI Month Picker Version 3.0-alpha6
+The jQuery UI Month Picker Version 3.0-beta1
[](https://travis-ci.org/benjamin-albert/jquery-ui-month-picker)
[](http://gruntjs.com/)
diff --git a/bower.json b/bower.json
index dddb01a..334bd90 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "jquery-ui-month-picker",
- "version": "2.8.3",
+ "version": "3.0-beta1",
"homepage": "https://github.com/KidSysco/jquery-ui-month-picker",
"authors": [
"Ryan Segura ").appendTo(n);q.append(' ')}this._buttons=a("button",n).jqueryUIButton(),i.on(H,function(a){return!1});var r=this,s="Month";a.each(["Min","Max"],function(a,b){r["_set"+b+s]=function(a){(r["_"+b+s]=j(r,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},r._setOption(b+s,r.options[b+s])});var t=e.SelectedMonth;if(void 0!==t){var u=j(this,t);b.val(this._formatMonth(new d(f(u),u%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyFadeShowYears:function(b){var c,d=125,e=this;this._jumpYearsButton.on("mouseenter"+q+"-j",function(b){var f=this;e.tOut=setTimeout(function(){e.tOut=null,a("span",f).animate({opacity:.45},{duration:d,complete:function(){e._backToYear||(c=a("span",f).text(),a("span",f).animate({opacity:1},d).text(e._i18n("jumpYears")))}})},175)}).on("mouseleave"+q+"-j",function(b){if(e.tOut)return clearTimeout(e.tOut);var f=this;a("span",f).animate({opacity:.45},{duration:d,complete:function(){a("span",f).text(c).animate({opacity:1},d)}})})},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),this._jumpYearsButton.jqueryUIButton({label:"Year "+c}),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),this._backToYear?(this._setPickerYear(this._backToYear),this._applyFadeShowYears(),this._showMonths(),this._backToYear=0):(clearTimeout(this.tOut),this._jumpYearsButton.off(q+"-j"),this._jumpYearsButton.jqueryUIButton({label:"Back to "+this._getPickerYear()}),this._jumpYearsButton.find("span").stop().css({opacity:1}),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)())},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).jqueryUIButton("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).jqueryUIButton("option","disabled",n&&e+12-1>n),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus();var b=this;setTimeout(function(){var c=a>0?b._nextButton:b._prevButton;c.addClass("ui-state-hover")},1),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.jqueryUIButton("option","disabled",g&&b==f(g)),this._nextButton.jqueryUIButton("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(n);q.append(' ')}this._buttons=a("button",n).jqueryUIButton(),i.on(H,function(a){return!1});var r=this,s="Month";a.each(["Min","Max"],function(a,b){r["_set"+b+s]=function(a){(r["_"+b+s]=j(r,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},r._setOption(b+s,r.options[b+s])});var t=e.SelectedMonth;if(void 0!==t){var u=j(this,t);b.val(this._formatMonth(new d(f(u),u%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyFadeShowYears:function(b){var c,d=125,e=this;this._jumpYearsButton.on("mouseenter"+q+"-j",function(b){var f=this;e.tOut=setTimeout(function(){e.tOut=null,a("span",f).animate({opacity:.45},{duration:d,complete:function(){e._backToYear||(c=a("span",f).text(),a("span",f).animate({opacity:1},d).text(e._i18n("jumpYears")))}})},175)}).on("mouseleave"+q+"-j",function(b){if(e.tOut)return clearTimeout(e.tOut);var f=this;a("span",f).animate({opacity:.45},{duration:d,complete:function(){a("span",f).text(c).animate({opacity:1},d)}})})},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),this._jumpYearsButton.jqueryUIButton({label:"Year "+c}),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),this._backToYear?(this._setPickerYear(this._backToYear),this._applyFadeShowYears(),this._showMonths(),this._backToYear=0):(clearTimeout(this.tOut),this._jumpYearsButton.off(q+"-j"),this._jumpYearsButton.jqueryUIButton({label:"Back to "+this._getPickerYear()}),this._jumpYearsButton.find("span").stop().css({opacity:1}),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)())},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).jqueryUIButton("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).jqueryUIButton("option","disabled",n&&e+12-1>n),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.jqueryUIButton("option","disabled",g&&b==f(g)),this._nextButton.jqueryUIButton("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/package.json b/package.json
index efebb29..5fefab6 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "jquery-ui-month-picker",
"description": "jQuery UI Month Picker Plugin",
- "version": "2.8.3",
+ "version": "3.0.0-beta1",
"scripts": {
"postinstall" : "bower install"
From 70f724eb96d23215ec5054a70cff0a88a2f2b76f Mon Sep 17 00:00:00 2001
From: Benjamin Albert ' +
'
' +
'';
- $.widget("KidSysco.MonthPickerButton", $.ui.button, {
+ var _headerButton = Date();
+ $.widget("KidSysco." + _headerButton, $.ui.button, {
_create: function() {
this.widgetFullName = 'ui-button';
this._superApply(arguments);
@@ -345,13 +346,13 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
$('.jump-years', _menu)
.attr('title', this._i18n('jumpYears'))
.click($proxy(this._showYearsClickHandler, this))
- .find('a').MonthPickerButton();
+ .find('a')[ _headerButton ]();
this._applyFadeShowYears();
this._createValidationMessage();
- this._prevButton = $('.previous-year a', _menu).MonthPickerButton({ text: false });
- this._nextButton = $('.next-year a', _menu).MonthPickerButton({ text: false });
+ this._prevButton = $('.previous-year a', _menu)[ _headerButton ]({ text: false });
+ this._nextButton = $('.next-year a', _menu)[ _headerButton ]({ text: false });
this._setRTL(_opts.IsRTL); //Assigns icons to the next/prev buttons.
@@ -787,7 +788,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
_setPickerYear: function (year) {
this._pickerYear = year || new Date().getFullYear();
- this._jumpYearsButton.MonthPickerButton({ label: this._i18n('year') + ' ' + this._pickerYear });
+ this._jumpYearsButton[ _headerButton ]({ label: this._i18n('year') + ' ' + this._pickerYear });
//this._yearContainer.text(year || new Date().getFullYear());
},
@@ -808,7 +809,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
_setActive( this._selectedBtn, false );
this._selectedBtn = _setActive( $(this._buttons[month-1]), true );
- this._jumpYearsButton.MonthPickerButton({label: 'Year ' + _year});
+ this._jumpYearsButton[ _headerButton ]({label: 'Year ' + _year});
_event('OnAfterChooseMonth', this)(date);
},
@@ -854,7 +855,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
if (!this._backToYear) {
clearTimeout(this.tOut);
this._jumpYearsButton.off(_eventsNs + '-j');
- this._jumpYearsButton.MonthPickerButton({label: 'Back to ' + this._getPickerYear()});
+ this._jumpYearsButton[ _headerButton ]({label: 'Back to ' + this._getPickerYear()});
this._jumpYearsButton.find('span').stop().css({ opacity: 1 });
this._backToYear = this._getPickerYear();
@@ -884,13 +885,13 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
.attr('title', this._i18n('prev12Years'))
.off(click)
.on(click, $proxy(this._addToYears, this, -AMOUNT_TO_ADD))
- .MonthPickerButton('option', 'disabled', _minYear && (_firstYear - 1) < _minYear);
+ [ _headerButton ]('option', 'disabled', _minYear && (_firstYear - 1) < _minYear);
this._nextButton
.attr('title', this._i18n('next12Years'))
.off(click)
.on(click, $proxy(this._addToYears, this, AMOUNT_TO_ADD))
- .MonthPickerButton('option', 'disabled', _maxYear && (_firstYear + 12) -1 > _maxYear);
+ [ _headerButton ]('option', 'disabled', _maxYear && (_firstYear + 12) -1 > _maxYear);
this._buttons.off(_eventsNs);
@@ -971,8 +972,8 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
}
// Disable the next/prev button if we've reached the min/max year.
- this._prevButton.MonthPickerButton('option', 'disabled', _minDate && _curYear == _toYear(_minDate));
- this._nextButton.MonthPickerButton('option', 'disabled', _maxDate && _curYear == _toYear(_maxDate));
+ this._prevButton[ _headerButton ]('option', 'disabled', _minDate && _curYear == _toYear(_minDate));
+ this._nextButton[ _headerButton ]('option', 'disabled', _maxDate && _curYear == _toYear(_maxDate));
for (var i = 0; i < 12; i++) {
// Disable the button if the month is not between the
diff --git a/test/test.js b/test/test.js
index 94a72c7..5572ac4 100644
--- a/test/test.js
+++ b/test/test.js
@@ -1428,11 +1428,11 @@ QUnit.test('JavaScript Date objects', function (assert) {
QUnit.module('Version 3.0');
QUnit.test('Title buttons', function (assert) {
- var field = $(RistrictMonthField).MonthPicker({
+ var field = $("").prependTo(document.body).MonthPicker({
MaxMonth: '+2Y'
});
- var menu = $(MonthPicker_RistrictMonthField);
+ var menu = $(MonthPicker_TitleButton);
var nextButton = menu.find('.next-year .ui-button');
field.MonthPicker('Open');
From fca9ef3dcbe87359977130a1be804e09365ab82a Mon Sep 17 00:00:00 2001
From: Benjamin Albert
").appendTo(n);q.append(' ')}this._buttons=a("button",n).jqueryUIButton(),i.on(H,function(a){return!1});var r=this,s="Month";a.each(["Min","Max"],function(a,b){r["_set"+b+s]=function(a){(r["_"+b+s]=j(r,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},r._setOption(b+s,r.options[b+s])});var t=e.SelectedMonth;if(void 0!==t){var u=j(this,t);b.val(this._formatMonth(new d(f(u),u%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyFadeShowYears:function(b){var c,d=125,e=this;this._jumpYearsButton.on("mouseenter"+q+"-j",function(b){var f=this;e.tOut=setTimeout(function(){e.tOut=null,a("span",f).animate({opacity:.45},{duration:d,complete:function(){e._backToYear||(c=a("span",f).text(),a("span",f).animate({opacity:1},d).text(e._i18n("jumpYears")))}})},175)}).on("mouseleave"+q+"-j",function(b){if(e.tOut)return clearTimeout(e.tOut);var f=this;a("span",f).animate({opacity:.45},{duration:d,complete:function(){a("span",f).text(c).animate({opacity:1},d)}})})},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),this._jumpYearsButton.jqueryUIButton({label:"Year "+c}),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),this._backToYear?(this._setPickerYear(this._backToYear),this._applyFadeShowYears(),this._showMonths(),this._backToYear=0):(clearTimeout(this.tOut),this._jumpYearsButton.off(q+"-j"),this._jumpYearsButton.jqueryUIButton({label:"Back to "+this._getPickerYear()}),this._jumpYearsButton.find("span").stop().css({opacity:1}),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)())},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).jqueryUIButton("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).jqueryUIButton("option","disabled",n&&e+12-1>n),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.jqueryUIButton("option","disabled",g&&b==f(g)),this._nextButton.jqueryUIButton("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a,b,c,d){"use strict";function e(a){return a.getMonth()+12*a.getFullYear()}function f(a){return Math.floor(a/12)}function g(){a(this).addClass(u)}function h(a,b){return a[b?"on":"off"]("mousenter mouseout",g).toggleClass(u,b)}function i(a,b,c){return(!b||a>=b)&&(!c||c>=a)}function j(b,c){if(null===c)return c;if(c instanceof d)return e(c);if(a.isNumeric(c))return e(new d)+parseInt(c,10);var f=b._parseMonth(c);return f?e(f):l(c)}function k(a,b){return F(b.options[a]||E,b.element[0])}function l(b,c){var f=a.trim(b);f=f.replace(/y/i,'":"y"'),f=f.replace(/m/i,'":"m"');try{var g=JSON.parse('{"'+f.replace(/ /g,',"')+"}"),h={};for(var i in g)h[g[i]]=i;var j=e(new d);return j+=parseInt(h.m,10)||0,j+12*(parseInt(h.y,10)||0)}catch(k){return!1}}function m(b){return a(''+b.i18n.buttonText+"").jqueryUIButton({text:!1,icons:{primary:b.ButtonIcon}})}function n(a,b){a[J]("option",{icons:{primary:"ui-icon-circle-triangle-"+(b?"w":"e")}})}function o(a){return!a.is("input")}var p="MonthPicker Error: ";if(!(a&&a.ui&&a.ui.button&&a.ui.datepicker))return void alert(p+"The jQuery UI button and datepicker plug-ins must be loaded.");a.widget.bridge("jqueryUIButton",a.ui.button);var q=a.fx.speeds,r=".MonthPicker",s="month-picker-disabled",t="ui-state-highlight",u="ui-state-active",v={my:"left top+1",at:"left bottom"},w={my:"right top+1",at:"right bottom"},x=p+"The jQuery UI position plug-in must be loaded.",y=p+"Unsupported % option value, supported values are: ",z=p+'"_" is not a valid %Month value.',A=null,B=!!a.ui.position,C={Animation:["slideToggle","fadeToggle","none"],ShowAnim:["fadeIn","slideDown","none"],HideAnim:["fadeOut","slideUp","none"]},D={ValidationErrorMessage:"_createValidationMessage",Disabled:"_setDisabledState",ShowIcon:"_updateButton",Button:"_updateButton",ShowOn:"_updateFieldEvents",IsRTL:"_setRTL",AltFormat:"_updateAlt",AltField:"_updateAlt",StartYear:"_setPickerYear",MinMonth:"_setMinMonth",MaxMonth:"_setMaxMonth",SelectedMonth:"_setSelectedMonth"},E=a.noop,F=a.proxy,G=a.datepicker,H="click"+r;a.MonthPicker={VERSION:"3.0-beta1",i18n:{year:"Year",prevYear:"Previous Year",nextYear:"Next Year",next12Years:"Jump Forward 12 Years",prev12Years:"Jump Back 12 Years",nextLabel:"Next",prevLabel:"Prev",buttonText:"Open Month Chooser",jumpYears:"Jump Years",backTo:"Back to",months:["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sep.","Oct.","Nov.","Dec."]}};var I=' ").appendTo(m);q.append(' ')}this._buttons=a("button",m).jqueryUIButton(),i.on(H,function(a){return!1});var r=this,s="Month";a.each(["Min","Max"],function(a,b){r["_set"+b+s]=function(a){(r["_"+b+s]=j(r,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},r._setOption(b+s,r.options[b+s])});var t=e.SelectedMonth;if(void 0!==t){var u=j(this,t);b.val(this._formatMonth(new d(f(u),u%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+r+this.uuid,F(this._keyDown,this)),d.off("blur"+r).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+r+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+r,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyFadeShowYears:function(b){var c,d=125,e=this;this._jumpYearsButton.on("mouseenter"+r+"-j",function(b){var f=this;e.tOut=setTimeout(function(){e.tOut=null,a("span",f).animate({opacity:.45},{duration:d,complete:function(){e._backToYear||(c=a("span",f).text(),a("span",f).animate({opacity:1},d).text(e._i18n("jumpYears")))}})},175)}).on("mouseleave"+r+"-j",function(b){if(e.tOut)return clearTimeout(e.tOut);var f=this;a("span",f).animate({opacity:.45},{duration:d,complete:function(){a("span",f).text(c).animate({opacity:1},d)}})})},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(r),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=H+" focus"+r;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+r,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in q?q[b]:q._default},_position:B?function(b){var c=this.options.IsRTL?w:v,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(s,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton[J]({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(t),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._buttons.off(r);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(t),this._showYears(),this._backToYear?(this._setPickerYear(this._backToYear),this._applyFadeShowYears(),this._showMonths(),this._backToYear=0):(clearTimeout(this.tOut),this._jumpYearsButton.off(r+"-j"),this._jumpYearsButton[J]({label:this._i18n("backTo")+" "+this._getPickerYear()}),this._jumpYearsButton.find("span").stop().css({opacity:1}),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)())},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(H).on(H,F(this._addToYears,this,-g))[J]("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next12Years")).off(H).on(H,F(this._addToYears,this,g))[J]("option","disabled",n&&e+12-1>n),this._buttons.off(r),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),q=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(t,v===j&&q).on(H,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton[J]("option","disabled",g&&b==f(g)),this._nextButton[J]("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(t,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/css/MonthPicker.css b/css/MonthPicker.css
index 2fde3af..3880dd5 100644
--- a/css/MonthPicker.css
+++ b/css/MonthPicker.css
@@ -113,7 +113,7 @@ in response to the slightly bigger buttons in the Jump years menu.
*/
.month-picker-month-table button {
width: 4.3em;
- margin: 3px;
+ margin: .2em;
}
.month-picker-open-button {
diff --git a/demo/Demo.min.css b/demo/Demo.min.css
index 310f347..29429c9 100644
--- a/demo/Demo.min.css
+++ b/demo/Demo.min.css
@@ -1 +1 @@
-.month-picker{display:inline-block;position:absolute;z-index:9999}.month-picker table{border-collapse:separate;border-spacing:2px 2px}.month-picker td{padding:0}.month-picker .ui-button-text{padding:.4em 0}.month-picker-header{margin:3px 3px 0}.month-picker-year-table{width:100%}.month-picker-year-table .jump-years{text-align:center}.month-picker-year-table a{border:1px solid transparent}.month-picker-year-table a.ui-button{font-size:1.1em;width:1.5em;height:1.5em;cursor:default}.month-picker-year-table .previous-year>a{float:left}.month-picker-year-table .next-year>a{float:right}.month-picker-year-table .jump-years a.ui-button{width:100%}.month-picker-year-table .ui-button-text{padding:0}.month-picker-month-table td{height:35px;text-align:center}.month-picker-month-table button{width:4.3em;margin:3px}.month-picker-open-button{height:20px;width:20px;vertical-align:bottom}.month-picker-invalid-message{display:none;background-color:#ff0}.month-picker-disabled,.option-block{background-color:#e1e1e1}body{font-size:12px;font-family:Verdana,Arial,sans-serif}.option-block{display:none;padding:4px;border:1px solid #000}.option{margin:20px;border:1px solid Gray;padding:4px}.demo,.demo-position{background-color:#e1e1e1;padding:8px;border:1px solid Gray}.option-link{text-decoration:underline;color:#00f;cursor:pointer;font-weight:700}.option-link:hover{color:Red}.option-type{margin:0 25px}.demo-position{width:100%}.text-right{text-align:right}
\ No newline at end of file
+.month-picker{display:inline-block;position:absolute;z-index:9999}.month-picker table{border-collapse:separate;border-spacing:2px 2px}.month-picker td{padding:0}.month-picker .ui-button-text{padding:.4em 0}.month-picker-header{margin:3px 3px 0}.month-picker-year-table{width:100%}.month-picker-year-table .jump-years{text-align:center}.month-picker-year-table a{border:1px solid transparent}.month-picker-year-table a.ui-button{font-size:1.1em;width:1.5em;height:1.5em;cursor:default}.month-picker-year-table .jump-years a.ui-button{width:100%;font-weight:700}.month-picker-year-table .ui-button-text{padding:0}.month-picker-month-table td{height:35px;text-align:center}.month-picker-month-table button{width:4.3em;margin:.2em}.month-picker-open-button{height:20px;width:20px;vertical-align:bottom}.month-picker-invalid-message{display:none;background-color:#ff0}.month-picker-disabled,.option-block{background-color:#e1e1e1}body{font-size:12px;font-family:Verdana,Arial,sans-serif}.option-block{display:none;padding:4px;border:1px solid #000}.option{margin:20px;border:1px solid Gray;padding:4px}.demo,.demo-position{background-color:#e1e1e1;padding:8px;border:1px solid Gray}.option-link{text-decoration:underline;color:#00f;cursor:pointer;font-weight:700}.option-link:hover{color:Red}.option-type{margin:0 25px}.demo-position{width:100%}.text-right{text-align:right}
\ No newline at end of file
diff --git a/demo/Demo.min.js b/demo/Demo.min.js
index ee1ebca..ce535f9 100644
--- a/demo/Demo.min.js
+++ b/demo/Demo.min.js
@@ -1 +1 @@
-!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(n);q.append(' ')}this._buttons=a("button",n).jqueryUIButton(),i.on(H,function(a){return!1});var r=this,s="Month";a.each(["Min","Max"],function(a,b){r["_set"+b+s]=function(a){(r["_"+b+s]=j(r,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},r._setOption(b+s,r.options[b+s])});var t=e.SelectedMonth;if(void 0!==t){var u=j(this,t);b.val(this._formatMonth(new d(f(u),u%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+q+this.uuid,F(this._keyDown,this)),d.off("blur"+q).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+q+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+q,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyFadeShowYears:function(b){var c,d=125,e=this;this._jumpYearsButton.on("mouseenter"+q+"-j",function(b){var f=this;e.tOut=setTimeout(function(){e.tOut=null,a("span",f).animate({opacity:.45},{duration:d,complete:function(){e._backToYear||(c=a("span",f).text(),a("span",f).animate({opacity:1},d).text(e._i18n("jumpYears")))}})},175)}).on("mouseleave"+q+"-j",function(b){if(e.tOut)return clearTimeout(e.tOut);var f=this;a("span",f).animate({opacity:.45},{duration:d,complete:function(){a("span",f).text(c).animate({opacity:1},d)}})})},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(q),f=d.ShowIcon?d.Button:!1;a.isFunction(f)&&(f=f.call(b[0],a.extend(!0,{i18n:a.MonthPicker.i18n},this.options)));var g=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(g=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=g}},_updateFieldEvents:function(){var a=H+" focus"+q;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+q,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton,!a),n(this._nextButton,a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in p?p[b]:p._default},_position:B?function(b){var c=this.options.IsRTL?v:u,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(r,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),this._jumpYearsButton.jqueryUIButton({label:"Year "+c}),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(s),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._buttons.off(q);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(s),this._showYears(),this._backToYear?(this._setPickerYear(this._backToYear),this._applyFadeShowYears(),this._showMonths(),this._backToYear=0):(clearTimeout(this.tOut),this._jumpYearsButton.off(q+"-j"),this._jumpYearsButton.jqueryUIButton({label:"Back to "+this._getPickerYear()}),this._jumpYearsButton.find("span").stop().css({opacity:1}),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)())},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev5Years")).off(H).on(H,F(this._addToYears,this,-g)).jqueryUIButton("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next5Years")).off(H).on(H,F(this._addToYears,this,g)).jqueryUIButton("option","disabled",n&&e+12-1>n),this._buttons.off(q),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),r=i(j,m,n),t=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(s,v===j&&r).on(H,{year:v},p);t&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton.jqueryUIButton("option","disabled",g&&b==f(g)),this._nextButton.jqueryUIButton("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(s,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(m);q.append(' ')}this._buttons=a("button",m).jqueryUIButton(),i.on(H,function(a){return!1});var r=this,s="Month";a.each(["Min","Max"],function(a,b){r["_set"+b+s]=function(a){(r["_"+b+s]=j(r,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},r._setOption(b+s,r.options[b+s])});var t=e.SelectedMonth;if(void 0!==t){var u=j(this,t);b.val(this._formatMonth(new d(f(u),u%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+r+this.uuid,F(this._keyDown,this)),d.off("blur"+r).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+r+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+r,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyFadeShowYears:function(b){var c,d=125,e=this;this._jumpYearsButton.on("mouseenter"+r+"-j",function(b){var f=this;e.tOut=setTimeout(function(){e.tOut=null,a("span",f).animate({opacity:.45},{duration:d,complete:function(){e._backToYear||(c=a("span",f).text(),a("span",f).animate({opacity:1},d).text(e._i18n("jumpYears")))}})},175)}).on("mouseleave"+r+"-j",function(b){if(e.tOut)return clearTimeout(e.tOut);var f=this;a("span",f).animate({opacity:.45},{duration:d,complete:function(){a("span",f).text(c).animate({opacity:1},d)}})})},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(r),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=H+" focus"+r;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+r,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in q?q[b]:q._default},_position:B?function(b){var c=this.options.IsRTL?w:v,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(s,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton[J]({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(t),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._buttons.off(r);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(t),this._showYears(),this._backToYear?(this._setPickerYear(this._backToYear),this._applyFadeShowYears(),this._showMonths(),this._backToYear=0):(clearTimeout(this.tOut),this._jumpYearsButton.off(r+"-j"),this._jumpYearsButton[J]({label:this._i18n("backTo")+" "+this._getPickerYear()}),this._jumpYearsButton.find("span").stop().css({opacity:1}),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)())},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(H).on(H,F(this._addToYears,this,-g))[J]("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next12Years")).off(H).on(H,F(this._addToYears,this,g))[J]("option","disabled",n&&e+12-1>n),this._buttons.off(r),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),q=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(t,v===j&&q).on(H,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton[J]("option","disabled",g&&b==f(g)),this._nextButton[J]("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(t,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/test/test.css b/test/test.css
index 62121e2..d6bd559 100644
--- a/test/test.css
+++ b/test/test.css
@@ -30,7 +30,7 @@
.option-type {
margin: 0 25px;
}
-.demo {
+.demo {
background-color: #e1e1e1;
padding: 8px;
border: solid 1px Gray;
@@ -43,6 +43,5 @@
width:100%;
}
.text-right{
- text-align: right;
+ text-align: right;
}
-
diff --git a/test/test.html b/test/test.html
index 505504c..08cb43f 100644
--- a/test/test.html
+++ b/test/test.html
@@ -3,6 +3,8 @@
").appendTo(m);q.append(' ')}this._buttons=a("button",m).jqueryUIButton(),i.on(H,function(a){return!1});var r=this,s="Month";a.each(["Min","Max"],function(a,b){r["_set"+b+s]=function(a){(r["_"+b+s]=j(r,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},r._setOption(b+s,r.options[b+s])});var t=e.SelectedMonth;if(void 0!==t){var u=j(this,t);b.val(this._formatMonth(new d(f(u),u%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+r+this.uuid,F(this._keyDown,this)),d.off("blur"+r).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+r+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+r,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyFadeShowYears:function(b){var c,d=125,e=this;this._jumpYearsButton.on("mouseenter"+r+"-j",function(b){var f=this;e.tOut=setTimeout(function(){e.tOut=null,a("span",f).animate({opacity:.45},{duration:d,complete:function(){e._backToYear||(c=a("span",f).text(),a("span",f).animate({opacity:1},d).text(e._i18n("jumpYears")))}})},175)}).on("mouseleave"+r+"-j",function(b){if(e.tOut)return clearTimeout(e.tOut);var f=this;a("span",f).animate({opacity:.45},{duration:d,complete:function(){a("span",f).text(c).animate({opacity:1},d)}})})},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(r),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=H+" focus"+r;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+r,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in q?q[b]:q._default},_position:B?function(b){var c=this.options.IsRTL?w:v,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(s,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton[J]({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(t),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._buttons.off(r);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(t),this._showYears(),this._backToYear?(this._setPickerYear(this._backToYear),this._applyFadeShowYears(),this._showMonths(),this._backToYear=0):(clearTimeout(this.tOut),this._jumpYearsButton.off(r+"-j"),this._jumpYearsButton[J]({label:this._i18n("backTo")+" "+this._getPickerYear()}),this._jumpYearsButton.find("span").stop().css({opacity:1}),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)())},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(H).on(H,F(this._addToYears,this,-g))[J]("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next12Years")).off(H).on(H,F(this._addToYears,this,g))[J]("option","disabled",n&&e+12-1>n),this._buttons.off(r),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),q=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(t,v===j&&q).on(H,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton[J]("option","disabled",g&&b==f(g)),this._nextButton[J]("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(t,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a,b,c,d){"use strict";function e(a){return a.getMonth()+12*a.getFullYear()}function f(a){return Math.floor(a/12)}function g(){a(this).addClass(w)}function h(a,b){return a[b?"on":"off"]("mousenter mouseout",g).toggleClass(w,b)}function i(a,b,c){return(!b||a>=b)&&(!c||c>=a)}function j(b,c){if(null===c)return c;if(c instanceof d)return e(c);if(a.isNumeric(c))return e(new d)+parseInt(c,10);var f=b._parseMonth(c);return f?e(f):l(c)}function k(a,b){return H(b.options[a]||G,b.element[0])}function l(b,c){var f=a.trim(b);f=f.replace(/y/i,'":"y"'),f=f.replace(/m/i,'":"m"');try{var g=JSON.parse('{"'+f.replace(/ /g,',"')+"}"),h={};for(var i in g)h[g[i]]=i;var j=e(new d);return j+=parseInt(h.m,10)||0,j+12*(parseInt(h.y,10)||0)}catch(k){return!1}}function m(b){return a(''+b.i18n.buttonText+"").jqueryUIButton({text:!1,icons:{primary:b.ButtonIcon}})}function n(a,b){a[L]("option",{icons:{primary:"ui-icon-circle-triangle-"+(b?"w":"e")}})}function o(a){return!a.is("input")}function p(b,c){function d(){i=l.text(),l.animate({opacity:1},k).text(c)}function e(){j=null,l=a("span",b).animate({opacity:.45},k,d)}function f(){j=setTimeout(e,175)}function g(){l.text(i).animate({opacity:1},k)}function h(){j?clearTimeout(j):l=a("span",b).animate({opacity:.45},k,g)}var i,j,k=125,l=a();b.data(t,function(){clearTimeout(j),l.stop().css({opacity:1}),b.off(s+"h")}),b.on("mouseenter"+s+"h",f).on("mouseleave"+s+"h",h)}var q="MonthPicker Error: ";if(!(a&&a.ui&&a.ui.button&&a.ui.datepicker))return void alert(q+"The jQuery UI button and datepicker plug-ins must be loaded.");a.widget.bridge("jqueryUIButton",a.ui.button);var r=a.fx.speeds,s=".MonthPicker",t="month-picker-clear-hint",u="month-picker-disabled",v="ui-state-highlight",w="ui-state-active",x={my:"left top+1",at:"left bottom"},y={my:"right top+1",at:"right bottom"},z=q+"The jQuery UI position plug-in must be loaded.",A=q+"Unsupported % option value, supported values are: ",B=q+'"_" is not a valid %Month value.',C=null,D=!!a.ui.position,E={Animation:["slideToggle","fadeToggle","none"],ShowAnim:["fadeIn","slideDown","none"],HideAnim:["fadeOut","slideUp","none"]},F={ValidationErrorMessage:"_createValidationMessage",Disabled:"_setDisabledState",ShowIcon:"_updateButton",Button:"_updateButton",ShowOn:"_updateFieldEvents",IsRTL:"_setRTL",AltFormat:"_updateAlt",AltField:"_updateAlt",StartYear:"_setPickerYear",MinMonth:"_setMinMonth",MaxMonth:"_setMaxMonth",SelectedMonth:"_setSelectedMonth"},G=a.noop,H=a.proxy,I=a.datepicker,J="click"+s;a.MonthPicker={VERSION:"3.0-beta1",i18n:{year:"Year",prevYear:"Previous Year",nextYear:"Next Year",next12Years:"Jump Forward 12 Years",prev12Years:"Jump Back 12 Years",nextLabel:"Next",prevLabel:"Prev",buttonText:"Open Month Chooser",jumpYears:"Jump Years",backTo:"Back to",months:["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sep.","Oct.","Nov.","Dec."]}};var K=' ").appendTo(m);p.append(' ')}this._buttons=a("button",m).jqueryUIButton(),i.on(J,function(a){return!1});var r=this,s="Month";a.each(["Min","Max"],function(a,b){r["_set"+b+s]=function(a){(r["_"+b+s]=j(r,a))===!1&&alert(B.replace(/%/,b).replace(/_/,a))},r._setOption(b+s,r.options[b+s])});var t=e.SelectedMonth;if(void 0!==t){var u=j(this,t);b.val(this._formatMonth(new d(f(u),u%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(H(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=G)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{C&&C.Close(b),C=this,a(c).on(J+this.uuid,H(this.Close,this)).on("keydown"+s+this.uuid,H(this._keyDown,this)),d.off("blur"+s).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:H(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,C=null,a(c).off("keydown"+s+this.uuid).off(J+this.uuid),this.Validate(),d.on("blur"+s,H(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return I.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return I.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyFadeShowYears:function(){p(this._jumpYearsButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(s),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(J,H(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=J+" focus"+s;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,H(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+s,H(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in r?r[b]:r._default},_position:D?function(b){var c=this.options.IsRTL?y:x,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(u,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton[L]({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(v),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(J).on(J,H(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(J).on(J,H(this._addToYear,this,1)),this._buttons.off(s);var c=this,d=H(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(J,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(v),this._showYears(),this._backToYear)this._setPickerYear(this._backToYear),this._applyFadeShowYears(),this._showMonths(),this._backToYear=0;else{var a=this._i18n("backTo")+" "+this._getPickerYear();this._jumpYearsButton[L]({label:a}).data(t)(),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(J).on(J,H(this._addToYears,this,-g))[L]("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next12Years")).off(J).on(J,H(this._addToYears,this,g))[L]("option","disabled",n&&e+12-1>n),this._buttons.off(s),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=H(this._onYearClick,this),q=i(j,m,n),r=i(o,m,n),t=0;12>t;t++){var u=b+c,w=a(this._buttons[t]).jqueryUIButton({disabled:!i(u,m,n),label:u}).toggleClass(v,u===j&&q).on(J,{year:u},p);r&&o&&o===u&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton[L]("option","disabled",g&&b==f(g)),this._nextButton[L]("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(v,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/demo/Demo.min.js b/demo/Demo.min.js
index ce535f9..8661f90 100644
--- a/demo/Demo.min.js
+++ b/demo/Demo.min.js
@@ -1 +1 @@
-!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(m);q.append(' ')}this._buttons=a("button",m).jqueryUIButton(),i.on(H,function(a){return!1});var r=this,s="Month";a.each(["Min","Max"],function(a,b){r["_set"+b+s]=function(a){(r["_"+b+s]=j(r,a))===!1&&alert(z.replace(/%/,b).replace(/_/,a))},r._setOption(b+s,r.options[b+s])});var t=e.SelectedMonth;if(void 0!==t){var u=j(this,t);b.val(this._formatMonth(new d(f(u),u%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(F(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=E)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{A&&A.Close(b),A=this,a(c).on(H+this.uuid,F(this.Close,this)).on("keydown"+r+this.uuid,F(this._keyDown,this)),d.off("blur"+r).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:F(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,A=null,a(c).off("keydown"+r+this.uuid).off(H+this.uuid),this.Validate(),d.on("blur"+r,F(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return G.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return G.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyFadeShowYears:function(b){var c,d=125,e=this;this._jumpYearsButton.on("mouseenter"+r+"-j",function(b){var f=this;e.tOut=setTimeout(function(){e.tOut=null,a("span",f).animate({opacity:.45},{duration:d,complete:function(){e._backToYear||(c=a("span",f).text(),a("span",f).animate({opacity:1},d).text(e._i18n("jumpYears")))}})},175)}).on("mouseleave"+r+"-j",function(b){if(e.tOut)return clearTimeout(e.tOut);var f=this;a("span",f).animate({opacity:.45},{duration:d,complete:function(){a("span",f).text(c).animate({opacity:1},d)}})})},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(r),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(H,F(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=H+" focus"+r;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,F(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+r,F(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in q?q[b]:q._default},_position:B?function(b){var c=this.options.IsRTL?w:v,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(s,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton[J]({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(t),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(H).on(H,F(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(H).on(H,F(this._addToYear,this,1)),this._buttons.off(r);var c=this,d=F(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(H,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){this._buttons.removeClass(t),this._showYears(),this._backToYear?(this._setPickerYear(this._backToYear),this._applyFadeShowYears(),this._showMonths(),this._backToYear=0):(clearTimeout(this.tOut),this._jumpYearsButton.off(r+"-j"),this._jumpYearsButton[J]({label:this._i18n("backTo")+" "+this._getPickerYear()}),this._jumpYearsButton.find("span").stop().css({opacity:1}),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)())},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(H).on(H,F(this._addToYears,this,-g))[J]("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next12Years")).off(H).on(H,F(this._addToYears,this,g))[J]("option","disabled",n&&e+12-1>n),this._buttons.off(r),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=F(this._onYearClick,this),q=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(t,v===j&&q).on(H,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton[J]("option","disabled",g&&b==f(g)),this._nextButton[J]("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(t,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(m);p.append(' ')}this._buttons=a("button",m).jqueryUIButton(),i.on(J,function(a){return!1});var r=this,s="Month";a.each(["Min","Max"],function(a,b){r["_set"+b+s]=function(a){(r["_"+b+s]=j(r,a))===!1&&alert(B.replace(/%/,b).replace(/_/,a))},r._setOption(b+s,r.options[b+s])});var t=e.SelectedMonth;if(void 0!==t){var u=j(this,t);b.val(this._formatMonth(new d(f(u),u%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(H(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=G)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{C&&C.Close(b),C=this,a(c).on(J+this.uuid,H(this.Close,this)).on("keydown"+s+this.uuid,H(this._keyDown,this)),d.off("blur"+s).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:H(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,C=null,a(c).off("keydown"+s+this.uuid).off(J+this.uuid),this.Validate(),d.on("blur"+s,H(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return I.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return I.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyFadeShowYears:function(){p(this._jumpYearsButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(s),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(J,H(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=J+" focus"+s;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,H(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+s,H(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in r?r[b]:r._default},_position:D?function(b){var c=this.options.IsRTL?y:x,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(u,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton[L]({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(v),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(J).on(J,H(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(J).on(J,H(this._addToYear,this,1)),this._buttons.off(s);var c=this,d=H(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(J,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(v),this._showYears(),this._backToYear)this._setPickerYear(this._backToYear),this._applyFadeShowYears(),this._showMonths(),this._backToYear=0;else{var a=this._i18n("backTo")+" "+this._getPickerYear();this._jumpYearsButton[L]({label:a}).data(t)(),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(J).on(J,H(this._addToYears,this,-g))[L]("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next12Years")).off(J).on(J,H(this._addToYears,this,g))[L]("option","disabled",n&&e+12-1>n),this._buttons.off(s),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=H(this._onYearClick,this),q=i(j,m,n),r=i(o,m,n),t=0;12>t;t++){var u=b+c,w=a(this._buttons[t]).jqueryUIButton({disabled:!i(u,m,n),label:u}).toggleClass(v,u===j&&q).on(J,{year:u},p);r&&o&&o===u&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton[L]("option","disabled",g&&b==f(g)),this._nextButton[L]("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(v,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
From af6dee740c60c4609ec97b1a9f66c1c70850b12c Mon Sep 17 00:00:00 2001
From: Benjamin Albert ' +
'';
- var _headerButton = Date();
- $.widget("KidSysco." + _headerButton, $.ui.button, {
- _create: function() {
- this.widgetFullName = 'ui-button';
- this._superApply(arguments);
- this.element.removeClass('ui-state-default');
- },
-
- _setOption: function(key, value) {
- if (key === 'disabled' && this.options[key] === value) {
- return;
- }
-
- this._super(key, value);
- }
- });
-
function _applyButtonHint(_button, _hintLabel) {
var _speed = 125, _currentLabel, _startTimeout, _labelElem = $();
@@ -246,6 +231,13 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
.on('mouseleave' + _eventsNs + 'h', _fadeOutHint);
}
+ function _setDisabled(_button, _value) {
+ var _btnWidget = _button.data('ui-button');
+ if (_btnWidget.option('disabled') !== _value) {
+ _btnWidget.option('disabled', _value);
+ }
+ }
+
$.widget("KidSysco.MonthPicker", {
/******* Properties *******/
@@ -272,9 +264,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
},
_monthPickerButton: $(),
-
_validationMessage: $(),
-
_selectedBtn: $(),
/******* jQuery UI Widget Factory Overrides ********/
@@ -318,6 +308,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
alert(_posErr);
return;
}
+ break;
case 'MonthFormat':
var date = this.GetSelectedDate();
if (date) {
@@ -386,23 +377,28 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
var isInline = _isInline(_el);
$(_markup).appendTo(_menu);
- (_menu).appendTo( isInline ? _el : document.body );
+ _menu.appendTo( isInline ? _el : document.body );
this._jumpYearsButton =
$('.jump-years', _menu)
.attr('title', this._i18n('jumpYears'))
.click($proxy(this._showYearsClickHandler, this))
- .find('a')[ _headerButton ]();
+ .find('a').jqueryUIButton()
+ .removeClass(_defaultClass);
this._applyJumpYearsHint();
this._createValidationMessage();
- this._prevButton = $('.previous-year a', _menu)[ _headerButton ]({ text: false });
- this._nextButton = $('.next-year a', _menu)[ _headerButton ]({ text: false });
+ this._prevButton = $('.previous-year a', _menu)
+ .jqueryUIButton({ text: false })
+ .removeClass(_defaultClass);
+
+ this._nextButton = $('.next-year a', _menu)
+ .jqueryUIButton({ text: false })
+ .removeClass(_defaultClass);
this._setRTL(_opts.IsRTL); //Assigns icons to the next/prev buttons.
- var _iconClass = '.ui-button-icon-primary';
$(_iconClass, this._nextButton).text(this._i18n('nextLabel'));
$(_iconClass, this._prevButton).text(this._i18n('prevLabel'));
@@ -801,7 +797,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
_setPickerYear: function (year) {
this._pickerYear = year || new Date().getFullYear();
- this._jumpYearsButton[ _headerButton ]({ label: this._i18n('year') + ' ' + this._pickerYear });
+ this._jumpYearsButton.jqueryUIButton({ label: this._i18n('year') + ' ' + this._pickerYear });
},
_updateAlt: function (noop, date) {
@@ -864,7 +860,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
if (!this._backToYear) {
var _label = this._i18n('backTo') + ' ' + this._getPickerYear();
- this._jumpYearsButton[ _headerButton ]({ label: _label }).data( _clearHint )();
+ this._jumpYearsButton.jqueryUIButton({ label: _label }).data( _clearHint )();
this._backToYear = this._getPickerYear();
@@ -891,14 +887,15 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
this._prevButton
.attr('title', this._i18n('prev12Years'))
.off(click)
- .on(click, $proxy(this._addToYears, this, -AMOUNT_TO_ADD))
- [ _headerButton ]('option', 'disabled', _minYear && (_firstYear - 1) < _minYear);
+ .on(click, $proxy(this._addToYears, this, -AMOUNT_TO_ADD));
this._nextButton
.attr('title', this._i18n('next12Years'))
.off(click)
- .on(click, $proxy(this._addToYears, this, AMOUNT_TO_ADD))
- [ _headerButton ]('option', 'disabled', _maxYear && (_firstYear + 12) -1 > _maxYear);
+ .on(click, $proxy(this._addToYears, this, AMOUNT_TO_ADD));
+
+ _setDisabled(this._prevButton, _minYear && (_firstYear - 1) < _minYear);
+ _setDisabled(this._nextButton, _maxYear && (_firstYear + 12) -1 > _maxYear);
this._buttons.off(_eventsNs);
@@ -979,8 +976,8 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
}
// Disable the next/prev button if we've reached the min/max year.
- this._prevButton[ _headerButton ]('option', 'disabled', _minDate && _curYear == _toYear(_minDate));
- this._nextButton[ _headerButton ]('option', 'disabled', _maxDate && _curYear == _toYear(_maxDate));
+ _setDisabled(this._prevButton, _minDate && _curYear == _toYear(_minDate));
+ _setDisabled(this._nextButton, _maxDate && _curYear == _toYear(_maxDate));
for (var i = 0; i < 12; i++) {
// Disable the button if the month is not between the
diff --git a/MonthPicker.min.js b/MonthPicker.min.js
index ac81c8c..09b35e6 100644
--- a/MonthPicker.min.js
+++ b/MonthPicker.min.js
@@ -1 +1 @@
-!function(a,b,c,d){"use strict";function e(a){return a.getMonth()+12*a.getFullYear()}function f(a){return Math.floor(a/12)}function g(){a(this).addClass(w)}function h(a,b){return a[b?"on":"off"]("mousenter mouseout",g).toggleClass(w,b)}function i(a,b,c){return(!b||a>=b)&&(!c||c>=a)}function j(b,c){if(null===c)return c;if(c instanceof d)return e(c);if(a.isNumeric(c))return e(new d)+parseInt(c,10);var f=b._parseMonth(c);return f?e(f):l(c)}function k(a,b){return H(b.options[a]||G,b.element[0])}function l(b,c){var f=a.trim(b);f=f.replace(/y/i,'":"y"'),f=f.replace(/m/i,'":"m"');try{var g=JSON.parse('{"'+f.replace(/ /g,',"')+"}"),h={};for(var i in g)h[g[i]]=i;var j=e(new d);return j+=parseInt(h.m,10)||0,j+12*(parseInt(h.y,10)||0)}catch(k){return!1}}function m(b){return a(''+b.i18n.buttonText+"").jqueryUIButton({text:!1,icons:{primary:b.ButtonIcon}})}function n(a,b){a[L]("option",{icons:{primary:"ui-icon-circle-triangle-"+(b?"w":"e")}})}function o(a){return!a.is("input")}function p(b,c){function d(){i=l.text(),l.animate({opacity:1},k).text(c)}function e(){j=null,l=a("span",b).animate({opacity:.45},k,d)}function f(){j=setTimeout(e,175)}function g(){l.text(i).animate({opacity:1},k)}function h(){j?clearTimeout(j):l=a("span",b).animate({opacity:.45},k,g)}var i,j,k=125,l=a();b.data(t,function(){clearTimeout(j),l.stop().css({opacity:1}),b.off(s+"h")}),b.on("mouseenter"+s+"h",f).on("mouseleave"+s+"h",h)}var q="MonthPicker Error: ";if(!(a&&a.ui&&a.ui.button&&a.ui.datepicker))return void alert(q+"The jQuery UI button and datepicker plug-ins must be loaded.");a.widget.bridge("jqueryUIButton",a.ui.button);var r=a.fx.speeds,s=".MonthPicker",t="month-picker-clear-hint",u="month-picker-disabled",v="ui-state-highlight",w="ui-state-active",x={my:"left top+1",at:"left bottom"},y={my:"right top+1",at:"right bottom"},z=q+"The jQuery UI position plug-in must be loaded.",A=q+"Unsupported % option value, supported values are: ",B=q+'"_" is not a valid %Month value.',C=null,D=!!a.ui.position,E={Animation:["slideToggle","fadeToggle","none"],ShowAnim:["fadeIn","slideDown","none"],HideAnim:["fadeOut","slideUp","none"]},F={ValidationErrorMessage:"_createValidationMessage",Disabled:"_setDisabledState",ShowIcon:"_updateButton",Button:"_updateButton",ShowOn:"_updateFieldEvents",IsRTL:"_setRTL",AltFormat:"_updateAlt",AltField:"_updateAlt",StartYear:"_setPickerYear",MinMonth:"_setMinMonth",MaxMonth:"_setMaxMonth",SelectedMonth:"_setSelectedMonth"},G=a.noop,H=a.proxy,I=a.datepicker,J="click"+s;a.MonthPicker={VERSION:"3.0-beta1",i18n:{year:"Year",prevYear:"Previous Year",nextYear:"Next Year",next12Years:"Jump Forward 12 Years",prev12Years:"Jump Back 12 Years",nextLabel:"Next",prevLabel:"Prev",buttonText:"Open Month Chooser",jumpYears:"Jump Years",backTo:"Back to",months:["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sep.","Oct.","Nov.","Dec."]}};var K='
").appendTo(m);p.append(' ')}this._buttons=a("button",m).jqueryUIButton(),i.on(J,function(a){return!1});var r=this,s="Month";a.each(["Min","Max"],function(a,b){r["_set"+b+s]=function(a){(r["_"+b+s]=j(r,a))===!1&&alert(B.replace(/%/,b).replace(/_/,a))},r._setOption(b+s,r.options[b+s])});var t=e.SelectedMonth;if(void 0!==t){var u=j(this,t);b.val(this._formatMonth(new d(f(u),u%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(H(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=G)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{C&&C.Close(b),C=this,a(c).on(J+this.uuid,H(this.Close,this)).on("keydown"+s+this.uuid,H(this._keyDown,this)),d.off("blur"+s).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:H(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,C=null,a(c).off("keydown"+s+this.uuid).off(J+this.uuid),this.Validate(),d.on("blur"+s,H(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return I.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return I.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyFadeShowYears:function(){p(this._jumpYearsButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(s),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(J,H(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=J+" focus"+s;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,H(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+s,H(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in r?r[b]:r._default},_position:D?function(b){var c=this.options.IsRTL?y:x,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(u,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton[L]({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(v),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(J).on(J,H(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(J).on(J,H(this._addToYear,this,1)),this._buttons.off(s);var c=this,d=H(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(J,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(v),this._showYears(),this._backToYear)this._setPickerYear(this._backToYear),this._applyFadeShowYears(),this._showMonths(),this._backToYear=0;else{var a=this._i18n("backTo")+" "+this._getPickerYear();this._jumpYearsButton[L]({label:a}).data(t)(),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(J).on(J,H(this._addToYears,this,-g))[L]("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next12Years")).off(J).on(J,H(this._addToYears,this,g))[L]("option","disabled",n&&e+12-1>n),this._buttons.off(s),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=H(this._onYearClick,this),q=i(j,m,n),r=i(o,m,n),t=0;12>t;t++){var u=b+c,w=a(this._buttons[t]).jqueryUIButton({disabled:!i(u,m,n),label:u}).toggleClass(v,u===j&&q).on(J,{year:u},p);r&&o&&o===u&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton[L]("option","disabled",g&&b==f(g)),this._nextButton[L]("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(v,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a,b,c,d){"use strict";function e(a){return a.getMonth()+12*a.getFullYear()}function f(a){return Math.floor(a/12)}function g(){a(this).addClass(y)}function h(a,b){return a[b?"on":"off"]("mousenter mouseout",g).toggleClass(y,b)}function i(a,b,c){return(!b||a>=b)&&(!c||c>=a)}function j(b,c){if(null===c)return c;if(c instanceof d)return e(c);if(a.isNumeric(c))return e(new d)+parseInt(c,10);var f=b._parseMonth(c);return f?e(f):l(c)}function k(a,b){return K(b.options[a]||J,b.element[0])}function l(b,c){var f=a.trim(b);f=f.replace(/y/i,'":"y"'),f=f.replace(/m/i,'":"m"');try{var g=JSON.parse('{"'+f.replace(/ /g,',"')+"}"),h={};for(var i in g)h[g[i]]=i;var j=e(new d);return j+=parseInt(h.m,10)||0,j+12*(parseInt(h.y,10)||0)}catch(k){return!1}}function m(b){return a(''+b.i18n.buttonText+"").jqueryUIButton({text:!1,icons:{primary:b.ButtonIcon}})}function n(a,b){a.jqueryUIButton("option",{icons:{primary:"ui-icon-circle-triangle-"+(b?"w":"e")}})}function o(a){return!a.is("input")}function p(b,c){function d(){i=l.text(),l.animate({opacity:1},k).text(c)}function e(){j=null,l=a("span",b).animate({opacity:.45},k,d)}function f(){j=setTimeout(e,175)}function g(){l.text(i).animate({opacity:1},k)}function h(){j?clearTimeout(j):l=a("span",b).animate({opacity:.45},k,g)}var i,j,k=125,l=a();b.data(u,function(){clearTimeout(j),l.stop().css({opacity:1}),b.off(t+"h")}),b.on("mouseenter"+t+"h",f).on("mouseleave"+t+"h",h)}function q(a,b){var c=a.data("ui-button");c.option("disabled")!==b&&c.option("disabled",b)}var r="MonthPicker Error: ";if(!(a&&a.ui&&a.ui.button&&a.ui.datepicker))return void alert(r+"The jQuery UI button and datepicker plug-ins must be loaded.");a.widget.bridge("jqueryUIButton",a.ui.button);var s=a.fx.speeds,t=".MonthPicker",u="month-picker-clear-hint",v=".ui-button-icon-primary",w="month-picker-disabled",x="ui-state-highlight",y="ui-state-active",z="ui-state-default",A={my:"left top+1",at:"left bottom"},B={my:"right top+1",at:"right bottom"},C=r+"The jQuery UI position plug-in must be loaded.",D=r+"Unsupported % option value, supported values are: ",E=r+'"_" is not a valid %Month value.',F=null,G=!!a.ui.position,H={Animation:["slideToggle","fadeToggle","none"],ShowAnim:["fadeIn","slideDown","none"],HideAnim:["fadeOut","slideUp","none"]},I={ValidationErrorMessage:"_createValidationMessage",Disabled:"_setDisabledState",ShowIcon:"_updateButton",Button:"_updateButton",ShowOn:"_updateFieldEvents",IsRTL:"_setRTL",AltFormat:"_updateAlt",AltField:"_updateAlt",StartYear:"_setPickerYear",MinMonth:"_setMinMonth",MaxMonth:"_setMaxMonth",SelectedMonth:"_setSelectedMonth"},J=a.noop,K=a.proxy,L=a.datepicker,M="click"+t;a.MonthPicker={VERSION:"3.0-beta1",i18n:{year:"Year",prevYear:"Previous Year",nextYear:"Next Year",next12Years:"Jump Forward 12 Years",prev12Years:"Jump Back 12 Years",nextLabel:"Next",prevLabel:"Prev",buttonText:"Open Month Chooser",jumpYears:"Jump Years",backTo:"Back to",months:["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sep.","Oct.","Nov.","Dec."]}};var N=' ").appendTo(l);n.append(' ')}this._buttons=a("button",l).jqueryUIButton(),i.on(M,function(a){return!1});var p=this,q="Month";a.each(["Min","Max"],function(a,b){p["_set"+b+q]=function(a){(p["_"+b+q]=j(p,a))===!1&&alert(E.replace(/%/,b).replace(/_/,a))},p._setOption(b+q,p.options[b+q])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(K(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=J)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{F&&F.Close(b),F=this,a(c).on(M+this.uuid,K(this.Close,this)).on("keydown"+t+this.uuid,K(this._keyDown,this)),d.off("blur"+t).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:K(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,F=null,a(c).off("keydown"+t+this.uuid).off(M+this.uuid),this.Validate(),d.on("blur"+t,K(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return L.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return L.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyJumpYearsHint:function(){p(this._jumpYearsButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(t),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(M,K(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=M+" focus"+t;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,K(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+t,K(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in s?s[b]:s._default},_position:G?function(b){var c=this.options.IsRTL?B:A,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){this._isMonthInputType||(this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask())},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(w,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(x),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(M).on(M,K(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(M).on(M,K(this._addToYear,this,1)),this._buttons.off(t);var c=this,d=K(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(M,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(x),this._showYears(),this._backToYear)this._setPickerYear(this._backToYear),this._applyJumpYearsHint(),this._showMonths(),this._backToYear=0;else{var a=this._i18n("backTo")+" "+this._getPickerYear();this._jumpYearsButton.jqueryUIButton({label:a}).data(u)(),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(M).on(M,K(this._addToYears,this,-g)),this._nextButton.attr("title",this._i18n("next12Years")).off(M).on(M,K(this._addToYears,this,g)),q(this._prevButton,m&&m>e-1),q(this._nextButton,n&&e+12-1>n),this._buttons.off(t),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=K(this._onYearClick,this),r=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(x,v===j&&r).on(M,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),q(this._prevButton,g&&b==f(g)),q(this._nextButton,j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(x,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/demo/Demo.min.js b/demo/Demo.min.js
index 8661f90..d3abf09 100644
--- a/demo/Demo.min.js
+++ b/demo/Demo.min.js
@@ -1 +1 @@
-!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(m);p.append(' ')}this._buttons=a("button",m).jqueryUIButton(),i.on(J,function(a){return!1});var r=this,s="Month";a.each(["Min","Max"],function(a,b){r["_set"+b+s]=function(a){(r["_"+b+s]=j(r,a))===!1&&alert(B.replace(/%/,b).replace(/_/,a))},r._setOption(b+s,r.options[b+s])});var t=e.SelectedMonth;if(void 0!==t){var u=j(this,t);b.val(this._formatMonth(new d(f(u),u%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(H(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=G)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{C&&C.Close(b),C=this,a(c).on(J+this.uuid,H(this.Close,this)).on("keydown"+s+this.uuid,H(this._keyDown,this)),d.off("blur"+s).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:H(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,C=null,a(c).off("keydown"+s+this.uuid).off(J+this.uuid),this.Validate(),d.on("blur"+s,H(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return I.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return I.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyFadeShowYears:function(){p(this._jumpYearsButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(s),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(J,H(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=J+" focus"+s;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,H(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+s,H(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in r?r[b]:r._default},_position:D?function(b){var c=this.options.IsRTL?y:x,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(u,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton[L]({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(v),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(J).on(J,H(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(J).on(J,H(this._addToYear,this,1)),this._buttons.off(s);var c=this,d=H(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(J,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(v),this._showYears(),this._backToYear)this._setPickerYear(this._backToYear),this._applyFadeShowYears(),this._showMonths(),this._backToYear=0;else{var a=this._i18n("backTo")+" "+this._getPickerYear();this._jumpYearsButton[L]({label:a}).data(t)(),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(J).on(J,H(this._addToYears,this,-g))[L]("option","disabled",m&&m>e-1),this._nextButton.attr("title",this._i18n("next12Years")).off(J).on(J,H(this._addToYears,this,g))[L]("option","disabled",n&&e+12-1>n),this._buttons.off(s),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=H(this._onYearClick,this),q=i(j,m,n),r=i(o,m,n),t=0;12>t;t++){var u=b+c,w=a(this._buttons[t]).jqueryUIButton({disabled:!i(u,m,n),label:u}).toggleClass(v,u===j&&q).on(J,{year:u},p);r&&o&&o===u&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),this._prevButton[L]("option","disabled",g&&b==f(g)),this._nextButton[L]("option","disabled",j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(v,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(l);n.append(' ')}this._buttons=a("button",l).jqueryUIButton(),i.on(M,function(a){return!1});var p=this,q="Month";a.each(["Min","Max"],function(a,b){p["_set"+b+q]=function(a){(p["_"+b+q]=j(p,a))===!1&&alert(E.replace(/%/,b).replace(/_/,a))},p._setOption(b+q,p.options[b+q])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(K(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=J)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{F&&F.Close(b),F=this,a(c).on(M+this.uuid,K(this.Close,this)).on("keydown"+t+this.uuid,K(this._keyDown,this)),d.off("blur"+t).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:K(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,F=null,a(c).off("keydown"+t+this.uuid).off(M+this.uuid),this.Validate(),d.on("blur"+t,K(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return L.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return L.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyJumpYearsHint:function(){p(this._jumpYearsButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(t),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(M,K(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=M+" focus"+t;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,K(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+t,K(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in s?s[b]:s._default},_position:G?function(b){var c=this.options.IsRTL?B:A,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){this._isMonthInputType||(this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask())},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(w,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(x),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(M).on(M,K(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(M).on(M,K(this._addToYear,this,1)),this._buttons.off(t);var c=this,d=K(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(M,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(x),this._showYears(),this._backToYear)this._setPickerYear(this._backToYear),this._applyJumpYearsHint(),this._showMonths(),this._backToYear=0;else{var a=this._i18n("backTo")+" "+this._getPickerYear();this._jumpYearsButton.jqueryUIButton({label:a}).data(u)(),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(M).on(M,K(this._addToYears,this,-g)),this._nextButton.attr("title",this._i18n("next12Years")).off(M).on(M,K(this._addToYears,this,g)),q(this._prevButton,m&&m>e-1),q(this._nextButton,n&&e+12-1>n),this._buttons.off(t),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=K(this._onYearClick,this),r=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(x,v===j&&r).on(M,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),q(this._prevButton,g&&b==f(g)),q(this._nextButton,j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(x,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
From b182dbf7b541476a78c9cb63b0a626e3d9e39333 Mon Sep 17 00:00:00 2001
From: Benjamin Albert ").appendTo(l);n.append(' ')}this._buttons=a("button",l).jqueryUIButton(),i.on(M,function(a){return!1});var p=this,q="Month";a.each(["Min","Max"],function(a,b){p["_set"+b+q]=function(a){(p["_"+b+q]=j(p,a))===!1&&alert(E.replace(/%/,b).replace(/_/,a))},p._setOption(b+q,p.options[b+q])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(K(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=J)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{F&&F.Close(b),F=this,a(c).on(M+this.uuid,K(this.Close,this)).on("keydown"+t+this.uuid,K(this._keyDown,this)),d.off("blur"+t).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:K(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,F=null,a(c).off("keydown"+t+this.uuid).off(M+this.uuid),this.Validate(),d.on("blur"+t,K(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return L.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return L.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyJumpYearsHint:function(){p(this._jumpYearsButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(t),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(M,K(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=M+" focus"+t;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,K(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+t,K(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in s?s[b]:s._default},_position:G?function(b){var c=this.options.IsRTL?B:A,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){this._isMonthInputType||(this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask())},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(w,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(x),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(M).on(M,K(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(M).on(M,K(this._addToYear,this,1)),this._buttons.off(t);var c=this,d=K(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(M,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(x),this._showYears(),this._backToYear)this._setPickerYear(this._backToYear),this._applyJumpYearsHint(),this._showMonths(),this._backToYear=0;else{var a=this._i18n("backTo")+" "+this._getPickerYear();this._jumpYearsButton.jqueryUIButton({label:a}).data(u)(),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(M).on(M,K(this._addToYears,this,-g)),this._nextButton.attr("title",this._i18n("next12Years")).off(M).on(M,K(this._addToYears,this,g)),q(this._prevButton,m&&m>e-1),q(this._nextButton,n&&e+12-1>n),this._buttons.off(t),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=K(this._onYearClick,this),r=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(x,v===j&&r).on(M,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),q(this._prevButton,g&&b==f(g)),q(this._nextButton,j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(x,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a,b,c,d){"use strict";function e(a){return a.getMonth()+12*a.getFullYear()}function f(a){return Math.floor(a/12)}function g(){a(this).addClass(z)}function h(a,b){return a[b?"on":"off"]("mousenter mouseout",g).toggleClass(z,b)}function i(a,b,c){return(!b||a>=b)&&(!c||c>=a)}function j(b,c){if(null===c)return c;if(c instanceof d)return e(c);if(a.isNumeric(c))return e(new d)+parseInt(c,10);var f=b._parseMonth(c);return f?e(f):l(c)}function k(a,b){return L(b.options[a]||K,b.element[0])}function l(b,c){var f=a.trim(b);f=f.replace(/y/i,'":"y"'),f=f.replace(/m/i,'":"m"');try{var g=JSON.parse('{"'+f.replace(/ /g,',"')+"}"),h={};for(var i in g)h[g[i]]=i;var j=e(new d);return j+=parseInt(h.m,10)||0,j+12*(parseInt(h.y,10)||0)}catch(k){return!1}}function m(b){return a(''+b.i18n.buttonText+"").jqueryUIButton({text:!1,icons:{primary:b.ButtonIcon}})}function n(a,b){a.jqueryUIButton("option",{icons:{primary:"ui-icon-circle-triangle-"+(b?"w":"e")}})}function o(a){return!a.is("input")}function p(b,c){function d(){i=l.text(),l.animate({opacity:1},k).text(c)}function e(){j=null,l=a("span",b).animate({opacity:.45},k,d)}function f(){j=setTimeout(e,175)}function g(){l.text(i).animate({opacity:1},k)}function h(){j?clearTimeout(j):l=a("span",b).animate({opacity:.45},k,g)}var i,j,k=125,l=a();b.data(v,function(){clearTimeout(j),l.stop().css({opacity:1}),b.off(t+"h")}),b.on("mouseenter"+t+"h",f).on("mouseleave"+t+"h",h)}function q(a,b){var c=a.data("ui-button");c.option("disabled")!==b&&c.option("disabled",b)}var r="MonthPicker Error: ";if(!(a&&a.ui&&a.ui.button&&a.ui.datepicker))return void alert(r+"The jQuery UI button and datepicker plug-ins must be loaded.");a.widget.bridge("jqueryUIButton",a.ui.button);var s=a.fx.speeds,t=".MonthPicker",u="month-year-input",v="month-picker-clear-hint",w=".ui-button-icon-primary",x="month-picker-disabled",y="ui-state-highlight",z="ui-state-active",A="ui-state-default",B={my:"left top+1",at:"left bottom"},C={my:"right top+1",at:"right bottom"},D=r+"The jQuery UI position plug-in must be loaded.",E=r+"Unsupported % option value, supported values are: ",F=r+'"_" is not a valid %Month value.',G=null,H=!!a.ui.position,I={Animation:["slideToggle","fadeToggle","none"],ShowAnim:["fadeIn","slideDown","none"],HideAnim:["fadeOut","slideUp","none"]},J={ValidationErrorMessage:"_createValidationMessage",Disabled:"_setDisabledState",ShowIcon:"_updateButton",Button:"_updateButton",ShowOn:"_updateFieldEvents",IsRTL:"_setRTL",AltFormat:"_updateAlt",AltField:"_updateAlt",StartYear:"_setPickerYear",MinMonth:"_setMinMonth",MaxMonth:"_setMaxMonth",SelectedMonth:"_setSelectedMonth"},K=a.noop,L=a.proxy,M=a.datepicker,N="click"+t;a.MonthPicker={VERSION:"3.0-beta1",i18n:{year:"Year",prevYear:"Previous Year",nextYear:"Next Year",next12Years:"Jump Forward 12 Years",prev12Years:"Jump Back 12 Years",nextLabel:"Next",prevLabel:"Prev",buttonText:"Open Month Chooser",jumpYears:"Jump Years",backTo:"Back to",months:["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sep.","Oct.","Nov.","Dec."]}};var O=' ").appendTo(l);n.append(' ')}this._buttons=a("button",l).jqueryUIButton(),i.on(N,function(a){return!1});var p=this,q="Month";a.each(["Min","Max"],function(a,b){p["_set"+b+q]=function(a){(p["_"+b+q]=j(p,a))===!1&&alert(F.replace(/%/,b).replace(/_/,a))},p._setOption(b+q,p.options[b+q])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass(u),b.change(L(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=K)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{G&&G.Close(b),G=this,a(c).on(N+this.uuid,L(this.Close,this)).on("keydown"+t+this.uuid,L(this._keyDown,this)),d.off("blur"+t).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:L(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,G=null,a(c).off("keydown"+t+this.uuid).off(N+this.uuid),this.Validate(),d.on("blur"+t,L(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return M.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return M.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyJumpYearsHint:function(){p(this._jumpYearsButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(t),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(N,L(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=N+" focus"+t;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,L(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+t,L(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in s?s[b]:s._default},_position:H?function(b){var c=this.options.IsRTL?C:B,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(x,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(y),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(N).on(N,L(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(N).on(N,L(this._addToYear,this,1)),this._buttons.off(t);var c=this,d=L(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(N,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(y),this._showYears(),this._backToYear)this._setPickerYear(this._backToYear),this._applyJumpYearsHint(),this._showMonths(),this._backToYear=0;else{var a=this._i18n("backTo")+" "+this._getPickerYear();this._jumpYearsButton.jqueryUIButton({label:a}).data(v)(),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(N).on(N,L(this._addToYears,this,-g)),this._nextButton.attr("title",this._i18n("next12Years")).off(N).on(N,L(this._addToYears,this,g)),q(this._prevButton,m&&m>e-1),q(this._nextButton,n&&e+12-1>n),this._buttons.off(t),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=L(this._onYearClick,this),r=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(y,v===j&&r).on(N,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),q(this._prevButton,g&&b==f(g)),q(this._nextButton,j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(y,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/css/MonthPicker.css b/css/MonthPicker.css
index 3880dd5..ee9255c 100644
--- a/css/MonthPicker.css
+++ b/css/MonthPicker.css
@@ -45,6 +45,15 @@ See: .month-picker-month-table button { width: 4.3em; }
.month-picker-year-table {
width: 100%;
+ /*
+ Makes sure the next/previous/jump years buttons are not unnecessarily
+ selected if the user clicks them a couple of times fast.
+ */
+ -ms-user-select: none; /* IE 10+ */
+ -moz-user-select: -moz-none;
+ -khtml-user-select: none;
+ -webkit-user-select: none;
+ user-select: none;
}
.month-picker-year-table .jump-years {
text-align: center;
diff --git a/demo/Demo.min.css b/demo/Demo.min.css
index 29429c9..73d1da1 100644
--- a/demo/Demo.min.css
+++ b/demo/Demo.min.css
@@ -1 +1 @@
-.month-picker{display:inline-block;position:absolute;z-index:9999}.month-picker table{border-collapse:separate;border-spacing:2px 2px}.month-picker td{padding:0}.month-picker .ui-button-text{padding:.4em 0}.month-picker-header{margin:3px 3px 0}.month-picker-year-table{width:100%}.month-picker-year-table .jump-years{text-align:center}.month-picker-year-table a{border:1px solid transparent}.month-picker-year-table a.ui-button{font-size:1.1em;width:1.5em;height:1.5em;cursor:default}.month-picker-year-table .jump-years a.ui-button{width:100%;font-weight:700}.month-picker-year-table .ui-button-text{padding:0}.month-picker-month-table td{height:35px;text-align:center}.month-picker-month-table button{width:4.3em;margin:.2em}.month-picker-open-button{height:20px;width:20px;vertical-align:bottom}.month-picker-invalid-message{display:none;background-color:#ff0}.month-picker-disabled,.option-block{background-color:#e1e1e1}body{font-size:12px;font-family:Verdana,Arial,sans-serif}.option-block{display:none;padding:4px;border:1px solid #000}.option{margin:20px;border:1px solid Gray;padding:4px}.demo,.demo-position{background-color:#e1e1e1;padding:8px;border:1px solid Gray}.option-link{text-decoration:underline;color:#00f;cursor:pointer;font-weight:700}.option-link:hover{color:Red}.option-type{margin:0 25px}.demo-position{width:100%}.text-right{text-align:right}
\ No newline at end of file
+.month-picker{display:inline-block;position:absolute;z-index:9999}.month-picker table{border-collapse:separate;border-spacing:2px 2px}.month-picker td{padding:0}.month-picker .ui-button-text{padding:.4em 0}.month-picker-header{margin:3px 3px 0}.month-picker-year-table{width:100%;-ms-user-select:none;-moz-user-select:-moz-none;-khtml-user-select:none;-webkit-user-select:none;user-select:none}.month-picker-year-table .jump-years{text-align:center}.month-picker-year-table a{border:1px solid transparent}.month-picker-year-table a.ui-button{font-size:1.1em;width:1.5em;height:1.5em;cursor:default}.month-picker-year-table .jump-years a.ui-button{width:100%;font-weight:700}.month-picker-year-table .ui-button-text{padding:0}.month-picker-month-table td{height:35px;text-align:center}.month-picker-month-table button{width:4.3em;margin:.2em}.month-picker-open-button{height:20px;width:20px;vertical-align:bottom}.month-picker-invalid-message{display:none;background-color:#ff0}.month-picker-disabled,.option-block{background-color:#e1e1e1}body{font-size:12px;font-family:Verdana,Arial,sans-serif}.option-block{display:none;padding:4px;border:1px solid #000}.option{margin:20px;border:1px solid Gray;padding:4px}.demo,.demo-position{background-color:#e1e1e1;padding:8px;border:1px solid Gray}.option-link{text-decoration:underline;color:#00f;cursor:pointer;font-weight:700}.option-link:hover{color:Red}.option-type{margin:0 25px}.demo-position{width:100%}.text-right{text-align:right}
\ No newline at end of file
diff --git a/demo/Demo.min.js b/demo/Demo.min.js
index d3abf09..9284839 100644
--- a/demo/Demo.min.js
+++ b/demo/Demo.min.js
@@ -1 +1 @@
-!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(l);n.append(' ')}this._buttons=a("button",l).jqueryUIButton(),i.on(M,function(a){return!1});var p=this,q="Month";a.each(["Min","Max"],function(a,b){p["_set"+b+q]=function(a){(p["_"+b+q]=j(p,a))===!1&&alert(E.replace(/%/,b).replace(/_/,a))},p._setOption(b+q,p.options[b+q])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass("month-year-input"),b.change(K(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=J)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{F&&F.Close(b),F=this,a(c).on(M+this.uuid,K(this.Close,this)).on("keydown"+t+this.uuid,K(this._keyDown,this)),d.off("blur"+t).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:K(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,F=null,a(c).off("keydown"+t+this.uuid).off(M+this.uuid),this.Validate(),d.on("blur"+t,K(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return L.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return L.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyJumpYearsHint:function(){p(this._jumpYearsButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(t),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(M,K(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=M+" focus"+t;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,K(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+t,K(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in s?s[b]:s._default},_position:G?function(b){var c=this.options.IsRTL?B:A,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){this._isMonthInputType||(this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask())},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(w,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(x),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(M).on(M,K(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(M).on(M,K(this._addToYear,this,1)),this._buttons.off(t);var c=this,d=K(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(M,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(x),this._showYears(),this._backToYear)this._setPickerYear(this._backToYear),this._applyJumpYearsHint(),this._showMonths(),this._backToYear=0;else{var a=this._i18n("backTo")+" "+this._getPickerYear();this._jumpYearsButton.jqueryUIButton({label:a}).data(u)(),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(M).on(M,K(this._addToYears,this,-g)),this._nextButton.attr("title",this._i18n("next12Years")).off(M).on(M,K(this._addToYears,this,g)),q(this._prevButton,m&&m>e-1),q(this._nextButton,n&&e+12-1>n),this._buttons.off(t),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=K(this._onYearClick,this),r=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(x,v===j&&r).on(M,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),q(this._prevButton,g&&b==f(g)),q(this._nextButton,j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(x,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(l);n.append(' ')}this._buttons=a("button",l).jqueryUIButton(),i.on(N,function(a){return!1});var p=this,q="Month";a.each(["Min","Max"],function(a,b){p["_set"+b+q]=function(a){(p["_"+b+q]=j(p,a))===!1&&alert(F.replace(/%/,b).replace(/_/,a))},p._setOption(b+q,p.options[b+q])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass(u),b.change(L(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=K)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{G&&G.Close(b),G=this,a(c).on(N+this.uuid,L(this.Close,this)).on("keydown"+t+this.uuid,L(this._keyDown,this)),d.off("blur"+t).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:L(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,G=null,a(c).off("keydown"+t+this.uuid).off(N+this.uuid),this.Validate(),d.on("blur"+t,L(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return M.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return M.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyJumpYearsHint:function(){p(this._jumpYearsButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(t),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(N,L(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=N+" focus"+t;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,L(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+t,L(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in s?s[b]:s._default},_position:H?function(b){var c=this.options.IsRTL?C:B,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(x,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(y),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(N).on(N,L(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(N).on(N,L(this._addToYear,this,1)),this._buttons.off(t);var c=this,d=L(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(N,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(y),this._showYears(),this._backToYear)this._setPickerYear(this._backToYear),this._applyJumpYearsHint(),this._showMonths(),this._backToYear=0;else{var a=this._i18n("backTo")+" "+this._getPickerYear();this._jumpYearsButton.jqueryUIButton({label:a}).data(v)(),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(N).on(N,L(this._addToYears,this,-g)),this._nextButton.attr("title",this._i18n("next12Years")).off(N).on(N,L(this._addToYears,this,g)),q(this._prevButton,m&&m>e-1),q(this._nextButton,n&&e+12-1>n),this._buttons.off(t),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=L(this._onYearClick,this),r=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(y,v===j&&r).on(N,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),q(this._prevButton,g&&b==f(g)),q(this._nextButton,j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(y,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
From be0aea48114759cfc37d455b84b93d1eb05b6784 Mon Sep 17 00:00:00 2001
From: Benjamin Albert ' +
'';
- function _applyButtonHint(_button, _hintLabel) {
+ // Groups state and functionallity to fade in the jump years hint
+ // when the user mouses over the Year 2016 text.
+ // NOTE: An invocation of this function:
+ // 1: Is an independent instance with it's own unique state.
+ // 2: Assumes that there is no previous hint applied to the
+ // button (it dosen't the existing hint).
+ function _applyButtonHint(_button, _hintText) {
var _speed = 125, _currentLabel, _startTimeout, _labelElem = $();
- function _fadeInHint() {
- _currentLabel = _labelElem.text();
- _labelElem.animate({ opacity: 1 }, _speed).text(_hintLabel);
+ _button.on('mouseenter' + _eventsNs + 'h', _prepareToStart);
+
+ // Setp 1: Wait to make sure the user isn't just mousing over and
+ // away from the button.
+ // NOTE: If _fadeOutHint() is triggered on mouseleave before the
+ // timeout is triggered the animation is canceled.
+ function _prepareToStart() {
+ _startTimeout = setTimeout(_fadeOutLabel, 175);
}
+ // Setp 2: Fade out the label (Year 2016) text to 45%.
function _fadeOutLabel() {
_startTimeout = null;
_labelElem = $('span', _button).animate({ opacity: 0.45 }, _speed, _fadeInHint);
}
- function _prepareToStart() {
- _startTimeout = setTimeout(_fadeOutLabel, 175);
+ // Setp 3: Fade in the hint text (Jump years).
+ function _fadeInHint() {
+ _currentLabel = _labelElem.text();
+ _labelElem.animate({ opacity: 1 }, _speed).text(_hintText);
}
- function _fadeInLabel() {
- _labelElem.text( _currentLabel ).animate({opacity: 1}, _speed);
- }
+ _button.on('mouseleave' + _eventsNs + 'h', _fadeOutHint);
function _fadeOutHint() {
if (_startTimeout) {
+ // If the user is just moving over and away from the button, cancel
+ // the animation completely.
clearTimeout(_startTimeout);
} else {
+ // Setp 4: Fade out the hint text (Jump years) to 45%.
_labelElem = $('span', _button).animate({ opacity: 0.45 }, _speed, _fadeInLabel);
}
}
+ // Setp 5: Fade in the label (Year 2016) text.
+ function _fadeInLabel() {
+ _labelElem.text( _currentLabel ).animate({opacity: 1}, _speed);
+ }
+
+ // Adds a function to the button elemene which is called when the
+ // user clicks the button (the hint needs to be removed).
_button.data(_clearHint, function() {
clearTimeout(_startTimeout);
_labelElem.stop().css({ opacity: 1 });
_button.off(_eventsNs + 'h');
});
-
- _button
- .on('mouseenter' + _eventsNs + 'h', _prepareToStart)
- .on('mouseleave' + _eventsNs + 'h', _fadeOutHint);
}
function _setDisabled(_button, _value) {
From 23634731c10eca62a951d91ca4cf682f80e9fc75 Mon Sep 17 00:00:00 2001
From: Benjamin Albert
").appendTo(l);n.append(' ')}this._buttons=a("button",l).jqueryUIButton(),i.on(N,function(a){return!1});var p=this,q="Month";a.each(["Min","Max"],function(a,b){p["_set"+b+q]=function(a){(p["_"+b+q]=j(p,a))===!1&&alert(F.replace(/%/,b).replace(/_/,a))},p._setOption(b+q,p.options[b+q])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass(u),b.change(L(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=K)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{G&&G.Close(b),G=this,a(c).on(N+this.uuid,L(this.Close,this)).on("keydown"+t+this.uuid,L(this._keyDown,this)),d.off("blur"+t).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:L(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,G=null,a(c).off("keydown"+t+this.uuid).off(N+this.uuid),this.Validate(),d.on("blur"+t,L(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return M.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return M.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyJumpYearsHint:function(){p(this._jumpYearsButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(t),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(N,L(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=N+" focus"+t;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,L(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+t,L(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in s?s[b]:s._default},_position:H?function(b){var c=this.options.IsRTL?C:B,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(x,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(y),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(N).on(N,L(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(N).on(N,L(this._addToYear,this,1)),this._buttons.off(t);var c=this,d=L(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(N,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(y),this._showYears(),this._backToYear)this._setPickerYear(this._backToYear),this._applyJumpYearsHint(),this._showMonths(),this._backToYear=0;else{var a=this._i18n("backTo")+" "+this._getPickerYear();this._jumpYearsButton.jqueryUIButton({label:a}).data(v)(),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(N).on(N,L(this._addToYears,this,-g)),this._nextButton.attr("title",this._i18n("next12Years")).off(N).on(N,L(this._addToYears,this,g)),q(this._prevButton,m&&m>e-1),q(this._nextButton,n&&e+12-1>n),this._buttons.off(t),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=L(this._onYearClick,this),r=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(y,v===j&&r).on(N,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),q(this._prevButton,g&&b==f(g)),q(this._nextButton,j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(y,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a,b,c,d){"use strict";function e(a){return a.getMonth()+12*a.getFullYear()}function f(a){return Math.floor(a/12)}function g(){a(this).addClass(z)}function h(a,b){return a[b?"on":"off"]("mousenter mouseout",g).toggleClass(z,b)}function i(a,b,c){return(!b||a>=b)&&(!c||c>=a)}function j(b,c){if(null===c)return c;if(c instanceof d)return e(c);if(a.isNumeric(c))return e(new d)+parseInt(c,10);var f=b._parseMonth(c);return f?e(f):l(c)}function k(a,b){return L(b.options[a]||K,b.element[0])}function l(b,c){var f=a.trim(b);f=f.replace(/y/i,'":"y"'),f=f.replace(/m/i,'":"m"');try{var g=JSON.parse('{"'+f.replace(/ /g,',"')+"}"),h={};for(var i in g)h[g[i]]=i;var j=e(new d);return j+=parseInt(h.m,10)||0,j+12*(parseInt(h.y,10)||0)}catch(k){return!1}}function m(b){return a(''+b.i18n.buttonText+"").jqueryUIButton({text:!1,icons:{primary:b.ButtonIcon}})}function n(a,b){a.jqueryUIButton("option",{icons:{primary:"ui-icon-circle-triangle-"+(b?"w":"e")}})}function o(a){return!a.is("input")}function p(b,c){function d(){j=setTimeout(e,175)}function e(){j=null,l=a("span",b).animate({opacity:.45},k,f)}function f(){i=l.text(),l.animate({opacity:1},k).text(c)}function g(){j?clearTimeout(j):l=a("span",b).animate({opacity:.45},k,h)}function h(){l.text(i).animate({opacity:1},k)}var i,j,k=125,l=a();b.on("mouseenter"+t+"h",d),b.on("mouseleave"+t+"h",g),b.data(v,function(){clearTimeout(j),l.stop().css({opacity:1}),b.off(t+"h")})}function q(a,b){var c=a.data("ui-button");c.option("disabled")!==b&&c.option("disabled",b)}var r="MonthPicker Error: ";if(!(a&&a.ui&&a.ui.button&&a.ui.datepicker))return void alert(r+"The jQuery UI button and datepicker plug-ins must be loaded.");a.widget.bridge("jqueryUIButton",a.ui.button);var s=a.fx.speeds,t=".MonthPicker",u="month-year-input",v="month-picker-clear-hint",w=".ui-button-icon-primary",x="month-picker-disabled",y="ui-state-highlight",z="ui-state-active",A="ui-state-default",B={my:"left top+1",at:"left bottom"},C={my:"right top+1",at:"right bottom"},D=r+"The jQuery UI position plug-in must be loaded.",E=r+"Unsupported % option value, supported values are: ",F=r+'"_" is not a valid %Month value.',G=null,H=!!a.ui.position,I={Animation:["slideToggle","fadeToggle","none"],ShowAnim:["fadeIn","slideDown","none"],HideAnim:["fadeOut","slideUp","none"]},J={ValidationErrorMessage:"_createValidationMessage",Disabled:"_setDisabledState",ShowIcon:"_updateButton",Button:"_updateButton",ShowOn:"_updateFieldEvents",IsRTL:"_setRTL",AltFormat:"_updateAlt",AltField:"_updateAlt",StartYear:"_setPickerYear",MinMonth:"_setMinMonth",MaxMonth:"_setMaxMonth",SelectedMonth:"_setSelectedMonth"},K=a.noop,L=a.proxy,M=a.datepicker,N="click"+t;a.MonthPicker={VERSION:"3.0-beta1",i18n:{year:"Year",prevYear:"Previous Year",nextYear:"Next Year",next12Years:"Jump Forward 12 Years",prev12Years:"Jump Back 12 Years",nextLabel:"Next",prevLabel:"Prev",buttonText:"Open Month Chooser",jumpYears:"Jump Years",backTo:"Back to",months:["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sep.","Oct.","Nov.","Dec."]}};var O=' ").appendTo(l);n.append(' ')}this._buttons=a("button",l).jqueryUIButton(),i.on(N,function(a){return!1});var p=this,q="Month";a.each(["Min","Max"],function(a,b){p["_set"+b+q]=function(a){(p["_"+b+q]=j(p,a))===!1&&alert(F.replace(/%/,b).replace(/_/,a))},p._setOption(b+q,p.options[b+q])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass(u),b.change(L(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=K)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{G&&G.Close(b),G=this,a(c).on(N+this.uuid,L(this.Close,this)).on("keydown"+t+this.uuid,L(this._keyDown,this)),d.off("blur"+t).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:L(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._backToYear&&(this._applyJumpYearsHint(),this._backToYear=0),this._visible=!1,G=null,a(c).off("keydown"+t+this.uuid).off(N+this.uuid),this.Validate(),d.on("blur"+t,L(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return M.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return M.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyJumpYearsHint:function(){p(this._jumpYearsButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(t),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(N,L(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=N+" focus"+t;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,L(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+t,L(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in s?s[b]:s._default},_position:H?function(b){var c=this.options.IsRTL?C:B,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(x,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(y),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(N).on(N,L(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(N).on(N,L(this._addToYear,this,1)),this._buttons.off(t);var c=this,d=L(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(N,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(y),this._backToYear)this._setPickerYear(this._backToYear),this._applyJumpYearsHint(),this._showMonths(),this._backToYear=0;else{this._backToYear=this._getPickerYear(),this._showYears();var a=this._i18n("backTo")+" "+this._getPickerYear();this._jumpYearsButton.jqueryUIButton({label:a}).data(v)(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(N).on(N,L(this._addToYears,this,-g)),this._nextButton.attr("title",this._i18n("next12Years")).off(N).on(N,L(this._addToYears,this,g)),q(this._prevButton,m&&m>e-1),q(this._nextButton,n&&e+12-1>n),this._buttons.off(t),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=L(this._onYearClick,this),r=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(y,v===j&&r).on(N,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),q(this._prevButton,g&&b==f(g)),q(this._nextButton,j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(y,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/css/MonthPicker.css b/css/MonthPicker.css
index ee9255c..8623362 100644
--- a/css/MonthPicker.css
+++ b/css/MonthPicker.css
@@ -55,6 +55,7 @@ See: .month-picker-month-table button { width: 4.3em; }
-webkit-user-select: none;
user-select: none;
}
+
.month-picker-year-table .jump-years {
text-align: center;
}
@@ -84,14 +85,15 @@ Sets the size of the next/previous buttons,
and makes the buttons in the heading (year-table) sligtly bigger,
and removes the pointer cursor from the buttons in the heading (year-table).
*/
-.month-picker-year-table a.ui-button {
+.month-picker-year-table .ui-button {
font-size: 1.1em;
width: 1.5em;
height: 1.5em;
cursor: default;
+ margin: 0;
}
-.month-picker-year-table .jump-years a.ui-button {
+.month-picker-year-table .jump-years .ui-button {
width: 100%;
font-weight: bold;
}
diff --git a/demo/Demo.min.css b/demo/Demo.min.css
index 73d1da1..3bbbf0b 100644
--- a/demo/Demo.min.css
+++ b/demo/Demo.min.css
@@ -1 +1 @@
-.month-picker{display:inline-block;position:absolute;z-index:9999}.month-picker table{border-collapse:separate;border-spacing:2px 2px}.month-picker td{padding:0}.month-picker .ui-button-text{padding:.4em 0}.month-picker-header{margin:3px 3px 0}.month-picker-year-table{width:100%;-ms-user-select:none;-moz-user-select:-moz-none;-khtml-user-select:none;-webkit-user-select:none;user-select:none}.month-picker-year-table .jump-years{text-align:center}.month-picker-year-table a{border:1px solid transparent}.month-picker-year-table a.ui-button{font-size:1.1em;width:1.5em;height:1.5em;cursor:default}.month-picker-year-table .jump-years a.ui-button{width:100%;font-weight:700}.month-picker-year-table .ui-button-text{padding:0}.month-picker-month-table td{height:35px;text-align:center}.month-picker-month-table button{width:4.3em;margin:.2em}.month-picker-open-button{height:20px;width:20px;vertical-align:bottom}.month-picker-invalid-message{display:none;background-color:#ff0}.month-picker-disabled,.option-block{background-color:#e1e1e1}body{font-size:12px;font-family:Verdana,Arial,sans-serif}.option-block{display:none;padding:4px;border:1px solid #000}.option{margin:20px;border:1px solid Gray;padding:4px}.demo,.demo-position{background-color:#e1e1e1;padding:8px;border:1px solid Gray}.option-link{text-decoration:underline;color:#00f;cursor:pointer;font-weight:700}.option-link:hover{color:Red}.option-type{margin:0 25px}.demo-position{width:100%}.text-right{text-align:right}
\ No newline at end of file
+.month-picker{display:inline-block;position:absolute;z-index:9999}.month-picker table{border-collapse:separate;border-spacing:2px 2px}.month-picker td{padding:0}.month-picker .ui-button-text{padding:.4em 0}.month-picker-header{margin:3px 3px 0}.month-picker-year-table{width:100%;-ms-user-select:none;-moz-user-select:-moz-none;-khtml-user-select:none;-webkit-user-select:none;user-select:none}.month-picker-year-table .jump-years{text-align:center}.month-picker-year-table a{border:1px solid transparent}.month-picker-year-table .ui-button{font-size:1.1em;width:1.5em;height:1.5em;cursor:default;margin:0}.month-picker-year-table .jump-years .ui-button{width:100%;font-weight:700}.month-picker-year-table .ui-button-text{padding:0}.month-picker-month-table td{height:35px;text-align:center}.month-picker-month-table button{width:4.3em;margin:.2em}.month-picker-open-button{height:20px;width:20px;vertical-align:bottom}.month-picker-invalid-message{display:none;background-color:#ff0}.month-picker-disabled,.option-block{background-color:#e1e1e1}body{font-size:12px;font-family:Verdana,Arial,sans-serif}.option-block{display:none;padding:4px;border:1px solid #000}.option{margin:20px;border:1px solid Gray;padding:4px}.demo,.demo-position{background-color:#e1e1e1;padding:8px;border:1px solid Gray}.option-link{text-decoration:underline;color:#00f;cursor:pointer;font-weight:700}.option-link:hover{color:Red}.option-type{margin:0 25px}.demo-position{width:100%}.text-right{text-align:right}
\ No newline at end of file
diff --git a/demo/Demo.min.js b/demo/Demo.min.js
index 9284839..c3e1b94 100644
--- a/demo/Demo.min.js
+++ b/demo/Demo.min.js
@@ -1 +1 @@
-!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(l);n.append(' ')}this._buttons=a("button",l).jqueryUIButton(),i.on(N,function(a){return!1});var p=this,q="Month";a.each(["Min","Max"],function(a,b){p["_set"+b+q]=function(a){(p["_"+b+q]=j(p,a))===!1&&alert(F.replace(/%/,b).replace(/_/,a))},p._setOption(b+q,p.options[b+q])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass(u),b.change(L(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=K)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{G&&G.Close(b),G=this,a(c).on(N+this.uuid,L(this.Close,this)).on("keydown"+t+this.uuid,L(this._keyDown,this)),d.off("blur"+t).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:L(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._visible=!1,G=null,a(c).off("keydown"+t+this.uuid).off(N+this.uuid),this.Validate(),d.on("blur"+t,L(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return M.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return M.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyJumpYearsHint:function(){p(this._jumpYearsButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(t),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(N,L(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=N+" focus"+t;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,L(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+t,L(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in s?s[b]:s._default},_position:H?function(b){var c=this.options.IsRTL?C:B,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(x,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(y),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(N).on(N,L(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(N).on(N,L(this._addToYear,this,1)),this._buttons.off(t);var c=this,d=L(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(N,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(y),this._showYears(),this._backToYear)this._setPickerYear(this._backToYear),this._applyJumpYearsHint(),this._showMonths(),this._backToYear=0;else{var a=this._i18n("backTo")+" "+this._getPickerYear();this._jumpYearsButton.jqueryUIButton({label:a}).data(v)(),this._backToYear=this._getPickerYear(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(N).on(N,L(this._addToYears,this,-g)),this._nextButton.attr("title",this._i18n("next12Years")).off(N).on(N,L(this._addToYears,this,g)),q(this._prevButton,m&&m>e-1),q(this._nextButton,n&&e+12-1>n),this._buttons.off(t),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=L(this._onYearClick,this),r=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(y,v===j&&r).on(N,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),q(this._prevButton,g&&b==f(g)),q(this._nextButton,j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(y,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(l);n.append(' ')}this._buttons=a("button",l).jqueryUIButton(),i.on(N,function(a){return!1});var p=this,q="Month";a.each(["Min","Max"],function(a,b){p["_set"+b+q]=function(a){(p["_"+b+q]=j(p,a))===!1&&alert(F.replace(/%/,b).replace(/_/,a))},p._setOption(b+q,p.options[b+q])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass(u),b.change(L(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=K)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{G&&G.Close(b),G=this,a(c).on(N+this.uuid,L(this.Close,this)).on("keydown"+t+this.uuid,L(this._keyDown,this)),d.off("blur"+t).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:L(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._backToYear&&(this._applyJumpYearsHint(),this._backToYear=0),this._visible=!1,G=null,a(c).off("keydown"+t+this.uuid).off(N+this.uuid),this.Validate(),d.on("blur"+t,L(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return M.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return M.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyJumpYearsHint:function(){p(this._jumpYearsButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(t),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(N,L(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=N+" focus"+t;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,L(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+t,L(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in s?s[b]:s._default},_position:H?function(b){var c=this.options.IsRTL?C:B,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(x,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(y),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(N).on(N,L(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(N).on(N,L(this._addToYear,this,1)),this._buttons.off(t);var c=this,d=L(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(N,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(y),this._backToYear)this._setPickerYear(this._backToYear),this._applyJumpYearsHint(),this._showMonths(),this._backToYear=0;else{this._backToYear=this._getPickerYear(),this._showYears();var a=this._i18n("backTo")+" "+this._getPickerYear();this._jumpYearsButton.jqueryUIButton({label:a}).data(v)(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(N).on(N,L(this._addToYears,this,-g)),this._nextButton.attr("title",this._i18n("next12Years")).off(N).on(N,L(this._addToYears,this,g)),q(this._prevButton,m&&m>e-1),q(this._nextButton,n&&e+12-1>n),this._buttons.off(t),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=L(this._onYearClick,this),r=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(y,v===j&&r).on(N,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),q(this._prevButton,g&&b==f(g)),q(this._nextButton,j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(y,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/test/test.css b/test/test.css
index d6bd559..64d55dc 100644
--- a/test/test.css
+++ b/test/test.css
@@ -1,6 +1,6 @@
/******* ***************** ********/
-/* Unit Testing CSS */
+/* Unit Testing and demo aon JSFiddle CSS */
/******* ***************** ********/
body {
diff --git a/test/test.html b/test/test.html
index 08cb43f..8a6056d 100644
--- a/test/test.html
+++ b/test/test.html
@@ -7,7 +7,7 @@
-
+
@@ -16,7 +16,7 @@
-
+
-
+
+
if (typeof $ === 'undefined' || !$.ui || typeof QUnit === 'undefnied') {
diff --git a/test/test.js b/test/test.js
index b15647f..48be8be 100644
--- a/test/test.js
+++ b/test/test.js
@@ -962,6 +962,17 @@ QUnit.test('ShowOn both', function (assert) {
assert.notOk(menu.is(':visible'), 'The menu was closed by pressing tab');
});
+QUnit.test('i18n', function (assert) {
+ assert.expect(2);
+
+ $("").MonthPicker({
+ Button: function(options) {
+ assert.ok(options.i18n.buttonText, 'The button callback received the buttonText i18n property');
+ assert.ok(options.i18n.nextYear, 'The button callback received the nextYear i18n property');
+ }
+ }).MonthPicker('destroy');
+});
+
QUnit.module("Min/MaxMonth");
QUnit.test('Month buttons are disabled', function (assert) {
From 7589c326d0be882182fa2b12c16c61aca4ba73e9 Mon Sep 17 00:00:00 2001
From: Benjamin Albert s in the
month-picker-year-table
The renaming is done to avoid conflicts with the users existing
CSS.
For example, the user might have defined a .next-year CSS
selector in there CSS which will mess up the menu.
It is also possible that users have applied their own CSS
to the menu to workaround some of the issues the CSS had
in version 2.x, in these cases I don't want the user's CSS to
mess up the new menu which works differently.
previous-year is now month-picker-previous
next-year is now month-picker-next
jump-years is now month-picker-title
---
MonthPicker.js | 12 ++++-----
MonthPicker.min.js | 2 +-
css/MonthPicker.css | 10 +++----
css/MonthPicker.min.css | 2 +-
demo/Demo.min.css | 2 +-
demo/Demo.min.js | 2 +-
test/test.js | 60 ++++++++++++++++++++---------------------
7 files changed, 45 insertions(+), 45 deletions(-)
diff --git a/MonthPicker.js b/MonthPicker.js
index 34db2ce..9d452c3 100644
--- a/MonthPicker.js
+++ b/MonthPicker.js
@@ -182,9 +182,9 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
'' +
@@ -399,7 +399,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
_menu.appendTo( isInline ? _el : document.body );
this._jumpYearsButton =
- $('.jump-years', _menu)
+ $('.month-picker-title', _menu)
.click($proxy(this._showYearsClickHandler, this))
.find('a').jqueryUIButton()
.removeClass(_defaultClass);
@@ -407,11 +407,11 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
this._applyJumpYearsHint();
this._createValidationMessage();
- this._prevButton = $('.previous-year a', _menu)
+ this._prevButton = $('.month-picker-previous>a', _menu)
.jqueryUIButton({ text: false })
.removeClass(_defaultClass);
- this._nextButton = $('.next-year a', _menu)
+ this._nextButton = $('.month-picker-next>a', _menu)
.jqueryUIButton({ text: false })
.removeClass(_defaultClass);
diff --git a/MonthPicker.min.js b/MonthPicker.min.js
index c1ec0cb..003a129 100644
--- a/MonthPicker.min.js
+++ b/MonthPicker.min.js
@@ -1 +1 @@
-!function(a,b,c,d){"use strict";function e(a){return a.getMonth()+12*a.getFullYear()}function f(a){return Math.floor(a/12)}function g(){a(this).addClass(z)}function h(a,b){return a[b?"on":"off"]("mousenter mouseout",g).toggleClass(z,b)}function i(a,b,c){return(!b||a>=b)&&(!c||c>=a)}function j(b,c){if(null===c)return c;if(c instanceof d)return e(c);if(a.isNumeric(c))return e(new d)+parseInt(c,10);var f=b._parseMonth(c);return f?e(f):l(c)}function k(a,b){return L(b.options[a]||K,b.element[0])}function l(b,c){var f=a.trim(b);f=f.replace(/y/i,'":"y"'),f=f.replace(/m/i,'":"m"');try{var g=JSON.parse('{"'+f.replace(/ /g,',"')+"}"),h={};for(var i in g)h[g[i]]=i;var j=e(new d);return j+=parseInt(h.m,10)||0,j+12*(parseInt(h.y,10)||0)}catch(k){return!1}}function m(b){return a(''+b.i18n.buttonText+"").jqueryUIButton({text:!1,icons:{primary:b.ButtonIcon}})}function n(a,b){a.jqueryUIButton("option",{icons:{primary:"ui-icon-circle-triangle-"+(b?"w":"e")}})}function o(a){return!a.is("input")}function p(b,c){function d(){j=setTimeout(e,175)}function e(){j=null,l=a("span",b).animate({opacity:.45},k,f)}function f(){i=l.text(),l.animate({opacity:1},k).text(c)}function g(){j?clearTimeout(j):l=a("span",b).animate({opacity:.45},k,h)}function h(){l.text(i).animate({opacity:1},k)}var i,j,k=125,l=a();b.on("mouseenter"+t+"h",d),b.on("mouseleave"+t+"h",g),b.data(v,function(){clearTimeout(j),l.stop().css({opacity:1}),b.off(t+"h")})}function q(a,b){var c=a.data("ui-button");c.option("disabled")!==b&&c.option("disabled",b)}var r="MonthPicker Error: ";if(!(a&&a.ui&&a.ui.button&&a.ui.datepicker))return void alert(r+"The jQuery UI button and datepicker plug-ins must be loaded.");a.widget.bridge("jqueryUIButton",a.ui.button);var s=a.fx.speeds,t=".MonthPicker",u="month-year-input",v="month-picker-clear-hint",w=".ui-button-icon-primary",x="month-picker-disabled",y="ui-state-highlight",z="ui-state-active",A="ui-state-default",B={my:"left top+1",at:"left bottom"},C={my:"right top+1",at:"right bottom"},D=r+"The jQuery UI position plug-in must be loaded.",E=r+"Unsupported % option value, supported values are: ",F=r+'"_" is not a valid %Month value.',G=null,H=!!a.ui.position,I={Animation:["slideToggle","fadeToggle","none"],ShowAnim:["fadeIn","slideDown","none"],HideAnim:["fadeOut","slideUp","none"]},J={ValidationErrorMessage:"_createValidationMessage",Disabled:"_setDisabledState",ShowIcon:"_updateButton",Button:"_updateButton",ShowOn:"_updateFieldEvents",IsRTL:"_setRTL",AltFormat:"_updateAlt",AltField:"_updateAlt",StartYear:"_setPickerYear",MinMonth:"_setMinMonth",MaxMonth:"_setMaxMonth",SelectedMonth:"_setSelectedMonth"},K=a.noop,L=a.proxy,M=a.datepicker,N="click"+t;a.MonthPicker={VERSION:"3.0-beta1",i18n:{year:"Year",prevYear:"Previous Year",nextYear:"Next Year",next12Years:"Jump Forward 12 Years",prev12Years:"Jump Back 12 Years",nextLabel:"Next",prevLabel:"Prev",buttonText:"Open Month Chooser",jumpYears:"Jump Years",backTo:"Back to",months:["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sep.","Oct.","Nov.","Dec."]}};var O=' ").appendTo(l);n.append(' ')}this._buttons=a("button",l).jqueryUIButton(),i.on(N,function(a){return!1});var p=this,q="Month";a.each(["Min","Max"],function(a,b){p["_set"+b+q]=function(a){(p["_"+b+q]=j(p,a))===!1&&alert(F.replace(/%/,b).replace(/_/,a))},p._setOption(b+q,p.options[b+q])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass(u),b.change(L(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=K)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{G&&G.Close(b),G=this,a(c).on(N+this.uuid,L(this.Close,this)).on("keydown"+t+this.uuid,L(this._keyDown,this)),d.off("blur"+t).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:L(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._backToYear&&(this._applyJumpYearsHint(),this._backToYear=0),this._visible=!1,G=null,a(c).off("keydown"+t+this.uuid).off(N+this.uuid),this.Validate(),d.on("blur"+t,L(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return M.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return M.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyJumpYearsHint:function(){p(this._jumpYearsButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(t),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(N,L(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=N+" focus"+t;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,L(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+t,L(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in s?s[b]:s._default},_position:H?function(b){var c=this.options.IsRTL?C:B,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(x,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(y),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(N).on(N,L(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(N).on(N,L(this._addToYear,this,1)),this._buttons.off(t);var c=this,d=L(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(N,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(y),this._backToYear)this._setPickerYear(this._backToYear),this._applyJumpYearsHint(),this._showMonths(),this._backToYear=0;else{this._backToYear=this._getPickerYear(),this._showYears();var a=this._i18n("backTo")+" "+this._getPickerYear();this._jumpYearsButton.jqueryUIButton({label:a}).data(v)(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(N).on(N,L(this._addToYears,this,-g)),this._nextButton.attr("title",this._i18n("next12Years")).off(N).on(N,L(this._addToYears,this,g)),q(this._prevButton,m&&m>e-1),q(this._nextButton,n&&e+12-1>n),this._buttons.off(t),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=L(this._onYearClick,this),r=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(y,v===j&&r).on(N,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),q(this._prevButton,g&&b==f(g)),q(this._nextButton,j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(y,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a,b,c,d){"use strict";function e(a){return a.getMonth()+12*a.getFullYear()}function f(a){return Math.floor(a/12)}function g(){a(this).addClass(z)}function h(a,b){return a[b?"on":"off"]("mousenter mouseout",g).toggleClass(z,b)}function i(a,b,c){return(!b||a>=b)&&(!c||c>=a)}function j(b,c){if(null===c)return c;if(c instanceof d)return e(c);if(a.isNumeric(c))return e(new d)+parseInt(c,10);var f=b._parseMonth(c);return f?e(f):l(c)}function k(a,b){return L(b.options[a]||K,b.element[0])}function l(b,c){var f=a.trim(b);f=f.replace(/y/i,'":"y"'),f=f.replace(/m/i,'":"m"');try{var g=JSON.parse('{"'+f.replace(/ /g,',"')+"}"),h={};for(var i in g)h[g[i]]=i;var j=e(new d);return j+=parseInt(h.m,10)||0,j+12*(parseInt(h.y,10)||0)}catch(k){return!1}}function m(b){return a(''+b.i18n.buttonText+"").jqueryUIButton({text:!1,icons:{primary:b.ButtonIcon}})}function n(a,b){a.jqueryUIButton("option",{icons:{primary:"ui-icon-circle-triangle-"+(b?"w":"e")}})}function o(a){return!a.is("input")}function p(b,c){function d(){j=setTimeout(e,175)}function e(){j=null,l=a("span",b).animate({opacity:.45},k,f)}function f(){i=l.text(),l.animate({opacity:1},k).text(c)}function g(){j?clearTimeout(j):l=a("span",b).animate({opacity:.45},k,h)}function h(){l.text(i).animate({opacity:1},k)}var i,j,k=125,l=a();b.on("mouseenter"+t+"h",d),b.on("mouseleave"+t+"h",g),b.data(v,function(){clearTimeout(j),l.stop().css({opacity:1}),b.off(t+"h")})}function q(a,b){var c=a.data("ui-button");c.option("disabled")!==b&&c.option("disabled",b)}var r="MonthPicker Error: ";if(!(a&&a.ui&&a.ui.button&&a.ui.datepicker))return void alert(r+"The jQuery UI button and datepicker plug-ins must be loaded.");a.widget.bridge("jqueryUIButton",a.ui.button);var s=a.fx.speeds,t=".MonthPicker",u="month-year-input",v="month-picker-clear-hint",w=".ui-button-icon-primary",x="month-picker-disabled",y="ui-state-highlight",z="ui-state-active",A="ui-state-default",B={my:"left top+1",at:"left bottom"},C={my:"right top+1",at:"right bottom"},D=r+"The jQuery UI position plug-in must be loaded.",E=r+"Unsupported % option value, supported values are: ",F=r+'"_" is not a valid %Month value.',G=null,H=!!a.ui.position,I={Animation:["slideToggle","fadeToggle","none"],ShowAnim:["fadeIn","slideDown","none"],HideAnim:["fadeOut","slideUp","none"]},J={ValidationErrorMessage:"_createValidationMessage",Disabled:"_setDisabledState",ShowIcon:"_updateButton",Button:"_updateButton",ShowOn:"_updateFieldEvents",IsRTL:"_setRTL",AltFormat:"_updateAlt",AltField:"_updateAlt",StartYear:"_setPickerYear",MinMonth:"_setMinMonth",MaxMonth:"_setMaxMonth",SelectedMonth:"_setSelectedMonth"},K=a.noop,L=a.proxy,M=a.datepicker,N="click"+t;a.MonthPicker={VERSION:"3.0-beta1",i18n:{year:"Year",prevYear:"Previous Year",nextYear:"Next Year",next12Years:"Jump Forward 12 Years",prev12Years:"Jump Back 12 Years",nextLabel:"Next",prevLabel:"Prev",buttonText:"Open Month Chooser",jumpYears:"Jump Years",backTo:"Back to",months:["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sep.","Oct.","Nov.","Dec."]}};var O=' ").appendTo(l);n.append(' ')}this._buttons=a("button",l).jqueryUIButton(),i.on(N,function(a){return!1});var p=this,q="Month";a.each(["Min","Max"],function(a,b){p["_set"+b+q]=function(a){(p["_"+b+q]=j(p,a))===!1&&alert(F.replace(/%/,b).replace(/_/,a))},p._setOption(b+q,p.options[b+q])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass(u),b.change(L(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=K)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{G&&G.Close(b),G=this,a(c).on(N+this.uuid,L(this.Close,this)).on("keydown"+t+this.uuid,L(this._keyDown,this)),d.off("blur"+t).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:L(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._backToYear&&(this._applyJumpYearsHint(),this._backToYear=0),this._visible=!1,G=null,a(c).off("keydown"+t+this.uuid).off(N+this.uuid),this.Validate(),d.on("blur"+t,L(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return M.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return M.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyJumpYearsHint:function(){p(this._jumpYearsButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(t),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,{},a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(N,L(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=N+" focus"+t;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,L(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+t,L(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in s?s[b]:s._default},_position:H?function(b){var c=this.options.IsRTL?C:B,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(x,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(y),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(N).on(N,L(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(N).on(N,L(this._addToYear,this,1)),this._buttons.off(t);var c=this,d=L(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(N,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(y),this._backToYear)this._setPickerYear(this._backToYear),this._applyJumpYearsHint(),this._showMonths(),this._backToYear=0;else{this._backToYear=this._getPickerYear(),this._showYears();var a=this._i18n("backTo")+" "+this._getPickerYear();this._jumpYearsButton.jqueryUIButton({label:a}).data(v)(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(N).on(N,L(this._addToYears,this,-g)),this._nextButton.attr("title",this._i18n("next12Years")).off(N).on(N,L(this._addToYears,this,g)),q(this._prevButton,m&&m>e-1),q(this._nextButton,n&&e+12-1>n),this._buttons.off(t),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=L(this._onYearClick,this),r=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(y,v===j&&r).on(N,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),q(this._prevButton,g&&b==f(g)),q(this._nextButton,j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(y,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/css/MonthPicker.css b/css/MonthPicker.css
index aad95fa..04c4828 100644
--- a/css/MonthPicker.css
+++ b/css/MonthPicker.css
@@ -56,10 +56,6 @@ See: .month-picker-month-table button { width: 4.3em; }
user-select: none;
}
-.month-picker-year-table .jump-years {
- text-align: center;
-}
-
/*
The plugin uses buttons with a transparent background in the year-table
(aka header) in order to look consistent with jQuery UI datepicker and to
@@ -93,7 +89,11 @@ and removes the pointer cursor from the buttons in the heading (year-table).
margin: 0;
}
-.month-picker-year-table .jump-years .ui-button {
+.month-picker-year-table .month-picker-title {
+ text-align: center;
+}
+
+.month-picker-year-table .month-picker-title .ui-button {
font-size: 1em;
padding: .1em 0;
width: 100%;
diff --git a/css/MonthPicker.min.css b/css/MonthPicker.min.css
index 35526ca..f12a581 100644
--- a/css/MonthPicker.min.css
+++ b/css/MonthPicker.min.css
@@ -1 +1 @@
-.month-picker{display:inline-block;position:absolute;z-index:9999}.month-picker table{border-collapse:separate;border-spacing:2px 2px}.month-picker td{padding:0}.month-picker .ui-button-text{padding:.4em 0}.month-picker-header{margin:3px 3px 0}.month-picker-year-table{width:100%;-ms-user-select:none;-moz-user-select:-moz-none;-khtml-user-select:none;-webkit-user-select:none;user-select:none}.month-picker-year-table .jump-years{text-align:center}.month-picker-year-table a{border:1px solid transparent}.month-picker-year-table .ui-button{font-size:1.1em;width:1.5em;height:1.5em;cursor:default;margin:0}.month-picker-year-table .jump-years .ui-button{width:100%;font-weight:700}.month-picker-year-table .ui-button-text{padding:0}.month-picker-month-table td{height:35px;text-align:center}.month-picker-month-table button{width:4.3em;margin:.2em}.month-picker-open-button{height:20px;width:20px;vertical-align:bottom}.month-picker-invalid-message{display:none;background-color:#ff0}.month-picker-disabled{background-color:#e1e1e1}
\ No newline at end of file
+.month-picker{display:inline-block;position:absolute;z-index:9999}.month-picker table{border-collapse:separate;border-spacing:2px 2px}.month-picker td{padding:0}.month-picker .ui-button-text{padding:.4em 0}.month-picker-header{margin:3px 3px 0}.month-picker-year-table{width:100%;-ms-user-select:none;-moz-user-select:-moz-none;-khtml-user-select:none;-webkit-user-select:none;user-select:none}.month-picker-year-table a{border:1px solid transparent}.month-picker-year-table .ui-button{font-size:1.1em;width:1.5em;height:1.5em;cursor:default;margin:0}.month-picker-year-table .month-picker-title{text-align:center}.month-picker-year-table .month-picker-title .ui-button{font-size:1em;padding:.1em 0;width:100%;font-weight:700}.month-picker-year-table .ui-button-text{padding:0}.month-picker-month-table td{height:35px;text-align:center}.month-picker-month-table button{width:4.3em;margin:.2em}.month-picker-open-button{height:20px;width:20px;vertical-align:bottom}.month-picker-invalid-message{display:none;background-color:#ff0}.month-picker-disabled{background-color:#e1e1e1}
\ No newline at end of file
diff --git a/demo/Demo.min.css b/demo/Demo.min.css
index 3bbbf0b..6b673c5 100644
--- a/demo/Demo.min.css
+++ b/demo/Demo.min.css
@@ -1 +1 @@
-.month-picker{display:inline-block;position:absolute;z-index:9999}.month-picker table{border-collapse:separate;border-spacing:2px 2px}.month-picker td{padding:0}.month-picker .ui-button-text{padding:.4em 0}.month-picker-header{margin:3px 3px 0}.month-picker-year-table{width:100%;-ms-user-select:none;-moz-user-select:-moz-none;-khtml-user-select:none;-webkit-user-select:none;user-select:none}.month-picker-year-table .jump-years{text-align:center}.month-picker-year-table a{border:1px solid transparent}.month-picker-year-table .ui-button{font-size:1.1em;width:1.5em;height:1.5em;cursor:default;margin:0}.month-picker-year-table .jump-years .ui-button{width:100%;font-weight:700}.month-picker-year-table .ui-button-text{padding:0}.month-picker-month-table td{height:35px;text-align:center}.month-picker-month-table button{width:4.3em;margin:.2em}.month-picker-open-button{height:20px;width:20px;vertical-align:bottom}.month-picker-invalid-message{display:none;background-color:#ff0}.month-picker-disabled,.option-block{background-color:#e1e1e1}body{font-size:12px;font-family:Verdana,Arial,sans-serif}.option-block{display:none;padding:4px;border:1px solid #000}.option{margin:20px;border:1px solid Gray;padding:4px}.demo,.demo-position{background-color:#e1e1e1;padding:8px;border:1px solid Gray}.option-link{text-decoration:underline;color:#00f;cursor:pointer;font-weight:700}.option-link:hover{color:Red}.option-type{margin:0 25px}.demo-position{width:100%}.text-right{text-align:right}
\ No newline at end of file
+.month-picker{display:inline-block;position:absolute;z-index:9999}.month-picker table{border-collapse:separate;border-spacing:2px 2px}.month-picker td{padding:0}.month-picker .ui-button-text{padding:.4em 0}.month-picker-header{margin:3px 3px 0}.month-picker-year-table{width:100%;-ms-user-select:none;-moz-user-select:-moz-none;-khtml-user-select:none;-webkit-user-select:none;user-select:none}.month-picker-year-table a{border:1px solid transparent}.month-picker-year-table .ui-button{font-size:1.1em;width:1.5em;height:1.5em;cursor:default;margin:0}.month-picker-year-table .month-picker-title{text-align:center}.month-picker-year-table .month-picker-title .ui-button{font-size:1em;padding:.1em 0;width:100%;font-weight:700}.month-picker-year-table .ui-button-text{padding:0}.month-picker-month-table td{height:35px;text-align:center}.month-picker-month-table button{width:4.3em;margin:.2em}.month-picker-open-button{height:20px;width:20px;vertical-align:bottom}.month-picker-invalid-message{display:none;background-color:#ff0}.month-picker-disabled,.option-block{background-color:#e1e1e1}body{font-size:12px;font-family:Verdana,Arial,sans-serif}.option-block{display:none;padding:4px;border:1px solid #000}.option{margin:20px;border:1px solid Gray;padding:4px}.demo,.demo-position{background-color:#e1e1e1;padding:8px;border:1px solid Gray}.option-link{text-decoration:underline;color:#00f;cursor:pointer;font-weight:700}.option-link:hover{color:Red}.option-type{margin:0 25px}.demo-position{width:100%}.text-right{text-align:right}
\ No newline at end of file
diff --git a/demo/Demo.min.js b/demo/Demo.min.js
index c3e1b94..1672735 100644
--- a/demo/Demo.min.js
+++ b/demo/Demo.min.js
@@ -1 +1 @@
-!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(l);n.append(' ')}this._buttons=a("button",l).jqueryUIButton(),i.on(N,function(a){return!1});var p=this,q="Month";a.each(["Min","Max"],function(a,b){p["_set"+b+q]=function(a){(p["_"+b+q]=j(p,a))===!1&&alert(F.replace(/%/,b).replace(/_/,a))},p._setOption(b+q,p.options[b+q])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass(u),b.change(L(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=K)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{G&&G.Close(b),G=this,a(c).on(N+this.uuid,L(this.Close,this)).on("keydown"+t+this.uuid,L(this._keyDown,this)),d.off("blur"+t).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:L(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._backToYear&&(this._applyJumpYearsHint(),this._backToYear=0),this._visible=!1,G=null,a(c).off("keydown"+t+this.uuid).off(N+this.uuid),this.Validate(),d.on("blur"+t,L(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return M.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return M.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyJumpYearsHint:function(){p(this._jumpYearsButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(t),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(N,L(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=N+" focus"+t;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,L(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+t,L(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in s?s[b]:s._default},_position:H?function(b){var c=this.options.IsRTL?C:B,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(x,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(y),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(N).on(N,L(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(N).on(N,L(this._addToYear,this,1)),this._buttons.off(t);var c=this,d=L(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(N,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(y),this._backToYear)this._setPickerYear(this._backToYear),this._applyJumpYearsHint(),this._showMonths(),this._backToYear=0;else{this._backToYear=this._getPickerYear(),this._showYears();var a=this._i18n("backTo")+" "+this._getPickerYear();this._jumpYearsButton.jqueryUIButton({label:a}).data(v)(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(N).on(N,L(this._addToYears,this,-g)),this._nextButton.attr("title",this._i18n("next12Years")).off(N).on(N,L(this._addToYears,this,g)),q(this._prevButton,m&&m>e-1),q(this._nextButton,n&&e+12-1>n),this._buttons.off(t),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=L(this._onYearClick,this),r=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(y,v===j&&r).on(N,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),q(this._prevButton,g&&b==f(g)),q(this._nextButton,j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(y,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(l);n.append(' ')}this._buttons=a("button",l).jqueryUIButton(),i.on(N,function(a){return!1});var p=this,q="Month";a.each(["Min","Max"],function(a,b){p["_set"+b+q]=function(a){(p["_"+b+q]=j(p,a))===!1&&alert(F.replace(/%/,b).replace(/_/,a))},p._setOption(b+q,p.options[b+q])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass(u),b.change(L(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=K)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{G&&G.Close(b),G=this,a(c).on(N+this.uuid,L(this.Close,this)).on("keydown"+t+this.uuid,L(this._keyDown,this)),d.off("blur"+t).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:L(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._backToYear&&(this._applyJumpYearsHint(),this._backToYear=0),this._visible=!1,G=null,a(c).off("keydown"+t+this.uuid).off(N+this.uuid),this.Validate(),d.on("blur"+t,L(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return M.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return M.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyJumpYearsHint:function(){p(this._jumpYearsButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(t),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,{},a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(N,L(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=N+" focus"+t;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,L(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+t,L(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in s?s[b]:s._default},_position:H?function(b){var c=this.options.IsRTL?C:B,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(x,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(y),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(N).on(N,L(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(N).on(N,L(this._addToYear,this,1)),this._buttons.off(t);var c=this,d=L(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(N,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(y),this._backToYear)this._setPickerYear(this._backToYear),this._applyJumpYearsHint(),this._showMonths(),this._backToYear=0;else{this._backToYear=this._getPickerYear(),this._showYears();var a=this._i18n("backTo")+" "+this._getPickerYear();this._jumpYearsButton.jqueryUIButton({label:a}).data(v)(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(N).on(N,L(this._addToYears,this,-g)),this._nextButton.attr("title",this._i18n("next12Years")).off(N).on(N,L(this._addToYears,this,g)),q(this._prevButton,m&&m>e-1),q(this._nextButton,n&&e+12-1>n),this._buttons.off(t),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=L(this._onYearClick,this),r=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(y,v===j&&r).on(N,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),q(this._prevButton,g&&b==f(g)),q(this._nextButton,j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(y,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/test/test.js b/test/test.js
index 48be8be..8d5be2d 100644
--- a/test/test.js
+++ b/test/test.js
@@ -17,7 +17,7 @@ var _today = new Date();
$.KidSysco.MonthPicker.prototype.options.Duration = 1;
function _getPickerYear(_pickerMenu) {
- return parseInt($('.jump-years span', _pickerMenu).text().replace(/\D/g, ''), 10);
+ return parseInt($('.month-picker-title span', _pickerMenu).text().replace(/\D/g, ''), 10);
}
QUnit.module("Installation");
@@ -398,11 +398,11 @@ QUnit.test('Inline menu', function(assert) {
});
var menu = $(MonthPicker_InlineMenuDiv);
- var nextYearButton = menu.find('.next-year .ui-button');
- var previousYearButton = menu.find('.previous-year .ui-button');
+ var nextYearButton = menu.find('.month-picker-next .ui-button');
+ var previousYearButton = menu.find('.month-picker-previous .ui-button');
- assert.equal(nextYearButton.css('float'), 'right', 'The next year button has the expected alignment for RTL documents');
- assert.equal(previousYearButton.css('float'), 'left', 'The previous year button has the expected alignment for RTL documents');
+ assert.equal(nextYearButton.css('float'), 'right', 'The next year button has the expected alignment for RTL documents');
+ assert.equal(previousYearButton.css('float'), 'left', 'The previous year button has the expected alignment for RTL documents');
assert.ok(menu.width() <= 200, 'The menu is visible and has the expected width');
@@ -491,7 +491,7 @@ QUnit.test('Events and context', function (assert) { // A.k.a duplicate code tes
assert.equal( this, EventsField, 'OnAfterNextYear was called in the right context' );
});
- var nextYearButton = menu.find('.next-year>a');
+ var nextYearButton = menu.find('.month-picker-next>a');
nextYearButton.trigger('click');
assert.ok(OnAfterNextYearTriggered, 'Clicking the next button triggered OnAfterNextYear');
@@ -503,7 +503,7 @@ QUnit.test('Events and context', function (assert) { // A.k.a duplicate code tes
assert.equal( this, EventsField, 'OnAfterPreviousYear was called in the right context' );
});
- var previousYearButton = menu.find('.previous-year>a');
+ var previousYearButton = menu.find('.month-picker-previous>a');
previousYearButton.trigger('click');
assert.ok(OnAfterPreviousYearTriggerd, 'Clciking rhe previous button triggered OnAfterPreviousYear');
@@ -514,7 +514,7 @@ QUnit.test('Events and context', function (assert) { // A.k.a duplicate code tes
assert.equal( this, EventsField, 'OnAfterChooseYears was called in the right context' );
});
- var showYearsButton = menu.find('.jump-years a');
+ var showYearsButton = menu.find('.month-picker-title a');
showYearsButton.trigger('click');
assert.ok(OnAfterChooseYearsTriggerd, 'Clicking the show years button triggered OnAfterChooseYears');
@@ -658,8 +658,8 @@ QUnit.test('Right to left', function (assert) {
var menu = $(MonthPicker_RTLField);
- var nextYearButton = menu.find('.next-year .ui-button');
- var previousYearButton = menu.find('.previous-year .ui-button');
+ var nextYearButton = menu.find('.month-picker-next .ui-button');
+ var previousYearButton = menu.find('.month-picker-previous .ui-button');
// Make sure the buttons are pointing in the right (opposite) direction.
assert.ok(previousYearButton.find('span.ui-icon-circle-triangle-e').length, 'Previous button is pointed east');
@@ -985,8 +985,8 @@ QUnit.test('Month buttons are disabled', function (assert) {
field.MonthPicker('Open');
var menu = $(MonthPicker_RistrictMonthField);
- var previousYearButton = menu.find('.previous-year>a');
- var nextYearButton = menu.find('.next-year>a');
+ var previousYearButton = menu.find('.month-picker-previous>a');
+ var nextYearButton = menu.find('.month-picker-next>a');
// Try to click the disabled buttons.
var buttons = menu.find('.month-picker-month-table button');
@@ -1063,7 +1063,7 @@ QUnit.test('Year buttons are disabled', function (assert) {
var menu = $(MonthPicker_RistrictMonthField);
// Click the year title to show the years.
- menu.find('.jump-years a').trigger('click');
+ menu.find('.month-picker-title a').trigger('click');
// Make sure we are in years view.
var buttons = menu.find('.month-picker-month-table button');
@@ -1085,7 +1085,7 @@ QUnit.test('Year buttons are disabled', function (assert) {
assert.ok(firstVisibleYear, "Clciking the disabled buttons didn't take us to month view");
// Make sure the next years button is disabled.
- var nextYearsButton = menu.find('.next-year>a');
+ var nextYearsButton = menu.find('.month-picker-next>a');
var isDisabled = nextYearsButton
.trigger('click')
.is('.ui-button-disabled');
@@ -1094,7 +1094,7 @@ QUnit.test('Year buttons are disabled', function (assert) {
var newFirstYrar = parseInt($(buttons[0]).text(), 10);
assert.equal(newFirstYrar, firstVisibleYear, "Clicking next year didn't change the year");
- var previousYearsButton = menu.find('.previous-year>a');
+ var previousYearsButton = menu.find('.month-picker-previous>a');
// Keep going back until there are no disabled buttons.
// We count to 10 to avoid an infinite loop in case there's
// a bug where we are going back in time but the the buttons stay disabled.
@@ -1145,7 +1145,7 @@ QUnit.test('Year buttons are disabled', function (assert) {
assert.ok(!hasDidabledButtons, 'All buttons are enabled');
// Click the year title to show the years menu.
- menu.find('.jump-years a').trigger('click');
+ menu.find('.month-picker-title a').trigger('click');
// Keeps clicking next years until we reach the disabled years.
for (var i = 1; !buttons.is('.ui-button-disabled') && i <= 10; i++) {
@@ -1268,8 +1268,8 @@ QUnit.test('Today and selected months are highlighted', function (assert) {
var todaysButton = $(buttons[new Date().getMonth()]);
- var nextYearButton = menu.find('.next-year>a');
- var previousYearButton = menu.find('.previous-year>a');
+ var nextYearButton = menu.find('.month-picker-next>a');
+ var previousYearButton = menu.find('.month-picker-previous>a');
assert.ok(todaysButton.is('.ui-state-highlight'), "Today's month is highlighted");
@@ -1292,7 +1292,7 @@ QUnit.test('Today and selected months are highlighted', function (assert) {
assert.equal( selectedButton.length, 1, 'There is one selected button');
assert.equal( selectedButton[0], buttons[4], 'The selected month is highlighted');
- menu.find('.jump-years a').trigger('click');
+ menu.find('.month-picker-title a').trigger('click');
var selectdBtn = buttons.filter('.ui-state-active');
assert.equal( selectdBtn.jqueryUIButton( "option", "label" ), _today.getFullYear(), 'The selected year is highlighted');
@@ -1332,8 +1332,8 @@ QUnit.test('Number of months from today', function (assert) {
// Make sure we are in years view.
var buttons = menu.find('.month-picker-month-table button');
- var nextYearButton = menu.find('.next-year>a');
- var previousYearButton = menu.find('.previous-year>a');
+ var nextYearButton = menu.find('.month-picker-next>a');
+ var previousYearButton = menu.find('.month-picker-previous>a');
var enabledMonths = 0;
@@ -1388,8 +1388,8 @@ QUnit.test('Relative month periods', function (assert) {
// Make sure we are in years view.
var buttons = menu.find('.month-picker-month-table button');
- var nextYearButton = menu.find('.next-year>a');
- var previousYearButton = menu.find('.previous-year>a');
+ var nextYearButton = menu.find('.month-picker-next>a');
+ var previousYearButton = menu.find('.month-picker-previous>a');
var enabledMonths = 0;
// Make sure that 18 buttons + 1 for today are disabled.
@@ -1464,7 +1464,7 @@ QUnit.test('Title buttons', function (assert) {
});
var menu = $(MonthPicker_RistrictMonthField);
- var nextButton = menu.find('.next-year .ui-button');
+ var nextButton = menu.find('.month-picker-next .ui-button');
field.MonthPicker('Open');
assert.notOk(nextButton.is('.ui-state-default'), "The next button doesn't have the .ui-state-default class");
@@ -1512,9 +1512,9 @@ QUnit.test('Back to 2015 button', function (assert) {
field.MonthPicker('Open');
var menu = $(MonthPicker_RistrictMonthField);
- var titleButton = menu.find('.jump-years .ui-button');
- var nextButton = menu.find('.next-year .ui-button');
- var backButton = menu.find('.previous-year .ui-button');
+ var titleButton = menu.find('.month-picker-title .ui-button');
+ var nextButton = menu.find('.month-picker-next .ui-button');
+ var backButton = menu.find('.month-picker-previous .ui-button');
nextButton.trigger('click');
var nextYear = _today.getFullYear() + 1;
@@ -1523,7 +1523,7 @@ QUnit.test('Back to 2015 button', function (assert) {
titleButton.trigger('click');
var expectedTitle = $.MonthPicker.i18n.backTo + ' ' + nextYear;
- assert.equal( $('.jump-years span', menu).text(), expectedTitle, 'The title button has the expected label' );
+ assert.equal( $('.month-picker-title span', menu).text(), expectedTitle, 'The title button has the expected label' );
/*
Here we simulate the user jumping back and forth in
@@ -1546,7 +1546,7 @@ QUnit.test('Back to 2015 button', function (assert) {
var nextClickCount = i;
assert.notOk( hasNext, "Today's year is not visible after clicking next" );
- assert.equal( $('.jump-years span', menu).text(), expectedTitle, 'Clicking next did not change the button label' );
+ assert.equal( $('.month-picker-title span', menu).text(), expectedTitle, 'Clicking next did not change the button label' );
for (var p = 0; p < nextClickCount * 2; p++) {
backButton.trigger('click');
@@ -1554,7 +1554,7 @@ QUnit.test('Back to 2015 button', function (assert) {
hasNext = buttons.is('.ui-state-highlight');
assert.notOk( hasNext, "Today's year is not visible after clicking previous" );
- assert.equal( $('.jump-years span', menu).text(), expectedTitle, 'Clicking previous did not change the button label' );
+ assert.equal( $('.month-picker-title span', menu).text(), expectedTitle, 'Clicking previous did not change the button label' );
// Click the title button and make sure it returnd us to the expected year.
titleButton.trigger('click');
From c4ce4d6ae9cf2d7a079e809e627c1bf9af40d1bc Mon Sep 17 00:00:00 2001
From: Benjamin Albert
+ `.
+The `` tag is a [jQyery UI Button](https://jqueryui.com/button/).
+
+The following elements:
+```
+
+
+```
+were replaced by:
+```
+
+
+```
From 90e3d2c51e464f2c5368c13692c3e18ae68b1cb4 Mon Sep 17 00:00:00 2001
From: Benjamin Albert Upgrading from version 2.x.x?
+Prerequisites
From e1fc3237635bb22b20b7b84980da46368bbc234e Mon Sep 17 00:00:00 2001
From: Benjamin Albert
").appendTo(l);n.append(' ')}this._buttons=a("button",l).jqueryUIButton(),i.on(N,function(a){return!1});var p=this,q="Month";a.each(["Min","Max"],function(a,b){p["_set"+b+q]=function(a){(p["_"+b+q]=j(p,a))===!1&&alert(F.replace(/%/,b).replace(/_/,a))},p._setOption(b+q,p.options[b+q])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass(u),b.change(L(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=K)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{G&&G.Close(b),G=this,a(c).on(N+this.uuid,L(this.Close,this)).on("keydown"+t+this.uuid,L(this._keyDown,this)),d.off("blur"+t).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:L(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._backToYear&&(this._applyJumpYearsHint(),this._backToYear=0),this._visible=!1,G=null,a(c).off("keydown"+t+this.uuid).off(N+this.uuid),this.Validate(),d.on("blur"+t,L(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return M.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return M.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyJumpYearsHint:function(){p(this._jumpYearsButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(t),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,{},a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(N,L(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=N+" focus"+t;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,L(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+t,L(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in s?s[b]:s._default},_position:H?function(b){var c=this.options.IsRTL?C:B,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(x,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(y),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(N).on(N,L(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(N).on(N,L(this._addToYear,this,1)),this._buttons.off(t);var c=this,d=L(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(N,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(y),this._backToYear)this._setPickerYear(this._backToYear),this._applyJumpYearsHint(),this._showMonths(),this._backToYear=0;else{this._backToYear=this._getPickerYear(),this._showYears();var a=this._i18n("backTo")+" "+this._getPickerYear();this._jumpYearsButton.jqueryUIButton({label:a}).data(v)(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(N).on(N,L(this._addToYears,this,-g)),this._nextButton.attr("title",this._i18n("next12Years")).off(N).on(N,L(this._addToYears,this,g)),q(this._prevButton,m&&m>e-1),q(this._nextButton,n&&e+12-1>n),this._buttons.off(t),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=L(this._onYearClick,this),r=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(y,v===j&&r).on(N,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),q(this._prevButton,g&&b==f(g)),q(this._nextButton,j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(y,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a,b,c,d){"use strict";function e(a){return a.getMonth()+12*a.getFullYear()}function f(a){return Math.floor(a/12)}function g(){a(this).addClass(z)}function h(a,b){return a[b?"on":"off"]("mousenter mouseout",g).toggleClass(z,b)}function i(a,b,c){return(!b||a>=b)&&(!c||c>=a)}function j(b,c){if(null===c)return c;if(c instanceof d)return e(c);if(a.isNumeric(c))return e(new d)+parseInt(c,10);var f=b._parseMonth(c);return f?e(f):l(c)}function k(a,b){return L(b.options[a]||K,b.element[0])}function l(b,c){var f=a.trim(b);f=f.replace(/y/i,'":"y"'),f=f.replace(/m/i,'":"m"');try{var g=JSON.parse('{"'+f.replace(/ /g,',"')+"}"),h={};for(var i in g)h[g[i]]=i;var j=e(new d);return j+=parseInt(h.m,10)||0,j+12*(parseInt(h.y,10)||0)}catch(k){return!1}}function m(b){return a(''+b.i18n.buttonText+"").jqueryUIButton({text:!1,icons:{primary:b.ButtonIcon}})}function n(a,b){a.jqueryUIButton("option",{icons:{primary:"ui-icon-circle-triangle-"+(b?"w":"e")}})}function o(a){return!a.is("input")}function p(b,c){function d(){j=setTimeout(e,175)}function e(){j=null,l=a("span",b).animate({opacity:.45},k,f)}function f(){i=l.text(),l.animate({opacity:1},k).text(c)}function g(){j?clearTimeout(j):l=a("span",b).animate({opacity:.45},k,h)}function h(){l.text(i).animate({opacity:1},k)}var i,j,k=125,l=a();b.on("mouseenter"+t+"h",d),b.on("mouseleave"+t+"h",g),b.data(v,function(){clearTimeout(j),l.stop().css({opacity:1}),b.off(t+"h")})}function q(a,b){var c=a.data("ui-button");c.option("disabled")!==b&&c.option("disabled",b)}var r="MonthPicker Error: ";if(!(a&&a.ui&&a.ui.button&&a.ui.datepicker))return void alert(r+"The jQuery UI button and datepicker plug-ins must be loaded.");a.widget.bridge("jqueryUIButton",a.ui.button);var s=a.fx.speeds,t=".MonthPicker",u="month-year-input",v="month-picker-clear-hint",w=".ui-button-icon-primary",x="month-picker-disabled",y="ui-state-highlight",z="ui-state-active",A="ui-state-default",B={my:"left top+1",at:"left bottom"},C={my:"right top+1",at:"right bottom"},D=r+"The jQuery UI position plug-in must be loaded.",E=r+"Unsupported % option value, supported values are: ",F=r+'"_" is not a valid %Month value.',G=null,H=!!a.ui.position,I={Animation:["slideToggle","fadeToggle","none"],ShowAnim:["fadeIn","slideDown","none"],HideAnim:["fadeOut","slideUp","none"]},J={ValidationErrorMessage:"_createValidationMessage",Disabled:"_setDisabledState",ShowIcon:"_updateButton",Button:"_updateButton",ShowOn:"_updateFieldEvents",IsRTL:"_setRTL",AltFormat:"_updateAlt",AltField:"_updateAlt",StartYear:"_setPickerYear",MinMonth:"_setMinMonth",MaxMonth:"_setMaxMonth",SelectedMonth:"_setSelectedMonth"},K=a.noop,L=a.proxy,M=a.datepicker,N="click"+t;a.MonthPicker={VERSION:"3.0-beta1",i18n:{year:"Year",prevYear:"Previous Year",nextYear:"Next Year",next12Years:"Jump Forward 12 Years",prev12Years:"Jump Back 12 Years",nextLabel:"Next",prevLabel:"Prev",buttonText:"Open Month Chooser",jumpYears:"Jump Years",backTo:"Back to",months:["Jan.","Feb.","Mar.","Apr.","May","June","July","Aug.","Sep.","Oct.","Nov.","Dec."]}};var O=' ").appendTo(l);n.append(' ')}this._buttons=a("button",l).jqueryUIButton(),i.on(N,function(a){return!1});var p=this,q="Month";a.each(["Min","Max"],function(a,b){p["_set"+b+q]=function(a){(p["_"+b+q]=j(p,a))===!1&&alert(F.replace(/%/,b).replace(/_/,a))},p._setOption(b+q,p.options[b+q])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass(u),b.change(L(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=K)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{G&&G.Close(b),G=this,a(c).on(N+this.uuid,L(this.Close,this)).on("keydown"+t+this.uuid,L(this._keyDown,this)),d.off("blur"+t).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:L(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._backToYear&&(this._applyJumpYearsHint(),this._backToYear=0),this._visible=!1,G=null,a(c).off("keydown"+t+this.uuid).off(N+this.uuid),this.Validate(),d.on("blur"+t,L(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return M.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return M.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyJumpYearsHint:function(){p(this._titleButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(t),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,{},a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(N,L(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=N+" focus"+t;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,L(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+t,L(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in s?s[b]:s._default},_position:H?function(b){var c=this.options.IsRTL?C:B,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(x,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._titleButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(y),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(N).on(N,L(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(N).on(N,L(this._addToYear,this,1)),this._buttons.off(t);var c=this,d=L(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(N,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(y),this._backToYear)this._setPickerYear(this._backToYear),this._applyJumpYearsHint(),this._showMonths(),this._backToYear=0;else{this._backToYear=this._getPickerYear(),this._showYears();var a=this._i18n("backTo")+" "+this._getPickerYear();this._titleButton.jqueryUIButton({label:a}).data(v)(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(N).on(N,L(this._addToYears,this,-g)),this._nextButton.attr("title",this._i18n("next12Years")).off(N).on(N,L(this._addToYears,this,g)),q(this._prevButton,m&&m>e-1),q(this._nextButton,n&&e+12-1>n),this._buttons.off(t),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=L(this._onYearClick,this),r=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(y,v===j&&r).on(N,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),q(this._prevButton,g&&b==f(g)),q(this._nextButton,j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(y,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
diff --git a/demo/Demo.min.js b/demo/Demo.min.js
index 1672735..b791048 100644
--- a/demo/Demo.min.js
+++ b/demo/Demo.min.js
@@ -1 +1 @@
-!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(l);n.append(' ')}this._buttons=a("button",l).jqueryUIButton(),i.on(N,function(a){return!1});var p=this,q="Month";a.each(["Min","Max"],function(a,b){p["_set"+b+q]=function(a){(p["_"+b+q]=j(p,a))===!1&&alert(F.replace(/%/,b).replace(/_/,a))},p._setOption(b+q,p.options[b+q])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass(u),b.change(L(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=K)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{G&&G.Close(b),G=this,a(c).on(N+this.uuid,L(this.Close,this)).on("keydown"+t+this.uuid,L(this._keyDown,this)),d.off("blur"+t).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:L(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._backToYear&&(this._applyJumpYearsHint(),this._backToYear=0),this._visible=!1,G=null,a(c).off("keydown"+t+this.uuid).off(N+this.uuid),this.Validate(),d.on("blur"+t,L(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return M.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return M.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyJumpYearsHint:function(){p(this._jumpYearsButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(t),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,{},a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(N,L(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=N+" focus"+t;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,L(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+t,L(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in s?s[b]:s._default},_position:H?function(b){var c=this.options.IsRTL?C:B,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(x,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._jumpYearsButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(y),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(N).on(N,L(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(N).on(N,L(this._addToYear,this,1)),this._buttons.off(t);var c=this,d=L(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(N,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(y),this._backToYear)this._setPickerYear(this._backToYear),this._applyJumpYearsHint(),this._showMonths(),this._backToYear=0;else{this._backToYear=this._getPickerYear(),this._showYears();var a=this._i18n("backTo")+" "+this._getPickerYear();this._jumpYearsButton.jqueryUIButton({label:a}).data(v)(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(N).on(N,L(this._addToYears,this,-g)),this._nextButton.attr("title",this._i18n("next12Years")).off(N).on(N,L(this._addToYears,this,g)),q(this._prevButton,m&&m>e-1),q(this._nextButton,n&&e+12-1>n),this._buttons.off(t),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=L(this._onYearClick,this),r=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(y,v===j&&r).on(N,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),q(this._prevButton,g&&b==f(g)),q(this._nextButton,j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(y,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
+!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof exports?require("jquery"):jQuery)}(function(a){var b,c=navigator.userAgent,d=/iphone/i.test(c),e=/chrome/i.test(c),f=/android/i.test(c);a.mask={definitions:{9:"[0-9]",a:"[A-Za-z]","*":"[A-Za-z0-9]"},autoclear:!0,dataName:"rawMaskFn",placeholder:"_"},a.fn.extend({caret:function(a,b){var c;return 0===this.length||this.is(":hidden")?void 0:"number"==typeof a?(b="number"==typeof b?b:a,this.each(function(){this.setSelectionRange?this.setSelectionRange(a,b):this.createTextRange&&(c=this.createTextRange(),c.collapse(!0),c.moveEnd("character",b),c.moveStart("character",a),c.select())})):(this[0].setSelectionRange?(a=this[0].selectionStart,b=this[0].selectionEnd):document.selection&&document.selection.createRange&&(c=document.selection.createRange(),a=0-c.duplicate().moveStart("character",-1e5),b=a+c.text.length),{begin:a,end:b})},unmask:function(){return this.trigger("unmask")},mask:function(c,g){var h,i,j,k,l,m,n,o;if(!c&&this.length>0){h=a(this[0]);var p=h.data(a.mask.dataName);return p?p():void 0}return g=a.extend({autoclear:a.mask.autoclear,placeholder:a.mask.placeholder,completed:null},g),i=a.mask.definitions,j=[],k=n=c.length,l=null,a.each(c.split(""),function(a,b){"?"==b?(n--,k=a):i[b]?(j.push(new RegExp(i[b])),null===l&&(l=j.length-1),k>a&&(m=j.length-1)):j.push(null)}),this.trigger("unmask").each(function(){function h(){if(g.completed){for(var a=l;m>=a;a++)if(j[a]&&C[a]===p(a))return;g.completed.call(B)}}function p(a){return g.placeholder.charAt(a ").appendTo(l);n.append(' ')}this._buttons=a("button",l).jqueryUIButton(),i.on(N,function(a){return!1});var p=this,q="Month";a.each(["Min","Max"],function(a,b){p["_set"+b+q]=function(a){(p["_"+b+q]=j(p,a))===!1&&alert(F.replace(/%/,b).replace(/_/,a))},p._setOption(b+q,p.options[b+q])});var s=e.SelectedMonth;if(void 0!==s){var t=j(this,s);b.val(this._formatMonth(new d(f(t),t%12,1)))}this._updateAlt(),this._setUseInputMask(),this._setDisabledState(),this.Destroy=this.destroy,k?this.Open():(b.addClass(u),b.change(L(this._updateAlt,this)))},GetSelectedDate:function(){return this._parseMonth()},GetSelectedYear:function(){var a=this.GetSelectedDate();return a?a.getFullYear():NaN},GetSelectedMonth:function(){var a=this.GetSelectedDate();return a?a.getMonth()+1:NaN},Validate:function(){var a=this.GetSelectedDate();return null===this.options.ValidationErrorMessage||this.options.Disabled||this._validationMessage.toggle(!a),a},GetSelectedMonthYear:function(){var a=this.Validate();return a?a.getMonth()+1+"/"+a.getFullYear():null},Disable:function(){this._setOption("Disabled",!0)},Enable:function(){this._setOption("Disabled",!1)},ClearAllCallbacks:function(){for(var a in this.options)0===a.indexOf("On")&&(this.options[a]=K)},Clear:function(){this.element.val(""),this._validationMessage.hide()},Toggle:function(a){return this._visible?this.Close(a):this.Open(a)},Open:function(b){var d=this.element,e=this.options;if(!e.Disabled&&!this._visible){if(b=b||a.Event(),k("OnBeforeMenuOpen",this)(b)===!1||b.isDefaultPrevented())return!1;this._visible=!0,this._ajustYear(e);var f=this._monthPickerMenu;if(this._showMonths(),o(d))f.css("position","static").show(),k("OnAfterMenuOpen",this)();else{G&&G.Close(b),G=this,a(c).on(N+this.uuid,L(this.Close,this)).on("keydown"+t+this.uuid,L(this._keyDown,this)),d.off("blur"+t).focus();var g=e.ShowAnim||e.Animation,h="none"===g;f[h?"fadeIn":g]({duration:h?0:this._duration(),start:L(this._position,this,f),complete:k("OnAfterMenuOpen",this)})}}return!1},Close:function(b){var d=this.element;if(!o(d)&&this._visible){var e=this._monthPickerMenu,f=this.options;if(b=b||a.Event(),k("OnBeforeMenuClose",this)(b)===!1||b.isDefaultPrevented())return;this._backToYear&&(this._applyJumpYearsHint(),this._backToYear=0),this._visible=!1,G=null,a(c).off("keydown"+t+this.uuid).off(N+this.uuid),this.Validate(),d.on("blur"+t,L(this.Validate,this));var g=k("OnAfterMenuClose",this),h=f.HideAnim||f.Animation;"none"===h?e.hide(0,g):e[h](this._duration(),g)}},MonthInputFormat:"yy-mm",ParseMonth:function(a,b){try{return M.parseDate("dd"+b,"01"+a)}catch(c){return null}},FormatMonth:function(a,b){try{return M.formatDate(b,a)||null}catch(c){return null}},_setSelectedMonth:function(a){var b=j(this,a),c=this.element;b?c.val(this._formatMonth(new d(f(b),b%12,1))):c.val(""),this._ajustYear(this.options),this._showMonths()},_applyJumpYearsHint:function(){p(this._titleButton,this._i18n("jumpYears"))},_i18n:function(b){return this.options.i18n[b]||a.MonthPicker.i18n[b]},_parseMonth:function(a,b){return this.ParseMonth(a||this.element.val(),b||this.options.MonthFormat)},_formatMonth:function(a,b){return this.FormatMonth(a||this._parseMonth(),b||this.options.MonthFormat)},_updateButton:function(){var a=this.options.Disabled;this._createButton();var b=this._monthPickerButton;try{b.jqueryUIButton("option","disabled",a)}catch(c){b.filter("button,input").prop("disabled",a)}this._updateFieldEvents()},_createButton:function(){var b=this.element,d=this.options;if(!o(b)){var e=this._monthPickerButton.off(t),f=d.ShowIcon?d.Button:!1;if(a.isFunction(f)){var g=a.extend(!0,{i18n:a.extend(!0,{},a.MonthPicker.i18n)},this.options);f=f.call(b[0],g)}var h=!1;this._monthPickerButton=(f instanceof a?f:a(f)).each(function(){a.contains(c.body,this)||(h=!0,a(this).insertAfter(b))}).on(N,L(this.Toggle,this)),this._removeOldBtn&&e.remove(),this._removeOldBtn=h}},_updateFieldEvents:function(){var a=N+" focus"+t;this.element.off(a),"both"!==this.options.ShowOn&&this._monthPickerButton.length||this.element.on(a,L(this.Open,this))},_createValidationMessage:function(){var b=this.options.ValidationErrorMessage,c=this.element;if(-1===a.inArray(b,[null,""])){var d=a(''+b+""),e=this._monthPickerButton;this._validationMessage=d.insertAfter(e.length?e:c),c.on("blur"+t,L(this.Validate,this))}else this._validationMessage.remove()},_setRTL:function(a){n(this._prevButton.css("float",a?"right":"left"),!a),n(this._nextButton.css("float",a?"left":"right"),a)},_keyDown:function(a){switch(a.keyCode){case 13:this.element.val()||this._chooseMonth((new d).getMonth()+1),this.Close(a);break;case 27:case 9:this.Close(a)}},_duration:function(){var b=this.options.Duration;return a.isNumeric(b)?b:b in s?s[b]:s._default},_position:H?function(b){var c=this.options.IsRTL?C:B,d=a.extend(c,this.options.Position);return b.position(a.extend({of:this.element},d))}:function(a){var b=this.element,c={top:b.offset().top+b.height()+7+"px"};return this.options.IsRTL?c.left=b.offset().left-a.width()+b.width()+7+"px":c.left=b.offset().left+"px",a.css(c)},_setUseInputMask:function(){if(!this._isMonthInputType)try{this.options.UseInputMask?this.element.mask(this._formatMonth(new d).replace(/\d/g,9)):this.element.unmask()}catch(a){}},_setDisabledState:function(){var a=this.options.Disabled,b=this.element;b[0].disabled=a,b.toggleClass(x,a),a&&this._validationMessage.hide(),this.Close(),this._updateButton(),k("OnAfterSetDisabled",this)(a)},_getPickerYear:function(){return this._pickerYear},_setPickerYear:function(a){this._pickerYear=a||(new d).getFullYear(),this._titleButton.jqueryUIButton({label:this._i18n("year")+" "+this._pickerYear})},_updateAlt:function(b,c){var d=a(this.options.AltField);d.length&&d.val(this._formatMonth(c,this.options.AltFormat))},_chooseMonth:function(b){var c=this._getPickerYear(),e=new d(c,b-1);this.element.val(this._formatMonth(e)).blur(),this._updateAlt(0,e),h(this._selectedBtn,!1),this._selectedBtn=h(a(this._buttons[b-1]),!0),k("OnAfterChooseMonth",this)(e)},_chooseYear:function(a){this._backToYear=0,this._setPickerYear(a),this._buttons.removeClass(y),this._showMonths(),k("OnAfterChooseYear",this)()},_showMonths:function(){var b=this._i18n("months");this._prevButton.attr("title",this._i18n("prevYear")).off(N).on(N,L(this._addToYear,this,-1)),this._nextButton.attr("title",this._i18n("nextYear")).off(N).on(N,L(this._addToYear,this,1)),this._buttons.off(t);var c=this,d=L(c._onMonthClick,c);a.each(b,function(b,e){a(c._buttons[b]).on(N,{month:b+1},d).jqueryUIButton("option","label",e)}),this._decorateButtons()},_showYearsClickHandler:function(){if(this._buttons.removeClass(y),this._backToYear)this._setPickerYear(this._backToYear),this._applyJumpYearsHint(),this._showMonths(),this._backToYear=0;else{this._backToYear=this._getPickerYear(),this._showYears();var a=this._i18n("backTo")+" "+this._getPickerYear();this._titleButton.jqueryUIButton({label:a}).data(v)(),k("OnAfterChooseYears",this)()}},_showYears:function(){var b=this._getPickerYear(),c=-4,e=b+c,g=12,j=(new d).getFullYear(),k=this._MinMonth,l=this._MaxMonth,m=k?f(k):0,n=l?f(l):0;this._prevButton.attr("title",this._i18n("prev12Years")).off(N).on(N,L(this._addToYears,this,-g)),this._nextButton.attr("title",this._i18n("next12Years")).off(N).on(N,L(this._addToYears,this,g)),q(this._prevButton,m&&m>e-1),q(this._nextButton,n&&e+12-1>n),this._buttons.off(t),h(this._selectedBtn,!1);for(var o=this.GetSelectedYear(),p=L(this._onYearClick,this),r=i(j,m,n),s=i(o,m,n),u=0;12>u;u++){var v=b+c,w=a(this._buttons[u]).jqueryUIButton({disabled:!i(v,m,n),label:v}).toggleClass(y,v===j&&r).on(N,{year:v},p);s&&o&&o===v&&(this._selectedBtn=h(w,!0)),c++}},_onMonthClick:function(a){this._chooseMonth(a.data.month),this.Close(a)},_onYearClick:function(a){this._chooseYear(a.data.year)},_addToYear:function(a){this._setPickerYear(this._getPickerYear()+a),this.element.focus(),this._decorateButtons(),k("OnAfter"+(a>0?"Next":"Previous")+"Year",this)()},_addToYears:function(a){this._pickerYear=this._getPickerYear()+a,this._showYears(),this.element.focus(),k("OnAfter"+(a>0?"Next":"Previous")+"Years",this)()},_ajustYear:function(a){var b=a.StartYear||this.GetSelectedYear()||(new d).getFullYear();null!==this._MinMonth&&(b=Math.max(f(this._MinMonth),b)),null!==this._MaxMonth&&(b=Math.min(f(this._MaxMonth),b)),this._setPickerYear(b)},_decorateButtons:function(){var b=this._getPickerYear(),c=e(new d),g=this._MinMonth,j=this._MaxMonth;h(this._selectedBtn,!1);var k=this.GetSelectedDate(),l=i(k?e(k):null,g,j);k&&k.getFullYear()===b&&(this._selectedBtn=h(a(this._buttons[k.getMonth()]),l)),q(this._prevButton,g&&b==f(g)),q(this._nextButton,j&&b==f(j));for(var m=0;12>m;m++){var n=12*b+m,o=i(n,g,j);a(this._buttons[m]).jqueryUIButton({disabled:!o}).toggleClass(y,o&&n==c)}}})}(jQuery,window,document,Date);
\ No newline at end of file
From cb168bba063ca8b1ce32eae90a4402864c08463d Mon Sep 17 00:00:00 2001
From: Benjamin Albert