jenkins-bot has submitted this change and it was merged. Change subject: Remove jquery.effects.blind dependency from tagadata ......................................................................
Remove jquery.effects.blind dependency from tagadata This patch removes a minor animation effect that is not used anyway. Main reason for this patch is to get rid of this jQuery dependency. There is a lot more in the tagadata code I would like to remove but I wanted this patch to focus on a single detail. Change-Id: Iff459f28d9f5faa6265ed5345722eb6492b429b1 --- M view/resources/jquery/ui/jquery.ui.tagadata.js M view/resources/jquery/ui/resources.php M view/resources/jquery/wikibase/jquery.wikibase.aliasesview.js M view/tests/qunit/jquery/ui/jquery.ui.tagadata.tests.js 4 files changed, 14 insertions(+), 38 deletions(-) Approvals: Hoo man: Looks good to me, approved jenkins-bot: Verified diff --git a/view/resources/jquery/ui/jquery.ui.tagadata.js b/view/resources/jquery/ui/jquery.ui.tagadata.js index 4152d2b..39a8d4d 100644 --- a/view/resources/jquery/ui/jquery.ui.tagadata.js +++ b/view/resources/jquery/ui/jquery.ui.tagadata.js @@ -34,10 +34,6 @@ * Text used as placeholder in the input field if no text has been typed yet. * Default: '' * - * @option {boolean} [anmiate] - * Whether to animate tag removals or not. - * Default: true - * * @option {number[]} [triggerKeys] * Keys which - when pressed in the input area - will trigger the current input to be added * as tag. $.ui.keyCode members can be used for convenience. @@ -92,7 +88,6 @@ editableTags: true, caseSensitive: true, placeholderText: null, - animate: true, triggerKeys: [] }, @@ -157,7 +152,7 @@ $tag.remove(); // completely remove helper } else { $tag - .removeClass( 'tagadata-choice tagadata-choice-removed ui-widget-content ' + .removeClass( 'tagadata-choice ui-widget-content ' + 'ui-state-default ui-corner-all ui-state-highlight remove' ) .empty() .off( '.' + this.widgetName ) @@ -185,16 +180,12 @@ usedLabels = []; this._$tagList.children( '.tagadata-choice' ).each( function() { - var $tag = $( this ); + var $tag = $( this ), + tagLabel = self.getTagLabel( $tag ); - // Check if already removed but still assigned till animations end: - if ( !$tag.hasClass( 'tagadata-choice-removed' ) ) { - var tagLabel = self.getTagLabel( $tag ); - - if ( tagLabel !== '' && $.inArray( tagLabel, usedLabels ) === -1 ) { - $tags = $tags.add( this ); - usedLabels.push( tagLabel ); - } + if ( tagLabel !== '' && $.inArray( tagLabel, usedLabels ) === -1 ) { + $tags = $tags.add( this ); + usedLabels.push( tagLabel ); } } ); return $tags; @@ -527,14 +518,9 @@ * Removes a tag. * * @param {jQuery} $tag - * @param {boolean} [animate] * @return {boolean} */ - removeTag: function( $tag, animate ) { - var self = this; - - animate = animate || this.options.animate; - + removeTag: function( $tag ) { if ( !$tag.hasClass( 'tagadata-choice' ) || !this._$tagList[0].contains( $tag[0] ) ) { @@ -549,16 +535,8 @@ equalTags.removeClass( 'tagadata-choice-equal' ); } - if ( animate ) { - $tag.addClass( 'tagadata-choice-removed' ); - $tag.fadeOut( 'fast' ).hide( 'blind', { direction: 'horizontal' }, 'fast', function() { - $tag.remove(); - self._trigger( 'tagRemoved', null, $tag ); - } ); - } else { - $tag.remove(); - this._trigger( 'tagRemoved', null, $tag ); - } + $tag.remove(); + this._trigger( 'tagRemoved', null, $tag ); return true; }, @@ -569,7 +547,7 @@ removeAll: function() { var self = this; this._$tagList.children( '.tagadata-choice' ).each( function() { - self.removeTag( $( this ), false ); + self.removeTag( $( this ) ); } ); }, diff --git a/view/resources/jquery/ui/resources.php b/view/resources/jquery/ui/resources.php index 15acae9..ee7fc3f 100644 --- a/view/resources/jquery/ui/resources.php +++ b/view/resources/jquery/ui/resources.php @@ -37,7 +37,7 @@ ), 'dependencies' => array( 'jquery.event.special.eachchange', - 'jquery.effects.blind', + 'jquery.effects.core', 'jquery.inputautoexpand', 'jquery.ui.widget', ), diff --git a/view/resources/jquery/wikibase/jquery.wikibase.aliasesview.js b/view/resources/jquery/wikibase/jquery.wikibase.aliasesview.js index a7093f4..2259722 100644 --- a/view/resources/jquery/wikibase/jquery.wikibase.aliasesview.js +++ b/view/resources/jquery/wikibase/jquery.wikibase.aliasesview.js @@ -113,7 +113,6 @@ this.$list .tagadata( { - animate: false, placeholderText: mw.msg( 'wikibase-alias-edit-placeholder' ) } ) .on( diff --git a/view/tests/qunit/jquery/ui/jquery.ui.tagadata.tests.js b/view/tests/qunit/jquery/ui/jquery.ui.tagadata.tests.js index 6ce617f..0deddb2 100644 --- a/view/tests/qunit/jquery/ui/jquery.ui.tagadata.tests.js +++ b/view/tests/qunit/jquery/ui/jquery.ui.tagadata.tests.js @@ -7,16 +7,15 @@ 'use strict'; /** - * @param {Object} [options] * @return {jQuery} */ -function createTagadata( options ) { +function createTagadata() { return $( '<ul/>' ) .addClass( 'test_tagadata' ) .append( $( '<li/>' ).text( 'A' ) ) .append( $( '<li/>' ).text( 'B' ) ) .append( $( '<li/>' ).text( 'C' ) ) - .tagadata( options || {} ) + .tagadata() .appendTo( 'body' ); } @@ -164,7 +163,7 @@ QUnit.test( 'hasConflict()', function( assert ) { assert.expect( 5 ); - var $tagadata = createTagadata( { animate: false } ), + var $tagadata = createTagadata(), tagadata = $tagadata.data( 'tagadata' ); assert.ok( -- To view, visit https://gerrit.wikimedia.org/r/314652 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Iff459f28d9f5faa6265ed5345722eb6492b429b1 Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> Gerrit-Reviewer: Hoo man <h...@online.de> Gerrit-Reviewer: Jonas Kress (WMDE) <jonas.kr...@wikimedia.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits