jenkins-bot has submitted this change and it was merged. Change subject: use jQuery.ui.inputextender's new "animation" event in snakview value variation ......................................................................
use jQuery.ui.inputextender's new "animation" event in snakview value variation REQUIRES If57ee1e in DataValues repo. Change-Id: I3c01bd2d6e5a85d84c925dbd860d1dd1b5fc2b11 --- M lib/resources/jquery.wikibase/jquery.wikibase.snakview/snakview.variations.Value.js 1 file changed, 30 insertions(+), 29 deletions(-) Approvals: Henning Snater: Looks good to me, approved jenkins-bot: Verified diff --git a/lib/resources/jquery.wikibase/jquery.wikibase.snakview/snakview.variations.Value.js b/lib/resources/jquery.wikibase/jquery.wikibase.snakview/snakview.variations.Value.js index 971fb56..f5d26af 100644 --- a/lib/resources/jquery.wikibase/jquery.wikibase.snakview/snakview.variations.Value.js +++ b/lib/resources/jquery.wikibase/jquery.wikibase.snakview/snakview.variations.Value.js @@ -179,6 +179,8 @@ */ _attachEventHandlers: function() { var self = this; + var $viewPort = this.$viewPort; + var heightAnimationQueue = self.variationBaseClass + 'height'; this._removeEventHandlers(); @@ -189,46 +191,45 @@ .on( 'valueviewafterparse.' + this.variationBaseClass, function( event ) { self._viewState.notify( ( self._valueView.value() ) ? 'valid' : 'invalid' ); } ) - .on( 'inputextenderanimationstep.' + this.variationBaseClass, function( event, now, tween ) { - if( tween !== undefined && tween.prop === 'opacity' ) { - // Do not do anything when fading. Animation will be performed when fading is - // completed via the animation's "complete" callback triggering an - // "animationstep" event without parameters. - return; - } + .on( 'inputextenderanimation.' + this.variationBaseClass, function( animationEvent ) { + animationEvent.animationCallbacks.add( 'done', function() { + var $input = $( animationEvent.target ); + var $extension = $input.data( 'inputextender' ).extension(); + var newHeight = 0; - var $input = $( event.target ), - $extension = $input.data( 'inputextender' ).extension(), - newHeight = 0; + $viewPort.stop( heightAnimationQueue, true ); - self.$viewPort.stop( true ); + if( $extension ) { + newHeight = $input.outerHeight() + $extension.outerHeight(); + } else { + var currentHeight = $viewPort.height(); + $viewPort.css( 'height', 'auto' ); + newHeight = $viewPort.height(); + $viewPort.height( currentHeight ); + } - if( $extension ) { - newHeight = $input.outerHeight() + $extension.outerHeight(); - } else { - var currentHeight = self.$viewPort.height(); - self.$viewPort.css( 'height', 'auto' ); - newHeight = self.$viewPort.height(); - self.$viewPort.height( currentHeight ); - } - - if( tween === undefined ) { - self.$viewPort.animate( + $viewPort.animate( { height: newHeight }, { + queue: heightAnimationQueue, duration: 250, progress: function( animation, progress, remainingMs ) { $.ui.inputextender.redrawVisibleExtensions(); } } - ); - } else { - self.$viewPort.height( newHeight ); - } + ).dequeue( heightAnimationQueue ); + } ); + } ) + .on( 'inputextendercontentanimation.' + this.variationBaseClass, function( animationEvent ) { + var $input = $( animationEvent.target ); + var inputHeight = $input.outerHeight(); + var $extension = $input.data( 'inputextender' ).extension(); - // Using .height() and .animate() automatically set overflow to "hidden" which we do - // not want since it clips the input element. - self.$viewPort.css( 'overflow', 'visible' ); + animationEvent.animationCallbacks + .add( 'progress', function() { + var newHeight = inputHeight + $extension.outerHeight(); + $viewPort.height( newHeight ); + } ); } ); }, -- To view, visit https://gerrit.wikimedia.org/r/79150 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I3c01bd2d6e5a85d84c925dbd860d1dd1b5fc2b11 Gerrit-PatchSet: 4 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Daniel Werner <daniel.wer...@wikimedia.de> Gerrit-Reviewer: Henning Snater <henning.sna...@wikimedia.de> Gerrit-Reviewer: jenkins-bot _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits