diff options
Diffstat (limited to 'ui/widgets/datepicker.js')
-rw-r--r-- | ui/widgets/datepicker.js | 55 |
1 files changed, 35 insertions, 20 deletions
diff --git a/ui/widgets/datepicker.js b/ui/widgets/datepicker.js index d363c8fc6..7dbcf3de7 100644 --- a/ui/widgets/datepicker.js +++ b/ui/widgets/datepicker.js @@ -1,5 +1,4 @@ -// jscs:disable maximumLineLength -/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */ +/* eslint-disable max-len, camelcase */ /*! * jQuery UI Datepicker @VERSION * http://jqueryui.com @@ -19,6 +18,8 @@ //>>css.theme: ../../themes/base/theme.css ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -32,7 +33,8 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; $.extend( $.ui, { datepicker: { version: "@VERSION" } } ); @@ -62,6 +64,7 @@ function datepicker_getZindex( elem ) { return 0; } + /* Date picker manager. Use the singleton instance of this class, $.datepicker, to interact with the date picker. Settings for (groups of) date pickers are maintained in an instance object, @@ -88,12 +91,12 @@ function Datepicker() { prevText: "Prev", // Display text for previous month link nextText: "Next", // Display text for next month link currentText: "Today", // Display text for current month link - monthNames: [ "January","February","March","April","May","June", - "July","August","September","October","November","December" ], // Names of months for drop-down and formatting + monthNames: [ "January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December" ], // Names of months for drop-down and formatting monthNamesShort: [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ], // For formatting dayNames: [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ], // For formatting dayNamesShort: [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ], // For formatting - dayNamesMin: [ "Su","Mo","Tu","We","Th","Fr","Sa" ], // Column headings for days starting at Sunday + dayNamesMin: [ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" ], // Column headings for days starting at Sunday weekHeader: "Wk", // Column header for week of the year dateFormat: "mm/dd/yy", // See format options on parseDate firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ... @@ -161,6 +164,7 @@ function Datepicker() { } $.extend( Datepicker.prototype, { + /* Class name added to elements to indicate already configured with a date picker. */ markerClassName: "hasDatepicker", @@ -453,7 +457,9 @@ $.extend( Datepicker.prototype, { if ( nodeName === "input" ) { target.disabled = false; inst.trigger.filter( "button" ). - each( function() { this.disabled = false; } ).end(). + each( function() { + this.disabled = false; + } ).end(). filter( "img" ).css( { opacity: "1.0", cursor: "" } ); } else if ( nodeName === "div" || nodeName === "span" ) { inline = $target.children( "." + this._inlineClass ); @@ -462,7 +468,11 @@ $.extend( Datepicker.prototype, { prop( "disabled", false ); } this._disabledInputs = $.map( this._disabledInputs, - function( value ) { return ( value === target ? null : value ); } ); // delete entry + + // Delete entry + function( value ) { + return ( value === target ? null : value ); + } ); }, /* Disable the date picker to a jQuery selection. @@ -481,7 +491,9 @@ $.extend( Datepicker.prototype, { if ( nodeName === "input" ) { target.disabled = true; inst.trigger.filter( "button" ). - each( function() { this.disabled = true; } ).end(). + each( function() { + this.disabled = true; + } ).end(). filter( "img" ).css( { opacity: "0.5", cursor: "default" } ); } else if ( nodeName === "div" || nodeName === "span" ) { inline = $target.children( "." + this._inlineClass ); @@ -490,7 +502,11 @@ $.extend( Datepicker.prototype, { prop( "disabled", true ); } this._disabledInputs = $.map( this._disabledInputs, - function( value ) { return ( value === target ? null : value ); } ); // delete entry + + // Delete entry + function( value ) { + return ( value === target ? null : value ); + } ); this._disabledInputs[ this._disabledInputs.length ] = target; }, @@ -518,8 +534,7 @@ $.extend( Datepicker.prototype, { _getInst: function( target ) { try { return $.data( target, "datepicker" ); - } - catch ( err ) { + } catch ( err ) { throw "Missing instance data for this datepicker"; } }, @@ -752,8 +767,7 @@ $.extend( Datepicker.prototype, { $.datepicker._updateAlternate( inst ); $.datepicker._updateDatepicker( inst ); } - } - catch ( err ) { + } catch ( err ) { } } return true; @@ -1558,8 +1572,7 @@ $.extend( Datepicker.prototype, { try { return $.datepicker.parseDate( $.datepicker._get( inst, "dateFormat" ), offset, $.datepicker._getFormatConfig( inst ) ); - } - catch ( e ) { + } catch ( e ) { // Ignore } @@ -2207,10 +2220,12 @@ $.fn.datepicker = function( options ) { apply( $.datepicker, [ this[ 0 ] ].concat( otherArgs ) ); } return this.each( function() { - typeof options === "string" ? - $.datepicker[ "_" + options + "Datepicker" ]. - apply( $.datepicker, [ this ].concat( otherArgs ) ) : + if ( typeof options === "string" ) { + $.datepicker[ "_" + options + "Datepicker" ] + .apply( $.datepicker, [ this ].concat( otherArgs ) ); + } else { $.datepicker._attachDatepicker( this, options ); + } } ); }; @@ -2221,4 +2236,4 @@ $.datepicker.version = "@VERSION"; return $.datepicker; -} ) ); +} ); |