User:Karima Rafes/findIRIWikidata.js

function findIriWikidata{ var iriWikidata = null; var patternWikibase = /t-wikibase.*href=\"([^\'\"]+)\"/;	var str = document.documentElement.innerHTML;	var matchesWikibase = patternWikibase.exec(str);	if ( matchesWikibase !== null) {	   iriWikidata = "http:"+ matchesWikibase[1];	} 	return iriWikidata; }

var url = findIriWikidata; if(url !== null){ $("#firstHeading").append("("+/Q[0-9]+/.exec(url)+")"); }