From 5eca84265fc8d7b5c7e5c9f508aded20109ebe32 Mon Sep 17 00:00:00 2001 From: Paul Bakaus Date: Wed, 7 Jan 2009 16:55:50 +0000 Subject: [PATCH] datepicker: prev/next buttons were bumping in disabled state due to :hover rules in the stylesheet, fixed by adding ui-datepicker-prev/next-hover classes, fixes #3774 --- themes/base/ui.datepicker.css | 6 +++--- ui/ui.datepicker.js | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/themes/base/ui.datepicker.css b/themes/base/ui.datepicker.css index d08a4af2c..457a9c957 100644 --- a/themes/base/ui.datepicker.css +++ b/themes/base/ui.datepicker.css @@ -3,11 +3,11 @@ .ui-datepicker { width: 17em; padding: .2em .2em 0; } .ui-datepicker-header { position:relative; padding:.2em 0; } .ui-datepicker-prev, .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } -.ui-datepicker-prev:hover, .ui-datepicker-next:hover { top: 1px;} +.ui-datepicker-prev-hover, .ui-datepicker-next-hover { top: 1px; } .ui-datepicker-prev { left:2px; } .ui-datepicker-next { right:2px; } -.ui-datepicker-prev:hover { left:1px; } -.ui-datepicker-next:hover { right:1px; } +.ui-datepicker-prev-hover { left:1px; } +.ui-datepicker-next-hover { right:1px; } .ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } .ui-datepicker-title select { float:left; font-size:1em; margin:1px 0; } diff --git a/ui/ui.datepicker.js b/ui/ui.datepicker.js index c50a606b9..e61f6fbc6 100644 --- a/ui/ui.datepicker.js +++ b/ui/ui.datepicker.js @@ -580,11 +580,15 @@ $.extend(Datepicker.prototype, { .find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a') .bind('mouseout', function(){ $(this).removeClass('ui-state-hover'); + if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover'); + if(this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover'); }) .bind('mouseover', function(){ if (!self._isDisabledDatepicker( inst.inline ? inst.dpDiv.parent()[0] : inst.input[0])) { $(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover'); $(this).addClass('ui-state-hover'); + if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover'); + if(this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover'); } }) .end() @@ -1303,7 +1307,7 @@ $.extend(Datepicker.prototype, { var buttonPanel = (showButtonPanel) ? '
' + (isRTL ? controls : '') + (this._isInRange(inst, gotoDate) ? '' : '') + (isRTL ? '' : controls) + '
' : ''; - var firstDay = parseInt(this._get(inst, 'firstDay')); + var firstDay = parseInt(this._get(inst, 'firstDay'),10); firstDay = (isNaN(firstDay) ? 0 : firstDay); var dayNames = this._get(inst, 'dayNames'); var dayNamesShort = this._get(inst, 'dayNamesShort');