Skip to content

Commit ea793f9

Browse files
committed
Merge pull request #57 from benjamin-albert/master
Fixes #53 by using the mousedown event to close the menu
2 parents 29f0250 + ee7bf07 commit ea793f9

File tree

5 files changed

+18
-19
lines changed

5 files changed

+18
-19
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: node_js
22
node_js:
3-
- "0.12.4"
3+
- "5.10.1"
44
before_install: npm install -g grunt-cli
55
install: npm install

demo/MonthPicker.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "jquery-ui-month-picker",
33
"description": "jQuery UI Month Picker Plugin",
4-
"version": "3.0.0",
4+
"version": "3.0.1",
55
"license": "GPL-3.0",
66
"repository": "https://github.com/KidSysco/jquery-ui-month-picker.git",
77
"scripts": {
@@ -10,6 +10,7 @@
1010
},
1111
"devDependencies": {
1212
"bower": "",
13+
"grunt": "^1.0.1",
1314
"grunt-contrib-cssmin": "^0.14.0",
1415
"grunt-contrib-qunit": "^0.6.0",
1516
"grunt-contrib-uglify": "~0.6.0",

src/MonthPicker.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
The jQuery UI Month Picker Version 3.0.0
2+
The jQuery UI Month Picker Version 3.0.1
33
https://github.com/KidSysco/jquery-ui-month-picker/
44
55
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
@@ -14,9 +14,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414
GNU General Public License for more details.
1515
1616
You should have received a copy of the GNU General Public License
17-
along with this program. If not, see
17+
along with this program. If not, see
1818
<http://www.gnu.org/licenses/gpl-3.0.txt>.
19-
2019
*/
2120

2221
.month-picker {

src/MonthPicker.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
The jQuery UI Month Picker Version 3.0.0
2+
The jQuery UI Month Picker Version 3.0.1
33
https://github.com/KidSysco/jquery-ui-month-picker/
44
55
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
@@ -14,9 +14,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1414
GNU General Public License for more details.
1515
1616
You should have received a copy of the GNU General Public License
17-
along with this program. If not, see
17+
along with this program. If not, see
1818
<http://www.gnu.org/licenses/gpl-3.0.txt>.
19-
2019
*/
2120

2221
(function ($, window, document, Date) {
@@ -167,7 +166,7 @@ along with this program. If not, see
167166
}
168167

169168
$.MonthPicker = {
170-
VERSION: '3.0.0', // Added in version 2.4;
169+
VERSION: '3.0.1', // Added in version 2.4;
171170
i18n: {
172171
year: 'Year',
173172
prevYear: 'Previous Year',
@@ -441,8 +440,8 @@ along with this program. If not, see
441440

442441
this._buttons = $('a', $table).jqueryUIButton();
443442

444-
_menu.on(click, function (event) {
445-
return false;
443+
_menu.on('mousedown' + _eventsNs, function (event) {
444+
event.preventDefault();
446445
});
447446

448447
// Checks and initailizes Min/MaxMonth properties
@@ -542,7 +541,7 @@ along with this program. If not, see
542541
// Allow the user to prevent opening the menu.
543542
event = event || $.Event();
544543
if (_event('OnBeforeMenuOpen', this)(event) === false || event.isDefaultPrevented()) {
545-
return false;
544+
return;
546545
}
547546

548547
this._visible = true;
@@ -561,8 +560,7 @@ along with this program. If not, see
561560
}
562561

563562
_openedInstance = this;
564-
565-
$(document).on(click + this.uuid, $proxy(this.Close, this))
563+
$(document).on('mousedown' + _eventsNs + this.uuid, $proxy(this.Close, this))
566564
.on('keydown' + _eventsNs + this.uuid, $proxy(this._keyDown, this));
567565

568566
// Trun off validation so that clicking one of the months
@@ -584,8 +582,6 @@ along with this program. If not, see
584582
});
585583
}
586584
}
587-
588-
return false;
589585
},
590586

591587
Close: function (event) {
@@ -609,7 +605,7 @@ along with this program. If not, see
609605
this._visible = false;
610606
_openedInstance = null;
611607
$(document).off('keydown' + _eventsNs + this.uuid)
612-
.off(click + this.uuid);
608+
.off('mousedown' + _eventsNs + this.uuid);
613609

614610
this.Validate();
615611
_elem.on('blur' + _eventsNs, $proxy(this.Validate, this));
@@ -718,7 +714,10 @@ along with this program. If not, see
718714
$(this).insertAfter(_elem);
719715
}
720716
})
721-
.on(click, $proxy(this.Toggle, this));
717+
.on(click, $proxy(this.Toggle, this))
718+
.on('mousedown' + _eventsNs, function(r) {
719+
r.preventDefault();
720+
});
722721

723722
if (this._removeOldBtn) {
724723
_oldButton.remove();

0 commit comments

Comments
 (0)