v2.1.0: Filtering in Brave Search + minor styling changes

pull/148/head v2.1.0
Kevin Payravi 2023-05-04 00:21:11 -05:00
parent 632052da6a
commit 4026395a50
8 changed files with 42 additions and 14 deletions

View File

@ -28,7 +28,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, and DuckDuckGo 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, and Brave Search 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.

View File

@ -1,4 +1,4 @@
const searchEngineRegex = /www\.google\.|duckduckgo\.com|www\.bing\.com/;
const searchEngineRegex = /www\.google\.|duckduckgo\.com|www\.bing\.com|search\.brave\.com/;
const fandomRegex = /\.fandom\.com$/;
const fextraRegex = /\.fextralife\.com$/;
const breezeWikiRegex = /breeze\.777\.tf$|breeze\.hostux\.net$|bw\.projectsegfau\.lt$|antifandom\.com$|breezewiki\.pussthecat\.org$|bw\.vern\.cc$|breezewiki\.esmailelbob\.xyz$|bw\.artemislena\.eu$/;
@ -167,11 +167,17 @@ function filterSearchResults(fandomSearchResults, searchEngine, storage) {
cssQuery = 'div.nrn-react-div';
}
break;
case 'brave':
if (searchResult.closest('div.snippet')) {
cssQuery = 'div.snippet';
}
break;
default:
}
if (cssQuery) {
let searchListing = document.createElement('div');
searchListing.style.fontStyle = 'italic';
searchListing.style.color = 'var(--search-text-03)';
let searchListingLink = document.createElement('a');
searchListingLink.href = 'https://' + site.destination_base_url;
searchListingLink.textContent = site.destination;
@ -321,6 +327,24 @@ function main(mutations = null, observer = null) {
}
});
}
} else if (currentURL.hostname.includes('search.brave.com')) {
// Check if doing a Brave search:
function filterBrave() {
let searchResults = Array.from(document.querySelectorAll(".result-header")).filter(el => el.innerHTML.includes('fandom.com') || el.innerHTML.includes('fextralife.com'));
filterSearchResults(searchResults, 'brave', storage);
}
// Need to wait for document to be ready
if (document.readyState === 'complete') {
addLocationObserver(main);
filterBrave();
} else {
document.addEventListener('readystatechange', e => {
if (document.readyState === 'complete') {
addLocationObserver(main);
filterBrave();
}
});
}
}
}
}

View File

@ -90,7 +90,7 @@
Indie Wiki Buddy provides a suite of features to help you discover independent wikis and improve your general wiki reading experience.
<br /><br />
When you visit a wiki on a large, corporate-run wiki host, this extension can notify or automatically redirect you to quality independent wikis when they're available.
Search results in Google, Bing, and DuckDuckGo can also be filtered, replacing non-independent wikis with text inviting you to visit the independent counterpart.
Search results in Google, Bing, DuckDuckGo, and Brave Search can also be filtered, replacing non-independent wikis with text inviting you to visit the independent counterpart.
<br /><br />
We currently redirect from Fandom and Fextralife wikis to independent counterparts.
<br /><br />
@ -123,14 +123,14 @@
</li>
<br />
<li>
<b>🔎 Filter non-indie wiki results in Google, Bing, & DuckDuckGo</b>
<b>🔎 Filter non-indie wikis in Google, Bing, DuckDuckGo, & Brave</b>
<br />
When this option is enabled, non-indie wikis will be filtered from search engine results
when an independent wiki is available. This is to help prioritize independent wikis in your results.
This is on by default.
<br />
<br />
Currently, Google, Bing, and DuckDuckGo are supported.
Currently, Google, Bing, DuckDuckGo, and Brave Search are supported.
Note that image results are not filtered;
we don't want users to miss out on images they might not find elsewhere!
<br />
@ -174,7 +174,7 @@
</li>
<li>
<img src="./images/toggle-search-filter.png" alt="" width="15">
<b>Search filtering</b>: Replace search results in Google, Bing, and DuckDuckGo with text inviting you
<b>Search filtering</b>: Replace search results in Google, Bing, DuckDuckGo, and Brave with text inviting you
to visit the independent wiki. Oftentimes, the non-independent wiki should appear in that same
search.
</li>

