MediaWiki:PiniginsUserInfo/code.js

/* * PiniginsUserInfo.js (c) 2017, Maksim Pinigin * Creates the "Special:UserInfo" page, which allows you to view a little information about the user

function getUserInfo { var username = $("#username_input").val; $("#userinfobody").html(""); $.ajax({       type:"get",        url:"/api.php?action=query&list=users&ususers=" + username + "&usprop=registration%7Cgender%7Ceditcount%7Cblockinfo%7Cgroups&format=json",        success:function (data) {            if(username == "") { $("#userinfobody").append(" You must enter a user name"); }            else {            $("#userinfobody").append(" ");            $("#userinfobody").append("User ID: " + data["query"]["users"][0]["userid"] + " ");            $("#userinfobody").append("Username: " + username + " ");            $("#userinfobody").append("Number of edits: " + data["query"]["users"][0]["editcount"] + " ");            $("#userinfobody").append("Date of registration: " + data["query"]["users"][0]["registration"] + " ");            $("#userinfobody").append("Gender: " + data["query"]["users"][0]["gender"] + " ");            $("#userinfobody").append("Groups: " + data["query"]["users"][0]["groups"].toString + " "); }       }    }); }

if(wgPageName == "Special:UserInfo") {   $('#mw-content-text').html(""); document.title = "User information | " + wgSiteName + " | FANDOM powered by Wikia"; $('#firstHeading').text("User information"); $('#mw-content-text').append(' Get user information '); if(location.hash.replace("#","") !== "") {       $("#username_input").val(location.hash.replace("#","")); getUserInfo; } }

$('', {id:"userinfo"}) .html('User information') .prependTo('.toolbar .tools');

if(wgPageName == "Special:SpecialPages") {   $('#mw-content-text').append(' Pinigin\'s User Information User information'); }