User:Venkat TL/ColourContrib.js
Appearance
From Wikipedia, the free encyclopedia
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump.
This code will be executed when previewing this page.
This code will be executed when previewing this page.
This user script seems to have a documentation page at User:Venkat TL/ColourContrib.
//See instructions for installation at [[User:Venkat_TL/ColourContrib#Installation]] // This script color-codes the user contributions page so that pages you've edited last are sharply distinguished from pages where another editor was the last to edit the page. //This tool is a fork of [[User:Ais523/topcontrib.js]] with lighter colours. //<pre><nowiki> $(document).ready(function(){ if(mw.config.get('wgCanonicalSpecialPageName')==='Contributions' &&location.href.indexOf("&ais523")==-1&&location.href.indexOf("?ais523")==-1) // the ais523 in the line above is meant to be ais523, not your username; it's // to avoid a clash with a couple of other scripts I've written. Feel free to // expand it to avoid clashes with other contribs-manipulating scripts, though. { varhash={}; $('ul.mw-contributions-list > li').each(function(index,item){ var$a=$(item).find('a.mw-contributions-title'); varhref=$a.attr('href'); // get the page title varmatch=$a.hasClass('mw-redirect')?href.match(/\/w\/index.php\?title=([^&]*)&/):href.match(/\/wiki\/([^"]*)/); vartitle=match[1]; // determine background color vartopspanfound=$(item).find('span.mw-uctop').length>0; varbg=topspanfound?"#e6e6ff":"#ffe6e6"; if(hash[title]!==undefined) bg=hash[title]=="#e6e6ff"?"#e6ffe6":"#ffe6ff"; else hash[title]=bg; // set the background color var$span=$('<span></span>'); $span.css('background-color',bg); $span.append($(item).contents()); $(item).append($span); }); } }); //</nowiki></pre> //[[Category:Wikipedia scripts]]