Merge "Minor CSS cleanup for Vector and Monobook skins"
[mediawiki.git] / resources / mediawiki.special / mediawiki.special.javaScriptTest.js
bloba560ca95aa273c558675d9af57a5fd8924a8af48
1 /**
2  * JavaScript for Special:JavaScriptTest
3  */
4 ( function ( mw, $ ) {
5         $( function () {
7                 // Create useskin dropdown menu and reload onchange to the selected skin
8                 // (only if a framework was found, not on error pages).
9                 $( '#mw-javascripttest-summary.mw-javascripttest-frameworkfound' ).append( function () {
11                         var $html = $( '<p><label for="useskin">'
12                                         + mw.message( 'javascripttest-pagetext-skins' ).escaped()
13                                         + ' '
14                                         + '</label></p>' ),
15                                 select = '<select name="useskin" id="useskin">';
17                         // Build <select> further
18                         $.each( mw.config.get( 'wgAvailableSkins' ), function ( id ) {
19                                 select += '<option value="' + id + '"'
20                                         + ( mw.config.get( 'skin' ) === id ? ' selected="selected"' : '' )
21                                         + '>' + mw.message( 'skinname-' + id ).escaped() + '</option>';
22                         } );
23                         select += '</select>';
25                         // Bind onchange event handler and append to form
26                         $html.append(
27                                 $( select ).change( function () {
28                                         window.location = QUnit.url( { useskin: $(this).val() } );
29                                 } )
30                         );
32                         return $html;
33                 } );
34         } );
36 }( mediaWiki, jQuery ) );