User:Laser Dragon/addBotRollback.js

// ================================================================== // Hide Reverted Edits from RecentChanges // // Functions: //  * Adds a "hide" link next to every "rollback" link. //  * Clicking "hide" will mark reverted edits with a bot flag. // ==================================================================

function addBotRollback { if ( wgUserGroups.indexOf('sysop') > -1 ){ var rbLinks = getElementsByClassName(document, "span", "mw-rollback-link"); for (var i in rbLinks) { var curLink = rbLinks[i].firstChild; while (curLink.nodeName.toLowerCase != 'a') curLink = curLink.nextSibling;

var newLink = document.createElement('a'); newLink.setAttribute('href', curLink.href + '&bot=1'); newLink.setAttribute('title', 'Hide reverted edit(s) from Special:RecentChanges'); newLink.innerHTML = 'hide'; curLink.parentNode.insertBefore(newLink,curLink.nextSibling);

var newPipe = document.createTextNode(' | '); curLink.parentNode.insertBefore(newPipe,curLink.nextSibling); } } }

addOnloadHook(addBotRollback);

// ================================================================== // End of Hide Reverted Edits from RecentChanges // ==================================================================