summaryrefslogtreecommitdiffstats
path: root/ui/ui.datepicker.js
diff options
context:
space:
mode:
authorMarc Grabanski <m@marcgrabanski.com>2008-09-29 19:20:25 +0000
committerMarc Grabanski <m@marcgrabanski.com>2008-09-29 19:20:25 +0000
commit502916f65f649a17b21536ed312abe76cb645048 (patch)
tree647d59bb80febb6ed7efc5954b939160eb48f400 /ui/ui.datepicker.js
parentc9a8ee531c2c46b686506cacac92d4873013a831 (diff)
downloadjquery-ui-502916f65f649a17b21536ed312abe76cb645048.tar.gz
jquery-ui-502916f65f649a17b21536ed312abe76cb645048.zip
Datepicker: Updated Mac keyboard commands
Diffstat (limited to 'ui/ui.datepicker.js')
-rw-r--r--ui/ui.datepicker.js39
1 files changed, 25 insertions, 14 deletions
diff --git a/ui/ui.datepicker.js b/ui/ui.datepicker.js
index 1d3a168c3..d547e4fcb 100644
--- a/ui/ui.datepicker.js
+++ b/ui/ui.datepicker.js
@@ -474,8 +474,9 @@ $.extend(Datepicker.prototype, {
switch (e.keyCode) {
case 9: $.datepicker._hideDatepicker(null, '');
break; // hide on tab out
- case 13: $.datepicker._selectDay(e.target, inst.selectedMonth, inst.selectedYear,
- $('td.ui-datepicker-days-cell-over', inst.dpDiv)[0]);
+ case 13: if ($('td.ui-datepicker-days-cell-over', inst.dpDiv)[0])
+ $.datepicker._selectDay(e.target, inst.selectedMonth, inst.selectedYear,
+ $('td.ui-datepicker-days-cell-over', inst.dpDiv)[0]);
return false; // don't submit the form
break; // select the value on enter
case 27: $.datepicker._hideDatepicker(null, $.datepicker._get(inst, 'duration'));
@@ -488,24 +489,34 @@ $.extend(Datepicker.prototype, {
+$.datepicker._get(inst, 'stepBigMonths') :
+$.datepicker._get(inst, 'stepMonths')), 'M');
break; // next month/year on page down/+ ctrl
- case 35: if (e.ctrlKey) $.datepicker._clearDate(e.target);
+ case 35: if (e.ctrlKey || e.metaKey) $.datepicker._clearDate(e.target);
handled = e.ctrlKey;
- break; // clear on ctrl+end
- case 36: if (e.ctrlKey) $.datepicker._gotoToday(e.target);
+ break; // clear on ctrl or command +end
+ case 36: if (e.ctrlKey || e.metaKey) $.datepicker._gotoToday(e.target);
handled = e.ctrlKey;
- break; // current on ctrl+home
- case 37: if (e.ctrlKey) $.datepicker._adjustDate(e.target, -1, 'D');
+ break; // current on ctrl or command +home
+ case 37: if (e.ctrlKey || e.metaKey) $.datepicker._adjustDate(e.target, -1, 'D');
handled = e.ctrlKey;
- break; // -1 day on ctrl+left
- case 38: if (e.ctrlKey) $.datepicker._adjustDate(e.target, -7, 'D');
+ // -1 day on ctrl or command +left
+ if (e.originalEvent.altKey) $.datepicker._adjustDate(e.target, (e.ctrlKey ?
+ -$.datepicker._get(inst, 'stepBigMonths') :
+ -$.datepicker._get(inst, 'stepMonths')), 'M');
+ // next month/year on alt +left on Mac
+ break;
+ case 38: if (e.ctrlKey || e.metaKey) $.datepicker._adjustDate(e.target, -7, 'D');
handled = e.ctrlKey;
- break; // -1 week on ctrl+up
- case 39: if (e.ctrlKey) $.datepicker._adjustDate(e.target, +1, 'D');
+ break; // -1 week on ctrl or command +up
+ case 39: if (e.ctrlKey || e.metaKey) $.datepicker._adjustDate(e.target, +1, 'D');
handled = e.ctrlKey;
- break; // +1 day on ctrl+right
- case 40: if (e.ctrlKey) $.datepicker._adjustDate(e.target, +7, 'D');
+ // +1 day on ctrl or command +right
+ if (e.originalEvent.altKey) $.datepicker._adjustDate(e.target, (e.ctrlKey ?
+ +$.datepicker._get(inst, 'stepBigMonths') :
+ +$.datepicker._get(inst, 'stepMonths')), 'M');
+ // next month/year on alt +right
+ break;
+ case 40: if (e.ctrlKey || e.metaKey) $.datepicker._adjustDate(e.target, +7, 'D');
handled = e.ctrlKey;
- break; // +1 week on ctrl+down
+ break; // +1 week on ctrl or command +down
default: handled = false;
}
else if (e.keyCode == 36 && e.ctrlKey) // display the date picker on ctrl+home