1/* global WPGroHo:true, Gravatar */ 2( function () { 3 var extend = function ( out ) { 4 out = out || {}; 5 6 for ( var i = 1; i < arguments.length; i++ ) { 7 if ( ! arguments[ i ] ) continue; 8 9 for ( var key in arguments[ i ] ) { 10 if ( arguments[ i ].hasOwnProperty( key ) ) out[ key ] = arguments[ i ][ key ]; 11 } 12 } 13 14 return out; 15 }; 16 17 WPGroHo = extend( 18 { 19 my_hash: '', 20 data: {}, 21 renderers: {}, 22 syncProfileData: function ( hash, id ) { 23 var hashElements; 24 25 if ( ! WPGroHo.data[ hash ] ) { 26 WPGroHo.data[ hash ] = {}; 27 hashElements = document.querySelectorAll( 'div.grofile-hash-map-' + hash + ' span' ); 28 for ( var i = 0; i < hashElements.length; i++ ) { 29 WPGroHo.data[ hash ][ hashElements[ i ].className ] = hashElements[ i ].innerText; 30 } 31 } 32 33 WPGroHo.appendProfileData( WPGroHo.data[ hash ], hash, id ); 34 }, 35 appendProfileData: function ( data, hash, id ) { 36 for ( var key in data ) { 37 if ( 'function' === typeof WPGroHo.renderers[ key ] ) { 38 return WPGroHo.renderers[ key ]( data[ key ], hash, id, key ); 39 } 40 41 var card = document.getElementById( id ); 42 if ( card ) { 43 var heading = card.querySelector( 'h4' ); 44 if ( heading ) { 45 var extra = document.createElement( 'p' ); 46 extra.className = 'grav-extra ' + key; 47 extra.innerHTML = data[ key ]; 48 49 heading.insertAdjacentElement( 'afterend', extra ); 50 } 51 } 52 } 53 }, 54 }, 55 WPGroHo || {} 56 ); 57 58 var jetpackHovercardsInit = function () { 59 if ( 'undefined' === typeof Gravatar ) { 60 return; 61 } 62 63 Gravatar.profile_cb = function ( h, d ) { 64 WPGroHo.syncProfileData( h, d ); 65 }; 66 67 Gravatar.my_hash = WPGroHo.my_hash; 68 Gravatar.init( 'body', '#wpadminbar' ); 69 }; 70 71 if ( document.readyState === 'interactive' || document.readyState === 'complete' ) { 72 jetpackHovercardsInit(); 73 } else { 74 document.addEventListener( 'DOMContentLoaded', jetpackHovercardsInit ); 75 } 76} )();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.