ব্যবহারকারী:ARI/common.js: সংশোধিত সংস্করণের মধ্যে পার্থক্য
অবয়ব
সম্পাদনা সারাংশ নেই |
সম্পাদনা সারাংশ নেই |
||
| ১ নং লাইন: | ১ নং লাইন: | ||
// Mass Rollback Tool | // Mass Rollback Tool - Language Independent | ||
$(function() { | $(function() { | ||
// | // Check if we're on any Special:Contributions page | ||
var isContribPage = mw.config.get('wgCanonicalSpecialPageName') === 'Contributions' || | |||
window.location.href.indexOf('Special:Contributions') > -1 || | |||
window.location.href.indexOf('বিশেষ:অবদান') > -1; | |||
console.log('Is contrib page?', isContribPage); | |||
console.log('Page name:', mw.config.get('wgCanonicalSpecialPageName')); | |||
if (!isContribPage) { | |||
console.log('Not on contributions page, exiting'); | |||
return; | |||
} | |||
console.log('Creating button...'); | |||
// Add mass rollback button | // Add mass rollback button | ||
var $button = $('<button>') | var $button = $('<button>') | ||
.attr('id', 'mass-rollback-btn') | |||
.text('Mass Rollback All') | .text('Mass Rollback All') | ||
.css({ | .css({ | ||
| ২১ নং লাইন: | ৩৪ নং লাইন: | ||
var $rollbackLinks = $('.mw-rollback-link a'); | var $rollbackLinks = $('.mw-rollback-link a'); | ||
var total = $rollbackLinks.length; | var total = $rollbackLinks.length; | ||
console.log('Found rollback links:', total); | |||
if (total === 0) { | if (total === 0) { | ||
alert('No rollback links found!'); | alert('No rollback links found on this page!'); | ||
return; | return; | ||
} | } | ||
var done = 0; | |||
mw.notify('Starting mass rollback of ' + total + ' edits...'); | mw.notify('Starting mass rollback of ' + total + ' edits...'); | ||
| ৪৩ নং লাইন: | ৫৮ নং লাইন: | ||
mw.notify('Error rolling back edit ' + (i+1), {type: 'error'}); | mw.notify('Error rolling back edit ' + (i+1), {type: 'error'}); | ||
}); | }); | ||
}, i * 1000); | }, i * 1000); | ||
}); | }); | ||
}); | }); | ||
// | // Try multiple places to add the button | ||
$('#mw-content-text').prepend($button); | if ($('#mw-content-text').length) { | ||
$('#mw-content-text').prepend($button); | |||
console.log('Button added to #mw-content-text'); | |||
} else if ($('.mw-body-content').length) { | |||
$('.mw-body-content').prepend($button); | |||
console.log('Button added to .mw-body-content'); | |||
} else { | |||
$('body').prepend($button); | |||
console.log('Button added to body'); | |||
} | |||
console.log('Button element:', $('#mass-rollback-btn').length); | |||
}); | }); | ||
০০:৫৭, ৭ জানুয়ারি ২০২৬ তারিখে সংশোধিত সংস্করণ
// Mass Rollback Tool - Language Independent
$(function() {
// Check if we're on any Special:Contributions page
var isContribPage = mw.config.get('wgCanonicalSpecialPageName') === 'Contributions' ||
window.location.href.indexOf('Special:Contributions') > -1 ||
window.location.href.indexOf('বিশেষ:অবদান') > -1;
console.log('Is contrib page?', isContribPage);
console.log('Page name:', mw.config.get('wgCanonicalSpecialPageName'));
if (!isContribPage) {
console.log('Not on contributions page, exiting');
return;
}
console.log('Creating button...');
// Add mass rollback button
var $button = $('<button>')
.attr('id', 'mass-rollback-btn')
.text('Mass Rollback All')
.css({
'margin': '10px',
'padding': '10px 20px',
'background': '#d33',
'color': 'white',
'border': 'none',
'cursor': 'pointer',
'font-weight': 'bold'
})
.click(function() {
if (!confirm('Are you sure you want to rollback ALL visible edits?')) return;
var $rollbackLinks = $('.mw-rollback-link a');
var total = $rollbackLinks.length;
console.log('Found rollback links:', total);
if (total === 0) {
alert('No rollback links found on this page!');
return;
}
var done = 0;
mw.notify('Starting mass rollback of ' + total + ' edits...');
$rollbackLinks.each(function(i) {
var link = this;
setTimeout(function() {
$.get(link.href).done(function() {
done++;
mw.notify('Rolled back ' + done + '/' + total);
if (done === total) {
mw.notify('Mass rollback complete! Refreshing...', {type: 'success'});
setTimeout(function() { location.reload(); }, 2000);
}
}).fail(function() {
mw.notify('Error rolling back edit ' + (i+1), {type: 'error'});
});
}, i * 1000);
});
});
// Try multiple places to add the button
if ($('#mw-content-text').length) {
$('#mw-content-text').prepend($button);
console.log('Button added to #mw-content-text');
} else if ($('.mw-body-content').length) {
$('.mw-body-content').prepend($button);
console.log('Button added to .mw-body-content');
} else {
$('body').prepend($button);
console.log('Button added to body');
}
console.log('Button element:', $('#mass-rollback-btn').length);
});