MediaWiki:Gadget-emailLinks.js

// /* email links *//*
 * BY: U:Technical 13
 * 20 August 2015
 * This Gadget shows all email links placed by T:User or T:UserForums if the user has email set up and enabled.

// ( new mw.Api ).get( { action: 'query',  meta: 'userinfo',  uiprop: 'rights' } ).done( function( uiResponse ) {  if ( $.inArray(  'sendemail', uiResponse.query.userinfo.rights ) !== -1 ) {    $( '.emailLink' ).each( function{ var checkEmailableUser = $( this ).attr( 'class' ).replace( 'emailLink ',  ).replace( 'email', ); ( new mw.Api ).get( {       action: 'query',        list: 'users',        usprop: 'emailable',        ususers: checkEmailableUser      } ).done( function( usResponse ) {        var isEmailable = ( usResponse.query.users[ 0 ].emailable !== undefined ? true : false );       if ( isEmailable ) {          $( '.email' + checkEmailableUser ).show;        }      } ); } ); } } ); //