User:Daniel Quinlan/Scripts/RangeHelper.js: Difference between revisions

Content deleted Content added
simplified IPv6 compression function
use uncompressed addresses for links
Line 227:
contentContainer.appendChild(resultsList);
const masks = ip.version === 4 ? sequence(16, 31) : sequence(19, 64);
const ranges = masks.map(mask => ip.masked(mask).toString(false, true));
if (!masks.includes(ip.mask)) {
ranges.push(ip.toString(false, true));
}
const blocks = [];
Line 360:
return '<span style="color:red;">No common range found.</span>';
}
const resultRange = ips[0].masked(bestMask).toString(false, true);
const contribsLink = `<a href="/wiki/Special:Contributions/${resultRange}" target="_blank">${resultRange.toString(false, true)}</a>`;
const blockLink = `<a href="/wiki/Special:Block/${resultRange}" target="_blank">block</a>`;
return `<span>${ips.length} unique IP${ips.length === 1 ? '' : 's'}: ${contribsLink} (${blockLink})</span>`;
Line 408:
const userTools = `(<a href="/wiki/User_talk:${block.user}" title="User talk:${block.user}">talk</a> | <span><a href="/wiki/Special:Contributions/${block.user}" title="Special:Contributions/${block.user}">contribs</a>)`;
const action = block.action === "reblock" ? "changed block settings for" : `${block.action}ed`;
const ipLink = `<a href="/wiki/Special:Contributions/${block.range}" title=""><bdi>${block.range.toString(false, true)}</bdi></a>`;
let restrictions = '';
if (block.params?.restrictions) {