Formatting files

pull/512/head^2
Kevin Payravi 2024-02-27 03:43:55 -06:00
parent 07a0a748b3
commit 59b6e17e69
8 changed files with 42 additions and 30 deletions

View File

@ -312,7 +312,7 @@ async function loadBreezewikiOptions() {
if (host !== 'CUSTOM' && !hostOptions.some(item => item.instance === host)) {
host = hostOptions[Math.floor(Math.random() * hostOptions.length)].instance;
}
populateBreezewikiHosts(hostOptions, host, customHost);
// Store BreezeWiki host details

View File

@ -101,7 +101,8 @@
<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, DuckDuckGo, Yahoo, Brave Search, Ecosia, Startpage, Qwant, Yandex, and Kagi can also be filtered,
Search results in Google, Bing, DuckDuckGo, Yahoo, Brave Search, Ecosia, Startpage, Qwant, Yandex, and Kagi can
also be filtered,
replacing non-independent wikis with links to independent counterpart (or hiding them completely).
<br /><br />
We currently redirect from Fandom, Fextralife, and Neoseeker wikis to independent counterparts.
@ -139,7 +140,8 @@
<li>
<b><span aria-hidden="true">🔔</span> On search engines, show banner when non-indie results are hidden</b>
<br />
When this option is enabled, a banner will be inserted at the top of search engine results when Indie Wiki Buddy
When this option is enabled, a banner will be inserted at the top of search engine results when Indie Wiki
Buddy
has hidden results from Fandom, Fextralife, or Neoseeker wikis.
This banner also lets you re-show the hidden results if you wish.
<br />
@ -173,7 +175,7 @@
a separate service that renders Fandom wikis without ads or bloat.
Note, BreezeWiki currently only supports English wikis.
</p>
<ul>
<li>
<b><img src="../../images/toggle-disabled.png" alt="" width="15"> BreezeWiki off</b>
@ -182,13 +184,16 @@
</li>
<br />
<li>
<b><img src="../../images/toggle-alert.png" alt="" width="15"> Insert banner link to take you to BreezeWiki</b>
<b><img src="../../images/toggle-alert.png" alt="" width="15"> Insert banner link to take you to
BreezeWiki</b>
<br />
At the top of English Fandom wikis, a small banner will be inserted with a link to take you to the BreezeWiki wiki.
At the top of English Fandom wikis, a small banner will be inserted with a link to take you to the BreezeWiki
wiki.
</li>
<br />
<li>
<b><img src="../../images/toggle-redirect.png" alt="" width="15"> Automatically redirect Fandom to BreezeWiki</b>
<b><img src="../../images/toggle-redirect.png" alt="" width="15"> Automatically redirect Fandom to
BreezeWiki</b>
<br />
Visiting any English Fandom wiki will immediately redirect you to view it through BreezeWiki.
If automatic redirect to an independent wiki is enabled, the indepedent wiki will take priority.
@ -202,7 +207,8 @@
<h2>Individual wiki settings help</h2>
<p>
In the individual settings section of the <a href="../settings/index.html" target="_blank">settings</a> page, you can
In the individual settings section of the <a href="../settings/index.html" target="_blank">settings</a> page,
you can
configure your settings per-wiki.
You can refer to the legend or hover over the icons to learn what each column controls.
</p>

View File

@ -98,6 +98,7 @@
color: #fff;
width: 100%;
}
#header div {
display: flex;
align-items: center;
@ -137,6 +138,7 @@
height: 30px;
text-align: center;
}
#power>label:hover {
outline: 2px solid #3174f1;
}
@ -192,11 +194,13 @@
.radioGroup {
display: flex;
}
.radioGroup.horizontal {
flex-direction: row;
line-height: 1.5rem;
gap: .5em;
}
.radioGroup.vertical {
flex-direction: column;
gap: .5em;
@ -320,7 +324,8 @@
</div>
</div>
<div role="radiogroup" aria-labelledby="defaultSearchActionLabel">
<span id="defaultSearchActionLabel">On search engines, when you see non-indie results with indie alternatives:</span>
<span id="defaultSearchActionLabel">On search engines, when you see non-indie results with indie
alternatives:</span>
<div class="radioGroup horizontal">
<label>
<input id="defaultSearchActionDisabledRadio" type="radio" name="defaultSearchAction" value="disabled" />
@ -381,8 +386,8 @@
</fieldset>
<fieldset id="breezewikiSettings">
<legend>
<span aria-hidden="true"></span> BreezeWiki alternative frontend for Fandom (<a id="breeezwikiLearnMore" href="https://breezewiki.com/"
target="_blank">learn more</a>)
<span aria-hidden="true"></span> BreezeWiki alternative frontend for Fandom (<a id="breeezwikiLearnMore"
href="https://breezewiki.com/" target="_blank">learn more</a>)
</legend>
<div role="radiogroup">
<div class="radioGroup vertical">
@ -410,8 +415,10 @@
</label>
<label id="breezewikiCustomHost">
Custom BreezeWiki domain:
<input disabled type="text" id="customBreezewikiHost" name="customBreezewikiHost" placeholder="See full settings page" size="30" />
<span id="breezewikiCustomHostStatus">Change custom domain on <a href="../settings/index.html" target="_blank">full settings page</a></span>
<input disabled type="text" id="customBreezewikiHost" name="customBreezewikiHost"
placeholder="See full settings page" size="30" />
<span id="breezewikiCustomHostStatus">Change custom domain on <a href="../settings/index.html"
target="_blank">full settings page</a></span>
</label>
</div>
</fieldset>

View File

@ -82,7 +82,7 @@ document.addEventListener('DOMContentLoaded', () => {
chrome.tabs.create({ 'url': chrome.runtime.getURL('pages/settings/index.html') });
window.close();
});
// Add event listener for BreezeWiki host select
const breezewikiHostSelect = document.getElementById('breezewikiHostSelect');
breezewikiHostSelect.addEventListener('change', () => {
@ -94,7 +94,7 @@ document.addEventListener('DOMContentLoaded', () => {
chrome.storage.sync.set({ 'breezewikiHost': breezewikiHostSelect.value });
});
document.options.addEventListener("submit", function(e) {
document.options.addEventListener("submit", function (e) {
e.preventDefault();
return false;
});

View File

@ -31,8 +31,8 @@ async function loadOptions(lang, textFilter = '') {
sites = sites.filter((site) => (
(lang === 'ALL' || site.language === lang) &&
(site.origins_label.toLowerCase().includes(textFilter) ||
site.destination.toLowerCase().includes(textFilter) ||
site.destination_base_url.toLowerCase().includes(textFilter))
site.destination.toLowerCase().includes(textFilter) ||
site.destination_base_url.toLowerCase().includes(textFilter))
));
chrome.storage.local.get((localStorage) => {
@ -513,14 +513,14 @@ document.addEventListener('DOMContentLoaded', () => {
}
document.getElementById('setCustomBreezewikiDomain').addEventListener('click', () => {
setCustomBreezewikiDomain();
setCustomBreezewikiDomain();
});
document.getElementById('customBreezewikiHost').onkeyup = function(e) {
document.getElementById('customBreezewikiHost').onkeyup = function (e) {
if (e.key === 'Enter') {
setCustomBreezewikiDomain();
}
}
document.options.addEventListener("submit", function(e) {
document.options.addEventListener("submit", function (e) {
e.preventDefault();
return false;
});

View File

@ -114,9 +114,9 @@ async function commonFunctionFindMatchingSite(site, crossLanguageSetting) {
matchingSites = sites.filter(el => site.replace(/.*https?:\/\//, '').startsWith(el.origin_base_url));
} else {
matchingSites = sites.filter(el => {
return site.replace(/.*https?:\/\//, '').startsWith(el.origin_base_url + el.origin_content_path)
return site.replace(/.*https?:\/\//, '').startsWith(el.origin_base_url + el.origin_content_path)
|| site.replace(/.*https?:\/\//, '').replace(/\/$/, '') === el.origin_base_url
}
}
);
}

View File

@ -1,9 +1,9 @@
// Hide Indie Wiki Buddy promo banner
const bwTopBanners = document.querySelectorAll('.bw-top-banner');
bwTopBanners.forEach((banner) => {
if (banner.innerText.includes('affiliated browser extension')) {
banner.style.display = 'none';
}
if (banner.innerText.includes('affiliated browser extension')) {
banner.style.display = 'none';
}
});
// Append "fandom allow" query param to Fandom links
@ -12,5 +12,5 @@ const bwFandomLinks = document.querySelectorAll('a[href*=".fandom.com"]');
bwFandomLinks.forEach((link) => {
const url = new URL(link);
url.searchParams.append('fandom', 'allow');
link.href = url;
link.href = url;
});

View File

@ -186,7 +186,7 @@ function replaceSearchResults(searchResultContainer, site, link) {
if (link.includes('.wiki.fextralife.com')) {
destinationArticleTitle = destinationArticleTitle.replace(/(?<!\+)\+/g, ' ');
}
if (site['language'] === 'EN' && link.match(/fandom\.com\/[a-z]{2}\/wiki\//)) {
indieResultText.innerText = 'Look up "' + decodeURIComponent(destinationArticleTitle) + '" on ' + site.destination + ' (EN)';
} else {
@ -402,8 +402,7 @@ async function filterSearchResults(searchResults, searchEngine, storage) {
searchResult.querySelector('h1') ||
searchResult.querySelector('h3') ||
searchResult.querySelector('cite') ||
searchResult.querySelector("div[role='link']")))
{
searchResult.querySelector("div[role='link']"))) {
searchResult.classList.add('iwb-detected');
continue;
}
@ -702,7 +701,7 @@ function main(mutations = null, observer = null) {
// Extract the URL between "RU=" and "/RK="
const embeddedUrlRegex = /RU=([^/]+)\/RK=/;
const match = searchResult.href.match(embeddedUrlRegex);
const extractedURL = decodeURIComponent(match && match[1]);
const extractedURL = decodeURIComponent(match && match[1]);
if (extractedURL.includes('.fandom.com') || extractedURL.includes('.wiki.fextralife.com') || extractedURL.includes('.neoseeker.com/wiki/')) {
searchResult.href = extractedURL;