Jump to content

User:Theki/clink.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Theki (talk | contribs) at 13:37, 23 October 2023. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
$(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"],
			ususers: [t.getMain()]
		}).done(function(data) {
			alert(data.query.users[0].editcount);
			alert(data.query.usercontribs[0].title);
		});
	}
});