mirror of
https://github.com/StarCitizenTools/mediawiki-skins-Citizen.git
synced 2024-11-28 00:01:05 +00:00
feat(core): ✨ allow the use of custom search suggestion module
defines the search suggestion ResourceLoader module used by the skin. It deprecates the config
This commit is contained in:
parent
57d50ea5c5
commit
391266c0a7
|
@ -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`
|
||||
|
|
|
@ -44,7 +44,7 @@ class ResourceLoaderHooks {
|
|||
Config $config
|
||||
) {
|
||||
return [
|
||||
'wgCitizenEnableSearch' => $config->get( 'CitizenEnableSearch' ),
|
||||
'wgCitizenSearchModule' => $config->get( 'CitizenSearchModule' ),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ function bindExpandOnSlash( window, checkbox, input ) {
|
|||
*/
|
||||
function initSearch( window ) {
|
||||
const
|
||||
searchConfig = require( './config.json' ).wgCitizenEnableSearch,
|
||||
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', () => {
|
||||
loadSearchModule( input, searchModule, () => {
|
||||
setLoadingIndicatorListeners( searchBox, false, renderSearchLoadingIndicator );
|
||||
} );
|
||||
} else {
|
||||
loadSearchModule( input, 'mediawiki.searchSuggest', () => {} );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
|
|
|
@ -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": {
|
||||
|
|
Loading…
Reference in a new issue