Only run re-ordering when wiki not disabled
parent
3f87018ac8
commit
d7fcc1d172
|
@ -560,15 +560,18 @@ async function reorderSearchResults(searchResults, searchEngine, storage) {
|
||||||
// Handle re-ordering of results to move destination results up the page
|
// Handle re-ordering of results to move destination results up the page
|
||||||
let matchingDest = await commonFunctionFindMatchingSite(searchResultLink, crossLanguageSetting, true);
|
let matchingDest = await commonFunctionFindMatchingSite(searchResultLink, crossLanguageSetting, true);
|
||||||
if (matchingDest) {
|
if (matchingDest) {
|
||||||
if (resultsFirstChild.contains(searchResult)) {
|
let searchEngineSettings = await commonFunctionDecompressJSON(storage.searchEngineSettings || {});
|
||||||
// If this search result is inside the first child of the results container (aka, it's the first result),
|
if (searchEngineSettings[matchingDest.id] !== 'disabled') {
|
||||||
// and there is a matchingDest at this point, then an indie wiki is #1 on the search results page.
|
if (resultsFirstChild.contains(searchResult)) {
|
||||||
// Therefore, we should abandon the search re-ordering.
|
// If this search result is inside the first child of the results container (aka, it's the first result),
|
||||||
console.debug('Indie Wiki Buddy is not re-ordering results, as an indie wiki is already the first result.');
|
// and there is a matchingDest at this point, then an indie wiki is #1 on the search results page.
|
||||||
break;
|
// Therefore, we should abandon the search re-ordering.
|
||||||
} else {
|
console.debug('Indie Wiki Buddy is not re-ordering results, as an indie wiki is already the first result.');
|
||||||
await reorderDestinationSearchResult(resultsFirstChild, searchResult);
|
break;
|
||||||
reorderedHrefs.push(searchResultLink);
|
} else {
|
||||||
|
await reorderDestinationSearchResult(resultsFirstChild, searchResult);
|
||||||
|
reorderedHrefs.push(searchResultLink);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
Loading…
Reference in New Issue