From: georggi Date: Sat, 16 Jan 2016 13:00:39 +0000 (+0200) Subject: Special:Import: Select first subproject if first project was empty X-Git-Tag: 1.31.0-rc.0~8313^2 X-Git-Url: http://git.cyclocoop.org/%27%2C%20%20%20quote_amp%28%24url%29%2C%20%20%20%27?a=commitdiff_plain;h=99d5da945de001f5d6eddaf93e12ed474c869bb1;p=lhc%2Fweb%2Fwiklou.git Special:Import: Select first subproject if first project was empty Previously, the first subproject in alphabetical order would be selected the first time the subproject dropdown was shown. Now, the first subproject in the list is selected, making it easier for common selections to be placed at the top of the list. Change-Id: Id6b9c6076630e4dad70ebe0f1185a59015b9a01f --- diff --git a/resources/src/mediawiki.special/mediawiki.special.import.js b/resources/src/mediawiki.special/mediawiki.special.import.js index 5622b32a38..3357461f2a 100644 --- a/resources/src/mediawiki.special/mediawiki.special.import.js +++ b/resources/src/mediawiki.special/mediawiki.special.import.js @@ -2,7 +2,8 @@ * JavaScript for Special:Import */ ( function ( $ ) { - function updateImportSubprojectList( firstTime ) { + var subprojectListAlreadyShown; + function updateImportSubprojectList() { var $projectField = $( '#mw-import-table-interwiki #interwiki' ), $subprojectField = $projectField.parent().find( '#subproject' ), $selected = $projectField.find( ':selected' ), @@ -14,12 +15,13 @@ option = document.createElement( 'option' ); option.appendChild( document.createTextNode( el ) ); option.setAttribute( 'value', el ); - if ( oldValue === el && firstTime !== true ) { + if ( oldValue === el && subprojectListAlreadyShown === true ) { option.setAttribute( 'selected', 'selected' ); } return option; } ); $subprojectField.show().empty().append( options ); + subprojectListAlreadyShown = true; } else { $subprojectField.hide(); } @@ -29,7 +31,7 @@ var $projectField = $( '#mw-import-table-interwiki #interwiki' ); if ( $projectField.length ) { $projectField.change( updateImportSubprojectList ); - updateImportSubprojectList( true ); + updateImportSubprojectList(); } } ); }( jQuery ) );