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 ] ) { 8 continue; 9 } 10 11 for ( var key in arguments[ i ] ) { 12 if ( Object.hasOwn( arguments[ i ], key ) ) { 13 out[ key ] = arguments[ i ][ key ]; 14 } 15 } 16 } 17 18 return out; 19 }; 20 21 WPGroHo = extend( 22 { 23 my_hash: '', 24 data: {}, 25 renderers: {}, 26 syncProfileData: function ( hash, id ) { 27 var hashElements; 28 29 if ( ! WPGroHo.data[ hash ] ) { 30 WPGroHo.data[ hash ] = {}; 31 hashElements = document.querySelectorAll( 'div.grofile-hash-map-' + hash + ' span' ); 32 for ( var i = 0; i < hashElements.length; i++ ) { 33 WPGroHo.data[ hash ][ hashElements[ i ].className ] = hashElements[ i ].innerText; 34 } 35 } 36 37 WPGroHo.appendProfileData( WPGroHo.data[ hash ], hash, id ); 38 }, 39 appendProfileData: function ( data, hash, id ) { 40 for ( var key in data ) { 41 if ( 'function' === typeof WPGroHo.renderers[ key ] ) { 42 return WPGroHo.renderers[ key ]( data[ key ], hash, id, key ); 43 } 44 45 var card = document.getElementById( id ); 46 if ( card ) { 47 var heading = card.querySelector( 'h4' ); 48 if ( heading ) { 49 var extra = document.createElement( 'p' ); 50 extra.className = 'grav-extra ' + key; 51 extra.textContent = data[ key ]; 52 53 heading.insertAdjacentElement( 'afterend', extra ); 54 } 55 } 56 } 57 }, 58 }, 59 WPGroHo || {} 60 ); 61 62 var jetpackHovercardsInit = function () { 63 if ( 'undefined' === typeof Gravatar ) { 64 return; 65 } 66 67 Gravatar.profile_cb = function ( h, d ) { 68 WPGroHo.syncProfileData( h, d ); 69 }; 70 71 Gravatar.my_hash = WPGroHo.my_hash; 72 Gravatar.init( 'body', '#wpadminbar' ); 73 }; 74 75 if ( document.readyState === 'interactive' || document.readyState === 'complete' ) { 76 jetpackHovercardsInit(); 77 } else { 78 document.addEventListener( 'DOMContentLoaded', jetpackHovercardsInit ); 79 } 80} )(); 81; 82/** 83 * File primary-navigation.js. 84 * 85 * This files only gets added to themes that support the mobile nav on side 86 */ 87( function() { 88 89 /** 90 * Menu Toggle Behaviors 91 * 92 * @param {Element} element 93 */ 94 var navMenu = function ( buttonId, inputId ) { 95 var wrapper = document.body; 96 97 var toggleButton = document.getElementById( buttonId ); 98 var toggleInput = document.getElementById( inputId ); 99 100 if ( toggleButton ) { 101 toggleButton.onclick = function() { 102 if ( true == toggleInput.checked ) { 103 wrapper.classList.remove( 'lock-scrolling' ); 104 } else { 105 wrapper.classList.add( 'lock-scrolling' ); 106 } 107 108 toggleButton.focus(); 109 } 110 } 111 112 document.addEventListener( 'click', function( event ) { 113 // If target onclick is <a> with # within the href attribute 114 if ( event.target.hash && event.target.hash.includes( '#' ) ) { 115 wrapper.classList.remove( 'lock-scrolling' ); 116 if (toggleInput) { 117 toggleInput.checked = false; 118 } 119 // Wait 550 and scroll to the anchor. 120 setTimeout(function () { 121 var anchor = document.getElementById(event.target.hash.slice(1)); 122 anchor.scrollIntoView(); 123 }, 550); 124 } 125 } ); 126 } 127 128 window.addEventListener( 'load', function() { 129 navMenu( 'toggle-menu', 'toggle' ); 130 navMenu( 'toggle-cart', 'woocommerce-toggle' ); 131 } ); 132} )();;
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.