6 var value = $( this ).val()
7 .replace( /[\[\]\{\}|#<>%+? ]/g, '_' )
8 .replace( /&/, '&' )
9 .replace( /__+/g, '_' )
11 .replace( /_+$/, '' );
12 value = value.charAt( 0 ).toUpperCase() + value.slice( 1 );
13 $label.text( labelText.replace( '$1', value ) );
16 // Set up the help system
17 $( '.config-help-field-data' )
19 .closest( '.config-help-field-container' )
20 .find( '.config-help-field-hint' )
24 .closest( '.config-help-field-container' )
25 .find( '.config-help-field-data' )
26 .slideToggle( 'fast' );
29 // Show/hide code for DB-specific options
30 // FIXME: Do we want slow, fast, or even non-animated (instantaneous) showing/hiding here?
31 $( '.dbRadio' ).each( function () {
32 $( document.getElementById( $( this ).attr( 'rel' ) ) ).hide();
34 $( document.getElementById( $( '.dbRadio:checked' ).attr( 'rel' ) ) ).show();
35 $( '.dbRadio' ).click( function () {
36 var $checked = $( '.dbRadio:checked' ),
37 $wrapper = $( document.getElementById( $checked.attr( 'rel' ) ) );
38 if ( $wrapper.is( ':hidden' ) ) {
39 $( '.dbWrapper' ).hide( 'slow' );
40 $wrapper.show( 'slow' );
44 // Scroll to the bottom of upgrade log
45 $( '#config-live-log' ).children( 'textarea' ).each( function () {
46 this.scrollTop = this.scrollHeight;
49 // Show/hide Creative Commons thingy
50 $( '.licenseRadio' ).click( function () {
51 var $wrapper = $( '#config-cc-wrapper' );
52 if ( $( '#config__LicenseCode_cc-choose' ).is( ':checked' ) ) {
53 $wrapper.show( 'slow' );
55 $wrapper.hide( 'slow' );
59 // Show/hide random stuff (email, upload)
60 $( '.showHideRadio' ).click( function () {
61 var $wrapper = $( '#' + $( this ).attr( 'rel' ) );
62 if ( $( this ).is( ':checked' ) ) {
63 $wrapper.show( 'slow' );
65 $wrapper.hide( 'slow' );
68 $( '.hideShowRadio' ).click( function () {
69 var $wrapper = $( '#' + $( this ).attr( 'rel' ) );
70 if ( $( this ).is( ':checked' ) ) {
71 $wrapper.hide( 'slow' );
73 $wrapper.show( 'slow' );
77 // Hide "other" textboxes by default
78 // Should not be done in CSS for javascript disabled compatibility
79 $( '.enabledByOther' ).closest( '.config-block' ).hide();
81 // Enable/disable "other" textboxes
82 $( '.enableForOther' ).click( function () {
83 var $textbox = $( document.getElementById( $( this ).attr( 'rel' ) ) );
84 // FIXME: Ugh, this is ugly
85 if ( $( this ).val() === 'other' ) {
86 $textbox.removeProp( 'readonly' ).closest( '.config-block' ).slideDown( 'fast' );
88 $textbox.prop( 'readonly', true ).closest( '.config-block' ).slideUp( 'fast' );
92 // Synchronize radio button label for sitename with textbox
93 $label = $( 'label[for=config__NamespaceType_site-name]' );
94 labelText = $label.text();
95 $label.text( labelText.replace( '$1', '' ) );
96 $( '#config_wgSitename' ).on( 'keyup change', syncText ).each( syncText );
98 // Show/Hide memcached servers when needed
99 $( 'input[name$="config__MainCacheType"]' ).change( function () {
100 var $memc = $( '#config-memcachewrapper' );
101 if ( $( 'input[name$="config__MainCacheType"]:checked' ).val() === 'memcached' ) {
102 $memc.show( 'slow' );
104 $memc.hide( 'slow' );