User:Polygnotus/Scripts/FilterInactiveOrBlocked.js: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Tag: Reverted
Line 6:
// Show input dialog immediately
showInputDialog();
}
 
// Helper function to scroll status area to bottom
function scrollStatusToBottom() {
const statusDiv = $('#status-text');
requestAnimationFrame(() => {
statusDiv.scrollTop(statusDiv[0].scrollHeight);
});
}
 
Line 29 ⟶ 21:
<textarea id="user-input" style="width: 100%; height: 200px; font-family: monospace;"
placeholder="Paste your usernames here..."></textarea>
<div id="status-area" style="margin-top: 10px; font-family: monospace; background: #f8f9fa; padding: 10px; border: 1px solid #ddd; height: 200px100px; overflow-y: auto; display: none;">
<div id="status-text"></div>
</div>
Line 38 ⟶ 30:
title: 'User Block Checker',
width: 600,
height: 650450,
modal: false,
resizable: true,
Line 77 ⟶ 69:
const statusDiv = $('#status-text');
statusDiv.html(`<div>Checking ${users.length} users for blocks and activity (last 12 months)...</div>`);
scrollStatusToBottom();
console.log(`Checking ${users.length} users for blocks and activity...`);
Line 87 ⟶ 78:
// Disable the Check Users button during processing
const checkButton = dialog.parent().find('.ui-dialog-buttonset button:contains("Check Users")');
const originalButtonClass = checkButton.propattr('disabled', true).text('Checking...class');
checkButton.prop('disabled', true).text('Checking...').attr('class', originalButtonClass);
for (let i = 0; i < users.length; i++) {
Line 94 ⟶ 86:
statusDiv.append(`<div>${progress} Checking ${userInfo.username}...</div>`);
// Always scroll to bottom to show latest activity
scrollStatusToBottom();
statusDiv.scrollTop(statusDiv[0].scrollHeight);
console.log(`${progress} Checking user: ${userInfo.username} ...`);
Line 105 ⟶ 98:
blockedUsers.push(userInfo.original);
statusDiv.append(`<div style="color: #d33;">${progress} ✗ ${userInfo.username} is blocked</div>`);
scrollStatusToBottom();// Always scroll to bottom to show latest activity
statusDiv.scrollTop(statusDiv[0].scrollHeight);
console.log(`✗ ${userInfo.username} is blocked`);
} else {
Line 114 ⟶ 108:
activeUsers.push(userInfo.original);
statusDiv.append(`<div style="color: #00af89;">${progress} ✓ ${userInfo.username} is active (not blocked + active in last 12 months)</div>`);
scrollStatusToBottom();// Always scroll to bottom to show latest activity
statusDiv.scrollTop(statusDiv[0].scrollHeight);
console.log(`✓ ${userInfo.username} is active (not blocked + active in last 12 months)`);
} else {
inactiveUsers.push(userInfo.original);
statusDiv.append(`<div style="color: #fc3;">${progress} ⚠ ${userInfo.username} is not blocked but inactive (no edits in last 12 months)</div>`);
scrollStatusToBottom();// Always scroll to bottom to show latest activity
statusDiv.scrollTop(statusDiv[0].scrollHeight);
console.log(`⚠ ${userInfo.username} is not blocked but inactive (no edits in last 12 months)`);
}
Line 128 ⟶ 124:
activeUsers.push(userInfo.original);
statusDiv.append(`<div style="color: #fc3;">${progress} ? ${userInfo.username} - check failed, assuming active</div>`);
// Always scroll to bottom to show latest activity
scrollStatusToBottom();
statusDiv.scrollTop(statusDiv[0].scrollHeight);
console.log(`? ${userInfo.username} - check failed, assuming active`);
}
});
statusDiv.scrollTop(statusDiv[0].scrollHeight);
// Add base delay between requests to avoid hammering the API
Line 139 ⟶ 138:
// Re-enable button and show completion
checkButton.prop('disabled', false).text('Check Users').attr('class', originalButtonClass);
statusDiv.append(`<div style="font-weight: bold; margin-top: 10px;">✓ Completed! ${activeUsers.length} active, ${blockedUsers.length} blocked, ${inactiveUsers.length} inactive</div>`);
// Always scroll to bottom to show latest activity
scrollStatusToBottom();
statusDiv.scrollTop(statusDiv[0].scrollHeight);
// Display results