বিষয়বস্তুতে চলুন
🎉 বইপিডিয়ার ১ বছর পূর্তি! · আমাদের ফেসবুক পেজ অনুসরণ করুন.

ব্যবহারকারী:ARI/common.js: সংশোধিত সংস্করণের মধ্যে পার্থক্য

বইপিডিয়া থেকে
সম্পাদনা সারাংশ নেই
সম্পাদনা সারাংশ নেই
১ নং লাইন: ১ নং লাইন:
// Mass Rollback Tool - Language Independent
console.log('===== USER SCRIPT LOADED =====');
$(function() {
console.log('Username:', mw.config.get('wgUserName'));
    // Check if we're on any Special:Contributions page
console.log('Page:', mw.config.get('wgCanonicalSpecialPageName'));
    var isContribPage = mw.config.get('wgCanonicalSpecialPageName') === 'Contributions' ||
 
                        window.location.href.indexOf('Special:Contributions') > -1 ||
// Wait for page to be ready
                        window.location.href.indexOf('বিশেষ:অবদান') > -1;
mw.loader.using(['mediawiki.util', 'jquery.ui'], function() {
   
     $(document).ready(function() {
    console.log('Is contrib page?', isContribPage);
        console.log('Document ready!');
    console.log('Page name:', mw.config.get('wgCanonicalSpecialPageName'));
       
   
        // Only on Contributions pages
    if (!isContribPage) {
        if (mw.config.get('wgCanonicalSpecialPageName') === 'Contributions') {
        console.log('Not on contributions page, exiting');
             console.log('ON CONTRIBUTIONS PAGE - CREATING BUTTON');
        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 $button = $('<button>')
            var total = $rollbackLinks.length;
                .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',
                    'font-size': '16px'
                })
                .click(function() {
                    if (!confirm('Rollback ALL visible edits?')) return;
                   
                    var $rollbackLinks = $('.mw-rollback-link a');
                    var total = $rollbackLinks.length;
                   
                    if (total === 0) {
                        alert('No rollback links found!');
                        return;
                    }
                   
                    var done = 0;
                    mw.notify('Starting rollback of ' + total + ' edits...');
                   
                    $rollbackLinks.each(function(i) {
                        var link = this;
                        setTimeout(function() {
                            $.get(link.href).done(function() {
                                done++;
                                if (done === total) {
                                    mw.notify('Complete! Refreshing...', {type: 'success'});
                                    setTimeout(function() { location.reload(); }, 2000);
                                }
                            });
                        }, i * 1000);
                    });
                });
              
              
            console.log('Found rollback links:', total);
             $('#mw-content-text').prepend($button);
           
            console.log('Button added!');
            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);
});
});

০১:০৩, ৭ জানুয়ারি ২০২৬ তারিখে সংশোধিত সংস্করণ

console.log('===== USER SCRIPT LOADED =====');
console.log('Username:', mw.config.get('wgUserName'));
console.log('Page:', mw.config.get('wgCanonicalSpecialPageName'));

// Wait for page to be ready
mw.loader.using(['mediawiki.util', 'jquery.ui'], function() {
    $(document).ready(function() {
        console.log('Document ready!');
        
        // Only on Contributions pages
        if (mw.config.get('wgCanonicalSpecialPageName') === 'Contributions') {
            console.log('ON CONTRIBUTIONS PAGE - CREATING 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',
                    'font-size': '16px'
                })
                .click(function() {
                    if (!confirm('Rollback ALL visible edits?')) return;
                    
                    var $rollbackLinks = $('.mw-rollback-link a');
                    var total = $rollbackLinks.length;
                    
                    if (total === 0) {
                        alert('No rollback links found!');
                        return;
                    }
                    
                    var done = 0;
                    mw.notify('Starting rollback of ' + total + ' edits...');
                    
                    $rollbackLinks.each(function(i) {
                        var link = this;
                        setTimeout(function() {
                            $.get(link.href).done(function() {
                                done++;
                                if (done === total) {
                                    mw.notify('Complete! Refreshing...', {type: 'success'});
                                    setTimeout(function() { location.reload(); }, 2000);
                                }
                            });
                        }, i * 1000);
                    });
                });
            
            $('#mw-content-text').prepend($button);
            console.log('Button added!');
        }
    });
});