Content deleted Content added
Polygnotus (talk | contribs) No edit summary |
Polygnotus (talk | contribs) No edit summary |
||
(3 intermediate revisions by the same user not shown) | |||
Line 73:
// Focus the textarea
setTimeout(() => $('#user-input').focus(), 100);
}
// Helper function to check if username is a vanished/renamed user
function isVanishedOrRenamed(username) {
const lowerUsername = username.toLowerCase();
return lowerUsername.startsWith('vanished user') || lowerUsername.startsWith('renamed user');
}
Line 103 ⟶ 109:
const blockedUsers = [];
const inactiveUsers = [];
const vanishedUsers = []; // New category for vanished/renamed users
// Disable the Check Users button during processing
Line 116 ⟶ 123:
console.log(`${progress} Checking user: ${userInfo.username} ...`);
// Check if this is a vanished or renamed user first
if (isVanishedOrRenamed(userInfo.username)) {
vanishedUsers.push(userInfo.original);
statusDiv.append(`<div style="color: #999;">${progress} ◯ ${userInfo.username} is a vanished/renamed user (skipped)</div>`);
scrollStatusToBottom();
console.log(`◯ ${userInfo.username} is a vanished/renamed user (skipped)`);
// Add base delay between requests
if (i < users.length - 1) {
await sleep(500); // Shorter delay since we're not making API calls
}
continue;
}
try {
Line 159 ⟶ 180:
// Re-enable button and show completion
checkButton.prop('disabled', false).text('Check Users');
statusDiv.append(`<div style="font-weight: bold; margin-top: 10px;">✓ Completed! ${activeUsers.length} active, ${blockedUsers.length} blocked, ${inactiveUsers.length} inactive, ${vanishedUsers.length} vanished/renamed</div>`);
scrollStatusToBottom();
Line 172 ⟶ 193:
console.log(`\nInactive users (not blocked but no edits in last 12 months) (${inactiveUsers.length}):`);
inactiveUsers.forEach(user => console.log(user));
console.log(`\nVanished/Renamed users (${vanishedUsers.length}):`);
vanishedUsers.forEach(user => console.log(user));
// Show results in a separate dialog
displayResults(activeUsers, blockedUsers, inactiveUsers, vanishedUsers);
}
Line 373 ⟶ 397:
}
function displayResults(activeUsers, blockedUsers, inactiveUsers, vanishedUsers) {
// Create a results dialog
const resultsHtml = `
<div style="max-height: 500px; overflow-y: auto;">
<h3>✓ Active Users (not blocked + active in last 12 months) (${activeUsers.length})</h3>
<textarea readonly style="width: 100%; height:
${activeUsers.join('\n')}</textarea>
<h3>✗ Blocked Users (${blockedUsers.length})</h3>
<textarea readonly style="width: 100%; height:
${blockedUsers.join('\n')}</textarea>
<h3>⚠ Inactive Users (not blocked but no edits in last 12 months) (${inactiveUsers.length})</h3>
<textarea readonly style="width: 100%; height:
${inactiveUsers.join('\n')}</textarea>
<h3>◯ Vanished/Renamed Users (${vanishedUsers.length})</h3>
<textarea readonly style="width: 100%; height: 100px; font-family: monospace;">
${vanishedUsers.join('\n')}</textarea>
</div>
`;
Line 395 ⟶ 423:
title: 'User Block & Activity Check Results',
width: 700,
height:
modal: false,
resizable: true,
Line 416 ⟶ 444:
navigator.clipboard.writeText(inactiveUsers.join('\n')).then(() => {
mw.notify('Inactive users copied to clipboard!', { type: 'success' });
}).catch(() => {
mw.notify('Failed to copy to clipboard', { type: 'error' });
});
},
'Copy Vanished/Renamed Users': function() {
navigator.clipboard.writeText(vanishedUsers.join('\n')).then(() => {
mw.notify('Vanished/Renamed users copied to clipboard!', { type: 'success' });
}).catch(() => {
mw.notify('Failed to copy to clipboard', { type: 'error' });
|