User:Danski454/wikidata Qnum.js

Source: Wikipedia, the free encyclopedia.
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.
$(document).ready(function(){
	if ($("#t-wikibase").length === 1) {//do we have a wikidata link?
		var splitHref = $("#t-wikibase a").attr("href").split("/");//split up the link
		var qnum = splitHref[splitHref.length - 1];//get the last item
		$("#firstHeading").append(' <span style="font-size:65%">(' + qnum + ")</span>");//add to title
	} else if (mw.config.get("wgWikibaseItemId")) {
		$("#firstHeading").append(' <span style="font-size:65%">(' + mw.config.get("wgWikibaseItemId") + ")</span>");//add to title
	}
});