User:NicoV/vector.js

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search
Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
// Coloration des contributions
function couleurContributions()
{
    var all_titles = {};
    var items = $('#bodyContent ul li');
    for(var i=0 ; i<items.length ; i++)
    {
        var item = items[i];
        var title = $(item).find('a')[0].getAttribute('title');
        if (getElementsByClassName(item,'span','mw-uctop').length>0)
        {
            all_titles[title]=true;
            item.setAttribute('style','background-color: #FFCC66');
        }
        else if (all_titles[title]!==undefined)
        {
            item.setAttribute('style','background-color: #FF9966');
        }
    }
}
if (mw.config.get('wgNamespaceNumber')==-1 && mw.config.get('wgCanonicalSpecialPageName')=="Contributions")
    $(couleurContributions);