User:Hulothe/common.js

//Alerts when the lookupContribs user is blocked on a wikia. @Author: Gguigui1 $(document).ready(function {    if (wgCanonicalSpecialPageName === "LookupContribs") {        function loads {            if ($('.dataTables_empty').length > 0) {                console.log('Not loaded');            } else {                checkblock;                return false;            }            setTimeout(loads, 3000);        }        loads;        function checkblock {            $('#lc-table > tbody > tr').each(function  { var object = $(this); var domain = $(this).find('td').eq(1).find('a').eq(0).attr('href'); var user = $(location).attr('search').split('=')[1]; console.log(user); var url = domain + 'api.php?action=query&list=users&ususers=' + user + '&usprop=blockinfo&callback=?&format=json'; $.getJSON(url, function (data) {                   console.log(data.query.users[0]);                    if (data.query.users[0].blockedby) {                        object.find('td').css('background-color', 'red');                    }                }); });       }    } });