MediaWiki:Gadget-emailLinks.js

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

// //( function ( $, mw ) { $( '.emailLink' ).each( function{ var checkEmailableUser = $( this ).attr( 'class' ).replace( 'emailLink ',  ).replace( 'email', ); $.ajax( {//* REALLY DON'T LIKE THIS!!! *//*     url: 'http://ddowiki.com/api.php?'        + 'action=query'        + '&format=json'        + '&list=users'        + '&usprop=emailable'        + '&ususers=' + encodeURIComponent( checkEmailableUser ),      dataType: 'json',      success: function( userData ) {            var isEmailable = ( userData.query.users[ 0 ].emailable !== undefined ? true : false );           if ( isEmailable ) {                $( '.email' + checkEmailableUser ).show;            }      },      fail: function( failureData ) {        alert( 'Sorry, failed to retrieve information from API.\n' + 'Please check the console for more details if available.' );       console.error( '%O', failureData );      }    } ); } ); //} )( mediaWiki, jQuery ); //