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