mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-15 10:27:31 +00:00
72df451bd3
Help with readability by using module.exports and require rather than the MobileFrontend provided mw.mobileFrontend module manager (and avoid adopting webpack at this time) Replace usages of mw.mobileFrontend.require with local require and module.exports (compatible with RL or Node implementation) Changes: * Notifications modules are merged into skins.minerva.scripts and initialised via a client side check. * new file overlayManager for exporting an overlayManager singleton rather than being hidden inside resources/skins.minerva.scripts/init.js * All M.define/M.requires swapped out for require where possible The `define` method is now forbidden in the repo. Bug: T212944 Change-Id: I44790dd3fc6fe42bb502d79c39c4081c223bf2b1
35 lines
1 KiB
JavaScript
35 lines
1 KiB
JavaScript
( function () {
|
|
/**
|
|
* Compares the default Uri host, usually `window.location.host`, and `mw.Uri.host`. Equivalence
|
|
* tests internal linkage, a mismatch may indicate an external link. Interwiki links are
|
|
* considered external.
|
|
*
|
|
* This function only indicates internal in the sense of being on the same host or not. It has
|
|
* no knowledge of [[Link]] vs [Link] links.
|
|
*
|
|
* On https://meta.wikimedia.org/wiki/Foo, the following links would be considered *internal*
|
|
* and return `true`:
|
|
*
|
|
* https://meta.wikimedia.org/
|
|
* https://meta.wikimedia.org/wiki/Bar
|
|
* https://meta.wikimedia.org/w/index.php?title=Bar
|
|
*
|
|
* Similarly, the following links would be considered *not* internal and return `false`:
|
|
*
|
|
* https://archive.org/
|
|
* https://foo.wikimedia.org/
|
|
* https://en.wikipedia.org/
|
|
* https://en.wikipedia.org/wiki/Bar
|
|
*
|
|
* @param {mw.Uri} uri
|
|
* @return {boolean}
|
|
*/
|
|
function isInternal( uri ) {
|
|
return uri.host === mw.Uri().host;
|
|
}
|
|
|
|
module.exports = {
|
|
isInternal: isInternal
|
|
};
|
|
}() );
|