From: Keith Wood Date: Wed, 23 Jul 2008 10:26:22 +0000 (+0000) Subject: Fixed 3111 Add option to allow large previous/next movements X-Git-Tag: 1.6rc2~184 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1f826dc041f74795fd466fd2d46bf0f68df4bcd1;p=jquery-ui.git Fixed 3111 Add option to allow large previous/next movements --- diff --git a/ui/ui.datepicker.js b/ui/ui.datepicker.js index ca27f1a05..a07a4df55 100644 --- a/ui/ui.datepicker.js +++ b/ui/ui.datepicker.js @@ -43,8 +43,12 @@ function Datepicker() { closeStatus: 'Close without change', // Status text for close link prevText: '<Prev', // Display text for previous month link prevStatus: 'Show the previous month', // Status text for previous month link + prevBigText: '<<', // Display text for previous year link + prevBigStatus: 'Show the previous year', // Status text for previous year link nextText: 'Next>', // Display text for next month link nextStatus: 'Show the next month', // Status text for next month link + nextBigText: '>>', // Display text for next year link + nextBigStatus: 'Show the next year', // Status text for next year link currentText: 'Today', // Display text for current month link currentStatus: 'Show the current month', // Status text for current month link monthNames: ['January','February','March','April','May','June', @@ -81,6 +85,7 @@ function Datepicker() { hideIfNoPrevNext: false, // True to hide next/previous month links // if not applicable, false to just disable them navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links + showBigPrevNext: false, // True to show big prev/next links gotoCurrent: false, // True if today link goes back to current selection instead changeMonth: true, // True if month can be selected directly, false if only prev/next changeYear: true, // True if year can be selected directly, false if only prev/next @@ -112,6 +117,7 @@ function Datepicker() { onClose: null, // Define a callback function when the datepicker is closed numberOfMonths: 1, // Number of months to show at a time stepMonths: 1, // Number of months to step back/forward + stepBigMonths: 12, // Number of months to step back/forward for the big links rangeSelect: false, // Allows for selecting a date range on one date picker rangeSeparator: ' - ', // Text between two dates in a range altField: '', // Selector for an alternate field to store selected dates into @@ -1222,8 +1228,10 @@ $.extend(Datepicker.prototype, { var closeAtTop = this._get(inst, 'closeAtTop'); var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext'); var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat'); + var showBigPrevNext = this._get(inst, 'showBigPrevNext'); var numMonths = this._getNumberOfMonths(inst); var stepMonths = this._get(inst, 'stepMonths'); + var stepBigMonths = this._get(inst, 'stepBigMonths'); var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1); var currentDate = (!inst.currentDay ? new Date(9999, 9, 9) : new Date(inst.currentYear, inst.currentMonth, inst.currentDay)); @@ -1247,17 +1255,27 @@ $.extend(Datepicker.prototype, { var prevText = this._get(inst, 'prevText'); prevText = (!navigationAsDateFormat ? prevText : this.formatDate( prevText, new Date(drawYear, drawMonth - stepMonths, 1), this._getFormatConfig(inst))); + var prevBigText = (showBigPrevNext ? this._get(inst, 'prevBigText') : ''); + prevBigText = (!navigationAsDateFormat ? prevBigText : this.formatDate( + prevBigText, new Date(drawYear, drawMonth - stepBigMonths, 1), this._getFormatConfig(inst))); var prev = '
' + (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? + (showBigPrevNext ? '' + prevBigText + '' : '') + '' + prevText + '' : - (hideIfNoPrevNext ? '' : '')) + '
'; + (hideIfNoPrevNext ? '' : '')) + ''; var nextText = this._get(inst, 'nextText'); nextText = (!navigationAsDateFormat ? nextText : this.formatDate( nextText, new Date(drawYear, drawMonth + stepMonths, 1), this._getFormatConfig(inst))); + var nextBigText = (showBigPrevNext ? this._get(inst, 'nextBigText') : ''); + nextBigText = (!navigationAsDateFormat ? nextBigText : this.formatDate( + nextBigText, new Date(drawYear, drawMonth + stepBigMonths, 1), this._getFormatConfig(inst))); var next = '
' + (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? '' + nextText + '' : - (hideIfNoPrevNext ? '' : '')) + '
'; + this._addStatus(showStatus, inst.id, this._get(inst, 'nextStatus'), initStatus) + '>' + nextText + '' + + (showBigPrevNext ? '' + nextBigText + '' : '') : + (hideIfNoPrevNext ? '' : '')) + ''; var currentText = this._get(inst, 'currentText'); var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today); currentText = (!navigationAsDateFormat ? currentText :