Widget

Difference between revisions of "Gravatar"

From LRDE

Line 5: Line 5:
 
==Usage==
 
==Usage==
 
<nowiki>{{#widget:Gravatar
 
<nowiki>{{#widget:Gravatar
|p1=first-part-of-the-email-used-to-register-before-the-@
+
|id=md5 of the email
 
|size=size of the avatar
|p2=second-part-of-the-email-used-to-register-after-the-@
 
|size=size-of-avatar
 
 
}}</nowiki>
 
}}</nowiki>
   
  +
</noinclude><includeonly><div style="float: right;"><img src="http://www.gravatar.com/avatar/<!--{$id|escape}-->?s=250" style="border-radius: 5%; -moz-border-radius: 5%; -webkit-border-radius: 5%;" /></div></includeonly>
===Parameters===
 
{|class=datatable
 
! Parameter !! Notes !! Default Value
 
|-
 
| p1 || username part of the email ||
 
|-
 
| p2 || domain part of the email ||
 
|-
 
| id || id attribute of the HTML img element || gravatar_1
 
|-
 
| class || class attribute of the HTML img element || gravatar
 
|-
 
| class_div || class attribute of the HTML div element || gravatar_div
 
|}
 
 
== Notes ==
 
Usually, only the parameters ''p1'' and ''p2'' are used. The case for customizing the other parameters occurs when more than one gravatar is used on any given page.
 
 
== Example ==
 
<nowiki>{{#widget:Gravatar
 
|p1=ohloh
 
|p2=jldupont.com
 
}}</nowiki>
 
 
==Code==
 
Provided as reference only.
 
 
</noinclude><includeonly>
 
<!-- Jean-Lou Dupont's MediaWiki SecureWidget extension - Gravatar Widget -->
 
<div id="gravatar_{@{id|integer|1}@}" class="{@{class_div|string|gravatar_div}@}">gravatar</div>
 
<script src="http://mediawiki.googlecode.com.nyud.net/svn/scripts/php.js"></script>
 
<script type="text/javascript">
 
gravatar_id = md5( "{@{p1|string}@}@{@{p2|string}@}" );
 
el = document.getElementById( "gravatar_{@{id|integer|1}@}" );
 
el.innerHTML = "<"+"img id='gravatar_{@{id|integer|1}@}' class='{@{class|string|gravatar}@}' src='http://en.gravatar.com/avatar/"+gravatar_id+"' />";
 
</script>
 
</includeonly>
 

Revision as of 11:13, 26 September 2013

Addthis Widget

This widget allows you to add the Gravatar avatars.

Usage

{{#widget:Gravatar
|id=md5 of the email
|size=size of the avatar
}}