Diferencia entre revisiones de «MediaWiki:Gadget-Mailable.js»
De WikiEducator
m (mail icon has been removed from vector, make a local copy MW 1.23+) |
(update gadget from en.WE) |
||
(Una revisión intermedia por el mismo usuario no mostrado) | |||
Línea 12: | Línea 12: | ||
function(d) { | 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')) { | 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() + '<a href="/Special:EmailUser/' + wgTitle + '" title="Email ' + wgTitle + '"><img style="margin-left: 1em;" src="/ | + | $('#firstHeading').html($('#firstHeading').text() + '<a href="/Special:EmailUser/' + wgTitle + '" title="Email ' + wgTitle + '"><img style="margin-left: 1em;" src="/skins/common/we/icons/mail-icon.png" /></a>'); |
} | } | ||
} | } |
Última revisión de 21:25 3 mar 2015
( 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 <jim@OERfoundation.org> * @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() + '<a href="/Special:EmailUser/' + wgTitle + '" title="Email ' + wgTitle + '"><img style="margin-left: 1em;" src="/skins/common/we/icons/mail-icon.png" /></a>'); } } ); } }); }( mediaWiki, jQuery ) );