From ff9f57a6a7507bc35fdf714db01f91097e34a0b7 Mon Sep 17 00:00:00 2001 From: tonythomas01 <01tonythomas@gmail.com> Date: Sat, 1 Feb 2014 00:21:35 +0530 Subject: [PATCH] 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 --- .../mediawiki.special.preferences.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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 ); + } + } ); } ); -- 2.20.1