User:MZMcBride/embeddedin.js

/* This is a proof-of-concept 'embeddedin detector' script using AJAX. */

if(mw.config.get('wgNamespaceNumber') == 10) embedded = function { var query = { 'action': 'query', 'list': 'embeddedin', 'eititle': mw.config.get('wgPageName'), 'eilimit': 1 }	var wikipedia_api = new Wikipedia.api( 'Checking for embeddedness', query, function( self ) {		var xmlDoc = self.responseXML;		var embedded = xmlDoc.evaluate( '//embeddedin/ei', xmlDoc, null, XPathResult.BOOLEAN_TYPE, null ).booleanValue;		if(!embedded) {                 document.getElementById('globalWrapper').style.background = '#FFD089';		}		}); wikipedia_api.post; }

if(mw.config.get('wgNamespaceNumber') == 10) addOnloadHook(embedded);