MediaWiki:Wikia.js/rights-list.js/advanced.js

var bcratList = [], adminList = [], chatmodList = [], rollbackerList = [], otherList = [], b_obj = {}, a_obj = {}, c_obj = {}, r_obj = {}; $(function{   function createSection(list_type, users){        var userHTML = ;        for (var user in users){            var itemHTML =                 ' \                     \                        \                             \                        \                        \                            ' + user + ' \                            ' + users[user].right + ' \                            ' + users[user].activity + ' \                        \                     \                    \                        Show more \ \                            \ Since: \ ' + ((users[user].since) ? users[user].since : 'Unknown') + ' \ Contact: \ ' + ((users[user].contact) ? users[user].contact : 'None')+ ' \ \                           ' + ((users[user].description) ? users[user].description : 'No description') + ' \ \               '; userHTML += itemHTML; }       $('.user-list-section[data-right="' + list_type + '"] > ul').append(userHTML); }   function addUserListSection(list_type){ if (!$('section[data-right=' + list_type + '"]').length){           $('.user-list-container').append(                $(' ', {                    "data-right": list_type,                    "class": "user-list-section",                    html: function{                        var t = $(this).attr('data-right');                        return [                            $(' ', {                                "class": "user-list-header",                                html: $(' ', {                                    text: t                                })                            })                        ];                    }                })            );        }    }    /*        Getting list of people in the user groups.       --       Taken from the ChatModHover script       created by Ozuzanna.    */    function getUserGroupsList(group, array){        $.ajax({           url: mw.util.wikiScript('api'), data: { format: 'json', action: 'query', list: 'allusers', augroup: group, aulimit: 500 },          dataType: 'json', type: 'POST', success: function(data){ var allusers = data.query.allusers; for (var i in allusers){ array.push(allusers[i].name); }          }        });    }    getUserGroupsList('bureaucrat', bcratList);    getUserGroupsList('administrator', adminList);    getUserGroupsList('chatmoderator', chatmodList);    getUserGroupsList('rollback', rollbackerList);    function configure(obj, arr, settings){        for (var i = 0; i < arr.length; i++){            obj[arr[i]] = settings[i];        }    }    console.log('(' + bcratList + '), (' + adminList + '), (' + chatmodList + '), (' + rollbackerList + ')');    configure(b_obj, bcratList, [{right: 'bureaucrat'}, {}, {}, {}]);    console.log(b_obj[0].right) });