MediaWiki:Gadget-Mailable.js

( function ( mw, $ ) {	/**	 * Add a "mailable" icon to the head of user pages when a logged in user	 * visits another person's user page who has enabled the email function	 *	 * @author Jim Tittsler 	 * @date 2013-02-22	 */	$(function { if ((wgUserName !== null) && (wgNamespaceNumber === 2) && (wgAction === "view") && (wgTitle.indexOf('/') === -1)) { $.getJSON(wgServer + '/api.php', {action: 'query', format: 'json', list: 'users', ususers: wgTitle + '|' + wgUserName, usprop: 'emailable'},				function(d) {					if (d.hasOwnProperty('query') && d.query.hasOwnProperty('users') && d.query.users.length === 2 && d.query.users[0].hasOwnProperty('emailable') && d.query.users[1].hasOwnProperty('emailable')) {						$('#firstHeading').html($('#firstHeading').text + '');					}				}			); }	}); }( mediaWiki, jQuery ) );