Thành viên:Unpear/newmessageshistory.js

Bách khoa toàn thư mở Wikipedia

Chú ý: Sau khi lưu thay đổi trang, bạn phải xóa bộ nhớ đệm của trình duyệt để nhìn thấy các thay đổi. Google Chrome, Firefox, Internet ExplorerSafari: Giữ phím ⇧ Shift và nhấn nút Reload/Tải lại trên thanh công cụ của trình duyệt. Để biết chi tiết và hướng dẫn cho các trình duyệt khác, xem Trợ giúp:Xóa bộ nhớ đệm.

/***** New messages history ****************************************

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

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

*/
$( function() {

  var messdiv = document.getElementById( "contentSub" ).nextSibling;
  if ( messdiv.className != "usermessage" ) {
    var messdiv = messdiv.nextSibling;  /* Skip the Firefox text node. */
  }
  if ( messdiv.className == "usermessage" ) {
    var link = document.createElement( "a" );
    link.appendChild( document.createTextNode( "history" ) );
    link.href = wgScript + "?title=User_talk:" + wgUserName + "&action=history";
 
    messdiv.insertBefore( document.createTextNode( ", " ), messdiv.lastChild );
    messdiv.insertBefore( link, messdiv.lastChild );
  }
 
} );  /* End New messages history */