MediaWiki:Gadget-morebits.js: Difference between revisions

Content deleted Content added
Repo at 133ed59: Account for a few missing cases in removeLink; Repository moved to wikimedia-gadgets from Azatoth; Properly escape entire string, use in Morebits.wikitext.page; Allow '' for no regex flags
Repo at 8efb3a0: lookupCreation: fix bug from JSON conversion; Allow CIDR notation
Line 59:
/**
* Converts an IPv6 address to the canonical form stored and used by MediaWiki.
* JavaScript translation of the {@link https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/libs/IPUtilscore/+/refs/heads8eb6ac3e84ea3312d391ca96c12c49e3ad0753bb/masterincludes/srcutils/IPUtilsIP.php#214131|`IP::sanitizeIP()`}
* function from the IPUtils library. Adddresses are verbose, uppercase,
* normalized, and expanded to 8 words.
*
* @param {string} address - The IPv6 address, with or without CIDR.
* @returns {string}
*/
Line 70 ⟶ 71:
return null;
}
if (!mw.util.isIPv6Address(address, true)) {
return address; // nothing else to do for IPv4 addresses or invalid ones
}
Line 81 ⟶ 82:
// address before any CIDR number (e.g. "a:b:c::/24").
var CIDRStart = address.indexOf('/');
var addressEnd = CIDRStart >!== -1 ? CIDRStart - 1 : address.length - 1;
// If the '::' is at the beginning...
var repeat, extra, pad;
Line 3,738 ⟶ 3,739:
var revs = response.pages[0].revisions;
 
for (var i = 0; i < revs.length; i++) {
revs.forEach(function(rev) {
if (!/^\s*#redirect/i.test(revrevs[i].textContentcontent)) { // inaccessible revisions also check out
ctx.creator = revrevs[i].user;
ctx.timestamp = revrevs[i].timestamp;
return false; // break;
}
});
 
if (!ctx.creator) {