2 * Web-installer progressive enhancement (ported from skins/common/config.js)
4 * Makes elements in the configuration form interactive and hides portions of the form when not in-use
11 $( document
).ready( function() {
12 // Show/hide code for help text
13 $( '.config-show-help a' ).click( function() {
14 $(this).parent().siblings( '.config-help-message' ).show( 'slow' );
15 $(this).parent().siblings( '.config-hide-help' ).show();
16 $(this).parent().hide();
19 $( '.config-hide-help a' ).click( function() {
20 $(this).parent().siblings( '.config-help-message' ).hide( 'slow' );
21 $(this).parent().siblings( '.config-show-help' ).show();
22 $(this).parent().hide();
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() { $( '#' + $(this).attr( 'rel' ) ).hide(); } );
28 $( '#' + $( '.dbRadio:checked' ).attr( 'rel' ) ).show();
29 $( '.dbRadio' ).click( function() {
30 var $checked
= $( '.dbRadio:checked' );
31 var $wrapper
= $( '#' + $checked
.attr( 'rel' ) );
32 if ( !$wrapper
.is( ':visible' ) ) {
33 $( '.dbWrapper' ).hide( 'slow' );
34 $wrapper
.show( 'slow' );
37 // Scroll to the bottom of upgrade log
38 $( "#config-update-log" ).each( function() { this.scrollTop
= this.scrollHeight
; } );
39 // Show/hide Creative Commons thingy
40 $( '.licenseRadio' ).click( function() {
41 var $wrapper
= $( '#config-cc-wrapper' );
42 if ( $( '#config__LicenseCode_cc-choose' ).is( ':checked' ) ) {
43 $wrapper
.show( 'slow' );
45 $wrapper
.hide( 'slow' );
48 // Show/hide random stuff (email, upload)
49 $( '.showHideRadio' ).click( function() {
50 var $wrapper
= $( '#' + $(this).attr( 'rel' ) );
51 if ( $(this).is( ':checked' ) ) {
52 $wrapper
.show( 'slow' );
54 $wrapper
.hide( 'slow' );
57 $( '.hideShowRadio' ).click( function() {
58 var $wrapper
= $( '#' + $(this).attr( 'rel' ) );
59 if ( $(this).is( ':checked' ) ) {
60 $wrapper
.hide( 'slow' );
62 $wrapper
.show( 'slow' );
65 // Enable/disable "other" textboxes
66 $( '.enableForOther' ).click( function() {
67 var $textbox
= $( '#' + $(this).attr( 'rel' ) );
68 if ( $(this).val() == 'other' ) { // FIXME: Ugh, this is ugly
69 $textbox
.removeAttr( 'disabled' );
71 $textbox
.attr( 'disabled', 'disabled' );
74 // Synchronize radio button label for sitename with textbox
75 $label
= $( 'label[for=config__NamespaceType_site-name]' );
76 labelText
= $label
.text();
77 $label
.text( labelText
.replace( '$1', '' ) );
78 $( '#config_wgSitename' ).bind( 'keyup change', syncText
).each( syncText
);
80 var value
= $(this).val()
81 .replace( /[\[\]\{\}|#<>%+? ]/g, '_' )
82 .replace( /&/, '&' )
83 .replace( /__+/g, '_' )
85 .replace( /_+$/, '' );
86 value
= value
.substr( 0, 1 ).toUpperCase() + value
.substr( 1 );
87 $label
.text( labelText
.replace( '$1', value
) );
89 // Show/Hide memcached servers when needed
90 $( "input[name$='config_wgMainCacheType']" ).change( function() {
91 var $memc
= $( "#config-memcachewrapper" );
92 if ( $( "input[name$='config_wgMainCacheType']:checked" ).val() == 'memcached' ) {
100 } )( jQuery
, mediaWiki
);