parent
ad31027561
commit
8e0426ce03
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "interlanguage-checker",
|
||||
"version": "1.10.18",
|
||||
"version": "1.10.19",
|
||||
"description": "Check the consistency of MediaWiki interlanguage links in a simple overview.",
|
||||
"author": "Felix W. Dekker",
|
||||
"browser": "dist/bundle.js",
|
||||
|
|
|
@ -95,7 +95,10 @@ export class Redirect {
|
|||
/**
|
||||
* A map of interwiki links.
|
||||
*
|
||||
* @property map {Array<{prefix: string, url: string}>} maps interwiki abbreviations to URLs
|
||||
* Not implemented as a map but as a list of objects. Therefore, when there are duplicate keys, the original value is
|
||||
* always retained.
|
||||
*
|
||||
* @property map {Array<{prefix: string, url: string}>} maps interwiki prefixes to URLs
|
||||
*/
|
||||
export class InterwikiMap {
|
||||
/**
|
||||
|
@ -105,7 +108,7 @@ export class InterwikiMap {
|
|||
* this map
|
||||
*/
|
||||
constructor(map) {
|
||||
this.map = map.map(it => Object.assign({}, it));
|
||||
this.map = map.map(it => ({prefix: it.prefix, url: it.url}));
|
||||
}
|
||||
|
||||
|
||||
|
@ -328,6 +331,11 @@ export class MediaWiki {
|
|||
*/
|
||||
async init() {
|
||||
const query = await this.getSiteInfo("general", "interwikimap", "namespaces");
|
||||
|
||||
// Add self to map
|
||||
query.interwikimap.push({prefix: query.general.lang, url: query.general.server + query.general.articlepath});
|
||||
|
||||
// Set fields
|
||||
this.general = query.general;
|
||||
this.interwikiMap = new InterwikiMap(query.interwikimap);
|
||||
this.namespaces = query.namespaces;
|
||||
|
@ -497,6 +505,7 @@ export class MediaWikiManager {
|
|||
}
|
||||
|
||||
if (this.hasMw(newMw.general.lang)) {
|
||||
// Duplicate MW with different but equivalent language code; destroy new MW instance
|
||||
this.mws[lang] = this.mws[newMw.general.lang];
|
||||
} else {
|
||||
this.mws[newMw.general.lang] = newMw;
|
||||
|
|
Loading…
Reference in New Issue