2 * JavaScript for Special:Import
5 function updateImportSubprojectList() {
6 var $projectField = $( '#mw-import-table-interwiki #interwiki' ),
7 $subprojectField = $projectField.parent().find( '#subproject' ),
8 $selected = $projectField.find( ':selected' ),
9 oldValue = $subprojectField.val(),
12 if ( $selected.attr( 'data-subprojects' ) ) {
13 options = $.map( $selected.attr( 'data-subprojects' ).split( ' ' ), function ( el ) {
14 option = document.createElement( 'option' );
15 option.appendChild( document.createTextNode( el ) );
16 option.setAttribute( 'value', el );
17 if ( oldValue === el ) {
18 option.setAttribute( 'selected', 'selected' );
22 $subprojectField.show().empty().append( options );
24 $subprojectField.hide();
29 var $projectField = $( '#mw-import-table-interwiki #interwiki' );
30 if ( $projectField.length ) {
31 $projectField.change( updateImportSubprojectList );
32 updateImportSubprojectList();