From: tonythomas01 <01tonythomas@gmail.com> Date: Fri, 31 Jan 2014 18:51:35 +0000 (+0530) Subject: Ticking 'Search in all namespaces' in prefs should disable other checkboxes X-Git-Tag: 1.31.0-rc.0~16844^2 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=ff9f57a6a7507bc35fdf714db01f91097e34a0b7;p=lhc%2Fweb%2Fwiklou.git Ticking 'Search in all namespaces' in prefs should disable other checkboxes Ticking 'Search in all namespaces' will disable all other checkboxes below. They will regain their original state once it is unticked. Bug: 60285 Change-Id: Ie62b9186e98dd770de4282ea57d7248158a6e782 --- diff --git a/resources/mediawiki.special/mediawiki.special.preferences.js b/resources/mediawiki.special/mediawiki.special.preferences.js index 0078724f95..7f1fd43345 100644 --- a/resources/mediawiki.special/mediawiki.special.preferences.js +++ b/resources/mediawiki.special/mediawiki.special.preferences.js @@ -4,7 +4,8 @@ jQuery( function ( $ ) { var $preftoc, $preferences, $fieldsets, $legends, hash, labelFunc, - $tzSelect, $tzTextbox, $localtimeHolder, servertime; + $tzSelect, $tzTextbox, $localtimeHolder, servertime, + $checkBoxes; labelFunc = function () { return this.id.replace( /^mw-prefsection/g, 'preftab' ); @@ -253,4 +254,18 @@ jQuery( function ( $ ) { sessionStorage.setItem( 'mediawikiPreferencesTab', storageData ); } ); } + + // To disable all 'namespace' checkboxes in Search preferences + // when 'Search in all namespaces' checkbox is ticked. + $checkBoxes = $( '#mw-htmlform-advancedsearchoptions input[id^=mw-input-wpsearchnamespaces]' ); + if ( $( '#mw-input-wpsearcheverything' ).prop( 'checked' ) ) { + $checkBoxes.prop( 'disabled', true ); + } + $( '#mw-input-wpsearcheverything' ).change( function () { + if ( $( this ).prop( 'checked' ) ) { + $checkBoxes.prop( 'disabled', true ); + } else { + $checkBoxes.prop( 'disabled', false ); + } + } ); } );