From 2ce88522459946fdc58b1b7f6e6164ee99c19d37 Mon Sep 17 00:00:00 2001 From: Reedy Date: Fri, 27 Jul 2012 00:18:09 +0100 Subject: [PATCH] Ugrade jQuery UI to 1.8.22 http://blog.jqueryui.com/2012/07/jquery-ui-1-8-22/ Change-Id: I770ca9eaae180dbac8ac785113a5787b71acc67d --- RELEASE-NOTES-1.20 | 2 +- resources/Resources.php | 1 - .../jquery.effects/jquery.effects.blind.js | 2 +- .../jquery.effects/jquery.effects.bounce.js | 4 +- .../jquery.effects/jquery.effects.clip.js | 2 +- .../jquery.effects/jquery.effects.core.js | 7 +- .../jquery.effects/jquery.effects.drop.js | 4 +- .../jquery.effects/jquery.effects.explode.js | 2 +- .../jquery.effects/jquery.effects.fade.js | 2 +- .../jquery.effects/jquery.effects.fold.js | 2 +- .../jquery.effects.highlight.js | 2 +- .../jquery.effects/jquery.effects.pulsate.js | 2 +- .../jquery.effects/jquery.effects.scale.js | 2 +- .../jquery.effects/jquery.effects.shake.js | 2 +- .../jquery.effects/jquery.effects.slide.js | 4 +- .../jquery.effects/jquery.effects.transfer.js | 2 +- .../i18n/jquery.ui.datepicker-fr-CH.js | 23 ---- resources/jquery.ui/jquery.ui.accordion.js | 4 +- resources/jquery.ui/jquery.ui.autocomplete.js | 2 +- resources/jquery.ui/jquery.ui.button.js | 2 +- resources/jquery.ui/jquery.ui.core.js | 101 ++++++++++-------- resources/jquery.ui/jquery.ui.datepicker.js | 74 +++++++++---- resources/jquery.ui/jquery.ui.dialog.js | 4 +- resources/jquery.ui/jquery.ui.draggable.js | 4 +- resources/jquery.ui/jquery.ui.droppable.js | 4 +- resources/jquery.ui/jquery.ui.mouse.js | 2 +- resources/jquery.ui/jquery.ui.position.js | 2 +- resources/jquery.ui/jquery.ui.progressbar.js | 4 +- resources/jquery.ui/jquery.ui.resizable.js | 4 +- resources/jquery.ui/jquery.ui.selectable.js | 4 +- resources/jquery.ui/jquery.ui.slider.js | 4 +- resources/jquery.ui/jquery.ui.sortable.js | 6 +- resources/jquery.ui/jquery.ui.tabs.js | 4 +- resources/jquery.ui/jquery.ui.widget.js | 2 +- .../themes/default/jquery.ui.accordion.css | 2 +- .../themes/default/jquery.ui.autocomplete.css | 4 +- .../themes/default/jquery.ui.button.css | 2 +- .../themes/default/jquery.ui.core.css | 2 +- .../themes/default/jquery.ui.datepicker.css | 4 +- .../themes/default/jquery.ui.dialog.css | 2 +- .../themes/default/jquery.ui.progressbar.css | 2 +- .../themes/default/jquery.ui.resizable.css | 2 +- .../themes/default/jquery.ui.selectable.css | 2 +- .../themes/default/jquery.ui.slider.css | 2 +- .../themes/default/jquery.ui.tabs.css | 2 +- .../themes/default/jquery.ui.theme.css | 2 +- 46 files changed, 171 insertions(+), 149 deletions(-) delete mode 100644 resources/jquery.ui/i18n/jquery.ui.datepicker-fr-CH.js diff --git a/RELEASE-NOTES-1.20 b/RELEASE-NOTES-1.20 index 2521804942..8473a275ec 100644 --- a/RELEASE-NOTES-1.20 +++ b/RELEASE-NOTES-1.20 @@ -61,7 +61,7 @@ upgrade PHP if you have not done so prior to upgrading MediaWiki. Special:Version * Edit notices can now be translated. * (bug 35680) jQuery upgraded to 1.7.2. -* jQuery UI upgraded to 1.8.21. +* jQuery UI upgraded to 1.8.22. * (bug 35705) QUnit upgraded from v1.2.0 to v1.8.0. * (bug 37604) jquery.cookie upgraded to 2011 version. * (bug 22887) Add warning and tracking category for preprocessor errors diff --git a/resources/Resources.php b/resources/Resources.php index 9900ab1480..7b03171c49 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -352,7 +352,6 @@ return array( 'fa' => 'resources/jquery.ui/i18n/jquery.ui.datepicker-fa.js', 'fi' => 'resources/jquery.ui/i18n/jquery.ui.datepicker-fi.js', 'fo' => 'resources/jquery.ui/i18n/jquery.ui.datepicker-fo.js', - 'fr-ch' => 'resources/jquery.ui/i18n/jquery.ui.datepicker-fr-CH.js', 'fr' => 'resources/jquery.ui/i18n/jquery.ui.datepicker-fr.js', 'gl' => 'resources/jquery.ui/i18n/jquery.ui.datepicker-gl.js', 'he' => 'resources/jquery.ui/i18n/jquery.ui.datepicker-he.js', diff --git a/resources/jquery.effects/jquery.effects.blind.js b/resources/jquery.effects/jquery.effects.blind.js index 686cdb7961..0149ed787c 100644 --- a/resources/jquery.effects/jquery.effects.blind.js +++ b/resources/jquery.effects/jquery.effects.blind.js @@ -1,5 +1,5 @@ /*! - * jQuery UI Effects Blind 1.8.21 + * jQuery UI Effects Blind 1.8.22 * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. diff --git a/resources/jquery.effects/jquery.effects.bounce.js b/resources/jquery.effects/jquery.effects.bounce.js index e3fc3d8d6f..e376cb91cc 100644 --- a/resources/jquery.effects/jquery.effects.bounce.js +++ b/resources/jquery.effects/jquery.effects.bounce.js @@ -1,5 +1,5 @@ /*! - * jQuery UI Effects Bounce 1.8.21 + * jQuery UI Effects Bounce 1.8.22 * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -32,7 +32,7 @@ $.effects.bounce = function(o) { $.effects.createWrapper(el); // Create Wrapper var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; - var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 3 : el.outerWidth({margin:true}) / 3); + var distance = o.options.distance || (ref == 'top' ? el.outerHeight(true) / 3 : el.outerWidth(true) / 3); if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift if (mode == 'hide') distance = distance / (times * 2); if (mode != 'hide') times--; diff --git a/resources/jquery.effects/jquery.effects.clip.js b/resources/jquery.effects/jquery.effects.clip.js index 2b435548a3..1ae42093b6 100644 --- a/resources/jquery.effects/jquery.effects.clip.js +++ b/resources/jquery.effects/jquery.effects.clip.js @@ -1,5 +1,5 @@ /*! - * jQuery UI Effects Clip 1.8.21 + * jQuery UI Effects Clip 1.8.22 * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. diff --git a/resources/jquery.effects/jquery.effects.core.js b/resources/jquery.effects/jquery.effects.core.js index cc31827123..a0efe681a5 100644 --- a/resources/jquery.effects/jquery.effects.core.js +++ b/resources/jquery.effects/jquery.effects.core.js @@ -1,5 +1,5 @@ /*! - * jQuery UI Effects 1.8.21 + * jQuery UI Effects 1.8.22 * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -75,7 +75,8 @@ function getColor(elem, attr) { var color; do { - color = $.curCSS(elem, attr); + // jQuery <1.4.3 uses curCSS, in 1.4.3 - 1.7.2 curCSS = css, 1.8+ only has css + color = ($.curCSS || $.css)(elem, attr); // Keep going until we find an element that has color, or we hit the body if ( color != '' && color != 'transparent' || $.nodeName(elem, "body") ) @@ -306,7 +307,7 @@ $.fn.extend({ /******************************************************************************/ $.extend($.effects, { - version: "1.8.21", + version: "1.8.22", // Saves a set of properties in a data storage save: function(element, set) { diff --git a/resources/jquery.effects/jquery.effects.drop.js b/resources/jquery.effects/jquery.effects.drop.js index 1fa5660bf0..dc5ce44071 100644 --- a/resources/jquery.effects/jquery.effects.drop.js +++ b/resources/jquery.effects/jquery.effects.drop.js @@ -1,5 +1,5 @@ /*! - * jQuery UI Effects Drop 1.8.21 + * jQuery UI Effects Drop 1.8.22 * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -28,7 +28,7 @@ $.effects.drop = function(o) { $.effects.createWrapper(el); // Create Wrapper var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; - var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) / 2 : el.outerWidth({margin:true}) / 2); + var distance = o.options.distance || (ref == 'top' ? el.outerHeight( true ) / 2 : el.outerWidth( true ) / 2); if (mode == 'show') el.css('opacity', 0).css(ref, motion == 'pos' ? -distance : distance); // Shift // Animation diff --git a/resources/jquery.effects/jquery.effects.explode.js b/resources/jquery.effects/jquery.effects.explode.js index f50e2571ab..6be5582382 100644 --- a/resources/jquery.effects/jquery.effects.explode.js +++ b/resources/jquery.effects/jquery.effects.explode.js @@ -1,5 +1,5 @@ /*! - * jQuery UI Effects Explode 1.8.21 + * jQuery UI Effects Explode 1.8.22 * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. diff --git a/resources/jquery.effects/jquery.effects.fade.js b/resources/jquery.effects/jquery.effects.fade.js index c62037f5dd..c76e6bf06b 100644 --- a/resources/jquery.effects/jquery.effects.fade.js +++ b/resources/jquery.effects/jquery.effects.fade.js @@ -1,5 +1,5 @@ /*! - * jQuery UI Effects Fade 1.8.21 + * jQuery UI Effects Fade 1.8.22 * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. diff --git a/resources/jquery.effects/jquery.effects.fold.js b/resources/jquery.effects/jquery.effects.fold.js index a660eedb3c..1788066c83 100644 --- a/resources/jquery.effects/jquery.effects.fold.js +++ b/resources/jquery.effects/jquery.effects.fold.js @@ -1,5 +1,5 @@ /*! - * jQuery UI Effects Fold 1.8.21 + * jQuery UI Effects Fold 1.8.22 * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. diff --git a/resources/jquery.effects/jquery.effects.highlight.js b/resources/jquery.effects/jquery.effects.highlight.js index e65bda35dd..451b02d3ad 100644 --- a/resources/jquery.effects/jquery.effects.highlight.js +++ b/resources/jquery.effects/jquery.effects.highlight.js @@ -1,5 +1,5 @@ /*! - * jQuery UI Effects Highlight 1.8.21 + * jQuery UI Effects Highlight 1.8.22 * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. diff --git a/resources/jquery.effects/jquery.effects.pulsate.js b/resources/jquery.effects/jquery.effects.pulsate.js index a512184200..f989174e50 100644 --- a/resources/jquery.effects/jquery.effects.pulsate.js +++ b/resources/jquery.effects/jquery.effects.pulsate.js @@ -1,5 +1,5 @@ /*! - * jQuery UI Effects Pulsate 1.8.21 + * jQuery UI Effects Pulsate 1.8.22 * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. diff --git a/resources/jquery.effects/jquery.effects.scale.js b/resources/jquery.effects/jquery.effects.scale.js index c312195c78..d5761a5e9f 100644 --- a/resources/jquery.effects/jquery.effects.scale.js +++ b/resources/jquery.effects/jquery.effects.scale.js @@ -1,5 +1,5 @@ /*! - * jQuery UI Effects Scale 1.8.21 + * jQuery UI Effects Scale 1.8.22 * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. diff --git a/resources/jquery.effects/jquery.effects.shake.js b/resources/jquery.effects/jquery.effects.shake.js index 08ce5a8461..6c2a8dbae4 100644 --- a/resources/jquery.effects/jquery.effects.shake.js +++ b/resources/jquery.effects/jquery.effects.shake.js @@ -1,5 +1,5 @@ /*! - * jQuery UI Effects Shake 1.8.21 + * jQuery UI Effects Shake 1.8.22 * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. diff --git a/resources/jquery.effects/jquery.effects.slide.js b/resources/jquery.effects/jquery.effects.slide.js index 3258a9ad7e..c77fad6c7e 100644 --- a/resources/jquery.effects/jquery.effects.slide.js +++ b/resources/jquery.effects/jquery.effects.slide.js @@ -1,5 +1,5 @@ /*! - * jQuery UI Effects Slide 1.8.21 + * jQuery UI Effects Slide 1.8.22 * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -28,7 +28,7 @@ $.effects.slide = function(o) { $.effects.createWrapper(el).css({overflow:'hidden'}); // Create Wrapper var ref = (direction == 'up' || direction == 'down') ? 'top' : 'left'; var motion = (direction == 'up' || direction == 'left') ? 'pos' : 'neg'; - var distance = o.options.distance || (ref == 'top' ? el.outerHeight({margin:true}) : el.outerWidth({margin:true})); + var distance = o.options.distance || (ref == 'top' ? el.outerHeight( true ) : el.outerWidth( true )); if (mode == 'show') el.css(ref, motion == 'pos' ? (isNaN(distance) ? "-" + distance : -distance) : distance); // Shift // Animation diff --git a/resources/jquery.effects/jquery.effects.transfer.js b/resources/jquery.effects/jquery.effects.transfer.js index 97514f19cc..5a68ae8910 100644 --- a/resources/jquery.effects/jquery.effects.transfer.js +++ b/resources/jquery.effects/jquery.effects.transfer.js @@ -1,5 +1,5 @@ /*! - * jQuery UI Effects Transfer 1.8.21 + * jQuery UI Effects Transfer 1.8.22 * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. diff --git a/resources/jquery.ui/i18n/jquery.ui.datepicker-fr-CH.js b/resources/jquery.ui/i18n/jquery.ui.datepicker-fr-CH.js deleted file mode 100644 index 244eacff44..0000000000 --- a/resources/jquery.ui/i18n/jquery.ui.datepicker-fr-CH.js +++ /dev/null @@ -1,23 +0,0 @@ -/* Swiss-French initialisation for the jQuery UI date picker plugin. */ -/* Written Martin Voelkle (martin.voelkle@e-tc.ch). */ -jQuery(function($){ - $.datepicker.regional['fr-CH'] = { - closeText: 'Fermer', - prevText: '<Préc', - nextText: 'Suiv>', - currentText: 'Courant', - monthNames: ['Janvier','Février','Mars','Avril','Mai','Juin', - 'Juillet','Août','Septembre','Octobre','Novembre','Décembre'], - monthNamesShort: ['Jan','Fév','Mar','Avr','Mai','Jun', - 'Jul','Aoû','Sep','Oct','Nov','Déc'], - dayNames: ['Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi'], - dayNamesShort: ['Dim','Lun','Mar','Mer','Jeu','Ven','Sam'], - dayNamesMin: ['Di','Lu','Ma','Me','Je','Ve','Sa'], - weekHeader: 'Sm', - dateFormat: 'dd.mm.yy', - firstDay: 1, - isRTL: false, - showMonthAfterYear: false, - yearSuffix: ''}; - $.datepicker.setDefaults($.datepicker.regional['fr-CH']); -}); \ No newline at end of file diff --git a/resources/jquery.ui/jquery.ui.accordion.js b/resources/jquery.ui/jquery.ui.accordion.js index fe0a729a66..d3dbdec2ee 100644 --- a/resources/jquery.ui/jquery.ui.accordion.js +++ b/resources/jquery.ui/jquery.ui.accordion.js @@ -1,5 +1,5 @@ /*! - * jQuery UI Accordion 1.8.21 + * jQuery UI Accordion 1.8.22 * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -518,7 +518,7 @@ $.widget( "ui.accordion", { }); $.extend( $.ui.accordion, { - version: "1.8.21", + version: "1.8.22", animations: { slide: function( options, additions ) { options = $.extend({ diff --git a/resources/jquery.ui/jquery.ui.autocomplete.js b/resources/jquery.ui/jquery.ui.autocomplete.js index f8009c61a9..501b60473f 100644 --- a/resources/jquery.ui/jquery.ui.autocomplete.js +++ b/resources/jquery.ui/jquery.ui.autocomplete.js @@ -1,5 +1,5 @@ /*! - * jQuery UI Autocomplete 1.8.21 + * jQuery UI Autocomplete 1.8.22 * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. diff --git a/resources/jquery.ui/jquery.ui.button.js b/resources/jquery.ui/jquery.ui.button.js index 47bd6aa7a8..bdee27c441 100644 --- a/resources/jquery.ui/jquery.ui.button.js +++ b/resources/jquery.ui/jquery.ui.button.js @@ -1,5 +1,5 @@ /*! - * jQuery UI Button 1.8.21 + * jQuery UI Button 1.8.22 * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. diff --git a/resources/jquery.ui/jquery.ui.core.js b/resources/jquery.ui/jquery.ui.core.js index 2a8a2c181d..40211ccd07 100644 --- a/resources/jquery.ui/jquery.ui.core.js +++ b/resources/jquery.ui/jquery.ui.core.js @@ -1,5 +1,5 @@ /*! - * jQuery UI 1.8.21 + * jQuery UI 1.8.22 * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -18,7 +18,7 @@ if ( $.ui.version ) { } $.extend( $.ui, { - version: "1.8.21", + version: "1.8.22", keyCode: { ALT: 18, @@ -131,49 +131,52 @@ $.fn.extend({ } }); -$.each( [ "Width", "Height" ], function( i, name ) { - var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], - type = name.toLowerCase(), - orig = { - innerWidth: $.fn.innerWidth, - innerHeight: $.fn.innerHeight, - outerWidth: $.fn.outerWidth, - outerHeight: $.fn.outerHeight - }; +// support: jQuery <1.8 +if ( !$( "" ).outerWidth( 1 ).jquery ) { + $.each( [ "Width", "Height" ], function( i, name ) { + var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], + type = name.toLowerCase(), + orig = { + innerWidth: $.fn.innerWidth, + innerHeight: $.fn.innerHeight, + outerWidth: $.fn.outerWidth, + outerHeight: $.fn.outerHeight + }; + + function reduce( elem, size, border, margin ) { + $.each( side, function() { + size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0; + if ( border ) { + size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0; + } + if ( margin ) { + size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0; + } + }); + return size; + } - function reduce( elem, size, border, margin ) { - $.each( side, function() { - size -= parseFloat( $.curCSS( elem, "padding" + this, true) ) || 0; - if ( border ) { - size -= parseFloat( $.curCSS( elem, "border" + this + "Width", true) ) || 0; - } - if ( margin ) { - size -= parseFloat( $.curCSS( elem, "margin" + this, true) ) || 0; + $.fn[ "inner" + name ] = function( size ) { + if ( size === undefined ) { + return orig[ "inner" + name ].call( this ); } - }); - return size; - } - - $.fn[ "inner" + name ] = function( size ) { - if ( size === undefined ) { - return orig[ "inner" + name ].call( this ); - } - return this.each(function() { - $( this ).css( type, reduce( this, size ) + "px" ); - }); - }; + return this.each(function() { + $( this ).css( type, reduce( this, size ) + "px" ); + }); + }; - $.fn[ "outer" + name] = function( size, margin ) { - if ( typeof size !== "number" ) { - return orig[ "outer" + name ].call( this, size ); - } + $.fn[ "outer" + name] = function( size, margin ) { + if ( typeof size !== "number" ) { + return orig[ "outer" + name ].call( this, size ); + } - return this.each(function() { - $( this).css( type, reduce( this, size, true, margin ) + "px" ); - }); - }; -}); + return this.each(function() { + $( this).css( type, reduce( this, size, true, margin ) + "px" ); + }); + }; + }); +} // selectors function focusable( element, isTabIndexNotNaN ) { @@ -205,9 +208,16 @@ function visible( element ) { } $.extend( $.expr[ ":" ], { - data: function( elem, i, match ) { - return !!$.data( elem, match[ 3 ] ); - }, + data: $.expr.createPseudo ? + $.expr.createPseudo(function( dataName ) { + return function( elem ) { + return !!$.data( elem, dataName ); + }; + }) : + // support: jQuery <1.8 + function( elem, i, match ) { + return !!$.data( elem, match[ 3 ] ); + }, focusable: function( element ) { return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) ); @@ -245,6 +255,11 @@ $(function() { body.removeChild( div ).style.display = "none"; }); +// jQuery <1.4.3 uses curCSS, in 1.4.3 - 1.7.2 curCSS = css, 1.8+ only has css +if ( !$.curCSS ) { + $.curCSS = $.css; +} + diff --git a/resources/jquery.ui/jquery.ui.datepicker.js b/resources/jquery.ui/jquery.ui.datepicker.js index 8ca1b152c9..58d3ff297a 100644 --- a/resources/jquery.ui/jquery.ui.datepicker.js +++ b/resources/jquery.ui/jquery.ui.datepicker.js @@ -1,5 +1,5 @@ /*! - * jQuery UI Datepicker 1.8.21 + * jQuery UI Datepicker 1.8.22 * * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. @@ -12,7 +12,7 @@ */ (function( $, undefined ) { -$.extend($.ui, { datepicker: { version: "1.8.21" } }); +$.extend($.ui, { datepicker: { version: "1.8.22" } }); var PROP_NAME = 'datepicker'; var dpuuid = new Date().getTime(); @@ -308,7 +308,7 @@ $.extend(Datepicker.prototype, { this.uuid += 1; var id = 'dp' + this.uuid; this._dialogInput = $(''); + '" style="position: absolute; top: -100px; width: 0px;"/>'); this._dialogInput.keydown(this._doKeyDown); $('body').append(this._dialogInput); inst = this._dialogInst = this._newInst(this._dialogInput, false); @@ -714,6 +714,7 @@ $.extend(Datepicker.prototype, { var borders = $.datepicker._getBorders(inst.dpDiv); instActive = inst; // for delegate hover events inst.dpDiv.empty().append(this._generateHTML(inst)); + this._attachHandlers(inst); var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6 cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()}) @@ -764,8 +765,8 @@ $.extend(Datepicker.prototype, { var dpHeight = inst.dpDiv.outerHeight(); var inputWidth = inst.input ? inst.input.outerWidth() : 0; var inputHeight = inst.input ? inst.input.outerHeight() : 0; - var viewWidth = document.documentElement.clientWidth + $(document).scrollLeft(); - var viewHeight = document.documentElement.clientHeight + $(document).scrollTop(); + var viewWidth = document.documentElement.clientWidth + (isFixed ? 0 : $(document).scrollLeft()); + var viewHeight = document.documentElement.clientHeight + (isFixed ? 0 : $(document).scrollTop()); offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0); offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0; @@ -1402,6 +1403,43 @@ $.extend(Datepicker.prototype, { return startDate; }, + /* Attach the onxxx handlers. These are declared statically so + * they work with static code transformers like Caja. + */ + _attachHandlers: function(inst) { + var stepMonths = this._get(inst, 'stepMonths'); + var id = '#' + inst.id; + inst.dpDiv.find('[data-handler]').map(function () { + var handler = { + prev: function () { + window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, -stepMonths, 'M'); + }, + next: function () { + window['DP_jQuery_' + dpuuid].datepicker._adjustDate(id, +stepMonths, 'M'); + }, + hide: function () { + window['DP_jQuery_' + dpuuid].datepicker._hideDatepicker(); + }, + today: function () { + window['DP_jQuery_' + dpuuid].datepicker._gotoToday(id); + }, + selectDay: function () { + window['DP_jQuery_' + dpuuid].datepicker._selectDay(id, +this.getAttribute('data-month'), +this.getAttribute('data-year'), this); + return false; + }, + selectMonth: function () { + window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'M'); + return false; + }, + selectYear: function () { + window['DP_jQuery_' + dpuuid].datepicker._selectMonthYear(id, this, 'Y'); + return false; + } + }; + $(this).bind(this.getAttribute('data-event'), handler[this.getAttribute('data-handler')]); + }); + }, + /* Generate the HTML for the current state of the date picker. */ _generateHTML: function(inst) { var today = new Date(); @@ -1444,8 +1482,7 @@ $.extend(Datepicker.prototype, { this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)), this._getFormatConfig(inst))); var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ? - '' + prevText + '' : (hideIfNoPrevNext ? '' : '' + prevText + '')); var nextText = this._get(inst, 'nextText'); @@ -1453,19 +1490,17 @@ $.extend(Datepicker.prototype, { this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)), this._getFormatConfig(inst))); var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ? - '' + nextText + '' : (hideIfNoPrevNext ? '' : '' + nextText + '')); var currentText = this._get(inst, 'currentText'); var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today); currentText = (!navigationAsDateFormat ? currentText : this.formatDate(currentText, gotoDate, this._getFormatConfig(inst))); - var controls = (!inst.inline ? '' : ''); + var controls = (!inst.inline ? '' : ''); var buttonPanel = (showButtonPanel) ? '
' + (isRTL ? controls : '') + - (this._isInRange(inst, gotoDate) ? '' : '') + (isRTL ? '' : controls) + '
' : ''; var firstDay = parseInt(this._get(inst, 'firstDay'),10); firstDay = (isNaN(firstDay) ? 0 : firstDay); @@ -1544,8 +1579,7 @@ $.extend(Datepicker.prototype, { (printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day (printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different) ((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title - (unselectable ? '' : ' onclick="DP_jQuery_' + dpuuid + '.datepicker._selectDay(\'#' + - inst.id + '\',' + printDate.getMonth() + ',' + printDate.getFullYear() + ', this);return false;"') + '>' + // actions + (unselectable ? '' : ' data-handler="selectDay" data-event="click" data-month="' + printDate.getMonth() + '" data-year="' + printDate.getFullYear() + '"') + '>' + // actions (otherMonth && !showOtherMonths ? ' ' : // display for other months (unselectable ? '' + printDate.getDate() + '' : ''; + monthHtml += ''; + inst.yearshtml += '