User:Quarl/newmessages.js

// User:Quarl/newmessages.js - annotate the "You have new messages" alert // to add "diff since" and "hist" links.

// requires: wikipage.js, diffsince.js, util.js

// quarl 2006-01-16 initial version

//

var newmessages = new Object;

newmessages._load = function { var talkmessagebox = getElementsByClass('usermessage',document.getElementById('bodyContent'),'div')[0]; if (!talkmessagebox || talkmessagebox.textContent != "You have new messages (diff).") return;

newmessages.wpTalk = new WikiPage(null,'User talk:' + wikiDoc.username); var histUrl = newmessages.wpTalk.qurl + '&action=history'; var diffSinceUrl = diffsince.makeUrl(newmessages.wpTalk);

talkmessagebox.className += ' plainlinks';

var t = (' ( ' + '' + 'diff since )' +            ' (history)');

// insert before final period talkmessagebox.innerHTML = talkmessagebox.innerHTML.replace(/(?=[.]$)/, t); }

newmessages.diffSince = function { return diffsince.diffPageAsync(newmessages.wpTalk,                           document.getElementById('newmessages-diffsince'),                            'diff since...'); }

$(newmessages._load);

//