Merge "Always use the canonical extension name to link the license file"
[lhc/web/wiklou.git] / resources / src / mediawiki.special / mediawiki.special.javaScriptTest.js
1 /*!
2 * JavaScript for Special:JavaScriptTest
3 */
4 ( function ( mw, $ ) {
5 $( function () {
6
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 () {
10
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">';
16
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>';
24
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 );
32
33 return $html;
34 } );
35 } );
36
37 }( mediaWiki, jQuery ) );