User:GeorgeMoney/UserScripts/newmessages
From Wikipedia, the free encyclopedia
//
addOnloadHook(function(){ var theuser = wgUserName.replace(' ', '_'); var divs = document.getElementsByTagName('div'); for (i=0; i<divs.length; i++) { if (divs[i].className == 'usermessage' && divs[i].innerHTML.indexOf(theuser) != -1) { if(readCookie('nmsalerted') != 'yes') { divs[i].innerHTML = '<input type="button" value="kill this bar" onclick="this.parentNode.style.display = \'none\';"> New Messages. <a href="/wiki/User_talk:'+theuser+'?diff=cur"><b>last change</b></a> → <a href="/wiki/User_talk:'+theuser+'">talk page</a>'; document.title = wgPageName.replace(/\_/g, ' ')+' - NEW MESSAGES - wikipedia'; alert('NEW MESSAGES'); createCookie('nmsalerted', 'yes', 365); } else { divs[i].innerHTML = ""; divs[i].style.display = "none"; addTab('/wiki/User_talk:'+theuser+'?diff=cur', 'view new message', 'ca-nms', 'view msg', 'n'); } } else if((divs[i].className == 'usermessage' && divs[i].innerHTML.indexOf(theuser) == -1)) { divs[i].style.display = "none"; } } if(document.getElementById('bodyContent').innerHTML.indexOf('class=\"usermessage\"') == -1 && readCookie('nmsalerted') == 'yes') { createCookie('nmsalerted', 'no', 365); } }); //END //