diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..9b7c47f --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +language: node_js +node_js: + - "0.12.4" +before_install: npm install -g grunt-cli +install: npm install +before_script: grunt diff --git a/MonthPicker.js b/MonthPicker.js index 7e4bea1..d7756fc 100644 --- a/MonthPicker.js +++ b/MonthPicker.js @@ -1,7 +1,7 @@ /* https://github.com/KidSysco/jquery-ui-month-picker/ -Version 2.8.3 +Version 3.0-beta1 This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -17,6 +17,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt. (function ($, window, document, Date) { 'use strict'; + var _setupErr = 'MonthPicker Error: '; // This test must be run before any rererence is made to jQuery. // In case the user didn't load jQuery or jQuery UI the plugin // will fail before it get's to this test + there is no reason @@ -32,12 +33,15 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt. var _speeds = $.fx.speeds; var _eventsNs = '.MonthPicker'; + var _textfieldClass = 'month-year-input'; + var _clearHint = 'month-picker-clear-hint'; + var _iconClass = '.ui-button-icon-primary'; var _disabledClass = 'month-picker-disabled'; var _todayClass = 'ui-state-highlight'; var _selectedClass = 'ui-state-active'; + var _defaultClass = 'ui-state-default'; var _defaultPos = { my: 'left top+1', at: 'left bottom' }; var _RTL_defaultPos = { my: 'right top+1', at: 'right bottom' }; - var _setupErr = 'MonthPicker Error: '; var _posErr = _setupErr + 'The jQuery UI position plug-in must be loaded.'; var _badOptValErr = _setupErr + 'Unsupported % option value, supported values are: '; var _badMinMaxVal = _setupErr + '"_" is not a valid %Month value.'; @@ -105,8 +109,8 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt. return _parsePeriod(_val); } - function _event(_event, _inst) { - return $proxy(_inst.options[_event] || $noop, _inst.element[0]); + function _event(_name, _inst) { + return $proxy(_inst.options[_name] || $noop, _inst.element[0]); } function _parsePeriod(_val, _initDate) { @@ -158,40 +162,101 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt. } $.MonthPicker = { - VERSION: '2.8.3', // Added in version 2.4; + VERSION: '3.0-beta1', // Added in version 2.4; 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", + 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 _markup = - '
| ' + - ' | ' +
- ' ' +
- '' +
- '' +
- ' ' +
- ' | ' +
- '' + + ' | ' + + ' | ' + + ' | ' + ' |
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.
-See a demo on jsFiddle at... -http://jsfiddle.net/kidsysco/JeZap/ ++Please read the 3.x Upgrade Guide +
+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...
<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" />
+<link href="css/MonthPicker.min.css" media="all" rel="stylesheet" type="text/css" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.10.2/jquery-ui.js" type="text/javascript"></script>
diff --git a/UPGRADE.md b/UPGRADE.md
new file mode 100644
index 0000000..04959a4
--- /dev/null
+++ b/UPGRADE.md
@@ -0,0 +1,67 @@
+# 3.x Upgrade Guide
+
+Version 3.x features a redesigned Month Picker menu which:
+
+1. Looks more consistent with [jQuery UI Datepicker](https://jqueryui.com/datepicker/).
+2. Turns the Year title into a button which gives the user a "hint" about
+the Jump Years menu when they mouse over it.
+3. Allows the user to return to the year they clicked Jump years at.
+
+See it for yourself at the [demo on JSFiddle](http://jsfiddle.net/kidsysco/JeZap/).
+
+## i18n property name changes
+If you changed out the buttons, labels or other text using the
+i18n support you should rename and translate `next5Years` to `next12Years`
+and `prev5Years` to `prev12Years`.
+
+You should also add the `backTo` property, which is used for the
+new *Back to 2016* button when the user enters the Jump Year menu.
+
+## CSS changes
+Version 3.x uses `em` instead of `px` units.
+This means that the menu determines it's size according to the
+`body` element's `font-size`, instead of having a fixed width of `200px`.
+
+If you need to resize the menu, add this rule to your CSS:
+```
+/* Makes the Month Picker menu 20% bigger. */
+.month-picker {
+ font-size: 1.2em;
+}
+```
+
+Version 3.x removes:
+```
+.month-year-input {
+ width: 60px;
+}
+```
+
+If you still want the plugin to implicitly resize the input fields it's applied to you must add this rule to your own CSS.
+
+If you explicitly defined a rule that reverts the effects of this rule, it's no longer necessary and it can be deleted.
+
+## Markup changes
+If you've applied custom CSS to the Month Picker menu, please note that:
+
+The following elements were removed:
+```
+
+
+
+
+
+```
+They were replaces by ` `.
+The `` tag is a [jQyery UI Button](https://jqueryui.com/button/).
+
+The following elements:
+```
+
+
+```
+were replaced by:
+```
+
+
+```
diff --git a/bower.json b/bower.json
index e947905..334bd90 100644
--- a/bower.json
+++ b/bower.json
@@ -1,13 +1,16 @@
{
"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 ",
"Benjamin Albert "
],
"description": "jQuery UI Month Picker plugin",
- "main": "MonthPicker.js",
+ "main": [
+ "MonthPicker.js",
+ "css/MonthPicker.css"
+ ],
"license": "MIT",
"ignore": [
"**/.*",
diff --git a/css/MonthPicker.css b/css/MonthPicker.css
index b60e4cd..04c4828 100644
--- a/css/MonthPicker.css
+++ b/css/MonthPicker.css
@@ -1,6 +1,5 @@
/*
-
-The jQuery UI Month Picker Version 2.8.3
+The jQuery UI Month Picker Version 3.0-beta1
https://github.com/KidSysco/jquery-ui-month-picker/
@@ -17,8 +16,7 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
*/
.month-picker {
- width: 200px;
- display: none;
+ display: inline-block;
position: absolute;
z-index: 9999;
}
@@ -28,67 +26,120 @@ http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
border-spacing: 2px 2px;
}
-.month-year-input {
- width: 60px;
-}
-.month-picker .year-container-all {
- cursor: pointer;
+.month-picker td {
+ padding: 0px;
}
-.month-picker-year-table .year-container-all {
- text-align: center;
+
+/*
+Prevents the button labels from maving sligtly to the left
+when applying the width CSS property to the buttons.
+See: .month-picker-month-table button { width: 4.3em; }
+*/
+.month-picker .ui-button-text {
+ padding: .4em 0;
}
-.month-picker-year-table .year-container {
- margin: 0 auto;
+
+.month-picker-header {
+ margin: 3px 3px 0px 3px;
}
-.month-picker-year-table .year-title {
- margin: 3px;
- font-size: 12px;
- font-family: Verdana, Arial, sans-serif;
+
+.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 .year {
- margin: 3px;
- font-size: 12px;
- font-family: Verdana, Arial, sans-serif;
+
+/*
+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
+make the year title a button that blends into the heading in the default state.
+
+The plugin does this by removing the .ui-state-default class from (in MonthPicker.js)
+the a tags (buttons) which also ends up removing the 1px border that it applies.
+
+To prevent the button from resizing and moving everything around when you hover
+in and out, we use a carefully constructed selector, which gets overroden by the
+more specific .ui-state-hover/actove class selectors in the jquery-ui.css
+that apply the visible borders that we want.
+
+This selector applies a 1px transparent border that keeps the button
+in the same size, but it doesen't hide the borders that .ui-state-hover/actove give us.
+*/
+.month-picker-year-table a {
+ border: 1px solid transparent;
}
-.month-picker-year-table .year-container {
- width: 50px;
+
+/*
+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 .ui-button {
+ font-size: 1.1em;
+ width: 1.5em;
+ height: 1.5em;
+ cursor: default;
+ margin: 0;
}
-.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.
- */
- 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;
+
+.month-picker-year-table .month-picker-title {
text-align: center;
- cursor: pointer;
}
-.month-picker-year-table .year-container {
- text-align: center;
+
+.month-picker-year-table .month-picker-title .ui-button {
+ font-size: 1em;
+ padding: .1em 0;
+ width: 100%;
+ font-weight: bold;
}
+
+/*
+The buttons in the heading (year-table) are slightly shrinked, but because jQuery ui and
+the .month-picker .ui-button-text rule at the top of this CSS file apply some
+padding which results in the button text being moved to the bottom of
+the button.
+
+This rule removes the unnecessary padding so the text in
+the jump years button will be vericaly centred.
+*/
+.month-picker-year-table .ui-button-text {
+ padding: 0;
+}
+
.month-picker-month-table td {
height: 35px;
text-align: center;
- font-size: 12px;
}
+
+/*
+Makes sure the buttons stay in the same size when swithching
+to the Jump years menu.
+this also ensures that the entire menu dosen't resize itself
+in response to the slightly bigger buttons in the Jump years menu.
+ */
+.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: Yellow;
}
+
.month-picker-disabled {
background-color: #e1e1e1;
}
diff --git a/css/MonthPicker.min.css b/css/MonthPicker.min.css
new file mode 100644
index 0000000..f12a581
--- /dev/null
+++ b/css/MonthPicker.min.css
@@ -0,0 +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 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 824c0a8..6b673c5 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-picker table{border-collapse:separate;border-spacing:2px 2px}.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{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 e51ec65..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=0&&!j[a];);return a}function s(a,b){var c,d;if(!(0>a)){for(c=a,d=q(b);n>c;c++)if(j[c]){if(!(n>d&&j[c].test(C[d])))break;C[c]=C[d],C[d]=p(d),d=q(d)}z(),B.caret(Math.max(l,a))}}function t(a){var b,c,d,e;for(b=a,c=p(a);n>b;b++)if(j[b]){if(d=q(b),e=C[b],C[b]=c,!(n>d&&j[d].test(e)))break;c=e}}function u(){var a=B.val(),b=B.caret();if(o&&o.length&&o.length>a.length){for(A(!0);b.begin>0&&!j[b.begin-1];)b.begin--;if(0===b.begin)for(;b.beging)&&g&&13!==g){if(i.end-i.begin!==0&&(y(i.begin,i.end),s(i.begin,i.end-1)),c=q(i.begin-1),n>c&&(d=String.fromCharCode(g),j[c].test(d))){if(t(c),C[c]=d,z(),e=q(c),f){var k=function(){a.proxy(a.fn.caret,B,e)()};setTimeout(k,0)}else B.caret(e);i.begin<=m&&h()}b.preventDefault()}}}function y(a,b){var c;for(c=a;b>c&&n>c;c++)j[c]&&(C[c]=p(c))}function z(){B.val(C.join(""))}function A(a){var b,c,d,e=B.val(),f=-1;for(b=0,d=0;n>b;b++)if(j[b]){for(C[b]=p(b);d++e.length){y(b+1,n);break}}else C[b]===e.charAt(d)&&d++,k>b&&(f=b);return a?z():k>f+1?g.autoclear||C.join("")===D?(B.val()&&B.val(""),y(0,n)):z():(z(),B.val(B.val().substring(0,f+1))),k?b:l}var B=a(this),C=a.map(c.split(""),function(a,b){return"?"!=a?i[a]?p(b):a:void 0}),D=C.join(""),E=B.val();B.data(a.mask.dataName,function(){return a.map(C,function(a,b){return j[b]&&a!=p(b)?a:null}).join("")}),B.one("unmask",function(){B.off(".mask").removeData(a.mask.dataName)}).on("focus.mask",function(){if(!B.prop("readonly")){clearTimeout(b);var a;E=B.val(),a=A(),b=setTimeout(function(){B.get(0)===document.activeElement&&(z(),a==c.replace("?","").length?B.caret(0,a):B.caret(a))},10)}}).on("blur.mask",v).on("keydown.mask",w).on("keypress.mask",x).on("input.mask paste.mask",function(){B.prop("readonly")||setTimeout(function(){var a=A(!0);B.caret(a),h()},0)}),e&&f&&B.off("input.mask").on("input.mask",u),A()})}})}),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:"2.8.2",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='
';a.widget("KidSysco.MonthPicker",{options:{i18n:{},IsRTL:!1,Position:null,StartYear:null,ShowIcon:!0,UseInputMask:!1,ValidationErrorMessage:null,Disabled:!1,MonthFormat:"mm/yy",Animation:"fadeToggle",ShowAnim:null,HideAnim:null,ShowOn:null,MinMonth:null,MaxMonth:null,Duration:"normal",Button:m,ButtonIcon:"ui-icon-calculator"},_monthPickerButton:a(),_validationMessage:a(),_selectedBtn:a(),_destroy:function(){var b=this.element;jQuery.mask&&this.options.UseInputMask&&(b.unmask(),this.GetSelectedDate()||b.val("")),b.removeClass("month-year-input").off(q),a(c).off(q+this.uuid),this._monthPickerMenu.remove();var d=this._monthPickerButton.off(H);this._removeOldBtn&&d.remove(),this._validationMessage.remove()},_setOption:function(b,c){switch(b){case"i18n":c=a.extend({},c);break;case"Position":if(!B)return void alert(x);case"MonthFormat":var d=this.GetSelectedDate();d&&this.element.val(this.FormatMonth(d,c))}return b in C&&-1===C[b].indexOf(c)?void alert(y.replace(/%/,b)+C[b]):(this._super(b,c),void(D[b]?this[D[b]](c):0))},_create:function(){var b=this.element,e=this.options;if(!b.is("input,div,span")||-1===a.inArray(b.attr("type"),["text","month",void 0])){var g=w+"MonthPicker can only be called on text or month inputs.";return alert(g+" \n\nSee (developer tools) for more details."),console.error(g+"\n Caused by:"),console.log(b[0]),!1}if(!a.mask&&e.UseInputMask)return alert(w+"The UseInputMask option requires the Input Mask Plugin. Get it from digitalbush.com"),!1;if(null!==e.Position&&!B)return alert(x),!1;for(var h in C)if(null!==e[h]&&-1===a.inArray(e[h],C[h]))return alert(y.replace(/%/,h)+C[h]),!1;this._isMonthInputType="month"===b.attr("type"),this._isMonthInputType&&(this.options.MonthFormat=this.MonthInputFormat,b.css("width","auto")),b.addClass("month-year-input");var i=this._monthPickerMenu=a(''),k=o(b);a(I).appendTo(i),i.appendTo(k?b:c.body),a(".year-title",i).text(this._i18n("year")),this._yearContainerAll=a(".year-container-all",i).attr("title",this._i18n("jumpYears")).click(F(this._showYearsClickHandler,this)),this._createValidationMessage(),this._yearContainer=a(".year",i),this._prevButton=a(".previous-year button",i).jqueryUIButton({text:!1}),this._nextButton=a(".next-year button",i).jqueryUIButton({text:!1}),this._setRTL(e.IsRTL);var l=".ui-button-icon-primary";a(l,this._nextButton).text(this._i18n("nextLabel")),a(l,this._prevButton).text(this._i18n("prevLabel"));for(var m=a(".month-picker-month-table",i),n=0;12>n;n++){var p=n%3?p:a(" ").appendTo(m);p.append(' ')}this._buttons=a("button",m).jqueryUIButton(),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.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 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).jqueryUIButton("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)).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._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]).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){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.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=0&&!j[a];);return a}function s(a,b){var c,d;if(!(0>a)){for(c=a,d=q(b);n>c;c++)if(j[c]){if(!(n>d&&j[c].test(C[d])))break;C[c]=C[d],C[d]=p(d),d=q(d)}z(),B.caret(Math.max(l,a))}}function t(a){var b,c,d,e;for(b=a,c=p(a);n>b;b++)if(j[b]){if(d=q(b),e=C[b],C[b]=c,!(n>d&&j[d].test(e)))break;c=e}}function u(){var a=B.val(),b=B.caret();if(o&&o.length&&o.length>a.length){for(A(!0);b.begin>0&&!j[b.begin-1];)b.begin--;if(0===b.begin)for(;b.beging)&&g&&13!==g){if(i.end-i.begin!==0&&(y(i.begin,i.end),s(i.begin,i.end-1)),c=q(i.begin-1),n>c&&(d=String.fromCharCode(g),j[c].test(d))){if(t(c),C[c]=d,z(),e=q(c),f){var k=function(){a.proxy(a.fn.caret,B,e)()};setTimeout(k,0)}else B.caret(e);i.begin<=m&&h()}b.preventDefault()}}}function y(a,b){var c;for(c=a;b>c&&n>c;c++)j[c]&&(C[c]=p(c))}function z(){B.val(C.join(""))}function A(a){var b,c,d,e=B.val(),f=-1;for(b=0,d=0;n>b;b++)if(j[b]){for(C[b]=p(b);d++e.length){y(b+1,n);break}}else C[b]===e.charAt(d)&&d++,k>b&&(f=b);return a?z():k>f+1?g.autoclear||C.join("")===D?(B.val()&&B.val(""),y(0,n)):z():(z(),B.val(B.val().substring(0,f+1))),k?b:l}var B=a(this),C=a.map(c.split(""),function(a,b){return"?"!=a?i[a]?p(b):a:void 0}),D=C.join(""),E=B.val();B.data(a.mask.dataName,function(){return a.map(C,function(a,b){return j[b]&&a!=p(b)?a:null}).join("")}),B.one("unmask",function(){B.off(".mask").removeData(a.mask.dataName)}).on("focus.mask",function(){if(!B.prop("readonly")){clearTimeout(b);var a;E=B.val(),a=A(),b=setTimeout(function(){B.get(0)===document.activeElement&&(z(),a==c.replace("?","").length?B.caret(0,a):B.caret(a))},10)}}).on("blur.mask",v).on("keydown.mask",w).on("keypress.mask",x).on("input.mask paste.mask",function(){B.prop("readonly")||setTimeout(function(){var a=A(!0);B.caret(a),h()},0)}),e&&f&&B.off("input.mask").on("input.mask",u),A()})}})}),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='
';a.widget("KidSysco.MonthPicker",{options:{i18n:{},IsRTL:!1,Position:null,StartYear:null,ShowIcon:!0,UseInputMask:!1,ValidationErrorMessage:null,Disabled:!1,MonthFormat:"mm/yy",Animation:"fadeToggle",ShowAnim:null,HideAnim:null,ShowOn:null,MinMonth:null,MaxMonth:null,Duration:"normal",Button:m,ButtonIcon:"ui-icon-calculator"},_monthPickerButton:a(),_validationMessage:a(),_selectedBtn:a(),_destroy:function(){var b=this.element;a.mask&&this.options.UseInputMask&&(b.unmask(),this.GetSelectedDate()||b.val("")),b.removeClass(u).off(t),a(c).off(t+this.uuid),this._monthPickerMenu.remove();var d=this._monthPickerButton.off(N);this._removeOldBtn&&d.remove(),this._validationMessage.remove(),G===this&&(G=null)},_setOption:function(b,c){switch(b){case"i18n":c=a.extend({},c);break;case"Position":if(!H)return void alert(D);break;case"MonthFormat":var d=this.GetSelectedDate();d&&this.element.val(this.FormatMonth(d,c))}return b in I&&-1===a.inArray(c,I[b])?void alert(E.replace(/%/,b)+I[b]):(this._super(b,c),void(J[b]?this[J[b]](c):0))},_create:function(){var b=this.element,e=this.options;if(!b.is("input,div,span")||-1===a.inArray(b.attr("type"),["text","month",void 0])){var g=r+"MonthPicker can only be called on text or month inputs.";return alert(g+" \n\nSee (developer tools) for more details."),console.error(g+"\n Caused by:"),console.log(b[0]),!1}if(!a.mask&&e.UseInputMask)return alert(r+"The UseInputMask option requires the Input Mask Plugin. Get it from digitalbush.com"),!1;if(null!==e.Position&&!H)return alert(D),!1;for(var h in I)if(null!==e[h]&&-1===a.inArray(e[h],I[h]))return alert(E.replace(/%/,h)+I[h]),!1;this._isMonthInputType="month"===b.attr("type"),this._isMonthInputType&&(this.options.MonthFormat=this.MonthInputFormat,b.css("width","auto"));var i=this._monthPickerMenu=a('').hide(),k=o(b);a(O).appendTo(i),i.appendTo(k?b:c.body),this._titleButton=a(".month-picker-title",i).click(L(this._showYearsClickHandler,this)).find("a").jqueryUIButton().removeClass(A),this._applyJumpYearsHint(),this._createValidationMessage(),this._prevButton=a(".month-picker-previous>a",i).jqueryUIButton({text:!1}).removeClass(A),this._nextButton=a(".month-picker-next>a",i).jqueryUIButton({text:!1}).removeClass(A),this._setRTL(e.IsRTL),a(w,this._nextButton).text(this._i18n("nextLabel")),a(w,this._prevButton).text(this._i18n("prevLabel"));for(var l=a(".month-picker-month-table",i),m=0;12>m;m++){var n=m%3?n: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
diff --git a/gruntfile.js b/gruntfile.js
index f2ab400..775f3f3 100644
--- a/gruntfile.js
+++ b/gruntfile.js
@@ -7,25 +7,26 @@ module.exports = function (grunt) {
qunit: {
all: ['test/test.html']
},
-
+
uglify: {
production: {
files: {
'MonthPicker.min.js': 'MonthPicker.js'
}
},
-
+
demo: {
files: {
'demo/Demo.min.js': ['test/jquery.maskedinput.min.js', 'MonthPicker.js']
}
}
},
-
+
cssmin: {
demo: {
files: {
- 'demo/Demo.min.css': ['css/MonthPicker.css', 'test/test.css']
+ 'demo/Demo.min.css': ['css/MonthPicker.css', 'test/test.css'],
+ 'css/MonthPicker.min.css': ['css/MonthPicker.css']
}
}
}
@@ -37,4 +38,4 @@ module.exports = function (grunt) {
grunt.registerTask('default', ['qunit', 'uglify', 'cssmin']);
grunt.registerTask('test', ['qunit']);
-};
\ No newline at end of file
+};
diff --git a/package.json b/package.json
index 08f8010..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"
@@ -10,7 +10,7 @@
"devDependencies": {
"grunt-contrib-uglify": "~0.6.0",
"grunt-contrib-cssmin": "^0.14.0",
- "grunt-contrib-qunit": "^0.7.0",
+ "grunt-contrib-qunit": "^0.6.0",
"bower" : ""
}
}
diff --git a/test/test.css b/test/test.css
index 62121e2..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 {
@@ -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 ebcdb24..d76c54a 100644
--- a/test/test.html
+++ b/test/test.html
@@ -3,7 +3,11 @@
jQuery UI Month Picker tests
+
+
+
+
@@ -13,6 +17,7 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Theme:
+
+
+
+
+ Example:
+
+
+