User:Theki/clink.js

$(function {	const t = mw.Title.newFromText(mw.config.get("wgPageName"));	if (t.exists && t.getNamespacePrefix === "User:" || t.getNamespacePrefix === "User_talk:") {		const api = new mw.Api;		api.get({ action: "query", list: ["usercontribs", "users"], ucuser: [t.getMain], uclimit: 1, usprop: ["editcount", "gender"], ususers: [t.getMain] }).done(function(data) { const mrc = data.query.usercontribs[0]; // Most recent contribution const userinfo = data.query.users[0]; const h = document.getElementById("firstHeading"); const d = document.createElement("span"); let article; switch (userinfo.gender) { case "male": article = "his"; break; case "female": article = "her"; break; default: article = "their"; }			d.innerHTML = ` [${userinfo.editcount} edits; ${article} last was on ${mrc.title.replaceAll(/_/g, " ")} ]`; d.style.fontSize = "10pt"; h.append(d); });	} });