vendor/assets/javascripts/pickadate/picker.time.js in pickadate-rails-1.2.0 vs vendor/assets/javascripts/pickadate/picker.time.js in pickadate-rails-1.2.1
- old
+ new
@@ -1,8 +1,8 @@
/*!
- * Time picker for pickadate.js v3.2.0
+ * Time picker for pickadate.js v3.2.1
* http://amsul.github.io/pickadate.js/time.htm
*/
/*jshint
debug: true,
@@ -11,15 +11,22 @@
asi: true,
unused: true,
boss: true
*/
+(function ( factory ) {
-// Create a new scope.
-(function() {
+ // Register as an anonymous module.
+ if ( typeof define === 'function' && define.amd )
+ define( ['picker'], factory )
+ // Or using browser globals.
+ else factory( Picker )
+}(function( Picker ) {
+
+
/**
* Globals and constants
*/
var HOURS_IN_DAY = 24,
MINUTES_IN_HOUR = 60,
@@ -173,11 +180,11 @@
if ( Picker._.isObject( value ) && Picker._.isInteger( value.pick ) ) {
value = value.pick
}
// If it's an array, convert it into minutes.
- else if ( Array.isArray( value ) ) {
+ else if ( $.isArray( value ) ) {
value = +value[ 0 ] * MINUTES_IN_HOUR + (+value[ 1 ])
}
// If no valid value is passed, set it to "now".
else if ( !Picker._.isInteger( value ) ) {
@@ -314,11 +321,11 @@
if ( Picker._.isInteger( timeToDisable ) ) {
return timeObject.hour == timeToDisable
}
// If it's an array, create the object and match the times.
- if ( Array.isArray( timeToDisable ) ) {
+ if ( $.isArray( timeToDisable ) ) {
return timeObject.pick == clock.create( timeToDisable ).pick
}
}).length
// If the clock is "enabled" flag is flipped, flip the condition.
@@ -368,11 +375,11 @@
var
clock = this,
parsingObject = {}
- if ( !value || Picker._.isInteger( value ) || Array.isArray( value ) || Picker._.isDate( value ) || Picker._.isObject( value ) && Picker._.isInteger( value.pick ) ) {
+ if ( !value || Picker._.isInteger( value ) || $.isArray( value ) || Picker._.isDate( value ) || Picker._.isObject( value ) && Picker._.isInteger( value.pick ) ) {
return value
}
// We need a `.format` to parse the value.
if ( !( options && options.format ) ) {
@@ -524,14 +531,14 @@
/**
* Filter through the disabled collection to find a time unit.
*/
TimePicker.prototype.filterDisabled = function( collection, timeUnit, isRemoving ) {
- var timeIsArray = Array.isArray( timeUnit )
+ var timeIsArray = $.isArray( timeUnit )
return collection.filter( function( disabledTimeUnit ) {
var isMatch = !timeIsArray && timeUnit === disabledTimeUnit ||
- timeIsArray && Array.isArray( disabledTimeUnit ) && timeUnit.toString() === disabledTimeUnit.toString()
+ timeIsArray && $.isArray( disabledTimeUnit ) && timeUnit.toString() === disabledTimeUnit.toString()
return isRemoving ? !isMatch : isMatch
})
} //TimePicker.prototype.filterDisabled
@@ -642,10 +649,9 @@
* Extend the picker to add the date picker.
*/
Picker.extend( 'pickatime', TimePicker )
-// Close the scope.
-})();
+}));