Merge "DatabaseMssql: Don't duplicate body of makeList()"
[mediawiki.git] / resources / src / mediawiki.special / mediawiki.special.javaScriptTest.js
blobfb74e4ec2ed5cdb21ab9900991a65494db465fca
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' ).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                                         var url = new mw.Uri();
29                                         location.href = url.extend( { useskin: $( this ).val() } );
30                                 } )
31                         );
33                         return $html;
34                 } );
35         } );
37 }( mediaWiki, jQuery ) );