PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 8.2
Jetpack – WP Security, Backup, Speed, & Growth v8.2
16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 All 501 releases
jetpack / modules / wpgroho.js

wpgroho.js in Jetpack – WP Security, Backup, Speed, & Growth 8.2, at modules/wpgroho.js

44 lines 1.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /* global WPGroHo:true, Gravatar */
2 WPGroHo = jQuery.extend(
3 {
4 my_hash: '',
5 data: {},
6 renderers: {},
7 syncProfileData: function( hash, id ) {
8 if ( ! WPGroHo.data[ hash ] ) {
9 WPGroHo.data[ hash ] = {};
10 jQuery( 'div.grofile-hash-map-' + hash + ' span' ).each( function() {
11 WPGroHo.data[ hash ][ this.className ] = jQuery( this ).text();
12 } );
13 }
14
15 WPGroHo.appendProfileData( WPGroHo.data[ hash ], hash, id );
16 },
17 appendProfileData: function( data, hash, id ) {
18 for ( var key in data ) {
19 if ( jQuery.isFunction( WPGroHo.renderers[ key ] ) ) {
20 return WPGroHo.renderers[ key ]( data[ key ], hash, id, key );
21 }
22
23 jQuery( '#' + id )
24 .find( 'h4' )
25 .after( jQuery( '<p class="grav-extra ' + key + '" />' ).html( data[ key ] ) );
26 }
27 },
28 },
29 WPGroHo
30 );
31
32 jQuery( document ).ready( function() {
33 if ( 'undefined' === typeof Gravatar ) {
34 return;
35 }
36
37 Gravatar.profile_cb = function( h, d ) {
38 WPGroHo.syncProfileData( h, d );
39 };
40
41 Gravatar.my_hash = WPGroHo.my_hash;
42 Gravatar.init( 'body', '#wpadminbar' );
43 } );
44