Skip to content

Commit

Permalink
Replacement of deprecated functions of jQuery
Browse files Browse the repository at this point in the history
  • Loading branch information
eureka2 committed Sep 21, 2020
1 parent afbf000 commit ef604da
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 47 deletions.
90 changes: 45 additions & 45 deletions js/datepicker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Accessible Datepicker v2.1.19
* Accessible Datepicker v2.1.20
* Copyright 2015-2019 Eureka2, Jacques Archimède.
* Based on the example of the Open AJAX Alliance Accessibility Tools Task Force : http://www.oaa-accessibility.org/examplep/datepicker1/
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
Expand Down Expand Up @@ -330,7 +330,7 @@
if (typeof this.options.inputFormat === 'string') {
this.options.inputFormat = [this.options.inputFormat];
}
if (! $.isArray(this.options.datesDisabled)) {
if (! Array.isArray(this.options.datesDisabled)) {
this.options.datesDisabled = [this.options.datesDisabled];
}
$.each(this.options.datesDisabled, function(i, v) {
Expand Down Expand Up @@ -454,7 +454,7 @@
};

this.bindHandlers();
this.$button.click(function(e) {
this.$button.on('click', function(e) {
if (!$(this).hasClass('disabled')) {
if (self.$calendar.attr('aria-hidden') === 'true') {
self.initializeDate();
Expand All @@ -467,7 +467,7 @@
e.stopPropagation();
return false;
});
this.$button.keydown(function(e) {
this.$button.on('keydown', function(e) {
var ev = e || event;
if(ev.keyCode == self.keys.enter || ev.keyCode == self.keys.space) {
$(this).trigger('click');
Expand All @@ -482,7 +482,7 @@
});
}

Datepicker.VERSION = '2.1.19'
Datepicker.VERSION = '2.1.20'

Datepicker.DEFAULTS = {
firstDayOfWeek: Date.dp_locales.firstday_of_week, // Determines the first column of the calendar grid
Expand Down Expand Up @@ -1184,64 +1184,64 @@
var self = this;

// bind button handlers
this.$fastprev.click(function(e) {
this.$fastprev.on('click', function(e) {
return self.handleFastPrevClick(e);
});
this.$prev.click(function(e) {
this.$prev.on('click', function(e) {
return self.handlePrevClick(e);
});
this.$next.click(function(e) {
this.$next.on('click', function(e) {
return self.handleNextClick(e);
});
this.$fastnext.click(function(e) {
this.$fastnext.on('click', function(e) {
return self.handleFastNextClick(e);
});
this.$monthObj.click(function(e) {
this.$monthObj.on('click', function(e) {
return self.handleMonthClick(e);
});
this.$monthObj.keydown(function(e) {
this.$monthObj.on('keydown', function(e) {
return self.handleMonthKeyDown(e);
});
this.$fastprev.keydown(function(e) {
this.$fastprev.on('keydown', function(e) {
return self.handleFastPrevKeyDown(e);
});
this.$prev.keydown(function(e) {
this.$prev.on('keydown', function(e) {
return self.handlePrevKeyDown(e);
});
this.$next.keydown(function(e) {
this.$next.on('keydown', function(e) {
return self.handleNextKeyDown(e);
});
this.$fastnext.keydown(function(e) {
this.$fastnext.on('keydown', function(e) {
return self.handleFastNextKeyDown(e);
});
if (this.options.modal == true) {
this.$close.click(function(e) {
this.$close.on('click', function(e) {
return self.handleCloseClick(e);
});
this.$close.keydown(function(e) {
this.$close.on('keydown', function(e) {
return self.handleCloseKeyDown(e);
});
}

// bind grid handlers
this.$grid.keydown(function(e) {
this.$grid.on('keydown', function(e) {
return self.handleGridKeyDown(e);
});
this.$grid.keypress(function(e) {
this.$grid.on('keypress', function(e) {
return self.handleGridKeyPress(e);
});
this.$grid.focus(function(e) {
this.$grid.on('focus', function(e) {
return self.handleGridFocus(e);
});
this.$grid.blur(function(e) {
this.$grid.on('blur', function(e) {
return self.handleGridBlur(e);
});
this.$grid.delegate('td', 'click', function(e) {
this.$grid.on('click', 'td', function(e) {
return self.handleGridClick(this, e);
});

// bind target handlers
this.$target.change(function(e) {
this.$target.on('change', function(e) {
var date = self.parseDate($(this).val());
self.updateLinked(date);
});
Expand Down Expand Up @@ -1436,9 +1436,9 @@
return true;
}
if (e.shiftKey) {
this.$close.focus();
this.$close.trigger('focus');
} else {
this.$prev.focus();
this.$prev.trigger('focus');
}
e.stopPropagation();
return false;
Expand Down Expand Up @@ -1484,12 +1484,12 @@
}
if (e.shiftKey) {
if (this.gridType == 0) {
this.$fastprev.focus();
this.$fastprev.trigger('focus');
} else {
this.$close.focus();
this.$close.trigger('focus');
}
} else {
this.$monthObj.focus();
this.$monthObj.trigger('focus');
}
e.stopPropagation();
return false;
Expand Down Expand Up @@ -1548,9 +1548,9 @@
return true;
}
if (e.shiftKey) {
this.$prev.focus();
this.$prev.trigger('focus');
} else {
this.$next.focus();
this.$next.trigger('focus');
}
e.stopPropagation();
return false;
Expand Down Expand Up @@ -1595,9 +1595,9 @@
this.$monthObj.focus();
} else {
if (this.gridType == 0) {
this.$fastnext.focus();
this.$fastnext.trigger('focus');
} else {
this.$grid.focus();
this.$grid.trigger('focus');
}
}
e.stopPropagation();
Expand Down Expand Up @@ -1653,9 +1653,9 @@
return true;
}
if (e.shiftKey) {
this.$next.focus();
this.$next.trigger('focus');
} else {
this.$grid.focus();
this.$grid.trigger('focus');
}
e.stopPropagation();
return false;
Expand Down Expand Up @@ -1699,9 +1699,9 @@
this.$grid.focus();
} else {
if (this.gridType == 0) {
this.$fastprev.focus();
this.$fastprev.trigger('focus');
} else {
this.$prev.focus();
this.$prev.trigger('focus');
}
}
e.stopPropagation();
Expand Down Expand Up @@ -1744,12 +1744,12 @@
if (this.options.modal == true) {
if (e.shiftKey) {
if (this.gridType == 0) {
this.$fastnext.focus();
this.$fastnext.trigger('focus');
} else {
this.$next.focus();
this.$next.trigger('focus');
}
} else {
this.$close.focus();
this.$close.trigger('focus');
}
e.stopPropagation()
return false;
Expand Down Expand Up @@ -2421,7 +2421,7 @@
$('.datepicker-calendar').trigger('ab.datepicker.closed', [self.id]);
// set focus on the focus target
if (!omitSettingFocus) {
this.$target.focus();
this.$target.trigger('focus');
}
}
} // end hide()
Expand Down Expand Up @@ -2995,7 +2995,7 @@
Datepicker.prototype.daysOfWeekDisabled = function(value) {
if (value != null) {
this.options.daysOfWeekDisabled = [];
if (! $.isArray(value)) {
if (! Array.isArray(value)) {
value = [value];
}
var self = this;
Expand Down Expand Up @@ -3032,7 +3032,7 @@
*/
Datepicker.prototype.inputFormat = function(value) {
if (value != null) {
if (! $.isArray(value)) {
if (! Array.isArray(value)) {
value = [value];
}
if (this.$target.attr('placeholder') == this.options.inputFormat[0]) {
Expand Down Expand Up @@ -3074,10 +3074,10 @@
this.$close.html(this.options.closeButtonTitle).attr('title', this.options.closeButtonLabel);
this.$calendar.find('.datepicker-bn-close-label').html(this.options.closeButtonLabel);
var self = this;
this.$close.click(function(e) {
this.$close.on('click', function(e) {
return self.handleCloseClick(e);
});
this.$close.keydown(function(e) {
this.$close.on('keydown', function(e) {
return self.handleCloseKeyDown(e);
});
} else {
Expand Down Expand Up @@ -3158,7 +3158,7 @@
*/
Datepicker.prototype.datesDisabled = function(dates) {
this.options.datesDisabled = [];
if (! $.isArray(dates)) {
if (! Array.isArray(dates)) {
dates = [dates];
}
var self = this;
Expand Down
4 changes: 2 additions & 2 deletions js/datepicker.min.js

Large diffs are not rendered by default.

0 comments on commit ef604da

Please sign in to comment.