2 $( document
).ready( function() {
3 // Show/hide code for help text
4 $( '.config-show-help a' ).click( function() {
5 $(this).parent().siblings( '.config-help-message' ).show( 'slow' );
6 $(this).parent().siblings( '.config-hide-help' ).show();
7 $(this).parent().hide();
10 $( '.config-hide-help a' ).click( function() {
11 $(this).parent().siblings( '.config-help-message' ).hide( 'slow' );
12 $(this).parent().siblings( '.config-show-help' ).show();
13 $(this).parent().hide();
17 // Show/hide code for DB-specific options
18 // FIXME: Do we want slow, fast, or even non-animated (instantaneous) showing/hiding here?
19 $( '.dbRadio' ).each( function() { $( '#' + $(this).attr( 'rel' ) ).hide(); } );
20 $( '#' + $( '.dbRadio:checked' ).attr( 'rel' ) ).show();
21 $( '.dbRadio' ).click( function() {
22 var $checked
= $( '.dbRadio:checked' );
23 var $wrapper
= $( '#' + $checked
.attr( 'rel' ) );
24 if ( !$wrapper
.is( ':visible' ) ) {
25 $( '.dbWrapper' ).hide( 'slow' );
26 $wrapper
.show( 'slow' );
30 // Scroll to the bottom of upgrade log
31 $( "#config-update-log" ).each( function() { this.scrollTop
= this.scrollHeight
; } );
33 // Show/hide Creative Commons thingy
34 $( '.licenseRadio' ).click( function() {
35 var $wrapper
= $( '#config-cc-wrapper' );
36 if ( $( '#config__LicenseCode_cc-choose' ).is( ':checked' ) ) {
37 $wrapper
.show( 'slow' );
39 $wrapper
.hide( 'slow' );
43 // Show/hide random stuff (email, upload)
44 $( '.showHideRadio' ).click( function() {
45 var $wrapper
= $( '#' + $(this).attr( 'rel' ) );
46 if ( $(this).is( ':checked' ) ) {
47 $wrapper
.show( 'slow' );
49 $wrapper
.hide( 'slow' );
52 $( '.hideShowRadio' ).click( function() {
53 var $wrapper
= $( '#' + $(this).attr( 'rel' ) );
54 if ( $(this).is( ':checked' ) ) {
55 $wrapper
.hide( 'slow' );
57 $wrapper
.show( 'slow' );
61 // Enable/disable "other" textboxes
62 $( '.enableForOther' ).click( function() {
63 var $textbox
= $( '#' + $(this).attr( 'rel' ) );
64 if ( $(this).val() == 'other' ) { // FIXME: Ugh, this is ugly
65 $textbox
.removeAttr( 'disabled' );
67 $textbox
.attr( 'disabled', 'disabled' );
71 // Synchronize radio button label for sitename with textbox
72 $label
= $( 'label[for=config__NamespaceType_site-name]' );
73 labelText
= $label
.text();
74 $label
.text( labelText
.replace( '$1', '' ) );
75 $( '#config_wgSitename' ).bind( 'keyup change', syncText
).each( syncText
);
77 var value
= $(this).val()
78 .replace( /[\[\]\{\}|#<>%+? ]/g, '_' )
79 .replace( /&/, '&' )
80 .replace( /__+/g, '_' )
82 .replace( /_+$/, '' );
83 value
= value
.substr( 0, 1 ).toUpperCase() + value
.substr( 1 );
84 $label
.text( labelText
.replace( '$1', value
) );