User:Davidgothberg/newmessageshistory.js

Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
/***** New messages history ****************************************

  Adds a "history" link to the "You have new messages" box. 

  See full documentation at [[User:Davidgothberg/newmessageshistory]].

*/
$( function() {

  var messtag = document.getElementById( "mw-youhavenewmessages" );
  if ( messtag ) {
    var link = document.createElement( "a" );
    link.appendChild( document.createTextNode( "history" ) );
    link.href = mw.config.get('wgScript') + "?title=User_talk:" + mw.config.get('wgUserName') + "&action=history";
 
    messtag.insertBefore( document.createTextNode( ", " ), messtag.lastChild );
    messtag.insertBefore( link, messtag.lastChild );
  }
 
} );  /* End New messages history */