User:Soldier 1033/monaco.js

addOnloadHook(rollbackAsBot); function rollbackAsBot { var hasRollback = getElementsByClassName(document, "span", "mw-rollback-link"); for (var i in wgUserGroups){ if (wgUserGroups[i] == 'sysop'){ var isSysop = true; } }  if (isSysop && hasRollback[0]){ for (var i in document.links) { var thisLink = document.links[i]; if (thisLink.href.indexOf('&action=rollback') != -1 && thisLink.href.indexOf('&bot=1') == -1) { var newOpen = document.createTextNode(' ['); var newClose = document.createTextNode(']'); var newLink = document.createElement('a'); newLink.setAttribute('href', thisLink.href + '&bot=1'); newLink.setAttribute('title', 'Mark rolled-back edits as bot'); newLink.innerHTML = 'mark as bot'; thisLink.parentNode.appendChild(newOpen); thisLink.parentNode.appendChild(newLink); thisLink.parentNode.appendChild(newClose); }   }  } }