diff --git a/README.md b/README.md index f707cbf8..d8dbcc4a 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ Name | Description | Values | Default ### Search suggestions Name | Description | Values | Default :--- | :--- | :--- | :--- -`$wgCitizenEnableSearch` | Enable or disable rich search suggestions |`true` - enable; `false` - disable | `true` +`$wgCitizenSearchModule` | Which ResourceLoader module to use for search suggestion (e.g. `mediawiki.searchSuggest`). | string | `skins.citizen.search` `$wgCitizenSearchGateway` | Which gateway to use for fetching search suggestion |`mwActionApi`; `mwRestApi` | `mwActionApi` `$wgCitizenSearchDescriptionSource` | Source of description text on search suggestions (only takes effect if `$wgCitizenSearchGateway` is `mwActionApi`) | `wikidata` - Use description provided by [WikibaseLib](Extension:WikibaseLib) or [ShortDescription](https://www.mediawiki.org/wiki/Extension:ShortDescription); `textextracts` - Use description provided by [TextExtracts](https://www.mediawiki.org/wiki/Extension:TextExtracts); `pagedescription` - Use description provided by [Description2](https://www.mediawiki.org/wiki/Extension:Description2) or any other extension that sets the `description` page property | `textextracts` `$wgCitizenMaxSearchResults` | Max number of search suggestions | Integer > 0 | `6` diff --git a/includes/Hooks/ResourceLoaderHooks.php b/includes/Hooks/ResourceLoaderHooks.php index b32f5abf..52212282 100644 --- a/includes/Hooks/ResourceLoaderHooks.php +++ b/includes/Hooks/ResourceLoaderHooks.php @@ -44,7 +44,7 @@ class ResourceLoaderHooks { Config $config ) { return [ - 'wgCitizenEnableSearch' => $config->get( 'CitizenEnableSearch' ), + 'wgCitizenSearchModule' => $config->get( 'CitizenSearchModule' ), ]; } diff --git a/resources/skins.citizen.scripts/search.js b/resources/skins.citizen.scripts/search.js index d3a5c535..f27434d0 100644 --- a/resources/skins.citizen.scripts/search.js +++ b/resources/skins.citizen.scripts/search.js @@ -142,8 +142,8 @@ function bindExpandOnSlash( window, checkbox, input ) { * @return {void} */ function initSearch( window ) { - const - searchConfig = require( './config.json' ).wgCitizenEnableSearch, + const + searchModule = require( './config.json' ).wgCitizenSearchModule, searchBoxes = document.querySelectorAll( '.citizen-search-box' ); if ( !searchBoxes.length ) { @@ -169,14 +169,10 @@ function initSearch( window ) { } ); } - if ( searchConfig ) { - setLoadingIndicatorListeners( searchBox, true, renderSearchLoadingIndicator ); - loadSearchModule( input, 'skins.citizen.search', () => { - setLoadingIndicatorListeners( searchBox, false, renderSearchLoadingIndicator ); - } ); - } else { - loadSearchModule( input, 'mediawiki.searchSuggest', () => {} ); - } + setLoadingIndicatorListeners( searchBox, true, renderSearchLoadingIndicator ); + loadSearchModule( input, searchModule, () => { + setLoadingIndicatorListeners( searchBox, false, renderSearchLoadingIndicator ); + } ); } ); } diff --git a/skin.json b/skin.json index 36f12ad3..8013435b 100644 --- a/skin.json +++ b/skin.json @@ -545,10 +545,10 @@ "descriptionmsg": "citizen-config-manifestbackgroundcolor", "public": true }, - "EnableSearch": { - "value": true, - "description": "Enable or disable rich search suggestions", - "descriptionmsg": "citizen-config-enablesearch", + "SearchModule": { + "value": "skins.citizen.search", + "description": "Which module to use for search suggestion. Avaliable options: [citizen|mw]", + "descriptionmsg": "citizen-config-searchmodule", "public": true }, "SearchGateway": {