Jump to content

User:Nx/HideFakeNotice.js

From Wikipedia, the free encyclopedia
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.
if (typeof nx_hfn_strict == 'undefined') nx_hfn_strict = false; 
 
function hidefakenotice() 
{ 
  var bodyContent = document.getElementById("bodyContent"); 
  if (!bodyContent) return; 
  var notices = getElementsByClassName(bodyContent,"*","usermessage"); 
  var i; 
  for (i=0;i<notices.length;++i) 
  { 
    if (notices[i].id == 'intercommessage') break; 
    var as = notices[i].getElementsByTagName("a"); 
    var j; 
    for (j=0;j<as.length;++j) 
    { 
      if (nx_hfn_strict) 
      { 
        if (as[j].title != "User talk:"+wgUserName) 
        { 
          notices[i].style.display = "none"; 
          break; 
        } 
      } else { 
        if ((as[j].innerHTML == "new messages" || as[j].innerHTML == "last change") && as[j].title != "User talk:"+wgUserName) 
        { 
          notices[i].style.display = "none"; 
          break; 
        } 
      } 
    } 
  } 
} 
 
addOnloadHook(hidefakenotice);