Merge "Remove not used private member variable mParserWarnings from OutputPage"
[mediawiki.git] / resources / src / mediawiki.special / mediawiki.special.import.js
blob5622b32a3837484c3b88099f48cf19cd84e220b3
1 /*!
2  * JavaScript for Special:Import
3  */
4 ( function ( $ ) {
5         function updateImportSubprojectList( firstTime ) {
6                 var $projectField = $( '#mw-import-table-interwiki #interwiki' ),
7                         $subprojectField = $projectField.parent().find( '#subproject' ),
8                         $selected = $projectField.find( ':selected' ),
9                         oldValue = $subprojectField.val(),
10                         option, options;
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 && firstTime !== true ) {
18                                         option.setAttribute( 'selected', 'selected' );
19                                 }
20                                 return option;
21                         } );
22                         $subprojectField.show().empty().append( options );
23                 } else {
24                         $subprojectField.hide();
25                 }
26         }
28         $( function () {
29                 var $projectField = $( '#mw-import-table-interwiki #interwiki' );
30                 if ( $projectField.length ) {
31                         $projectField.change( updateImportSubprojectList );
32                         updateImportSubprojectList( true );
33                 }
34         } );
35 }( jQuery ) );