diff options
author | Nicolas Lécureuil <neoclust@mageia.org> | 2017-04-19 00:18:12 +0200 |
---|---|---|
committer | Nicolas Lécureuil <neoclust@mageia.org> | 2017-04-19 00:18:12 +0200 |
commit | 0e8b7f021f27e524f8c0b25dca600c00fd2c2468 (patch) | |
tree | a1194ff372adcc235bcfea361af8830ed954456a /common/config.js | |
parent | 14ffe3143e36d79ef7054b293e51f3fb4b658224 (diff) | |
download | mediawiki-0e8b7f021f27e524f8c0b25dca600c00fd2c2468.tar mediawiki-0e8b7f021f27e524f8c0b25dca600c00fd2c2468.tar.gz mediawiki-0e8b7f021f27e524f8c0b25dca600c00fd2c2468.tar.bz2 mediawiki-0e8b7f021f27e524f8c0b25dca600c00fd2c2468.tar.xz mediawiki-0e8b7f021f27e524f8c0b25dca600c00fd2c2468.zip |
Add mw 1.23.15 themes
Diffstat (limited to 'common/config.js')
-rw-r--r-- | common/config.js | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/common/config.js b/common/config.js new file mode 100644 index 0000000..2886e08 --- /dev/null +++ b/common/config.js @@ -0,0 +1,108 @@ +( function ( $ ) { + $( function () { + var $label, labelText; + + function syncText() { + var value = $(this).val() + .replace( /[\[\]\{\}|#<>%+? ]/g, '_' ) + .replace( /&/, '&' ) + .replace( /__+/g, '_' ) + .replace( /^_+/, '' ) + .replace( /_+$/, '' ); + value = value.substr( 0, 1 ).toUpperCase() + value.substr( 1 ); + $label.text( labelText.replace( '$1', value ) ); + } + + // Set up the help system + $( '.mw-help-field-data' ) + .hide() + .closest( '.mw-help-field-container' ) + .find( '.mw-help-field-hint' ) + .show() + .click( function () { + $(this) + .closest( '.mw-help-field-container' ) + .find( '.mw-help-field-data' ) + .slideToggle( 'fast' ); + } ); + + // Show/hide code for DB-specific options + // FIXME: Do we want slow, fast, or even non-animated (instantaneous) showing/hiding here? + $( '.dbRadio' ).each( function () { + $( document.getElementById( $(this).attr( 'rel' ) ) ).hide(); + } ); + $( document.getElementById( $( '.dbRadio:checked' ).attr( 'rel' ) ) ).show(); + $( '.dbRadio' ).click( function () { + var $checked = $( '.dbRadio:checked' ), + $wrapper = $( document.getElementById( $checked.attr( 'rel' ) ) ); + if ( $wrapper.is( ':hidden' ) ) { + $( '.dbWrapper' ).hide( 'slow' ); + $wrapper.show( 'slow' ); + } + } ); + + // Scroll to the bottom of upgrade log + $( '#config-live-log' ).children( 'textarea' ).each( function () { + this.scrollTop = this.scrollHeight; + } ); + + // Show/hide Creative Commons thingy + $( '.licenseRadio' ).click( function () { + var $wrapper = $( '#config-cc-wrapper' ); + if ( $( '#config__LicenseCode_cc-choose' ).is( ':checked' ) ) { + $wrapper.show( 'slow' ); + } else { + $wrapper.hide( 'slow' ); + } + } ); + + // Show/hide random stuff (email, upload) + $( '.showHideRadio' ).click( function () { + var $wrapper = $( '#' + $(this).attr( 'rel' ) ); + if ( $(this).is( ':checked' ) ) { + $wrapper.show( 'slow' ); + } else { + $wrapper.hide( 'slow' ); + } + } ); + $( '.hideShowRadio' ).click( function () { + var $wrapper = $( '#' + $(this).attr( 'rel' ) ); + if ( $(this).is( ':checked' ) ) { + $wrapper.hide( 'slow' ); + } else { + $wrapper.show( 'slow' ); + } + } ); + + // Hide "other" textboxes by default + // Should not be done in CSS for javascript disabled compatibility + $( '.enabledByOther' ).closest( '.config-block' ).hide(); + + // Enable/disable "other" textboxes + $( '.enableForOther' ).click( function () { + var $textbox = $( document.getElementById( $(this).attr( 'rel' ) ) ); + // FIXME: Ugh, this is ugly + if ( $(this).val() === 'other' ) { + $textbox.removeProp( 'readonly' ).closest( '.config-block' ).slideDown( 'fast' ); + } else { + $textbox.prop( 'readonly', true ).closest( '.config-block' ).slideUp( 'fast' ); + } + } ); + + // Synchronize radio button label for sitename with textbox + $label = $( 'label[for=config__NamespaceType_site-name]' ); + labelText = $label.text(); + $label.text( labelText.replace( '$1', '' ) ); + $( '#config_wgSitename' ).on( 'keyup change', syncText ).each( syncText ); + + // Show/Hide memcached servers when needed + $( 'input[name$="config_wgMainCacheType"]' ).change( function () { + var $memc = $( '#config-memcachewrapper' ); + if ( $( 'input[name$="config_wgMainCacheType"]:checked' ).val() === 'memcached' ) { + $memc.show( 'slow' ); + } else { + $memc.hide( 'slow' ); + } + } ); + } ); +}( jQuery ) ); |