User:Guywan/Scripts/HistoryHighlight.js

Source: 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.
// [[Category:Wikipedia scripts]]
// <nowiki>
$(function()
{
	if(mw.config.get("wgCanonicalSpecialPageName") == "Contributions")
	{
		// Set the username in local storage.
		mw.cookie.set("hh-username", mw.config.get("wgRelevantUserName"));
	}
	else if(mw.config.get("wgAction") == "history" && mw.cookie.get("hh-username"))
	{
		// Highlight edits performed by the username in storage.
		var username = mw.cookie.get("hh-username");
		var colour = window.hh_highlight === undefined ? "lightgreen" : window.hh_highlight;
		
		$("#pagehistory li").each(function()
		{
			if(username == $(".history-user a bdi", this).html())
			{
				$(this).css("background-color", colour);
			}
		});
	}
});
// </nowiki>