Qwant search filtering support
Co-authored-by: Snootiful <denniskok@fastmail.com>pull/496/head
parent
c52858cf2f
commit
46f3b88a9d
|
@ -37,7 +37,7 @@ Large, corporate-run wiki farms have enabled hundreds of great wikis and communi
|
|||
|
||||
When visiting a wiki on a large corporate wiki farm such as Fandom, Indie Wiki Buddy will notify and/or automatically redirect you if a quality, independent alternative is available. You can customize your experience per-wiki.
|
||||
|
||||
In addition, search results in Google, Bing, DuckDuckGo, Yahoo, Brave Search, Ecosia, and Startpage can also be filtered, replacing non-independent wikis with text inviting you to visit the independent counterpart.
|
||||
In addition, search results in Google, Bing, DuckDuckGo, Yahoo, Brave Search, Ecosia, Startpage, and Qwant can also be filtered, replacing non-independent wikis with text inviting you to visit the independent counterpart.
|
||||
|
||||
Indie Wiki Buddy also supports [BreezeWiki](https://breezewiki.com/), a service that renders Fandom wikis without ads or bloat. This helps give you a more enjoyable reading experience on Fandom when an independent wiki isn't available.
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
"https://search.brave.com/search*",
|
||||
"https://*.duckduckgo.com/*",
|
||||
"https://*.ecosia.org/*",
|
||||
"https://*.qwant.com/*",
|
||||
"https://*.startpage.com/*",
|
||||
"https://*.search.yahoo.com/*",
|
||||
"https://www.google.com/search*",
|
||||
|
|
|
@ -118,6 +118,7 @@
|
|||
"https://search.brave.com/search*",
|
||||
"https://*.duckduckgo.com/*",
|
||||
"https://*.ecosia.org/*",
|
||||
"https://*.qwant.com/*",
|
||||
"https://*.startpage.com/*",
|
||||
"https://*.search.yahoo.com/*",
|
||||
"https://www.google.com/search*",
|
||||
|
|
|
@ -319,6 +319,9 @@ function hideSearchResults(searchResultContainer, searchEngine, site, showBanner
|
|||
case 'ecosia':
|
||||
document.querySelector('body').prepend(searchRemovalNotice);
|
||||
break;
|
||||
case 'qwant':
|
||||
document.querySelector('div[data-testid=sectionWeb]').prepend(searchRemovalNotice);
|
||||
break;
|
||||
case 'startpage':
|
||||
document.querySelector('#main').prepend(searchRemovalNotice);
|
||||
break;
|
||||
|
@ -464,6 +467,12 @@ async function filterSearchResults(searchResults, searchEngine, storage) {
|
|||
case 'ecosia':
|
||||
searchResultContainer = searchResult.closest('div.mainline__result-wrapper article div.result__body');
|
||||
break;
|
||||
case 'qwant':
|
||||
if (searchResult.closest('div[data-testid=webResult]')) {
|
||||
cssQuery = 'div[data-testid=webResult]';
|
||||
searchResultContainer = searchResult.closest(cssQuery).parentElement;
|
||||
}
|
||||
break;
|
||||
case 'startpage':
|
||||
searchResultContainer = searchResult.closest('div.w-gl__result');
|
||||
break;
|
||||
|
@ -621,6 +630,23 @@ function main(mutations = null, observer = null) {
|
|||
}
|
||||
}, { once: true });
|
||||
}
|
||||
} else if (currentURL.hostname.includes('qwant.com')) {
|
||||
// Function to filter search results in Qwant
|
||||
function filterQwant() {
|
||||
let searchResults = Array.from(document.querySelectorAll('a[data-testid=serTitle]')).filter(el => el.href.includes('fandom.com') || el.href.includes('fextralife.com'));
|
||||
filterSearchResults(searchResults, 'qwant', storage);
|
||||
}
|
||||
|
||||
// Wait for document to be interactive/complete:
|
||||
if (['interactive', 'complete'].includes(document.readyState)) {
|
||||
filterQwant();
|
||||
} else {
|
||||
document.addEventListener('readystatechange', e => {
|
||||
if (['interactive', 'complete'].includes(document.readyState)) {
|
||||
filterQwant();
|
||||
}
|
||||
}, { once: true });
|
||||
}
|
||||
} else if (currentURL.hostname.includes('startpage.com')) {
|
||||
// Function to filter search results in Startpage
|
||||
function filterStartpage() {
|
||||
|
|
Loading…
Reference in New Issue