User:R3m0t/pplmark.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Firefox/Mozilla/Safari: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Internet Explorer: press Ctrl-F5, Opera/Konqueror: press F5.
function in_array(the_needle, the_haystack){ var the_hay = the_haystack.toString(); if(the_hay == ''){ return false; } var the_pattern = new RegExp(the_needle, 'g'); var matched = the_pattern.test(the_haystack); return matched; } function markpeople() { Links = document.getElementsByTagName('a'); users = 0; dryRun = false; for (var i = 0; i < Links.length; i++) { link = Links[i]; if (!link.href) { continue; } if (link.title == 'View the user page [alt-c]') { continue; } addr = link.href; if (!/http:\/\/en.wikipedia.org\/wiki\/User:[^/#]+$/.test(addr) && !/http:\/\/en.wikipedia.org\/w\/index.php\?title=Special:Contributions&target=/.test(addr) && !/http:\/\/en.wikipedia.org\/w\/index.php\?title=User:[^/]*&action=edit/.test(addr)) { continue; } //not user page if (dryRun) { link.setAttribute('onMouseover', "javascript:return marklink(this);"); continue; } user = addr.replace(/http:\/\/en.wikipedia.org\/wiki\/User:/, ''); user = user.replace(/http:\/\/en.wikipedia.org\/w\/index.php\?title=Special:Contributions&target=/, ''); user = user.replace(/http:\/\/en.wikipedia.org\/w\/index.php\?title=User:/, ''); user = user.replace(/&.*$/, ''); user = user.replace(/_/, ' '); themark = document.createElement('sub'); usertype = '?'; themark.style.cssText = 'color: #000; font-size: small'; if (MP_adminslist.indexOf('\n' + user + '\n') != -1) { usertype = 'a'; themark.style.cssText = 'color: #090'; } else { users++; if (MP_whitelist.indexOf('\n' + user + '\n') != -1) { usertype = 'w'; themark.style.cssText = 'color: #066'; } if (MP_blacklist.indexOf('\n' + user + '\n') != -1) { usertype = '!'; themark.style.cssText = 'color: #C00'; } if (/^[0-9.]+$/.test(user)) { if (MP_blacklistIP.indexOf('\n' + user + '\n') != -1) { usertype = '!'; themark.style.cssText = 'color: #C00'; } } } themark.appendChild(document.createTextNode(usertype)); link.parentNode.insertBefore(themark, link); if (users == 100) { dryRun = true; } } } function marklink(link) { if (!link.href) { alert('o'); return; } if (link.title == 'View the user page [alt-c]') { alert('oddd'); return; } addr = link.href; if (!/http:\/\/en.wikipedia.org\/wiki\/User:[^/#]+$/.test(addr) && !/http:\/\/en.wikipedia.org\/w\/index.php\?title=Special:Contributions&target=/.test(addr) && !/http:\/\/en.wikipedia.org\/w\/index.php\?title=User:[^/]*&action=edit/.test(addr)) { alert('oSS'); return; } //not user page users++; user = addr.replace(/http:\/\/en.wikipedia.org\/wiki\/User:/, ''); user = user.replace(/http:\/\/en.wikipedia.org\/w\/index.php\?title=Special:Contributions&target=/, ''); user = user.replace(/http:\/\/en.wikipedia.org\/w\/index.php\?title=User:/, ''); user = user.replace(/&.*$/, ''); user = user.replace(/_/, ' '); themark = document.createElement('sub'); usertype = '?'; themark.style.cssText = 'color: #000; font-size: small'; if (MP_adminslist.indexOf('\n' + user + '\n') != -1) { usertype = 'a'; themark.style.cssText = 'color: #090'; } else { if (MP_whitelist.indexOf('\n' + user + '\n') != -1) { usertype = 'w'; themark.style.cssText = 'color: #066'; } if (MP_blacklist.indexOf('\n' + user + '\n') != -1) { usertype = '!'; themark.style.cssText = 'color: #C00'; } if (/^[0-9.]+$/.test(user)) { if (MP_blacklistIP.indexOf('\n' + user + '\n') != -1) { usertype = '!'; themark.style.cssText = 'color: #C00'; } } } themark.appendChild(document.createTextNode(usertype)); link.parentNode.insertBefore(themark, link); link.setAttribute('onMouseover', "javascript:return true;"); //don't do anything on next mouseover return true; } document.write('<script type="text/javascript"' + 'src="http://en.wikipedia.org/w/index.php?title=User:R3m0t/pplmark.data.js' + '&action=raw&ctype=text/javascript&dontcountme=s&maxage=86400"></script>'); if (window.addEventListener) window.addEventListener("load",markpeople,false); else if (window.attachEvent) window.attachEvent("onload",markpeople);