summaryrefslogtreecommitdiff
path: root/resources/src/mediawiki.special/mediawiki.special.import.js
diff options
context:
space:
mode:
Diffstat (limited to 'resources/src/mediawiki.special/mediawiki.special.import.js')
-rw-r--r--resources/src/mediawiki.special/mediawiki.special.import.js35
1 files changed, 35 insertions, 0 deletions
diff --git a/resources/src/mediawiki.special/mediawiki.special.import.js b/resources/src/mediawiki.special/mediawiki.special.import.js
new file mode 100644
index 00000000..a9a985eb
--- /dev/null
+++ b/resources/src/mediawiki.special/mediawiki.special.import.js
@@ -0,0 +1,35 @@
+/*!
+ * JavaScript for Special:Import
+ */
+( function ( $ ) {
+ function updateImportSubprojectList() {
+ var $projectField = $( '#mw-import-table-interwiki #interwiki' ),
+ $subprojectField = $projectField.parent().find( '#subproject' ),
+ $selected = $projectField.find( ':selected' ),
+ oldValue = $subprojectField.val(),
+ option, options;
+
+ if ( $selected.attr( 'data-subprojects' ) ) {
+ options = $.map( $selected.attr( 'data-subprojects' ).split( ' ' ), function ( el ) {
+ option = document.createElement( 'option' );
+ option.appendChild( document.createTextNode( el ) );
+ option.setAttribute( 'value', el );
+ if ( oldValue === el ) {
+ option.setAttribute( 'selected', 'selected' );
+ }
+ return option;
+ } );
+ $subprojectField.show().empty().append( options );
+ } else {
+ $subprojectField.hide();
+ }
+ }
+
+ $( function () {
+ var $projectField = $( '#mw-import-table-interwiki #interwiki' );
+ if ( $projectField.length ) {
+ $projectField.change( updateImportSubprojectList );
+ updateImportSubprojectList();
+ }
+ } );
+}( jQuery ) );