Merge branch 'main' into i10n

i10n
Kevin Payravi 2024-12-17 02:53:02 -06:00
commit 3db7fca3ef
70 changed files with 1235 additions and 108 deletions

View File

@ -23,6 +23,7 @@ Indie Wiki Buddy is a browser extension that automatically notifies and redirect
![SV wikis](https://img.shields.io/badge/dynamic/json?style=flat-square&label=SV%20wikis&query=length&url=https%3A%2F%2Fraw.githubusercontent.com%2FKevinPayravi%2Findie-wiki-buddy%2Fmain%2Fdata%2FsitesSV.json)
![TH wikis](https://img.shields.io/badge/dynamic/json?style=flat-square&label=TH%20wikis&query=length&url=https%3A%2F%2Fraw.githubusercontent.com%2FKevinPayravi%2Findie-wiki-buddy%2Fmain%2Fdata%2FsitesTH.json)
![TOK wikis](https://img.shields.io/badge/dynamic/json?style=flat-square&label=TOK%20wikis&query=length&url=https%3A%2F%2Fraw.githubusercontent.com%2FKevinPayravi%2Findie-wiki-buddy%2Fmain%2Fdata%2FsitesTOK.json)
![TR wikis](https://img.shields.io/badge/dynamic/json?style=flat-square&label=TR%20wikis&query=length&url=https%3A%2F%2Fraw.githubusercontent.com%2FKevinPayravi%2Findie-wiki-buddy%2Fmain%2Fdata%2FsitesTR.json)
![UK wikis](https://img.shields.io/badge/dynamic/json?style=flat-square&label=UK%20wikis&query=length&url=https%3A%2F%2Fraw.githubusercontent.com%2FKevinPayravi%2Findie-wiki-buddy%2Fmain%2Fdata%2FsitesUK.json)
![ZH wikis](https://img.shields.io/badge/dynamic/json?style=flat-square&label=ZH%20wikis&query=length&url=https%3A%2F%2Fraw.githubusercontent.com%2FKevinPayravi%2Findie-wiki-buddy%2Fmain%2Fdata%2FsitesZH.json)
@ -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!

View File

@ -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 / Українська",

File diff suppressed because it is too large Load Diff

21
data/sitesTR.json Normal file
View File

@ -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"
}
]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 750 B

After

Width:  |  Height:  |  Size: 741 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 711 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 588 B

BIN
favicons/en/astreawiki.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 804 B

BIN
favicons/en/chefrpgwiki.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 833 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 856 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 776 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 745 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 818 B

After

Width:  |  Height:  |  Size: 816 B

BIN
favicons/en/dotagewiki.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 909 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 706 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 883 B

BIN
favicons/en/foxholewiki.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 513 B

BIN
favicons/en/gothicwiki.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 694 B

BIN
favicons/en/gttodwiki.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 646 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 474 B

After

Width:  |  Height:  |  Size: 467 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 900 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 684 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 757 B

After

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 693 B

After

Width:  |  Height:  |  Size: 690 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 821 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 210 B

BIN
favicons/en/necessewiki.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

BIN
favicons/en/norlandwiki.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 543 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 332 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 752 B

After

Width:  |  Height:  |  Size: 724 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 821 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 395 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 836 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 749 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 833 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 754 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

BIN
favicons/en/strinova.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 829 B

After

Width:  |  Height:  |  Size: 827 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 913 B

After

Width:  |  Height:  |  Size: 896 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 741 B

BIN
favicons/en/tincanwiki.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 B

BIN
favicons/en/ufo50.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 176 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 849 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 735 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 612 B

After

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 746 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 733 B

BIN
favicons/en/worshipwiki.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 704 B

After

Width:  |  Height:  |  Size: 701 B

BIN
favicons/tr/sithpedi.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 722 B

View File

@ -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"
],

View File

@ -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"
],

View File

@ -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>

View File

@ -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;

View File

@ -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);
}
}
}
}