Wikipedia:WikiProject User scripts/Scripts/New message history
- Purpose
- Add a link to your talk page history to the "You have new messages" warning.
- Usage
- Include a call to
newmessagehistory()
in your load page function. - Bugs
- Will break any function called after it (ie, it should be called last).
//
/**** WARNING: THIS SCRIPT IS CURRENTLY UNSTABLE AND WILL KILL OTHER FUNCTIONS. ****/ /**** NO WARRANTY IS PROVIDED OR IMPLIED. ***/ function newmessagehistory() { var divs = document.getElementsByTagName('div'); var talkmessagebox; for(var x = 0; x < divs.length; ++x) { if(divs[x].className.indexOf('usermessage') != -1) { talkmessagebox = divs[x]; x = divs.length; // force break } } var newmessagelink = talkmessagebox.getElementsByTagName('a')[0]; var historylink = document.createElement('a'); historylink.href = newmessagelink.href.replace(/\/wiki\//, '/w/index.php?title=') + '&action=history'; historylink.appendChild(document.createTextNode('changes')); var talkmessagetext = 'You have '; talkmessagebox.innerHTML = talkmessagetext; talkmessagebox.appendChild(newmessagelink); talkmessagebox.appendChild(document.createTextNode(' (')); talkmessagebox.appendChild(historylink); talkmessagebox.appendChild(document.createTextNode(')')); } //