父节点
8424620e18
当前提交
43fbbb2469
|
@ -33,6 +33,7 @@ function getGateway() {
|
|||
* @param {AbortController} controller
|
||||
* @return {Object} Results
|
||||
*/
|
||||
// eslint-disable-next-line es-x/no-async-functions
|
||||
async function getResults( searchQuery, controller ) {
|
||||
const gateway = getGateway();
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
/* eslint-disable es-x/no-optional-chaining */
|
||||
/* eslint-disable es-x/no-symbol-prototype-description */
|
||||
const config = require( '../config.json' ),
|
||||
descriptionSource = config.wgCitizenSearchDescriptionSource;
|
||||
|
||||
|
@ -84,6 +86,7 @@ function convertDataToResults( data ) {
|
|||
return [];
|
||||
}
|
||||
|
||||
// eslint-disable-next-line es-x/no-object-values, compat/compat
|
||||
data = Object.values( data.query.pages );
|
||||
|
||||
// Sort the data with the index property since it is not in order
|
||||
|
|
|
@ -22,6 +22,7 @@ function getUrl( input ) {
|
|||
function convertDataToResults( data ) {
|
||||
const results = [];
|
||||
|
||||
// eslint-disable-next-line es-x/no-optional-chaining, es-x/no-nullish-coalescing-operators
|
||||
data = data?.pages ?? [];
|
||||
|
||||
for ( let i = 0; i < data.length; i++ ) {
|
||||
|
@ -29,6 +30,7 @@ function convertDataToResults( data ) {
|
|||
id: data[ i ].id,
|
||||
key: data[ i ].key,
|
||||
title: data[ i ].title,
|
||||
// eslint-disable-next-line es-x/no-symbol-prototype-description
|
||||
description: data[ i ].description
|
||||
};
|
||||
// Redirect title
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable es-x/no-symbol-prototype-description */
|
||||
const
|
||||
config = require( './config.json' ),
|
||||
PREFIX = 'citizen-typeahead',
|
||||
|
@ -186,6 +187,7 @@ function getSuggestions( searchQuery, htmlSafeSearchQuery, placeholder ) {
|
|||
cleanTitle = cleanup( title ),
|
||||
cleanMatchedTitle = cleanup( matchedTitle );
|
||||
|
||||
// eslint-disable-next-line max-len, es-x/no-array-prototype-includes
|
||||
return !( cleanTitle.includes( cleanMatchedTitle ) || cleanMatchedTitle.includes( cleanTitle ) );
|
||||
};
|
||||
|
||||
|
@ -246,6 +248,7 @@ function getSuggestions( searchQuery, htmlSafeSearchQuery, placeholder ) {
|
|||
searchInput.parentNode.classList.add( SEARCH_LOADING_CLASS );
|
||||
|
||||
const
|
||||
// eslint-disable-next-line compat/compat
|
||||
controller = new AbortController(),
|
||||
abortFetch = () => {
|
||||
controller.abort();
|
||||
|
|
正在加载...
在新工单中引用