diff options
author | Scott González <scott.gonzalez@gmail.com> | 2008-09-19 14:20:14 +0000 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2008-09-19 14:20:14 +0000 |
commit | 7c2e7965e90896b3ccf8525aeebfe2b9242203ff (patch) | |
tree | aec37d89461d5d9b14979523f3f82b8b7440f97c /ui/ui.datepicker.js | |
parent | 8d04c3594c4bd56ee2b86068e002b7566359df14 (diff) | |
download | jquery-ui-7c2e7965e90896b3ccf8525aeebfe2b9242203ff.tar.gz jquery-ui-7c2e7965e90896b3ccf8525aeebfe2b9242203ff.zip |
Reverted r695.
Diffstat (limited to 'ui/ui.datepicker.js')
-rw-r--r-- | ui/ui.datepicker.js | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/ui/ui.datepicker.js b/ui/ui.datepicker.js index 43dfac2c1..9a3ecd199 100644 --- a/ui/ui.datepicker.js +++ b/ui/ui.datepicker.js @@ -4,7 +4,7 @@ * Copyright (c) 2006, 2007, 2008 Marc Grabanski * Dual licensed under the MIT (MIT-LICENSE.txt) * and GPL (GPL-LICENSE.txt) licenses. - * + * * http://docs.jquery.com/UI/Datepicker * * Depends: @@ -12,7 +12,7 @@ * * Marc Grabanski (m@marcgrabanski.com) and Keith Wood (kbwood@virginbroadband.com.au). */ - + (function($) { // hide the namespace var PROP_NAME = 'datepicker'; @@ -101,7 +101,7 @@ function Datepicker() { calculateWeek: this.iso8601Week, // How to calculate the week of the year, // takes a Date and returns the number of the week for it shortYearCutoff: '+10', // Short year values < this are in the current century, - // > this are in the previous century, + // > this are in the previous century, // string value starting with '+' for current year + value showStatus: false, // True to show status bar at bottom, false to not show it statusForDate: this.dateStatus, // Function to provide status text for a date - @@ -110,7 +110,7 @@ function Datepicker() { maxDate: null, // The latest selectable date, or null for no limit duration: 'normal', // Duration of display/closure beforeShowDay: null, // Function that takes a date and returns an array with - // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '', + // [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '', // [2] = cell title (optional), e.g. $.datepicker.noWeekends beforeShow: null, // Function that takes an input field and // returns a set of custom settings for the date picker @@ -139,8 +139,8 @@ $.extend(Datepicker.prototype, { if (this.debug) console.log.apply('', arguments); }, - - /* Override the default settings for all instances of the date picker. + + /* Override the default settings for all instances of the date picker. @param settings object - the new settings to use as defaults (anonymous object) @return the manager object */ setDefaults: function(settings) { @@ -170,7 +170,7 @@ $.extend(Datepicker.prototype, { if (!target.id) target.id = 'dp' + (++this.uuid); var inst = this._newInst($(target), inline); - inst.settings = $.extend({}, settings || {}, inlineSettings || {}); + inst.settings = $.extend({}, settings || {}, inlineSettings || {}); if (nodeName == 'input') { this._connectDatepicker(target, inst); } else if (inline) { @@ -204,7 +204,7 @@ $.extend(Datepicker.prototype, { if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked var buttonText = this._get(inst, 'buttonText'); var buttonImage = this._get(inst, 'buttonImage'); - var trigger = $(this._get(inst, 'buttonImageOnly') ? + var trigger = $(this._get(inst, 'buttonImageOnly') ? $('<img/>').addClass(this._triggerClass). attr({ src: buttonImage, alt: buttonText, title: buttonText }) : $('<button type="button"></button>').addClass(this._triggerClass). @@ -248,7 +248,7 @@ $.extend(Datepicker.prototype, { _inlineShow: function(inst) { var numMonths = this._getNumberOfMonths(inst); // fix width for dynamic number of date pickers inst.dpDiv.width(numMonths[1] * $('.ui-datepicker', inst.dpDiv[0]).width()); - }, + }, /* Pop-up the date picker in a "dialog" box. @param input element - ignored @@ -458,7 +458,7 @@ $.extend(Datepicker.prototype, { _getDateDatepicker: function(target) { var inst = this._getInst(target); if (inst && !inst.inline) - this._setDateFromField(inst); + this._setDateFromField(inst); return (inst ? this._getDate(inst) : null); }, @@ -626,7 +626,7 @@ $.extend(Datepicker.prototype, { offset.top -= (isFixed ? scrollY : 0); return offset; }, - + /* Find an object's position on the screen. */ _findPos: function(obj) { while (obj && (obj.type == 'hidden' || obj.nodeType != 1)) { @@ -767,7 +767,7 @@ $.extend(Datepicker.prototype, { if (inst.stayOpen) { $('.ui-datepicker td', inst.dpDiv).removeClass(this._currentClass); $(td).addClass(this._currentClass); - } + } } inst.selectedDay = inst.currentDay = $('a', td).html(); inst.selectedMonth = inst.currentMonth = month; @@ -833,7 +833,7 @@ $.extend(Datepicker.prototype, { this._lastInput = null; } }, - + /* Update any alternate field to synchronise with the main field. */ _updateAlternate: function(inst) { var altField = this._get(inst, 'altField'); @@ -856,7 +856,7 @@ $.extend(Datepicker.prototype, { var day = date.getDay(); return [(day > 0 && day < 6), '']; }, - + /* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition. @param date Date - the date to get the week for @return number - the number of the week within the year that contains this date */ @@ -877,7 +877,7 @@ $.extend(Datepicker.prototype, { } return Math.floor(((checkDate - firstMon) / 86400000) / 7) + 1; // Weeks to given date }, - + /* Provide status text for a particular date. @param date the date to get the status for @param inst the current datepicker instance @@ -920,7 +920,7 @@ $.extend(Datepicker.prototype, { var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); if (matches) iFormat++; - return matches; + return matches; }; // Extract a number from the string value var getNumber = function(match) { @@ -972,17 +972,17 @@ $.extend(Datepicker.prototype, { case 'd': day = getNumber('d'); break; - case 'D': + case 'D': getName('D', dayNamesShort, dayNames); break; case 'o': doy = getNumber('o'); break; - case 'm': + case 'm': month = getNumber('m'); break; case 'M': - month = getName('M', monthNamesShort, monthNames); + month = getName('M', monthNamesShort, monthNames); break; case 'y': year = getNumber('y'); @@ -1074,7 +1074,7 @@ $.extend(Datepicker.prototype, { var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match); if (matches) iFormat++; - return matches; + return matches; }; // Format a number, with leading zero if necessary var formatNumber = function(match, value, len) { @@ -1102,7 +1102,7 @@ $.extend(Datepicker.prototype, { case 'd': output += formatNumber('d', date.getDate(), 2); break; - case 'D': + case 'D': output += formatName('D', date.getDay(), dayNamesShort, dayNames); break; case 'o': @@ -1111,18 +1111,18 @@ $.extend(Datepicker.prototype, { doy += this._getDaysInMonth(date.getFullYear(), m); output += formatNumber('o', doy, 3); break; - case 'm': + case 'm': output += formatNumber('m', date.getMonth() + 1, 2); break; case 'M': - output += formatName('M', date.getMonth(), monthNamesShort, monthNames); + output += formatName('M', date.getMonth(), monthNamesShort, monthNames); break; case 'y': - output += (lookAhead('y') ? date.getFullYear() : + output += (lookAhead('y') ? date.getFullYear() : (date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100); break; case '@': - output += date.getTime(); + output += date.getTime(); break; case "'": if (lookAhead("'")) @@ -1150,7 +1150,7 @@ $.extend(Datepicker.prototype, { else switch (format.charAt(iFormat)) { case 'd': case 'm': case 'y': case '@': - chars += '0123456789'; + chars += '0123456789'; break; case 'D': case 'M': return null; // Accept anything @@ -1175,7 +1175,7 @@ $.extend(Datepicker.prototype, { /* Parse existing date and initialise date picker. */ _setDateFromField: function(inst) { var dateFormat = this._get(inst, 'dateFormat'); - var dates = inst.input ? inst.input.val().split(this._get(inst, 'rangeSeparator')) : null; + var dates = inst.input ? inst.input.val().split(this._get(inst, 'rangeSeparator')) : null; inst.endDay = inst.endMonth = inst.endYear = null; var date = defaultDate = this._getDefaultDate(inst); if (dates.length > 0) { @@ -1201,7 +1201,7 @@ $.extend(Datepicker.prototype, { inst.currentYear = (dates[0] ? date.getFullYear() : 0); this._adjustInstDate(inst); }, - + /* Retrieve the default date shown on opening. */ _getDefaultDate: function(inst) { var date = this._determineDate(this._get(inst, 'defaultDate'), new Date()); @@ -1233,7 +1233,7 @@ $.extend(Datepicker.prototype, { case 'w' : case 'W' : day += parseInt(matches[1],10) * 7; break; case 'm' : case 'M' : - month += parseInt(matches[1],10); + month += parseInt(matches[1],10); day = Math.min(day, getDaysInMonth(year, month)); break; case 'y': case 'Y' : @@ -1348,7 +1348,7 @@ $.extend(Datepicker.prototype, { var prevBigText = (showBigPrevNext ? this._get(inst, 'prevBigText') : ''); prevBigText = (!navigationAsDateFormat ? prevBigText : this.formatDate( prevBigText, new Date(drawYear, drawMonth - stepBigMonths, 1), this._getFormatConfig(inst))); - var prev = '<div class="ui-datepicker-prev">' + (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? + var prev = '<div class="ui-datepicker-prev">' + (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? (showBigPrevNext ? '<a onclick="jQuery.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepBigMonths + ', \'M\');"' + this._addStatus(showStatus, inst.id, this._get(inst, 'prevBigStatus'), initStatus) + '>' + prevBigText + '</a>' : '') + '<a onclick="jQuery.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' + @@ -1367,7 +1367,7 @@ $.extend(Datepicker.prototype, { this._addStatus(showStatus, inst.id, this._get(inst, 'nextBigStatus'), initStatus) + '>' + nextBigText + '</a>' : '') : (hideIfNoPrevNext ? '' : '<label>' + nextText + '</label><label>' + nextBigText + '</label>')) + '</div>'; var currentText = this._get(inst, 'currentText'); - var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today); + var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today); currentText = (!navigationAsDateFormat ? currentText : this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); var html = (prompt ? '<div class="' + this._promptClass + '">' + prompt + '</div>' : '') + @@ -1398,7 +1398,7 @@ $.extend(Datepicker.prototype, { html += '<div class="ui-datepicker-one-month' + (col == 0 ? ' ui-datepicker-new-row' : '') + '">' + this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate, selectedDate, row > 0 || col > 0, showStatus, initStatus, monthNames) + // draw month headers - '<table class="ui-datepicker" cellpadding="0" cellspacing="0"><thead>' + + '<table class="ui-datepicker" cellpadding="0" cellspacing="0"><thead>' + '<tr class="ui-datepicker-title-row">' + (showWeeks ? '<td' + this._addStatus(showStatus, inst.id, weekStatus, initStatus) + '>' + this._get(inst, 'weekHeader') + '</td>' : ''); @@ -1408,7 +1408,7 @@ $.extend(Datepicker.prototype, { status.replace(/D/, dayNamesShort[day])); html += '<td' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end-cell"' : '') + '>' + (!changeFirstDay ? '<span' : - '<a onclick="jQuery.datepicker._changeFirstDay(\'#' + inst.id + '\', ' + day + ');"') + + '<a onclick="jQuery.datepicker._changeFirstDay(\'#' + inst.id + '\', ' + day + ');"') + this._addStatus(showStatus, inst.id, dayStatus, initStatus) + ' title="' + dayNames[day] + '">' + dayNamesMin[day] + (changeFirstDay ? '</a>' : '</span>') + '</td>'; } @@ -1470,15 +1470,15 @@ $.extend(Datepicker.prototype, { } html += '</tbody></table></div>'; } - html += (showStatus ? '<div style="clear: both;"></div><div id="ui-datepicker-status-' + inst.id + + html += (showStatus ? '<div style="clear: both;"></div><div id="ui-datepicker-status-' + inst.id + '" class="ui-datepicker-status">' + initStatus + '</div>' : '') + (!closeAtTop && !inst.inline ? controls : '') + - '<div style="clear: both;"></div>' + - ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ? + '<div style="clear: both;"></div>' + + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ? '<iframe src="javascript:false;" class="ui-datepicker-cover"></iframe>' : ''); return html; }, - + /* Generate the month and year header. */ _generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate, selectedDate, secondary, showStatus, initStatus, monthNames) { @@ -1579,7 +1579,7 @@ $.extend(Datepicker.prototype, { onChange.apply((inst.input ? inst.input[0] : null), [inst.selectedYear, inst.selectedMonth + 1, inst]); }, - + /* Determine the number of months to show. */ _getNumberOfMonths: function(inst) { var numMonths = this._get(inst, 'numberOfMonths'); @@ -1628,7 +1628,7 @@ $.extend(Datepicker.prototype, { var maxDate = this._getMinMaxDate(inst, 'max'); return ((!minDate || date >= minDate) && (!maxDate || date <= maxDate)); }, - + /* Provide the configuration settings for formatting/parsing. */ _getFormatConfig: function(inst) { var shortYearCutoff = this._get(inst, 'shortYearCutoff'); @@ -1672,14 +1672,14 @@ function isArray(a) { Object - settings for attaching new datepicker functionality @return jQuery object */ $.fn.datepicker = function(options){ - + /* Initialise the date picker. */ if (!$.datepicker.initialized) { $(document.body).append($.datepicker.dpDiv). mousedown($.datepicker._checkExternalClick); $.datepicker.initialized = true; } - + var otherArgs = Array.prototype.slice.call(arguments, 1); if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate')) return $.datepicker['_' + options + 'Datepicker']. |