Datepicker #3647: Added RTL support to the datepicker theme and reverted markup changes for RTL in r1196 for better semantics.

This commit is contained in:
Ca-Phun Ung 2008-12-22 20:24:27 +00:00
parent 2f436836e7
commit 0339770320
2 changed files with 13 additions and 9 deletions

View File

@ -29,14 +29,19 @@
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } .ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } .ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } .ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left:0; } .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left:0; } .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } .ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
/* RTL support */ /* RTL support */
.ui-datepicker-rtl { direction: rtl; }
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } .ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } .ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } .ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } .ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } .ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
.ui-datepicker-rtl .ui-datepicker-group { float:right; }
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }

View File

@ -1343,8 +1343,8 @@ $.extend(Datepicker.prototype, {
var thead = ''; var thead = '';
for (var dow = 0; dow < 7; dow++) { // days of the week for (var dow = 0; dow < 7; dow++) { // days of the week
var day = (dow + firstDay) % 7; var day = (dow + firstDay) % 7;
thead = (isRTL ? '' : thead) + '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' + thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' +
'<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>' + (isRTL ? thead : ''); '<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>';
} }
calender += thead + '</tr></thead><tbody>'; calender += thead + '</tr></thead><tbody>';
var daysInMonth = this._getDaysInMonth(drawYear, drawMonth); var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
@ -1362,7 +1362,7 @@ $.extend(Datepicker.prototype, {
var otherMonth = (printDate.getMonth() != drawMonth); var otherMonth = (printDate.getMonth() != drawMonth);
var unselectable = otherMonth || !daySettings[0] || var unselectable = otherMonth || !daySettings[0] ||
(minDate && printDate < minDate) || (maxDate && printDate > maxDate); (minDate && printDate < minDate) || (maxDate && printDate > maxDate);
tbody = (isRTL ? '' : tbody) + '<td class="' + tbody += '<td class="' +
((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends ((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends
(otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months (otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key ((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key
@ -1382,8 +1382,7 @@ $.extend(Datepicker.prototype, {
(printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') + (printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') +
(printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ? // in current range (printDate.getTime() >= currentDate.getTime() && printDate.getTime() <= endDate.getTime() ? // in current range
' ui-state-active' : '') + // highlight selected day ' ui-state-active' : '') + // highlight selected day
'" href="#">' + printDate.getDate() + '</a>')) + '</td>' + // display for this month '" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display for this month
(isRTL ? tbody : '');
printDate.setDate(printDate.getDate() + 1); printDate.setDate(printDate.getDate() + 1);
printDate = this._daylightSavingAdjust(printDate); printDate = this._daylightSavingAdjust(printDate);
} }
@ -1395,7 +1394,7 @@ $.extend(Datepicker.prototype, {
drawYear++; drawYear++;
} }
calender += '</tbody></table>' + (isMultiMonth ? '</div>' : ''); calender += '</tbody></table>' + (isMultiMonth ? '</div>' : '');
group = (isRTL ? calender + group : group + calender ); group += calender;
} }
html += group; html += group;
} }