From 39e44da293d9ca9b58a0947c20e166802376ca9f Mon Sep 17 00:00:00 2001 From: Jayden <7265189+jayktaylor@users.noreply.github.com> Date: Thu, 21 Mar 2024 05:09:18 +0000 Subject: [PATCH] Re-order indie wiki results in Google --- .gitignore | 3 +- background.js | 101 +++-- data/sitesDE.json | 7 +- data/sitesEN.json | 83 +++- data/sitesES.json | 10 +- data/sitesFR.json | 7 +- data/sitesHU.json | 3 +- data/sitesIT.json | 3 +- data/sitesJA.json | 9 +- data/sitesKO.json | 6 +- data/sitesLZH.json | 5 +- data/sitesPL.json | 4 +- data/sitesPT.json | 11 +- data/sitesRU.json | 8 +- data/sitesTH.json | 6 +- data/sitesUK.json | 6 +- data/sitesZH.json | 10 +- manifest-chromium.json | 2 +- manifest-firefox.json | 2 +- pages/common-page-functions.js | 27 +- pages/guide/index.html | 11 +- pages/popup/index.html | 10 +- pages/settings/index.html | 8 + scripts/common-functions.js | 89 ++-- scripts/content-banners.js | 109 +++-- scripts/content-search-filtering.js | 669 ++++++++++++++-------------- 26 files changed, 700 insertions(+), 509 deletions(-) diff --git a/.gitignore b/.gitignore index 869aae3..fc61653 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ .DS_Store .vscode/* *.py -*.pyc \ No newline at end of file +*.pyc +.idea/ diff --git a/background.js b/background.js index f741784..9903c64 100644 --- a/background.js +++ b/background.js @@ -2,6 +2,24 @@ if (typeof importScripts !== 'undefined') { importScripts('scripts/common-functions.js'); } +let cachedStorage = {}; + +async function updateCachedStorage() { + let localStorage = await chrome.storage.local.get(); + let syncStorage = await chrome.storage.sync.get(); + cachedStorage = {...localStorage, ...syncStorage}; +} + +async function getCachedStorage() { + if (Object.keys(cachedStorage).length === 0) { + await updateCachedStorage(); + } + return cachedStorage; +} + +// Cache Chrome's storage in memory so that we don't need to make repeated calls +updateCachedStorage(); + // Capture web requests chrome.webRequest.onBeforeSendHeaders.addListener( async (event) => { @@ -21,6 +39,11 @@ chrome.webRequest.onBeforeSendHeaders.addListener( chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => { if (msg.action === 'updateIcon') { setPowerIcon(msg.value); + } else if (msg.action === 'getStorage') { + getCachedStorage().then((res) => { + sendResponse(res) + }); + return true; } }); @@ -31,6 +54,11 @@ chrome.runtime.onStartup.addListener(() => { }); }); +// Listen for changes to stored data, and updated our cached data +chrome.storage.onChanged.addListener(() => { + updateCachedStorage(); +}) + // Listen for extension installed/updating chrome.runtime.onInstalled.addListener(async (detail) => { // Set initial icon state @@ -150,49 +178,46 @@ function redirectToBreezeWiki(storage, tabId, url) { } async function main(url, tabId) { - chrome.storage.local.get((localStorage) => { - chrome.storage.sync.get(async (syncStorage) => { - const storage = { ...syncStorage, ...localStorage }; - if ((storage.power ?? 'on') === 'on') { - let crossLanguageSetting = storage.crossLanguage || 'off'; - let matchingSite = await commonFunctionFindMatchingSite(url, crossLanguageSetting); + let storage = await getCachedStorage(); - if (matchingSite) { - // Get user's settings for the wiki - let settings = await commonFunctionDecompressJSON(storage.wikiSettings) || {}; - let id = matchingSite['id']; - let siteSetting = settings[id] || storage.defaultWikiAction || 'alert'; + if ((storage.power ?? 'on') === 'on') { + let crossLanguageSetting = storage.crossLanguage || 'off'; + let matchingSite = await commonFunctionFindMatchingSite(url, crossLanguageSetting); - // Check if redirects are enabled for the site - if (siteSetting === 'redirect') { - let newURL = commonFunctionGetNewURL(url, matchingSite); + if (matchingSite) { + // Get user's settings for the wiki + let settings = await commonFunctionDecompressJSON(storage.wikiSettings) || {}; + let id = matchingSite['id']; + let siteSetting = settings[id] || storage.defaultWikiAction || 'alert'; - // Perform redirect - chrome.tabs.update(tabId, { url: newURL }); + // Check if redirects are enabled for the site + if (siteSetting === 'redirect') { + let newURL = commonFunctionGetNewURL(url, matchingSite); - // Increase redirect count - chrome.storage.sync.set({ 'countRedirects': (storage.countRedirects ?? 0) + 1 }); + // Perform redirect + chrome.tabs.update(tabId, { url: newURL }); - // Notify if enabled - if ((storage.notifications ?? 'on') === 'on') { - // Notify that user is being redirected - let notifID = 'independent-wiki-redirector-notification-' + Math.floor(Math.random() * 1E16); - chrome.notifications.create(notifID, { - "type": "basic", - "iconUrl": 'images/logo-48.png', - "title": "You've been redirected!", - "message": "Indie Wiki Buddy has sent you from " + matchingSite['origin'] + " to " + matchingSite['destination'] - }); - // Self-clear notification after 6 seconds - setTimeout(() => { chrome.notifications.clear(notifID); }, 6000); - } - } else if ((storage.breezewiki ?? 'off') === 'on' || (storage.breezewiki ?? 'off') === 'redirect') { - redirectToBreezeWiki(storage, tabId, url); - } - } else if ((storage.breezewiki ?? 'off') === 'on' || (storage.breezewiki ?? 'off') === 'redirect') { - redirectToBreezeWiki(storage, tabId, url); + // Increase redirect count + chrome.storage.sync.set({ 'countRedirects': (storage.countRedirects ?? 0) + 1 }); + + // Notify if enabled + if ((storage.notifications ?? 'on') === 'on') { + // Notify that user is being redirected + let notifID = 'independent-wiki-redirector-notification-' + Math.floor(Math.random() * 1E16); + chrome.notifications.create(notifID, { + "type": "basic", + "iconUrl": 'images/logo-48.png', + "title": "You've been redirected!", + "message": "Indie Wiki Buddy has sent you from " + matchingSite['origin'] + " to " + matchingSite['destination'] + }); + // Self-clear notification after 6 seconds + setTimeout(() => { chrome.notifications.clear(notifID); }, 6000); } + } else if ((storage.breezewiki ?? 'off') === 'on' || (storage.breezewiki ?? 'off') === 'redirect') { + redirectToBreezeWiki(storage, tabId, url); } - }); - }); + } else if ((storage.breezewiki ?? 'off') === 'on' || (storage.breezewiki ?? 'off') === 'redirect') { + redirectToBreezeWiki(storage, tabId, url); + } + } } diff --git a/data/sitesDE.json b/data/sitesDE.json index 0eebd4a..3c8e2e0 100644 --- a/data/sitesDE.json +++ b/data/sitesDE.json @@ -34,6 +34,7 @@ "destination_icon": "arkwiki.png", "destination_main_page": "ARK_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -73,7 +74,8 @@ "destination_platform": "mediawiki", "destination_icon": "minecraftwiki.png", "destination_main_page": "Minecraft_Wiki", - "destination_search_path": "/" + "destination_search_path": "/", + "destination_content_path": "/w/" }, { "id": "de-pokemon", @@ -128,6 +130,7 @@ "destination_icon": "terrariawiki.png", "destination_main_page": "Terraria_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -151,4 +154,4 @@ "destination_main_page": "Hauptseite", "destination_search_path": "/index.php" } -] \ No newline at end of file +] diff --git a/data/sitesEN.json b/data/sitesEN.json index eb9103b..71c9c44 100644 --- a/data/sitesEN.json +++ b/data/sitesEN.json @@ -34,6 +34,7 @@ "destination_icon": "acecombatwiki.png", "destination_main_page": "Ace_Combat_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -163,6 +164,7 @@ "destination_icon": "animalcrossingpocketcampwiki.png", "destination_main_page": "Animal_Crossing:_Pocket_Camp_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -221,6 +223,7 @@ "destination_icon": "anvilempireswiki.png", "destination_main_page": "Anvil_Empires_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -249,6 +252,7 @@ "destination_icon": "apexlegendswiki.png", "destination_main_page": "Apex_Legends_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -292,6 +296,7 @@ "destination_icon": "arkwiki.png", "destination_main_page": "ARK_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -314,6 +319,7 @@ "destination_icon": "arknightswiki.png", "destination_main_page": "Arknights_Terra_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -422,6 +428,7 @@ "destination_icon": "astroneerwiki.png", "destination_main_page": "Astroneer_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -444,6 +451,7 @@ "destination_icon": "atelierwiki.png", "destination_main_page": "Atelier_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -489,6 +497,7 @@ "destination_icon": "backpackbattleswiki.png", "destination_main_page": "Backpack_Battles_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -609,6 +618,7 @@ "destination_icon": "battlebitwiki.png", "destination_main_page": "BattleBit_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -649,6 +659,7 @@ "destination_icon": "bellasarawiki.png", "destination_main_page": "The_Bella_Sara_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -745,6 +756,7 @@ "destination_icon": "bookoftravelswiki.png", "destination_main_page": "Book_of_Travels_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -867,6 +879,7 @@ "destination_icon": "calamitymodwiki.png", "destination_main_page": "Calamity_Mod_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -1061,6 +1074,7 @@ "destination_icon": "cookieclickerwiki.png", "destination_main_page": "Cookie_Clicker_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -1103,6 +1117,7 @@ "destination_icon": "coromonwiki.png", "destination_main_page": "Coromon_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -1200,6 +1215,7 @@ "destination_icon": "darkestdungeonwiki.png", "destination_main_page": "Darkest_Dungeon_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -1222,6 +1238,7 @@ "destination_icon": "deadcellswiki.png", "destination_main_page": "Dead_Cells_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -1244,6 +1261,7 @@ "destination_icon": "deeprockgalacticwiki.png", "destination_main_page": "Deep_Rock_Galactic_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -1368,6 +1386,7 @@ "destination_icon": "dontstarvewiki.png", "destination_main_page": "Don't_Starve_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -1493,6 +1512,7 @@ "destination_icon": "dredgewiki.png", "destination_main_page": "DREDGE_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -1550,6 +1570,7 @@ "destination_icon": "dyinglightwiki.png", "destination_main_page": "Dying_Light_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -1595,6 +1616,7 @@ "destination_icon": "eiyudenchroniclewiki.png", "destination_main_page": "Eiyuden_Chronicle_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -1669,6 +1691,7 @@ "destination_icon": "enawiki.png", "destination_main_page": "ENA_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -1845,6 +1868,7 @@ "destination_icon": "farmingsimulatorwiki.png", "destination_main_page": "Farming_Simulator_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -1884,6 +1908,7 @@ "destination_icon": "fearhungerwiki.png", "destination_main_page": "%22Fear_and_Hunger:_the_Tormentpedia%22_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -1990,6 +2015,7 @@ "destination_icon": "fridaynightfunkinwiki.png", "destination_main_page": "Friday_Night_Funkin'_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -2134,6 +2160,7 @@ "destination_icon": "galaxylifewiki.png", "destination_main_page": "Galaxy_Life_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -2494,6 +2521,7 @@ "destination_icon": "hearthstonewiki.png", "destination_main_page": "Hearthstone_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -2557,6 +2585,7 @@ "destination_icon": "holocurewiki.png", "destination_main_page": "HoloCure_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -2717,6 +2746,7 @@ "destination_icon": "instarsandtimewiki.png", "destination_main_page": "In_Stars_and_Time_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -2936,6 +2966,7 @@ "destination_icon": "lastoriginwiki.png", "destination_main_page": "Last_Origin_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -2957,6 +2988,7 @@ "destination_icon": "leafblowerrevolutionwiki.png", "destination_main_page": "Leaf_Blower_Revolution_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -3077,6 +3109,7 @@ "destination_icon": "themagicalmixturemillwiki.png", "destination_main_page": "The_Magical_Mixture_Mill_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -3243,6 +3276,7 @@ "destination_icon": "mindhackwiki.png", "destination_main_page": "MINDHACK_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -3293,7 +3327,8 @@ "destination_platform": "mediawiki", "destination_icon": "minecraftwiki.png", "destination_main_page": "Minecraft_Wiki", - "destination_search_path": "/" + "destination_search_path": "/", + "destination_content_path": "/w/" }, { "id": "en-minetest", @@ -3333,6 +3368,7 @@ "destination_icon": "minicraftwiki.png", "destination_main_page": "Minicraft_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -3355,6 +3391,7 @@ "destination_icon": "multiversuswiki.png", "destination_main_page": "MultiVersus_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -3466,6 +3503,7 @@ "destination_icon": "necromergerwiki.png", "destination_main_page": "NecroMerger_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -3505,6 +3543,7 @@ "destination_icon": "noitawiki.png", "destination_main_page": "Noita_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -3544,6 +3583,7 @@ "destination_icon": "oldschoolrunescape.png", "destination_main_page": "Old_School_RuneScape_Wiki", "destination_search_path": "/", + "destination_content_path": "/w/", "tags": [ "official" ] @@ -3565,6 +3605,7 @@ "destination_icon": "omegastrikerswiki.png", "destination_main_page": "Omega_Strikers_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -3605,6 +3646,7 @@ "destination_icon": "paliawiki.png", "destination_main_page": "Palia_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -3627,6 +3669,7 @@ "destination_icon": "palworldwiki.png", "destination_main_page": "Palworld_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -3684,6 +3727,7 @@ "destination_icon": "pathologicwiki.png", "destination_main_page": "Pathologic_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -3705,6 +3749,7 @@ "destination_icon": "peglinwiki.png", "destination_main_page": "Peglin_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -3794,6 +3839,7 @@ "destination_icon": "plantsvszombieswiki.png", "destination_main_page": "Plants_vs._Zombies_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -3902,6 +3948,7 @@ "destination_icon": "projectwingmanwiki.png", "destination_main_page": "Project_Wingman_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -3962,6 +4009,7 @@ "destination_icon": "pubgwiki.png", "destination_main_page": "PUBG_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -4138,6 +4186,7 @@ "destination_icon": "riskofrainwiki.png", "destination_main_page": "Risk_of_Rain_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -4159,6 +4208,7 @@ "destination_icon": "riskofrain2wiki.png", "destination_main_page": "Risk_of_Rain_2_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -4204,6 +4254,7 @@ "destination_icon": "runescape.png", "destination_main_page": "RuneScape_Wiki", "destination_search_path": "/", + "destination_content_path": "/w/", "tags": [ "official" ] @@ -4318,6 +4369,7 @@ "destination_icon": "satisfactorywiki.png", "destination_main_page": "Satisfactory_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -4361,6 +4413,7 @@ "destination_icon": "seaofthieveswiki.png", "destination_main_page": "Sea_of_Thieves_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -4454,6 +4507,7 @@ "destination_icon": "signalis.png", "destination_main_page": "SIGNALIS_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -4520,6 +4574,7 @@ "destination_icon": "sonsoftheforestwiki.png", "destination_main_page": "Sons_of_the_Forest_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -4559,6 +4614,7 @@ "destination_icon": "spiritmodwiki.png", "destination_main_page": "Spirit_Mod_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -4701,6 +4757,7 @@ "destination_icon": "steamworldwiki.png", "destination_main_page": "SteamWorld_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -4740,6 +4797,7 @@ "destination_icon": "sugaryspirewiki.png", "destination_main_page": "Sugary_Spire_Wiki:Main_Page", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -4780,6 +4838,7 @@ "destination_icon": "sunhavenwiki.png", "destination_main_page": "Sun_Haven_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -4801,6 +4860,7 @@ "destination_icon": "superautopetswiki.png", "destination_main_page": "Super_Auto_Pets_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -4921,6 +4981,7 @@ "destination_icon": "officialtemtemwiki.png", "destination_main_page": "Temtem_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -4955,6 +5016,7 @@ "destination_icon": "terrariawiki.png", "destination_main_page": "Terraria_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -4977,6 +5039,7 @@ "destination_icon": "starlightrivermodwiki.png", "destination_main_page": "Starlight_River_Mod_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -5092,6 +5155,7 @@ "destination_icon": "thoriummodwiki.png", "destination_main_page": "Thorium_Mod_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -5114,6 +5178,7 @@ "destination_icon": "timberbornwiki.png", "destination_main_page": "Timberborn_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -5172,6 +5237,7 @@ "destination_icon": "toontowncorporateclashwiki.png", "destination_main_page": "Toontown_Corporate_Clash_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -5253,6 +5319,7 @@ "destination_icon": "towerclimbwiki.png", "destination_main_page": "TowerClimb_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -5295,6 +5362,7 @@ "destination_icon": "towerunitewiki.png", "destination_main_page": "Tower_Unite_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -5352,6 +5420,7 @@ "destination_icon": "trucksimulatorwiki.png", "destination_main_page": "Truck_Simulator_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -5436,6 +5505,7 @@ "destination_icon": "underminewiki.png", "destination_main_page": "UnderMine_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -5457,8 +5527,8 @@ "destination_platform": "mediawiki", "destination_icon": "undertaleyellowwiki.png", "destination_main_page": "Undertale_Yellow_Wiki", - "destination_search_path": "/index.php" - }, + "destination_search_path": "/index.php", + "destination_content_path": "/wiki/"}, { "id": "en-unevendream", "origins_label": "Uneven Dream Fandom Wiki", @@ -5549,6 +5619,7 @@ "destination_icon": "thevoidrainsuponherheartwiki.png", "destination_main_page": "The_Void_Rains_Upon_Her_Heart_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -5570,6 +5641,7 @@ "destination_icon": "vtolvr.png", "destination_main_page": "VTOL_VR_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -5633,6 +5705,7 @@ "destination_icon": "warcraftwiki.png", "destination_main_page": "Warcraft_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -5696,6 +5769,7 @@ "destination_icon": "wildfrostwiki.png", "destination_main_page": "Wildfrost_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "official" ] @@ -5717,6 +5791,7 @@ "destination_icon": "willyousnailwiki.png", "destination_main_page": "Will_You_Snail_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -5739,6 +5814,7 @@ "destination_icon": "witchhatatelierwiki.png", "destination_main_page": "Witch_Hat_Atelier_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "telepedia" ] @@ -5778,6 +5854,7 @@ "destination_icon": "wizardrywiki.png", "destination_main_page": "Wizardry_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] diff --git a/data/sitesES.json b/data/sitesES.json index e441caf..8256a83 100644 --- a/data/sitesES.json +++ b/data/sitesES.json @@ -52,6 +52,7 @@ "destination_icon": "arkwiki.png", "destination_main_page": "ARK_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -74,6 +75,7 @@ "destination_icon": "wikicalamitymodoficial.png", "destination_main_page": "Wiki_Calamity_Mod_en_Español", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -96,6 +98,7 @@ "destination_icon": "coromonwiki.png", "destination_main_page": "Coromon_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -118,6 +121,7 @@ "destination_icon": "deeprockgalacticwiki.png", "destination_main_page": "Deep_Rock_Galactic_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -138,7 +142,8 @@ "destination_platform": "mediawiki", "destination_icon": "minecraftwiki.png", "destination_main_page": "Minecraft_Wiki", - "destination_search_path": "/" + "destination_search_path": "/", + "destination_content_path": "/w/" }, { "id": "es-pokemon", @@ -233,6 +238,7 @@ "destination_icon": "terrariawiki.png", "destination_main_page": "Terraria_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -256,4 +262,4 @@ "destination_main_page": "Touhou_Wiki", "destination_search_path": "/index.php" } -] \ No newline at end of file +] diff --git a/data/sitesFR.json b/data/sitesFR.json index 82dd27b..b18c040 100644 --- a/data/sitesFR.json +++ b/data/sitesFR.json @@ -16,6 +16,7 @@ "destination_icon": "arkwiki.png", "destination_main_page": "ARK_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -97,7 +98,8 @@ "destination_platform": "mediawiki", "destination_icon": "minecraftwiki.png", "destination_main_page": "Minecraft_Wiki", - "destination_search_path": "/" + "destination_search_path": "/", + "destination_content_path": "/w/" }, { "id": "fr-pokemon", @@ -134,9 +136,10 @@ "destination_icon": "terrariawiki.png", "destination_main_page": "Terraria_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" ] } -] \ No newline at end of file +] diff --git a/data/sitesHU.json b/data/sitesHU.json index 1b15ab2..0638b21 100644 --- a/data/sitesHU.json +++ b/data/sitesHU.json @@ -16,9 +16,10 @@ "destination_icon": "terrariawiki.png", "destination_main_page": "Terraria_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" ] } -] \ No newline at end of file +] diff --git a/data/sitesIT.json b/data/sitesIT.json index 3ec8b9d..0c3bed6 100644 --- a/data/sitesIT.json +++ b/data/sitesIT.json @@ -16,6 +16,7 @@ "destination_icon": "arkwiki.png", "destination_main_page": "ARK_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -75,4 +76,4 @@ "destination_main_page": "Home", "destination_search_path": "/index.php" } -] \ No newline at end of file +] diff --git a/data/sitesJA.json b/data/sitesJA.json index 24f1d4e..c4407c4 100644 --- a/data/sitesJA.json +++ b/data/sitesJA.json @@ -16,6 +16,7 @@ "destination_icon": "aceswiki.png", "destination_main_page": "ACES_WIKI", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -37,6 +38,7 @@ "destination_icon": "arkwiki.png", "destination_main_page": "ARK_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -59,6 +61,7 @@ "destination_icon": "fridaynightfunkinwiki.png", "destination_main_page": "Friday_Night_Funkin'_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -80,6 +83,7 @@ "destination_icon": "noitawiki.png", "destination_main_page": "Noita_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -100,6 +104,7 @@ "destination_platform": "mediawiki", "destination_icon": "minecraftwiki.png", "destination_main_page": "Minecraft_Wiki", - "destination_search_path": "/" + "destination_search_path": "/", + "destination_content_path": "/w/" } -] \ No newline at end of file +] diff --git a/data/sitesKO.json b/data/sitesKO.json index f1aa919..e133423 100644 --- a/data/sitesKO.json +++ b/data/sitesKO.json @@ -15,7 +15,8 @@ "destination_platform": "mediawiki", "destination_icon": "minecraftwiki.png", "destination_main_page": "Minecraft_Wiki", - "destination_search_path": "/" + "destination_search_path": "/", + "destination_content_path": "/w/" }, { "id": "ko-terraria", @@ -34,9 +35,10 @@ "destination_icon": "terrariawiki.png", "destination_main_page": "Terraria_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" ] } -] \ No newline at end of file +] diff --git a/data/sitesLZH.json b/data/sitesLZH.json index 1974d25..a9e45e7 100644 --- a/data/sitesLZH.json +++ b/data/sitesLZH.json @@ -15,6 +15,7 @@ "destination_platform": "mediawiki", "destination_icon": "minecraftwiki.png", "destination_main_page": "礦藝大典", - "destination_search_path": "/" + "destination_search_path": "/", + "destination_content_path": "/w/" } -] \ No newline at end of file +] diff --git a/data/sitesPL.json b/data/sitesPL.json index 7be45b5..f4ab8df 100644 --- a/data/sitesPL.json +++ b/data/sitesPL.json @@ -16,6 +16,7 @@ "destination_icon": "arkwiki.png", "destination_main_page": "ARK_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -78,9 +79,10 @@ "destination_icon": "terrariawiki.png", "destination_main_page": "Terraria_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" ] } -] \ No newline at end of file +] diff --git a/data/sitesPT.json b/data/sitesPT.json index e88cf77..8de8cf1 100644 --- a/data/sitesPT.json +++ b/data/sitesPT.json @@ -16,6 +16,7 @@ "destination_icon": "acecombatwiki.png", "destination_main_page": "Página_principal", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -37,6 +38,7 @@ "destination_icon": "arkwiki.png", "destination_main_page": "ARK_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -58,7 +60,8 @@ "destination_platform": "mediawiki", "destination_icon": "minecraftwiki.png", "destination_main_page": "Minecraft_Wiki", - "destination_search_path": "/" + "destination_search_path": "/", + "destination_content_path": "/w/" }, { "id": "pt-runescape", @@ -76,7 +79,8 @@ "destination_platform": "mediawiki", "destination_icon": "runescape.png", "destination_main_page": "RuneScape_Wiki", - "destination_search_path": "/" + "destination_search_path": "/", + "destination_content_path": "/w/" }, { "id": "pt-teamfortress", @@ -117,9 +121,10 @@ "destination_icon": "terrariawiki.png", "destination_main_page": "Terraria_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" ] } -] \ No newline at end of file +] diff --git a/data/sitesRU.json b/data/sitesRU.json index 10d9a75..bac7b0b 100644 --- a/data/sitesRU.json +++ b/data/sitesRU.json @@ -16,6 +16,7 @@ "destination_icon": "arkwiki.png", "destination_main_page": "ARK_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -38,6 +39,7 @@ "destination_icon": "calamitymodwiki.png", "destination_main_page": "Calamity_Mod_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -59,7 +61,8 @@ "destination_platform": "mediawiki", "destination_icon": "minecraftwiki.png", "destination_main_page": "Заглавная_страница", - "destination_search_path": "/" + "destination_search_path": "/", + "destination_content_path": "/w/" }, { "id": "ru-terraria", @@ -78,9 +81,10 @@ "destination_icon": "terrariawiki.png", "destination_main_page": "Terraria_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" ] } -] \ No newline at end of file +] diff --git a/data/sitesTH.json b/data/sitesTH.json index 16ea3bd..65e1bbf 100644 --- a/data/sitesTH.json +++ b/data/sitesTH.json @@ -16,6 +16,7 @@ "destination_icon": "arkwiki.png", "destination_main_page": "ARK_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -37,6 +38,7 @@ "destination_platform": "mediawiki", "destination_icon": "minecraftwiki.png", "destination_main_page": "Minecraft_Wiki", - "destination_search_path": "/" + "destination_search_path": "/", + "destination_content_path": "/w/" } -] \ No newline at end of file +] diff --git a/data/sitesUK.json b/data/sitesUK.json index a51a1b4..9990ab4 100644 --- a/data/sitesUK.json +++ b/data/sitesUK.json @@ -15,7 +15,8 @@ "destination_platform": "mediawiki", "destination_icon": "minecraftwiki.png", "destination_main_page": "Головна_сторінка", - "destination_search_path": "/" + "destination_search_path": "/", + "destination_content_path": "/w/" }, { "id": "uk-terraria", @@ -34,9 +35,10 @@ "destination_icon": "terrariawiki.png", "destination_main_page": "Terraria_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" ] } -] \ No newline at end of file +] diff --git a/data/sitesZH.json b/data/sitesZH.json index ca2c3e8..18e4b3b 100644 --- a/data/sitesZH.json +++ b/data/sitesZH.json @@ -16,6 +16,7 @@ "destination_icon": "acecombatwiki.png", "destination_main_page": "Ace_Combat_中文_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -37,6 +38,7 @@ "destination_icon": "calamitymodwiki.png", "destination_main_page": "Calamity_Mod_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" @@ -59,6 +61,7 @@ "destination_icon": "fridaynightfunkinwiki.png", "destination_main_page": "Friday_Night_Funkin'_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -85,7 +88,8 @@ "destination_platform": "mediawiki", "destination_icon": "minecraftwiki.png", "destination_main_page": "Minecraft_Wiki", - "destination_search_path": "/" + "destination_search_path": "/", + "destination_content_path": "/w/" }, { "id": "zh-noita", @@ -104,6 +108,7 @@ "destination_icon": "noitawiki.png", "destination_main_page": "Noita_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg" ] @@ -125,9 +130,10 @@ "destination_icon": "terrariawiki.png", "destination_main_page": "Terraria_Wiki", "destination_search_path": "/index.php", + "destination_content_path": "/wiki/", "tags": [ "wiki.gg", "official" ] } -] \ No newline at end of file +] diff --git a/manifest-chromium.json b/manifest-chromium.json index 9cd2de9..6a843de 100644 --- a/manifest-chromium.json +++ b/manifest-chromium.json @@ -280,7 +280,7 @@ "scripts/common-functions.js", "scripts/content-search-filtering.js" ], - "run_at": "document_start" + "run_at": "document_end" }, { "matches": [ diff --git a/manifest-firefox.json b/manifest-firefox.json index 3095f5a..5f0e847 100644 --- a/manifest-firefox.json +++ b/manifest-firefox.json @@ -358,7 +358,7 @@ "scripts/common-functions.js", "scripts/content-search-filtering.js" ], - "run_at": "document_start" + "run_at": "document_end" } ], "optional_permissions": ["https://*/*"], diff --git a/pages/common-page-functions.js b/pages/common-page-functions.js index b93affc..6fd8ebd 100644 --- a/pages/common-page-functions.js +++ b/pages/common-page-functions.js @@ -11,6 +11,9 @@ chrome.storage.sync.get({ 'hiddenResultsBanner': 'on' }, (item) => { chrome.storage.sync.get({ 'crossLanguage': 'off' }, (item) => { setCrossLanguage(item.crossLanguage, false); }); +chrome.storage.sync.get({ 'reorderResults': 'on' }, (item) => { + setReorder(item.reorderResults, false); +}); chrome.storage.sync.get({ 'openChangelog': 'off' }, (item) => { setOpenChangelog(item.openChangelog, false); }); @@ -85,6 +88,19 @@ function setCrossLanguage(setting, storeSetting = true) { } } +// Set re-order setting +function setReorder(setting, storeSetting = true) { + if (storeSetting) { + chrome.storage.sync.set({ 'reorderResults': setting }); + } + + if (setting === 'on') { + document.getElementById('reorderResultsCheckbox').checked = true; + } else { + document.getElementById('reorderResultsCheckbox').checked = false; + } +} + // Set open changelog setting function setOpenChangelog(setting, storeSetting = true) { if (storeSetting) { @@ -129,6 +145,15 @@ document.getElementById('crossLanguageCheckbox').addEventListener('change', () = } }); }); +document.getElementById('reorderResultsCheckbox').addEventListener('change', () => { + chrome.storage.sync.get({ 'reorderResults': 'on' }, (item) => { + if (item.reorderResults === 'on') { + setReorder('off'); + } else { + setReorder('on'); + } + }); +}); document.getElementById('openChangelogCheckbox').addEventListener('change', () => { chrome.storage.sync.get({ 'openChangelog': 'off' }, (item) => { if (item.openChangelog === 'on') { @@ -319,4 +344,4 @@ async function loadBreezewikiOptions() { chrome.storage.sync.set({ 'breezewikiHost': host }); } }); -} \ No newline at end of file +} diff --git a/pages/guide/index.html b/pages/guide/index.html index 1859f03..6577051 100644 --- a/pages/guide/index.html +++ b/pages/guide/index.html @@ -161,6 +161,15 @@ Unfortunately this feature does not currently work for Fextralife wikis.
+
  • + Move indie wiki results to the top of + search results on Google +
    + By default, Indie Wiki Buddy will re-order the results page on Google to move indie wiki results to the top, + if they are further down the first page of results. This allows you to find the pages you're looking for + quicker. +
  • +
  • Open changelog when Indie Wiki Buddy is updated
    @@ -267,4 +276,4 @@ - \ No newline at end of file + diff --git a/pages/popup/index.html b/pages/popup/index.html index 0996092..7ffa68b 100644 --- a/pages/popup/index.html +++ b/pages/popup/index.html @@ -376,6 +376,14 @@ indie English wikis there is no same-lang wiki +
    + +
    +
    + +