User:NguoiDungKhongDinhDanh/revdel-checkboxes.js

// Originally by Anomie $(document).ready(function($){   // File description pages    var filehistory=$('.filehistory');    if(filehistory && filehistory.length){        var ct=0;        filehistory.find('.mw-revdelundel-link a').each(function(i,a){ var m=a.href.match(/&ids=([0-9]+)/); if(!m) return; var chk=$(''); var td=a; while(td.nodeName!='TD') td=td.parentNode; chk.appendTo(td); ct++; });       if(ct>0){            var button=$('');            button.click(function(ev){ var q={ title:'Special:RevisionDelete', type:'oldimage', target:mw.config.get('wgPageName'), ids:{} };               var ct=0; $('input[name="revdel-ids"]').each(function(i,n){                   if(n.checked){                        ct++;                        q.ids[n.value]=1;                    }                }); if(ct == 0) $('input[name="revdel-ids"]').each(function(i,n){                   ct++;                    q.ids[n.value]=1;                }); if(ct > 0) location.href=mw.config.get('wgScript')+'?'+jQuery.param(q); });           filehistory.after(button);        }    } });