2 $( document
).ready( function() {
5 // Set up the help system
6 $( '.mw-help-field-data' )
8 .closest( '.mw-help-field-container' )
9 .find( '.mw-help-field-hint' )
13 .closest( '.mw-help-field-container' )
14 .find( '.mw-help-field-data' )
15 .slideToggle( 'fast' );
18 // Show/hide code for DB-specific options
19 // FIXME: Do we want slow, fast, or even non-animated (instantaneous) showing/hiding here?
20 $( '.dbRadio' ).each( function() { $( '#' + $(this).attr( 'rel' ) ).hide(); } );
21 $( '#' + $( '.dbRadio:checked' ).attr( 'rel' ) ).show();
22 $( '.dbRadio' ).click( function() {
23 var $checked
= $( '.dbRadio:checked' );
24 var $wrapper
= $( '#' + $checked
.attr( 'rel' ) );
25 if ( !$wrapper
.is( ':visible' ) ) {
26 $( '.dbWrapper' ).hide( 'slow' );
27 $wrapper
.show( 'slow' );
31 // Scroll to the bottom of upgrade log
32 $( '#config-live-log' ).find( '> textarea' ).each( function() { this.scrollTop
= this.scrollHeight
; } );
34 // Show/hide Creative Commons thingy
35 $( '.licenseRadio' ).click( function() {
36 var $wrapper
= $( '#config-cc-wrapper' );
37 if ( $( '#config__LicenseCode_cc-choose' ).is( ':checked' ) ) {
38 $wrapper
.show( 'slow' );
40 $wrapper
.hide( 'slow' );
44 // Show/hide random stuff (email, upload)
45 $( '.showHideRadio' ).click( function() {
46 var $wrapper
= $( '#' + $(this).attr( 'rel' ) );
47 if ( $(this).is( ':checked' ) ) {
48 $wrapper
.show( 'slow' );
50 $wrapper
.hide( 'slow' );
53 $( '.hideShowRadio' ).click( function() {
54 var $wrapper
= $( '#' + $(this).attr( 'rel' ) );
55 if ( $(this).is( ':checked' ) ) {
56 $wrapper
.hide( 'slow' );
58 $wrapper
.show( 'slow' );
62 // Hide "other" textboxes by default
63 // Should not be done in CSS for javascript disabled compatibility
64 $( '.enabledByOther' ).closest( '.config-block' ).hide();
66 // Enable/disable "other" textboxes
67 $( '.enableForOther' ).click( function() {
68 var $textbox
= $( '#' + $(this).attr( 'rel' ) );
69 if ( $(this).val() == 'other' ) { // FIXME: Ugh, this is ugly
70 $textbox
.removeProp( 'readonly' ).closest( '.config-block' ).slideDown( 'fast' );
72 $textbox
.prop( 'readonly', true ).closest( '.config-block' ).slideUp( 'fast' );
76 // Synchronize radio button label for sitename with textbox
77 $label
= $( 'label[for=config__NamespaceType_site-name]' );
78 labelText
= $label
.text();
79 $label
.text( labelText
.replace( '$1', '' ) );
80 $( '#config_wgSitename' ).bind( 'keyup change', syncText
).each( syncText
);
82 var value
= $(this).val()
83 .replace( /[\[\]\{\}|#<>%+? ]/g, '_' )
84 .replace( /&/, '&' )
85 .replace( /__+/g, '_' )
87 .replace( /_+$/, '' );
88 value
= value
.substr( 0, 1 ).toUpperCase() + value
.substr( 1 );
89 $label
.text( labelText
.replace( '$1', value
) );
92 // Show/Hide memcached servers when needed
93 $("input[name$='config_wgMainCacheType']").change( function() {
94 var $memc
= $( "#config-memcachewrapper" );
95 if( $( "input[name$='config_wgMainCacheType']:checked" ).val() == 'memcached' ) {