Jump to content

User:Kylu/diff.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 diff_only_buttons()
  {
  handle_diff('differences-prevlink');
  handle_diff('differences-nextlink');
 
  function handle_diff(diff_id)
    {
    var link = document.getElementById(diff_id);
    if (link == null)
      {
      return false;
      }
    var diff_only = document.createElement('a');
    diff_only.id = diff_id;
    diff_only.href = link.href + '&diffonly=1';
    diff_only.appendChild(document.createTextNode(' - (Diff only)'));
    link.parentNode.appendChild(diff_only);
    return true;
    }
  }
$(diff_only_buttons)