Merge branch 'main' into i10n
|
@ -23,6 +23,7 @@ Indie Wiki Buddy is a browser extension that automatically notifies and redirect
|
|||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
|
@ -106,3 +107,6 @@ Entries are formatted as follows:
|
|||
* `tags`: An optional array of tags. Currently only `official` is used, to mark wikis officially endorsed by the subject of the wiki. If there are no tags, omit this property.
|
||||
|
||||
Favicons should be uploaded as 16px PNGs inside the [favicons](favicons) folder.
|
||||
|
||||
# Translations
|
||||
Translations are currently being prepared on Hosted Weblate ([link](https://hosted.weblate.org/projects/indie-wiki-buddy/indie-wiki-buddy-browser-extension/)). If you're interested in helping translate, please register for an account at hosted.weblate.org, and you should be able to dive right in and start translating!
|
||||
|
|
|
@ -454,7 +454,11 @@
|
|||
},
|
||||
"settingsLangTOK": {
|
||||
"message": "[TOK] Toki Pona / toki pona",
|
||||
"description": "Do not translate the language code in brackets. If this language is your language, leave only one name. Otherwise, add the name of the language in your language before the slash. For example, TOKE should be \"[TOK] Toki Pona / toki pona\" in English, but just \"[TOK] toki pona\" in Toki Pona."
|
||||
"description": "Do not translate the language code in brackets. If this language is your language, leave only one name. Otherwise, add the name of the language in your language before the slash. For example, TOK should be \"[TOK] Toki Pona / toki pona\" in English, but just \"[TOK] toki pona\" in Toki Pona."
|
||||
},
|
||||
"settingsLangTR": {
|
||||
"message": "[TR] Turkish / Türkçe",
|
||||
"description": "Do not translate the language code in brackets. If this language is your language, leave only one name. Otherwise, add the name of the language in your language before the slash. For example, TR should be \"[TR] Turkish / Türkçe\" in English, but just \"[TR] Türkçe\" in Turkish."
|
||||
},
|
||||
"settingsLangUK": {
|
||||
"message": "[UK] Ukrainian / Українська",
|
||||
|
|
1090
data/sitesEN.json
|
@ -0,0 +1,21 @@
|
|||
[
|
||||
{
|
||||
"id": "tr-starwars",
|
||||
"origins_label": "Star Wars Fandom Wiki",
|
||||
"origins": [
|
||||
{
|
||||
"origin": "Star Wars Fandom Wiki",
|
||||
"origin_base_url": "starwars.fandom.com/tr",
|
||||
"origin_content_path": "/wiki/",
|
||||
"origin_main_page": "Ana_sayfa"
|
||||
}
|
||||
],
|
||||
"destination": "Sithpedi",
|
||||
"destination_base_url": "starwarsturkiye.com",
|
||||
"destination_platform": "mediawiki",
|
||||
"destination_icon": "sithpedi.png",
|
||||
"destination_content_path": "/wiki/",
|
||||
"destination_search_path": "/wiki/index.php",
|
||||
"destination_main_page": "Anasayfa"
|
||||
}
|
||||
]
|
Before Width: | Height: | Size: 750 B After Width: | Height: | Size: 741 B |
After Width: | Height: | Size: 711 B |
After Width: | Height: | Size: 588 B |
After Width: | Height: | Size: 855 B |
After Width: | Height: | Size: 823 B |
After Width: | Height: | Size: 804 B |
After Width: | Height: | Size: 833 B |
After Width: | Height: | Size: 78 B |
After Width: | Height: | Size: 856 B |
After Width: | Height: | Size: 776 B |
After Width: | Height: | Size: 745 B |
Before Width: | Height: | Size: 818 B After Width: | Height: | Size: 816 B |
After Width: | Height: | Size: 750 B |
After Width: | Height: | Size: 909 B |
After Width: | Height: | Size: 706 B |
After Width: | Height: | Size: 769 B |
After Width: | Height: | Size: 522 B |
After Width: | Height: | Size: 883 B |
After Width: | Height: | Size: 513 B |
After Width: | Height: | Size: 694 B |
After Width: | Height: | Size: 646 B |
Before Width: | Height: | Size: 474 B After Width: | Height: | Size: 467 B |
After Width: | Height: | Size: 750 B |
After Width: | Height: | Size: 508 B |
After Width: | Height: | Size: 900 B |
After Width: | Height: | Size: 811 B |
After Width: | Height: | Size: 479 B |
After Width: | Height: | Size: 684 B |
Before Width: | Height: | Size: 757 B After Width: | Height: | Size: 738 B |
Before Width: | Height: | Size: 693 B After Width: | Height: | Size: 690 B |
After Width: | Height: | Size: 821 B |
After Width: | Height: | Size: 210 B |
After Width: | Height: | Size: 245 B |
After Width: | Height: | Size: 543 B |
After Width: | Height: | Size: 332 B |
Before Width: | Height: | Size: 752 B After Width: | Height: | Size: 724 B |
After Width: | Height: | Size: 821 B |
After Width: | Height: | Size: 395 B |
After Width: | Height: | Size: 836 B |
After Width: | Height: | Size: 749 B |
After Width: | Height: | Size: 833 B |
After Width: | Height: | Size: 477 B |
After Width: | Height: | Size: 754 B |
After Width: | Height: | Size: 842 B |
After Width: | Height: | Size: 343 B |
Before Width: | Height: | Size: 829 B After Width: | Height: | Size: 827 B |
After Width: | Height: | Size: 490 B |
Before Width: | Height: | Size: 913 B After Width: | Height: | Size: 896 B |
After Width: | Height: | Size: 741 B |
After Width: | Height: | Size: 506 B |
After Width: | Height: | Size: 176 B |
After Width: | Height: | Size: 428 B |
After Width: | Height: | Size: 849 B |
After Width: | Height: | Size: 735 B |
Before Width: | Height: | Size: 612 B After Width: | Height: | Size: 611 B |
After Width: | Height: | Size: 575 B |
After Width: | Height: | Size: 746 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 839 B |
Before Width: | Height: | Size: 704 B After Width: | Height: | Size: 701 B |
After Width: | Height: | Size: 722 B |
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "__MSG_extensionName__",
|
||||
"version": "3.11.0",
|
||||
"version": "3.12.0",
|
||||
"description": "__MSG_extensionDescription__",
|
||||
"permissions": [
|
||||
"storage",
|
||||
|
@ -47,6 +47,7 @@
|
|||
"data/sitesSV.json",
|
||||
"data/sitesTH.json",
|
||||
"data/sitesTOK.json",
|
||||
"data/sitesTR.json",
|
||||
"data/sitesUK.json",
|
||||
"data/sitesZH.json"
|
||||
],
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "__MSG_extensionName__",
|
||||
"version": "3.11.0",
|
||||
"version": "3.12.0",
|
||||
"description": "__MSG_extensionDescription__",
|
||||
"default_locale": "en",
|
||||
"permissions": [
|
||||
|
@ -67,6 +67,7 @@
|
|||
"data/sitesSV.json",
|
||||
"data/sitesTH.json",
|
||||
"data/sitesTOK.json",
|
||||
"data/sitesTR.json",
|
||||
"data/sitesUK.json",
|
||||
"data/sitesZH.json"
|
||||
],
|
||||
|
|
|
@ -272,6 +272,7 @@
|
|||
<option value="SV" data-msg="settingsLangSV"></option>
|
||||
<option value="TH" data-msg="settingsLangTH"></option>
|
||||
<option value="TOK" data-msg="settingsLangTOK"></option>
|
||||
<option value="TR" data-msg="settingsLangTR"></option>
|
||||
<option value="UK" data-msg="settingsLangUK"></option>
|
||||
<option value="ZH" data-msg="settingsLangZH"></option>
|
||||
</select>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var LANGS = ["DE", "EN", "ES", "FI", "FR", "HU", "IT", "JA", "KO", "LZH", "NL", "PL", "PT", "RU", "SV", "TH", "TOK", "UK", "ZH"];
|
||||
var LANGS = ["DE", "EN", "ES", "FI", "FR", "HU", "IT", "JA", "KO", "LZH", "NL", "PL", "PT", "RU", "SV", "TH", "TOK", "TR", "UK", "ZH"];
|
||||
var BASE64REGEX = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
||||
const extensionAPI = typeof browser === "undefined" ? chrome : browser;
|
||||
|
||||
|
|
|
@ -385,41 +385,55 @@ function getResultContainer(searchEngine, searchResult) {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param {SiteData} wikiInfo
|
||||
* @param {HTMLAnchorElement} anchorElement
|
||||
* Given a wiki ID, returns the corresponding search filter setting
|
||||
* @param {string} wikiId
|
||||
*/
|
||||
function filterSearchResult(wikiInfo, anchorElement) {
|
||||
// Get user's settings for the wiki
|
||||
let id = wikiInfo.id;
|
||||
function getSearchFilterSetting(wikiId) {
|
||||
let searchFilterSetting = 'replace';
|
||||
let reorderResults = storage.reorderResults ?? 'on';
|
||||
let searchEngineSettings = storage.searchEngineSettings ?? {};
|
||||
if (searchEngineSettings[id]) {
|
||||
searchFilterSetting = searchEngineSettings[id];
|
||||
if (searchEngineSettings[wikiId]) {
|
||||
searchFilterSetting = searchEngineSettings[wikiId];
|
||||
} else if (storage.defaultSearchAction) {
|
||||
searchFilterSetting = storage.defaultSearchAction;
|
||||
}
|
||||
|
||||
return searchFilterSetting;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {SiteData} wikiInfo
|
||||
* @param {HTMLAnchorElement} anchorElement
|
||||
*/
|
||||
function filterSearchResult(wikiInfo, anchorElement) {
|
||||
let countFiltered = 0;
|
||||
|
||||
if (getSearchFilterSetting(wikiInfo.id) !== 'disabled') {
|
||||
// Get user's reorder settings
|
||||
let reorderResults = storage.reorderResults ?? 'on';
|
||||
|
||||
// Get the containing element for the search result
|
||||
let searchResultContainer = getResultContainer(searchEngine, anchorElement);
|
||||
if (searchResultContainer) {
|
||||
// If this page from Fandom is the same as a re-ordered page, filter it out
|
||||
// If this page from the non-indie wiki is the same as a re-ordered page, filter it out
|
||||
let searchResultLink = anchorElement.getAttribute('data-iwb-href') || anchorElement.href;
|
||||
let originArticle = commonFunctionGetOriginArticle(searchResultLink, wikiInfo);
|
||||
let destinationArticle = commonFunctionGetDestinationArticle(wikiInfo, originArticle);
|
||||
|
||||
if (reorderResults === 'on' && processedCache.find(({ url }) => url.match(
|
||||
if (reorderResults === 'on' && ((processedCache.find(({ url }) => url.match(
|
||||
// Match for destination URL with content path and article name
|
||||
new RegExp(
|
||||
`http(s)?://${wikiInfo.destination_base_url}${wikiInfo.destination_content_path}${decodeURI(destinationArticle)}$`
|
||||
)
|
||||
))) {
|
||||
))) || ((originArticle === wikiInfo.origin_main_page) && processedCache.find(({ url }) => url.match(
|
||||
// Match for destination URL by main page, when applicable
|
||||
new RegExp(
|
||||
`http(s)?://${wikiInfo.destination_base_url}${wikiInfo.destination_content_path}${decodeURI(wikiInfo.destination_main_page)}$`
|
||||
)
|
||||
))))) {
|
||||
countFiltered += hideSearchResults(searchResultContainer, wikiInfo, 'off');
|
||||
console.debug(`Indie Wiki Buddy has hidden a result matching ${searchResultLink} because we re-ordered an indie wiki result with a matching article`);
|
||||
} else if (searchFilterSetting !== 'disabled') {
|
||||
if (searchFilterSetting === 'hide') {
|
||||
} else {
|
||||
if (getSearchFilterSetting(wikiInfo.id) === 'hide') {
|
||||
// Else, if the user has the preference set to hide search results, hide it indiscriminately
|
||||
countFiltered += hideSearchResults(searchResultContainer, wikiInfo, storage['hiddenResultsBanner']);
|
||||
} else {
|
||||
|
@ -427,6 +441,7 @@ function filterSearchResult(wikiInfo, anchorElement) {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return countFiltered;
|
||||
}
|
||||
|
@ -498,9 +513,11 @@ async function filterSearchResults(searchResults) {
|
|||
// Handle source -> destination filtering, i.e. non-indie/commercial wikis
|
||||
let matchingNonIndieWiki = await commonFunctionFindMatchingSite(searchResultLink, crossLanguageSetting);
|
||||
if (matchingNonIndieWiki) {
|
||||
console.debug('Indie Wiki Buddy: Filtering search result:', searchResultLink);
|
||||
// Site found in db, process search result
|
||||
console.debug('Indie Wiki Buddy: Filtering search result:', searchResultLink);
|
||||
|
||||
countFiltered += filterSearchResult(matchingNonIndieWiki, searchResult);
|
||||
|
||||
processedCache.push({
|
||||
url: searchResultLink,
|
||||
isNonIndie: true,
|
||||
|
@ -521,6 +538,7 @@ async function filterSearchResults(searchResults) {
|
|||
anchor: searchResult,
|
||||
};
|
||||
|
||||
if (getSearchFilterSetting(matchingIndieWiki.id) !== 'disabled') {
|
||||
if ((storage.reorderResults ?? 'on') == 'on' && processedCache.at(-1)?.isNonIndie) {
|
||||
console.debug('Indie Wiki Buddy: Reordering search result:', searchResultLink);
|
||||
|
||||
|
@ -537,6 +555,9 @@ async function filterSearchResults(searchResults) {
|
|||
} else {
|
||||
processedCache.push(cacheInfo);
|
||||
}
|
||||
} else {
|
||||
processedCache.push(cacheInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|