vendor/assets/javascripts/bootstrap-datetimepicker.js in bootstrap3-datetimepicker-rails-3.1.1 vs vendor/assets/javascripts/bootstrap-datetimepicker.js in bootstrap3-datetimepicker-rails-3.1.2
- old
+ new
@@ -1,7 +1,7 @@
/*
-//! version : 3.1.1
+//! version : 3.1.2
=========================================================
bootstrap-datetimepicker.js
https://github.com/Eonasdan/bootstrap-datetimepicker
=========================================================
The MIT License (MIT)
@@ -29,12 +29,15 @@
;(function (root, factory) {
'use strict';
if (typeof define === 'function' && define.amd) {
// AMD is used - Register as an anonymous module.
define(['jquery', 'moment'], factory);
- } else {
- // AMD is not used - Attempt to fetch dependencies from scope.
+ } else if (typeof exports === 'object') {
+ factory(require('jquery'), require('moment'));
+ }
+ else {
+ // Neither AMD or CommonJS used. Use global variables.
if (!jQuery) {
throw new Error('bootstrap-datetimepicker requires jQuery to be loaded first');
}
if (!moment) {
throw new Error('bootstrap-datetimepicker requires moment.js to be loaded first');
@@ -179,11 +182,13 @@
fillHours();
fillMinutes();
fillSeconds();
update();
showMode();
- attachDatePickerEvents();
+ if (!getPickerInput().prop('disabled')) {
+ attachDatePickerEvents();
+ }
if (picker.options.defaultDate !== '' && getPickerInput().val() === '') {
picker.setValue(picker.options.defaultDate);
}
if (picker.options.minuteStepping !== 1) {
rInterval = picker.options.minuteStepping;
@@ -348,10 +353,11 @@
});
} else {
picker.widget.css({
position: position,
top: offset.top,
+ bottom: 'auto',
left: offset.left,
right: offset.right
});
}
},
@@ -1180,10 +1186,13 @@
picker.component.removeData('DateTimePicker');
}
};
picker.show = function (e) {
+ if (getPickerInput().prop('disabled')) {
+ return;
+ }
if (picker.options.useCurrent) {
if (getPickerInput().val() === '') {
if (picker.options.minuteStepping !== 1) {
var mDate = moment(),
rInterval = picker.options.minuteStepping;
@@ -1218,19 +1227,19 @@
stopEvent(e);
}
};
picker.disable = function () {
- var input = picker.element.find('input');
+ var input = getPickerInput();
if (input.prop('disabled')) {
return;
}
input.prop('disabled', true);
detachDatePickerEvents();
};
picker.enable = function () {
- var input = picker.element.find('input');
+ var input = getPickerInput();
if (!input.prop('disabled')) {
return;
}
input.prop('disabled', false);
attachDatePickerEvents();