6 var value
= $( this ).val()
7 .replace( /[\[\]{}|#<>%+? ]/g, '_' ) // eslint-disable-line no-useless-escape
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' ).hide()
18 .closest( '.config-help-field-container' ).find( '.config-help-field-hint' )
21 $( this ).closest( '.config-help-field-container' ).find( '.config-help-field-data' )
22 .slideToggle( 'fast' );
25 // Show/hide code for DB-specific options
26 // FIXME: Do we want slow, fast, or even non-animated (instantaneous) showing/hiding here?
27 $( '.dbRadio' ).each( function () {
28 $( document
.getElementById( $( this ).attr( 'rel' ) ) ).hide();
30 $( document
.getElementById( $( '.dbRadio:checked' ).attr( 'rel' ) ) ).show();
31 $( '.dbRadio' ).click( function () {
32 var $checked
= $( '.dbRadio:checked' ),
33 $wrapper
= $( document
.getElementById( $checked
.attr( 'rel' ) ) );
34 if ( $wrapper
.is( ':hidden' ) ) {
35 $( '.dbWrapper' ).hide( 'slow' );
36 $wrapper
.show( 'slow' );
40 // Scroll to the bottom of upgrade log
41 $( '#config-live-log' ).children( 'textarea' ).each( function () {
42 this.scrollTop
= this.scrollHeight
;
45 // Show/hide Creative Commons thingy
46 $( '.licenseRadio' ).click( function () {
47 var $wrapper
= $( '#config-cc-wrapper' );
48 if ( $( '#config__LicenseCode_cc-choose' ).is( ':checked' ) ) {
49 $wrapper
.show( 'slow' );
51 $wrapper
.hide( 'slow' );
55 // Show/hide random stuff (email, upload)
56 $( '.showHideRadio' ).click( function () {
57 var $wrapper
= $( '#' + $( this ).attr( 'rel' ) );
58 if ( $( this ).is( ':checked' ) ) {
59 $wrapper
.show( 'slow' );
61 $wrapper
.hide( 'slow' );
64 $( '.hideShowRadio' ).click( function () {
65 var $wrapper
= $( '#' + $( this ).attr( 'rel' ) );
66 if ( $( this ).is( ':checked' ) ) {
67 $wrapper
.hide( 'slow' );
69 $wrapper
.show( 'slow' );
73 // Hide "other" textboxes by default
74 // Should not be done in CSS for javascript disabled compatibility
75 $( '.enabledByOther' ).closest( '.config-block' ).hide();
77 // Enable/disable "other" textboxes
78 $( '.enableForOther' ).click( function () {
79 var $textbox
= $( document
.getElementById( $( this ).attr( 'rel' ) ) );
80 // FIXME: Ugh, this is ugly
81 if ( $( this ).val() === 'other' ) {
82 $textbox
.removeProp( 'readonly' ).closest( '.config-block' ).slideDown( 'fast' );
84 $textbox
.prop( 'readonly', true ).closest( '.config-block' ).slideUp( 'fast' );
88 // Synchronize radio button label for sitename with textbox
89 $label
= $( 'label[for=config__NamespaceType_site-name]' );
90 labelText
= $label
.text();
91 $label
.text( labelText
.replace( '$1', '' ) );
92 $( '#config_wgSitename' ).on( 'keyup change', syncText
).each( syncText
);
94 // Show/Hide memcached servers when needed
95 $( 'input[name$="config__MainCacheType"]' ).change( function () {
96 var $memc
= $( '#config-memcachewrapper' );
97 if ( $( 'input[name$="config__MainCacheType"]:checked' ).val() === 'memcached' ) {
100 $memc
.hide( 'slow' );