Compare commits

...

10 Commits

Author SHA1 Message Date
DrWhoFan13 2f1238a365
Merge b273c85e51 into 2d46e8895e 2024-05-01 18:32:43 -07:00
DrWhoFan13 b273c85e51
Added SCP Secret Laboratory 2024-05-01 18:32:14 -07:00
DrWhoFan13 2d46e8895e
Added Minecraft Story Mode Redirect 2024-05-01 19:51:27 -05:00
Kevin Payravi 5a1ac577db Adding xkcd wiki 2024-05-01 19:18:36 -05:00
Kevin Payravi cf838788b2 Splitting reordering into separate loop
We now have on loop that checks which results we want to re-order, and then a second loop that actually does the re-ordering.
2024-05-01 18:59:28 -05:00
Kevin Payravi a8c740480c Removing reverse for now, needs a closer look 2024-05-01 14:55:41 -05:00
Kevin Payravi 1f5f969750 For search re-ordering, avoid capturing Q&A
Check for JS-powered sections via div[jsname]

Co-Authored-By: Jayden <7265189+jayktaylor@users.noreply.github.com>
2024-05-01 14:50:52 -05:00
Kevin Payravi f55cd3b795 For search re-ordering, reverse at end
This avoids conflicting with the check for the first result being an indie wiki
2024-05-01 14:49:05 -05:00
trfunk 0d4ae31f17
Fix path for the Dota 2 wiki
The fandom wiki that moved is the game wiki and not the eSports wiki. This fixes the path to be the correct one.
2024-04-29 10:03:07 -05:00
Kevin Payravi de1abf33c5
Updating main page title for Wesnoth 2024-04-29 10:41:46 -04:00
3 changed files with 45 additions and 11 deletions

View File

@ -1738,8 +1738,8 @@
"destination_platform": "mediawiki",
"destination_icon": "liquipediadota2wiki.png",
"destination_main_page": "Main_Page",
"destination_search_path": "/dota2/index.php",
"destination_content_path": "/dota2/"
"destination_search_path": "/dota2game/index.php",
"destination_content_path": "/dota2game/"
},
{
"id": "en-dotflow",
@ -3901,6 +3901,12 @@
"origin_base_url": "minecraftdungeons.wiki.fextralife.com",
"origin_content_path": "/",
"origin_main_page": "Minecraft+Dungeons+Wiki"
},
{
"origin": "Minecraft Story Mode Fandom Wiki",
"origin_base_url": "minecraftstorymode.fandom.com",
"origin_content_path": "/wiki/",
"origin_main_page": "Minecraft_Story_Mode_Wiki"
}
],
"destination": "Minecraft Wiki",
@ -5153,7 +5159,7 @@
"destination_icon": "scpslwiki.png",
"destination_main_page": "Main_Page",
"destination_search_path": "/index.php",
"destination_content_path": "/index.php?title="
"destination_content_path": "/index.php?title=",
"tags": [
"official"
]
@ -6745,7 +6751,7 @@
"destination_base_url": "wiki.wesnoth.org",
"destination_platform": "mediawiki",
"destination_icon": "thebattleforwesnothwiki.png",
"destination_main_page": "Main_Page",
"destination_main_page": "StartingPoints",
"destination_search_path": "/index.php",
"destination_content_path": "/",
"tags": [
@ -6986,6 +6992,25 @@
"destination_search_path": "/index.php",
"destination_content_path": "/w/"
},
{
"id": "en-xkcd",
"origins_label": "xkcd Fandom Wiki",
"origins": [
{
"origin": "xkcd Fandom Wiki",
"origin_base_url": "xkcd.fandom.com",
"origin_content_path": "/wiki/",
"origin_main_page": "Xkcd_Wiki"
}
],
"destination": "explain xkcd",
"destination_base_url": "www.explainxkcd.com",
"destination_platform": "mediawiki",
"destination_icon": "explainxkcd.png",
"destination_main_page": "Main_Page",
"destination_search_path": "/wiki/index.php",
"destination_content_path": "/wiki/index.php/"
},
{
"id": "en-yugioh",
"origins_label": "Yu-Gi-Oh! Fandom & Neoseeker Wikis",

BIN
favicons/en/explainxkcd.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

View File

@ -548,11 +548,8 @@ async function reorderSearchResults(searchResults, searchEngine, storage) {
if (!resultsFirstChild) return;
let crossLanguageSetting = storage.crossLanguage || 'off';
let resultsToSort = [];
// Re-order search results
// This is so that higher results are re-ordered to the top last
searchResults = searchResults.reverse();
for (const searchResult of searchResults) {
try {
if (searchResult.closest('.iwb-detected')) {
@ -573,8 +570,7 @@ async function reorderSearchResults(searchResults, searchEngine, storage) {
console.debug('Indie Wiki Buddy is not re-ordering results, as an indie wiki is already the first result.');
break;
} else {
await reorderDestinationSearchResult(resultsFirstChild, searchResult);
reorderedHrefs.push(searchResultLink);
resultsToSort.push(searchResult);
}
}
}
@ -582,6 +578,19 @@ async function reorderSearchResults(searchResults, searchEngine, storage) {
console.log('Indie Wiki Buddy failed to properly re-order search results with error: ' + e);
}
}
// Reverse order of resultsToSort,
// to restore top-down order.
resultsToSort = resultsToSort.reverse();
for (const searchResult of resultsToSort) {
try {
await reorderDestinationSearchResult(resultsFirstChild, searchResult);
reorderedHrefs.push(searchResultLink);
} catch (e) {
console.log('Indie Wiki Buddy failed to properly re-order search results with error: ' + e);
}
}
}
return reorderedHrefs;
@ -664,7 +673,7 @@ function startFiltering(searchEngine, storage, mutations = null, observer = null
let searchResults = document.querySelectorAll("div[data-hveid] a:first-of-type:not([role='button']):not([target='_self'])");
// Remove any matches that are not "standard" search results - this could've been done with :has() but limited browser support right now
searchResults = Array.from(searchResults).filter((e) => !e.closest('g-section-with-header'));
searchResults = Array.from(searchResults).filter((e) => !e.closest('g-section-with-header, div[jsname]'));
return await reorderSearchResults(searchResults, 'google', storage);
}