View File

@ -1,6 +1,6 @@
{
"name": "Indie Wiki Buddy",
"version": "2.0.0",
"version": "2.1.0",
"description": "Indie Wiki Buddy helps you discover quality, independent wikis through alerts, redirects, and search filtering.",
"permissions": [
"storage",
@ -66,6 +66,7 @@
"https://bw.artemislena.eu/*",
"https://*.duckduckgo.com/*",
"https://*.bing.com/search*",
"https://search.brave.com/search*",
"https://www.google.com/search*",
"https://www.google.ad/search*",
"https://www.google.ae/search*",

View File

@ -1,6 +1,6 @@
{
"name": "Indie Wiki Buddy",
"version": "2.0.0",
"version": "2.1.0",
"description": "Indie Wiki Buddy helps you discover quality, independent wikis through alerts, redirects, and search filtering.",
"permissions": [
"storage",
@ -50,6 +50,7 @@
"https://bw.artemislena.eu/*",
"https://*.duckduckgo.com/*",
"https://www.bing.com/*",
"https://search.brave.com/*",
"https://www.google.com/*",
"https://www.google.ad/*",
"https://www.google.ae/*",
@ -262,6 +263,7 @@
"https://bw.artemislena.eu/*",
"https://*.duckduckgo.com/*",
"https://*.bing.com/search*",
"https://search.brave.com/search*",
"https://www.google.com/search*",
"https://www.google.ad/search*",
"https://www.google.ae/search*",

View File

@ -155,7 +155,7 @@
<div id="notifications" class="settingToggle">
<input id="notificationsCheckbox" type="checkbox" />
<label for="notificationsCheckbox">
<span id="notificationsText">🔔 Desktop notifications when redirected to an indie wiki or BreezeWiki</span>
<span id="notificationsText">🔔 Desktop notifications when redirected to indie wiki or BreezeWiki</span>
</label>
</div>
</div>
@ -163,7 +163,7 @@
<div id="searchFilter" class="settingToggle">
<input id="searchFilterCheckbox" type="checkbox" />
<label for="searchFilterCheckbox">
<span id="searchFilterText">🔎 Filter non-indie wiki results in Google, Bing, & DuckDuckGo</span>
<span id="searchFilterText">🔎 Filter non-indie wikis in Google, Bing, DuckDuckGo, & Brave</span>
</label>
</div>
</div>

View File

@ -76,6 +76,7 @@
#content {
background-color: #fff;
box-sizing: border-box;
padding: 0 .5em;
}
/* FOOTER */
@ -315,7 +316,7 @@
<div id="searchFilter" class="settingToggle">
<label>
<input id="searchFilterCheckbox" type="checkbox" />
<span id="searchFilterText">🔎 Filter non-indie wiki results in Google, Bing, & DuckDuckGo</span>
<span id="searchFilterText">🔎 Filter non-indie wikis in Google, Bing, DuckDuckGo, & Brave</span>
</label>
</div>
</div>
@ -406,8 +407,8 @@
<img
src="images/toggle-search-filter.png"
width="15"
alt="Filter results from Google, Bing, and DuckDuckGo"
title="Filter results from Google, Bing, and DuckDuckGo"
alt="Filter non-indie wikis from Google, Bing, DuckDuckGo, & Brave"
title="Filter non-indie wikis from Google, Bing, DuckDuckGo, & Brave"
/>
</div>
</div>

View File

@ -178,7 +178,7 @@ async function loadOptions(lang) {
inputFilter.classList = 'toggleFilter';
inputFilter.type = 'checkbox';
inputFilter.name = key;
inputFilter.title = 'Filter ' + sites[i].origins_label + ' from Google, Bing, and DuckDuckGo';
inputFilter.title = 'Filter ' + sites[i].origins_label + ' from Google, Bing, DuckDuckGo, & Brave';
inputFilter.id = key + '-filter';
inputFilter.lang = lang;