Content deleted Content added
Polygnotus (talk | contribs) No edit summary |
Polygnotus (talk | contribs) No edit summary |
||
Line 70:
// Extract the path after User:
const userPath = href.match(/User:([^?&#/]+)/);
if (!userPath) {
return false;
}
//
▲ return !userPath[1].includes('/');
});
console.log('Found user links:', links.length);
links.each((_, link) =>
const username = getUsernameFromLink(link);
console.log('User link:', $(link).text(), '→', username, $(link).attr('href'));
});
return links;
}
Line 88 ⟶ 90:
function getUsernameFromLink(link) {
const href = $(link).attr('href');
// Handle both regular wiki links and redlinks
if (href.startsWith('/wiki/')) {
match = decodeURIComponent(href).match(/User:([^/?&#/]+)/);
} else {
// For redlinks, check the title parameter
const url = new URL(href, window.___location.origin);
const title = url.searchParams.get('title');
if (title) {
match = decodeURIComponent(title).match(/User:([^/?&#/]+)/);
}
}
return match ? match[1].replace(/_/g, ' ') : null;
}
Line 219 ⟶ 234:
userLinks.each((_, link) => {
const username = getUsernameFromLink(link);
if (username && !processedUsers.has(username)) {
users.push(username);
processedUsers.add(username);
|