From 8260f606daa11beb085fd5e064be2bc133b13ea6 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Fri, 17 Aug 2018 19:24:01 +0100 Subject: [PATCH] jquery.expandableField: Remove module unused since 1.22 Was originally created for Vector, which was originally part of MediaWiki core. It hasn't been used for a while, and Vector is in its own repository now. Found 0 uses of this anywhere in Wikimedia Git, nor elsewhere indexed by MediaWiki Codesearch. Bug: T202154 Change-Id: I72ab5ad7f25be87b2f6d2f5f41a672b6a48b8005 --- RELEASE-NOTES-1.32 | 1 + jsduck.json | 1 - resources/Resources.php | 3 - .../src/jquery/jquery.expandableField.js | 147 ------------------ 4 files changed, 1 insertion(+), 151 deletions(-) delete mode 100644 resources/src/jquery/jquery.expandableField.js diff --git a/RELEASE-NOTES-1.32 b/RELEASE-NOTES-1.32 index fb37334d6f..5953a21cd4 100644 --- a/RELEASE-NOTES-1.32 +++ b/RELEASE-NOTES-1.32 @@ -194,6 +194,7 @@ because of Phabricator reports. * The mediawiki.widgets.visibleByteLimit module alias, deprecated in 1.32, was removed. Use mediawiki.widgets.visibleLengthLimit instead. * The jquery.farbtastic module, unused since 1.18, was removed. +* The 'jquery.expandableField' module, unused since 1.22, was removed. * (T181318) The $wgStyleVersion setting and its appendage to various script and style URLs in OutputPage, deprecated in 1.31, was removed. * The hooks 'PreferencesFormPreSave' and 'PreferencesGetLegend' may provide diff --git a/jsduck.json b/jsduck.json index 28473aacb5..6e96945af7 100644 --- a/jsduck.json +++ b/jsduck.json @@ -13,7 +13,6 @@ "resources/src/jquery.tablesorter", "resources/src/jquery.tipsy", "resources/src/jquery/jquery.color.js", - "resources/src/jquery/jquery.expandableField.js", "resources/src/jquery/jquery.highlightText.js", "resources/src/jquery/jquery.mw-jump.js", "resources/src/mediawiki.legacy", diff --git a/resources/Resources.php b/resources/Resources.php index 3cc5f4aee2..e91224230a 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -224,9 +224,6 @@ return [ 'scripts' => 'resources/lib/jquery/jquery.cookie.js', 'targets' => [ 'desktop', 'mobile' ], ], - 'jquery.expandableField' => [ - 'scripts' => 'resources/src/jquery/jquery.expandableField.js', - ], 'jquery.form' => [ 'scripts' => 'resources/lib/jquery/jquery.form.js', ], diff --git a/resources/src/jquery/jquery.expandableField.js b/resources/src/jquery/jquery.expandableField.js deleted file mode 100644 index c3d39dafaf..0000000000 --- a/resources/src/jquery/jquery.expandableField.js +++ /dev/null @@ -1,147 +0,0 @@ -/** - * This plugin provides functionality to expand a text box on focus to double it's current width - * - * Usage: - * - * Set options: - * $('#textbox').expandableField( { option1: value1, option2: value2 } ); - * $('#textbox').expandableField( option, value ); - * Get option: - * value = $('#textbox').expandableField( option ); - * Initialize: - * $('#textbox').expandableField(); - * - * Options: - */ -( function ( $ ) { - - $.expandableField = { - /** - * Expand the field, make the callback - * - * @param {jQuery.Event} e Event - * @param {Object} context - */ - expandField: function ( e, context ) { - context.config.beforeExpand.call( context.data.$field, context ); - context.data.$field - .animate( { width: context.data.expandedWidth }, 'fast', function () { - context.config.afterExpand.call( this, context ); - } ); - }, - /** - * Condense the field, make the callback - * - * @param {jQuery.Event} e Event - * @param {Object} context - */ - condenseField: function ( e, context ) { - context.config.beforeCondense.call( context.data.$field, context ); - context.data.$field - .animate( { width: context.data.condensedWidth }, 'fast', function () { - context.config.afterCondense.call( this, context ); - } ); - }, - /** - * Sets the value of a property, and updates the widget accordingly - * - * @param {Object} context - * @param {string} property Name of property - * @param {Mixed} value Value to set property with - */ - configure: function ( context, property, value ) { - // TODO: Validate creation using fallback values - context.config[ property ] = value; - } - - }; - - $.fn.expandableField = function () { - - // Multi-context fields - var returnValue, - args = arguments; - - $( this ).each( function () { - var key, context, timeout; - - /* Construction / Loading */ - - context = $( this ).data( 'expandableField-context' ); - - // TODO: Do we need to check both null and undefined? - if ( context === undefined || context === null ) { - context = { - config: { - // callback function for before collapse - beforeCondense: function () {}, - - // callback function for before expand - beforeExpand: function () {}, - - // callback function for after collapse - afterCondense: function () {}, - - // callback function for after expand - afterExpand: function () {}, - - // Whether the field should expand to the left or the right -- defaults to left - expandToLeft: true - } - }; - } - - /* API */ - // Handle various calling styles - if ( args.length > 0 ) { - if ( typeof args[ 0 ] === 'object' ) { - // Apply set of properties - for ( key in args[ 0 ] ) { - $.expandableField.configure( context, key, args[ 0 ][ key ] ); - } - } else if ( typeof args[ 0 ] === 'string' ) { - if ( args.length > 1 ) { - // Set property values - $.expandableField.configure( context, args[ 0 ], args[ 1 ] ); - - // TODO: Do we need to check both null and undefined? - } else if ( returnValue === null || returnValue === undefined ) { - // Get property values, but don't give access to internal data - returns only the first - returnValue = ( args[ 0 ] in context.config ? undefined : context.config[ args[ 0 ] ] ); - } - } - } - - /* Initialization */ - - if ( context.data === undefined ) { - context.data = { - // The width of the field in it's condensed state - condensedWidth: $( this ).width(), - - // The width of the field in it's expanded state - expandedWidth: $( this ).width() * 2, - - // Reference to the field - $field: $( this ) - }; - - $( this ) - .addClass( 'expandableField' ) - .focus( function ( e ) { - clearTimeout( timeout ); - $.expandableField.expandField( e, context ); - } ) - .blur( function ( e ) { - timeout = setTimeout( function () { - $.expandableField.condenseField( e, context ); - }, 250 ); - } ); - } - // Store the context for next time - $( this ).data( 'expandableField-context', context ); - } ); - return returnValue !== undefined ? returnValue : $( this ); - }; - -}( jQuery ) ); -- 2.20.1