User:Amalthea/History hidden UTC.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.
// Add a hidden "(UTC)|" into page histories to make using Template:Unsigned2 or Template:Signing2 easier.
if (mw.config.get('wgAction')=='history') addOnloadHook(function() {
  var nodes = document.getElementsByTagName('span');
  var regexSpanClass = /(^| )history-user( |$)/;
  for (i=0; i<nodes.length; i++)
  {
    if (!regexSpanClass.test(nodes[i].className)) continue;
    var hidden=document.createElement("span");
    hidden.appendChild(document.createTextNode("(UTC)|"));
    hidden.setAttribute("style", "display:none");
    nodes[i].childNodes[0].insertBefore(hidden,nodes[i].childNodes[0].childNodes[0]);
  }
});