User:Waldyrious/sinceContribs.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.
function addSinceLinks() {
  var ul = document.getElementById("contentSub").nextElementSibling.nextElementSibling.nextElementSibling.nextElementSibling;
  for(i=0; i<ul.children.length; i++) {
    h = ul.children[i].children[3].text ? ul.children[i].children[3] : ul.children[i].children[2];
    pipe = document.createTextNode("\u00a0| ");
    cur = ul.children[i].children[1].cloneNode(true);
    cur.href = cur.href.concat("&diff=cur");
    cur.text = "cur";
    ul.children[i].insertBefore(cur,h);
    ul.children[i].insertBefore(pipe,h);
  }
}

if (mw.config.get('wgCanonicalSpecialPageName') == 'Contributions' && mw.config.get('wgAction') == 'view')
  mw.util.addPortletLink('p-cactions', 'javascript: addSinceLinks()', '+cur', 'ca-addcur',
                 "Add links to see the changes since your laste edit", '');