Display all wikifarm hosts in the redirect banner (#737)

Instead of storing the destination wiki's host as a tag, move it to a dedicated "destination_host" property.
pull/755/head
SnorlaxMonster 2024-07-18 19:02:58 +09:30 committed by GitHub
parent 2b14da434b
commit 6cb81fd193
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 254 additions and 487 deletions

View File

@ -77,30 +77,30 @@ Entries are formatted as follows:
"destination_main_page": "Main_Page",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"official",
"miraheze",
"wiki.gg"
"official"
]
}
```
* `id`: A unique identifier for the wiki; should start with the two-letter language code for the wiki, followed by a hypen and the name of the subject/franchise the wiki covers.
* `origins_label`: A label that is shown to the user, identifying the non-indie wiki(s). This is usually just the name of the wiki, but in the case of multiple wikis, it may be something like "Example Fandom Wikis" (plural).
* `origins`: An array of wikis being redirected to the destination wiki. The vast majority of the time, there is just one wiki here. There may be multiple when a series has multiple wikis that combined into one destination wiki; when a Fandom wiki has archived alternatives; or when there are multiple non-independent wikis across multiple wiki farms.
* `id`: A unique identifier for the wiki; should start with the (usually two-letter) language code for the wiki, followed by a hyphen and the name of the subject/franchise the wiki covers.
* `origins_label`: A label that is shown to the user, identifying the non-indie wiki(s). This is usually just the name of the non-indie wiki, but in the case of multiple non-indie wikis, it may be something like "Example Fandom Wikis" (plural).
* `origins`: An array of wikis being redirected to the destination wiki. The vast majority of the time, there is just one wiki here. There may be multiple when a series has multiple wikis that combined into one destination wiki, when a Fandom wiki has archived alternatives, or when there are multiple non-independent wikis across multiple wiki farms.
* `origin`: Name of the wiki being redirected.
* `origin_base_url`: Fully qualified domain name of the wiki being redirected.
* `origin_content_path`: The URL path prefix for article links on the wiki being redirected. On MediaWiki wikis, it can be found at Special:Version. Fandom wikis are usually `/wiki/`.
* `origin_main_page`: The title of the main page of the wiki. This is used to direct the user to the corresponding main page on the destination wiki.
* `origin_base_url`: Fully qualified domain name of the wiki being redirected. Do not include `https://` or `http://`. For non-English Fandom wikis, this also needs to include the language portion of the URL (e.g. `example.fandom.com/fr`).
* `origin_content_path`: The URL path prefix for article links on the wiki being redirected. On MediaWiki wikis, it is listed on Special:Version as the article path. For Fandom wikis it will be `/wiki/`.
* `origin_main_page`: The title of the wiki being redirected's main page. This is used to ensure it redirects to the destination wiki's main page even if their titles differ.
* `destination`: Name of the wiki being redirected to.
* `destination_base_url`: Fully qualified domain name of the wiki being redirected to.
* `destination_content_prefix`: A prefix that is prepended to article names before performing a search on the destination wiki. This can be useful if a wiki separates its content into different namespaces. For example, if we wanted to redirect a wiki about Super Mario Odyssey to a general Mario wiki that has Odyssey content in a namespace called `Odyssey`, we would set `destination_content_prefix` to `Odyssey:`.
* `destination_content_suffix`: A suffix that is added to the end of article names before performing a search on the destination wiki. This is typically used when a multilingual wiki separates its languages by suffixes (e.g. `/es`, `/pt`, etc.). Team Fortress Wiki is an example that uses this.
* `destination_platform`: The wiki's software. The current supported options are `mediawiki` and `dokuwiki`. If you are contributing a wiki that is on another wiki platform, please open an issue so that support for the platform can be added.
* `destination_icon`: The name of the wiki's favicon in the [favicons](favicons) folder.
* `destination_main_page`: The title of the main page of the destination wiki.
* `destination_search_path`: The URL path prefix for performing searches. On MediaWiki wikis, it is called the index.php entry point and can be found at Special:Version.
* `destination_content_path`: The URL path prefix for article links on the destination wiki. On MediaWiki wikis, it can be found at Special:Version.
* `tags`: An optional array of tags. We currently support `official`, `miraheze`, and `wiki.gg` (the latter two of which are hosts). If none of these apply, leave the `tags` property out.
* `destination_base_url`: Fully qualified domain name of the wiki being redirected to. Do not include `https://` or `http://`.
* `destination_content_prefix`: A prefix that is prepended to article names before performing a search on the destination wiki. This can be useful if a wiki separates its content into different namespaces. For example, to redirect a wiki about _The Elder Scrolls V: Skyrim_ to a general Elder Scrolls wiki that has _Skyrim_ content in a namespace called `Skyrim`, set `destination_content_prefix` to `Skyrim:`. If this is not applicable, omit this property.
* `destination_content_suffix`: A suffix that is added to the end of article names before performing a search on the destination wiki. This is typically used when a multilingual wiki separates its languages by suffixes (e.g. `/es`, `/pt`, etc.). Team Fortress Wiki is an example that uses this. If this is not applicable, omit this property.
* `destination_platform`: The wiki software used by the wiki being redirected to. The currently supported options are `mediawiki` and `dokuwiki`. If you are contributing a redirect to a wiki that is on another wiki platform, please open an issue so that support for the platform can be added.
* `destination_icon`: The name of the favicon in the [favicons](favicons) folder for the wiki being redirected to.
* `destination_main_page`: The title of the main page of the wiki being redirected to.
* `destination_search_path`: The URL path prefix for performing searches on the wiki being redirected to. On MediaWiki wikis, it is listed on Special:Version as the index.php entry point.
* `destination_content_path`: The URL path prefix for article links on the wiki being redirected to. On MediaWiki wikis, it is listed on Special:Version as the article path.
* `destination_host`: The host of the wiki being redirected to, if it is hosted by a large wiki host (e.g. wiki.gg, Miraheze). If the wiki is hosted independantly, omit this property.
* `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.

View File

@ -25,17 +25,29 @@
"message": "an independent",
"description": "Descriptor used for an independent wiki. See the bannerText message for more information."
},
"bannerDescriptorWikigg": {
"message": "a wiki.gg",
"description": "Descriptor used for a wiki.gg wiki"
"bannerDescriptorWikifarm": {
"message": "a $host$",
"description": "Descriptor used for a wiki hosted on an indie-like wikifarm. See the bannerText message for more information.",
"placeholders": {
"host": {
"content": "$1",
"example": "wiki.gg"
}
}
},
"bannerDescriptorIndependentOfficial": {
"message": "an official independent",
"description": "Descriptor used for an official independent wiki. See the bannerText message for more information."
},
"bannerDescriptorWikiggOfficial": {
"message": "an official wiki.gg",
"description": "Descriptor used for an official wiki.gg wiki. See the bannerText message for more information."
"bannerDescriptorWikifarmOfficial": {
"message": "an official $host$",
"description": "Descriptor used for an official wiki hosted on an indie-like wikifarm. See the bannerText message for more information.",
"placeholders": {
"host": {
"content": "$1",
"example": "wiki.gg"
}
}
},
"bannerLanguageEnglish": {
"message": " in English",

View File

@ -36,8 +36,8 @@
"destination_main_page": "ARK_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
},
@ -78,9 +78,7 @@
"destination_icon": "lethalcompany.png",
"destination_main_page": "Main_Page",
"destination_search_path": "/w/index.php",
"tags": [
"miraheze"
]
"destination_host": "Miraheze"
},
{
"id": "de-minecraft",
@ -176,8 +174,8 @@
"destination_main_page": "Terraria_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
},
@ -200,4 +198,4 @@
"destination_search_path": "/index.php",
"destination_content_path": "/index.php/"
}
]
]

File diff suppressed because it is too large Load Diff

View File

@ -55,8 +55,8 @@
"destination_main_page": "ARK_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
},
@ -78,8 +78,8 @@
"destination_main_page": "Wiki_Calamity_Mod_en_Español",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
},
@ -101,9 +101,7 @@
"destination_main_page": "Wiki_Clash_of_Clans_en_Español",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"tags": [
"wiki.gg"
]
"destination_host": "wiki.gg"
},
{
"id": "es-coromon",
@ -123,8 +121,8 @@
"destination_main_page": "Coromon_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
},
@ -146,9 +144,7 @@
"destination_main_page": "Deep_Rock_Galactic_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"tags": [
"wiki.gg"
]
"destination_host": "wiki.gg"
},
{
"id": "es-halflife",
@ -306,8 +302,8 @@
"destination_main_page": "Terraria_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
},
@ -330,4 +326,4 @@
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/"
}
]
]

View File

@ -37,9 +37,7 @@
"destination_main_page": "Etusivu",
"destination_search_path": "/w/index.php",
"destination_content_path": "/wiki/",
"tags": [
"shoutwiki"
]
"destination_host": "ShoutWiki"
},
{
"id": "fi-trains",
@ -59,8 +57,6 @@
"destination_main_page": "Etusivu",
"destination_search_path": "/w/index.php",
"destination_content_path": "/wiki/",
"tags": [
"shoutwiki"
]
"destination_host": "ShoutWiki"
}
]
]

View File

@ -17,8 +17,8 @@
"destination_main_page": "ARK_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
},
@ -59,7 +59,7 @@
"destination_main_page": "Accueil",
"destination_search_path": "/index.php",
"destination_content_path": "/"
},
},
{
"id": "fr-gameofthrones",
"origins_label": "Game of Thrones Fandom Wiki",
@ -97,9 +97,7 @@
"destination_icon": "lethalcompany.png",
"destination_main_page": "Main_Page",
"destination_search_path": "/w/index.php",
"tags": [
"miraheze"
]
"destination_host": "Miraheze"
},
{
"id": "fr-minecraft",
@ -163,9 +161,9 @@
"destination_main_page": "Terraria_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
}
]
]

View File

@ -17,9 +17,9 @@
"destination_main_page": "Terraria_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
}
]
]

View File

@ -17,8 +17,8 @@
"destination_main_page": "ARK_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
},
@ -98,4 +98,4 @@
"destination_search_path": "/wt/index.php",
"destination_content_path": "/wiki/"
}
]
]

View File

@ -17,9 +17,7 @@
"destination_main_page": "ACES_WIKI",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"tags": [
"wiki.gg"
]
"destination_host": "wiki.gg"
},
{
"id": "ja-ark",
@ -39,8 +37,8 @@
"destination_main_page": "ARK_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
},
@ -62,9 +60,7 @@
"destination_main_page": "Friday_Night_Funkin'_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"tags": [
"wiki.gg"
]
"destination_host": "wiki.gg"
},
{
"id": "ja-minecraft",
@ -103,9 +99,7 @@
"destination_main_page": "Noita_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"tags": [
"wiki.gg"
]
"destination_host": "wiki.gg"
},
{
"id": "ja-pokemon",

View File

@ -36,8 +36,8 @@
"destination_main_page": "Terraria_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
}

View File

@ -17,8 +17,8 @@
"destination_main_page": "ARK_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
},
@ -101,8 +101,8 @@
"destination_main_page": "Terraria_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
}

View File

@ -17,9 +17,7 @@
"destination_main_page": "Página_principal",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"tags": [
"wiki.gg"
]
"destination_host": "wiki.gg"
},
{
"id": "pt-ark",
@ -39,8 +37,8 @@
"destination_main_page": "ARK_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
},
@ -142,8 +140,8 @@
"destination_main_page": "Terraria_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
},
@ -166,4 +164,4 @@
"destination_search_path": "/w/index.php",
"destination_content_path": "/wiki/"
}
]
]

View File

@ -17,8 +17,8 @@
"destination_main_page": "ARK_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
},
@ -40,8 +40,8 @@
"destination_main_page": "Calamity_Mod_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
},
@ -82,9 +82,7 @@
"destination_icon": "lethalcompany.png",
"destination_main_page": "Main_Page",
"destination_search_path": "/w/index.php",
"tags": [
"miraheze"
]
"destination_host": "Miraheze"
},
{
"id": "ru-minecraft",
@ -144,9 +142,9 @@
"destination_main_page": "Rain_World_Wiki",
"destination_search_path": "/w/index.php",
"destination_content_path": "/wiki/",
"destination_host": "Miraheze",
"tags": [
"official",
"miraheze"
"official"
]
},
{
@ -189,9 +187,9 @@
"destination_main_page": "Terraria_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
}
]
]

View File

@ -17,8 +17,8 @@
"destination_main_page": "ARK_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
},
@ -41,4 +41,4 @@
"destination_search_path": "/",
"destination_content_path": "/w/"
}
]
]

View File

@ -36,9 +36,9 @@
"destination_main_page": "Terraria_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
}
]
]

View File

@ -17,9 +17,7 @@
"destination_main_page": "Ace_Combat_中文_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"tags": [
"wiki.gg"
]
"destination_host": "wiki.gg"
},
{
"id": "zh-calamitymod",
@ -39,8 +37,8 @@
"destination_main_page": "Calamity_Mod_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
},
@ -81,9 +79,7 @@
"destination_main_page": "Friday_Night_Funkin'_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"tags": [
"wiki.gg"
]
"destination_host": "wiki.gg"
},
{
"id": "zh-halflife",
@ -147,9 +143,7 @@
"destination_main_page": "Noita_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"tags": [
"wiki.gg"
]
"destination_host": "wiki.gg"
},
{
"id": "zh-pokemon",
@ -194,8 +188,8 @@
"destination_main_page": "Terraria_Wiki",
"destination_search_path": "/index.php",
"destination_content_path": "/wiki/",
"destination_host": "wiki.gg",
"tags": [
"wiki.gg",
"official"
]
}

View File

@ -99,6 +99,7 @@ async function populateSiteDataByOrigin() {
"destination_platform": site.destination_platform,
"destination_icon": site.destination_icon,
"destination_main_page": site.destination_main_page,
"destination_host": site.destination_host,
"tags": site.tags || [],
"language": LANGS[i]
})

View File

@ -102,7 +102,7 @@ function displayBreezewikiBanner(newUrl) {
addBannerToDOM();
}
function displayRedirectBanner(newUrl, id, destinationName, destinationLanguage, tags, storage) {
function displayRedirectBanner(newUrl, id, destinationName, destinationLanguage, host, tags, storage) {
// Output banner
let banner = document.createElement('div');
banner.id = 'indie-wiki-banner-redirect';
@ -184,12 +184,13 @@ function displayRedirectBanner(newUrl, id, destinationName, destinationLanguage,
// Build descriptor
let descriptor = extensionAPI.i18n.getMessage('bannerDescriptorIndependent');
if (tags.includes('wiki.gg')) {
descriptor = tags.includes('official')
? extensionAPI.i18n.getMessage('bannerDescriptorWikiggOfficial')
: extensionAPI.i18n.getMessage('bannerDescriptorWikigg')
}
if (tags.includes('official') && !tags.includes('wiki.gg')) {
if (host) {
if (tags.includes('official')) {
descriptor = extensionAPI.i18n.getMessage('bannerDescriptorWikifarmOfficial', [host]);
} else {
descriptor = extensionAPI.i18n.getMessage('bannerDescriptorWikifarm', [host])
}
} else if (tags.includes('official')) {
descriptor = extensionAPI.i18n.getMessage('bannerDescriptorIndependentOfficial');
}
@ -286,7 +287,7 @@ function main() {
const headElement = document.querySelector('head');
if (headElement) {
try {
displayRedirectBanner(newURL, matchingSite['id'], matchingSite['destination'], matchingSite['language'], matchingSite['tags'], storage);
displayRedirectBanner(newURL, matchingSite['id'], matchingSite['destination'], matchingSite['language'], matchingSite['destination_host'], matchingSite['tags'], storage);
} finally {
mutationInstance.disconnect();
}