Jump to content

User:Writ Keeper/Scripts/watchlistContribs.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.
$(document).ready(contribber);

function contribber()
{
  if(mw.config.get("wgPageName") === "Special:Watchlist")
  {
	$('[class^="mw-changeslist-title"][title^="User talk:"]').each(function(index, link)
		{
			var node = document.createElement("a");
			var ind = link.href.search("User_talk");
			node.href = link.href.substr(0, ind) + "Special:Contributions/" + link.href.substr(ind+10);
			node.title = "Contribs of "+ link.title.substr(10);
                        link.innerHTML = link.innerHTML + "; ";
			node.innerHTML = "<strong>(C)</strong>"
			node.target="_blank";
			link.parentNode.appendChild(node);
		}
	);
	$('[class^="mw-changeslist-title"][title^="User:"]').each(function(index, link)
		{
			var node = document.createElement("a");
			var ind = link.href.search("User:");
			node.href = link.href.substr(0, ind) + "Special:Contributions/" + link.href.substr(ind+5);
			node.title = "Contribs of "+ link.title.substr(5);
                        link.innerHTML = link.innerHTML + "; ";
			node.innerHTML = "<strong>(C)</strong>"
			node.target="_blank";
			link.parentNode.appendChild(node);
		}
	);
  }
}