User:Cryptic/relatedchanges.js
From Wikipedia, the free encyclopedia
If a message on your talk page led you here, please be wary of who left it. Code that you insert on this page could contain malicious content capable of compromising your account. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. If this is a .js page, the code will be executed when previewing the page.
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
// <pre><nowiki> // Only show the most recent change to each article in Related Changes. // Also change the diff links so they're the same urls as the History page (and thus show up in the "visited" color). addOnloadHook(function () { if (document.title == 'Related changes - Wikipedia, the free encyclopedia') { var uls = document.getElementsByTagName('ul'); var entries = new Object; for (var i = 0; i < uls.length; ++i) if (uls[i].className && uls[i].className.indexOf('special') >= 0) { var ul = uls[i]; var li = ul.getElementsByTagName('li'); for (var j = 0; j < li.length; ++j) { var a = li[j].getElementsByTagName('a'); if (a[0].firstChild.data == "diff") if (entries[a[2].href] == 'y') li[j].style.display = 'none'; else { a[0].href = a[0].href.replace(/&curid=[0-9]+/, ''); entries[a[2].href] = 'y'; } } } } }); // </nowiki></pre>

