User:AzaToth/embedded.js

function embedded { mw.util.addPortletLink( 'p-cactions', "javascript:embedded.callback", "e?", "embedded", "Is the page embedded?", ""); }

$(embedded);

embedded.callback = function { var query = { 'action': 'query', 'list': 'embeddedin', 'eititle': wgPageName, 'eilimit': 1 }	var wikipedia_api = new Wikipedia.api( 'Checking for embeddness', query, function( self ) {		var xmlDoc = self.responseXML;		var embedded = xmlDoc.evaluate( '//embeddedin/ei', xmlDoc, null, XPathResult.BOOLEAN_TYPE, null ).booleanValue;		alert( embedded ? 'yes' : 'no' );		}); wikipedia_api.post; }