User:Syunsyunminmin/userrightmanager.js

// var allsecname = document.getElementsByClassName('toclevel-1'); var links = document.getElementsByClassName('assign-permissions-link'); var Reg = new RegExp("(.*) \((.*)\)"); for( var i = 0; i < links.length; i++ ){ var sectionnum = allsecname[i].getElementsByClassName('tocnumber')[0].innerHTML; var sectionname = allsecname[i].getElementsByClassName('toctext')[0].innerHTML; console.log(sectionnum); console.log(sectionname); var username = sectionname.replace(Reg, '$1'); var right = sectionname.replace(Reg, '$2'); console.log(username + ': ' + right); links[i].removeAttribute('style'); links[i].getElementsByTagName('a')[0].setAttribute('href', '/w/index.php?wpReason=per+request&title=Special%3AUserRights&user=' + username); } //