Cp-s05box Wiki
Advertisement

Get current wiki language (needs more checking with wikis that were given custom prefixes):

mw.user.options.get("variant")

Get current user's signature:

$.getJSON("/api.php?action=query&format=json&prop=info&meta=userinfo&uiprop=options&cb=" + new Date().getTime(), function(data) {
	console.log(data.query.userinfo.options.nickname);
});

Get current normal hidden pin in CP (via the CPW):

(function foo() {
	cpJSON.get("paper_items");
	cpJSON.get("rooms");
	if (typeof cpJSON.values["paper_items"] !== "undefined" && typeof cpJSON.values["rooms"] !== "undefined") {
		for (var pin_id in cpJSON.values["rooms"]) {
			var id = cpJSON.values["rooms"][pin_id]["pin_id"],
				paper = cpJSON.values["paper_items"];
			for (var i = 0; i < paper.length; i++) {
				if (paper[i]["paper_item_id"] == id) {
					alert("The current pin is " + paper[i]["label"] + " (ID " + id + ")");
				}
			}
		}
	} else {
		setTimeout(function() {
			foo();
		}, 40);
	}
}());
Advertisement