1/** 2 * navigation.js 3 * 4 * Handles toggling the navigation menu for small screens and enables tab 5 * support for dropdown menus. 6 */ 7( function() { 8 var container, button, menu, links, subMenus; 9 10 container = document.getElementById( 'site-navigation' ); 11 if ( ! container ) { 12 return; 13 } 14 15 button = document.getElementsByClassName( 'menu-toggle' )[0]; 16 if ( 'undefined' === typeof button ) { 17 return; 18 } 19 20 menu = container.getElementsByTagName( 'ul' )[0]; 21 22 // Hide menu toggle button if menu is empty and return early. 23 if ( 'undefined' === typeof menu ) { 24 button.style.display = 'none'; 25 return; 26 } 27 28 menu.setAttribute( 'aria-expanded', 'false' ); 29 if ( -1 === menu.className.indexOf( 'nav-menu' ) ) { 30 menu.className += ' nav-menu'; 31 } 32 33 button.onclick = function() { 34 if ( -1 !== container.className.indexOf( 'toggled' ) ) { 35 container.className = container.className.replace( ' toggled', '' ); 36 button.setAttribute( 'aria-expanded', 'false' ); 37 menu.setAttribute( 'aria-expanded', 'false' ); 38 } else { 39 container.className += ' toggled'; 40 button.setAttribute( 'aria-expanded', 'true' ); 41 menu.setAttribute( 'aria-expanded', 'true' ); 42 } 43 }; 44 45 // Get all the link elements within the menu. 46 links = menu.getElementsByTagName( 'a' ); 47 subMenus = menu.getElementsByTagName( 'ul' ); 48 49 // Set menu items with submenus to aria-haspopup="true". 50 for ( var i = 0, len = subMenus.length; i < len; i++ ) { 51 subMenus[i].parentNode.setAttribute( 'aria-haspopup', 'true' ); 52 } 53 54 // Each time a menu link is focused or blurred, toggle focus. 55 for ( i = 0, len = links.length; i < len; i++ ) { 56 links[i].addEventListener( 'focus', toggleFocus, true ); 57 links[i].addEventListener( 'blur', toggleFocus, true ); 58 } 59 60 /** 61 * Sets or removes .focus class on an element. 62 */ 63 function toggleFocus() { 64 var self = this; 65 66 // Move up through the ancestors of the current link until we hit .nav-menu. 67 while ( -1 === self.className.indexOf( 'nav-menu' ) ) { 68 69 // On li elements toggle the class .focus. 70 if ( 'li' === self.tagName.toLowerCase() ) { 71 if ( -1 !== self.className.indexOf( 'focus' ) ) { 72 self.className = self.className.replace( ' focus', '' ); 73 } else { 74 self.className += ' focus'; 75 } 76 } 77 78 self = self.parentElement; 79 } 80 } 81 82 /** 83 * Fix child menus for touch devices 84 */ 85 function fixMenuTouchTaps( container ) { 86 87 var touchStartFn, 88 parentLink = container.querySelectorAll( '.menu-item-has-children > a, .page_item_has_children > a' ); 89 90 if ( 'ontouchstart' in window ) { 91 if( window.innerWidth > 1000 ) { 92 touchStartFn = function( e ) { 93 var menuItem = this.parentNode; 94 95 if ( ! menuItem.classList.contains( 'focus' ) ) { 96 e.preventDefault(); 97 for( var i = 0; i < menuItem.parentNode.children.length; ++i ) { 98 if ( menuItem === menuItem.parentNode.children[i] ) { 99 continue; 100 } 101 menuItem.parentNode.children[i].classList.remove( 'focus' ); 102 } 103 menuItem.classList.add( 'focus' ); 104 } else { 105 menuItem.classList.remove( 'focus' ); 106 } 107 }; 108 109 for ( var i = 0; i < parentLink.length; ++i ) { 110 parentLink[i].addEventListener( 'touchstart', touchStartFn, false ) 111 } 112 } 113 } 114 } 115 116 fixMenuTouchTaps( container ); 117 118} )();; 119( function () { 120 'use strict'; 121 122 var menuToggle; 123 var searchToggle; 124 var search; 125 var menu; 126 127 var pendingTransition; 128 129 function cleanUp( el ) { 130 el.style.removeProperty( 'display' ); 131 el.style.removeProperty( 'height' ); 132 el.style.removeProperty( 'margin-top' ); 133 el.style.removeProperty( 'overflow' ); 134 el.style.removeProperty( 'transition' ); 135 } 136 137 function slideDown( el ) { 138 // Start by cancelling any ongoing transitions and displaying the element. 139 // Note that this won't actually render on screen, as we won't give the 140 // browser a chance to do that. 141 cleanUp( el ); 142 pendingTransition = null; 143 el.style.display = 'block'; 144 145 // Take measurements. 146 var styles = getComputedStyle( el ); 147 var height = styles.height; 148 var marginTop = styles.marginTop; 149 150 // Re-hide the element by setting the height to 0, before the browser has a 151 // chance to render. Also, set up animation parameters for the next step. 152 el.style.height = 0; 153 el.style.overflow = 'hidden'; 154 el.style.transition = 'height 400ms, margin-top 400ms'; 155 156 // Now that we have our end numbers and the stage is set, trigger animation. 157 // Sadly, we must use a non-performant height/margin animation, as we need 158 // to push all the other page content down while resizing the element. 159 // We use a double rAF to ensure browser compatibility. 160 requestAnimationFrame( function () { 161 requestAnimationFrame( function () { 162 el.style.height = height; 163 el.style.marginTop = marginTop; 164 } ); 165 } ); 166 } 167 168 function slideUp( el ) {
169 // Trigger animation. 170 el.style.height = 0; 171 el.style.marginTop = 0; 172 173 var whenFinished = function ( e ) { 174 if ( e.target === el && e.propertyName === 'height' ) { 175 if ( pendingTransition === whenFinished ) { 176 cleanUp( el ); 177 pendingTransition = null; 178 } 179 el.removeEventListener( 'transitionend', whenFinished ); 180 el.removeEventListener( 'transitioncancel', whenFinished ); 181 } 182 }; 183 184 // Listen for animation end, so that we can clean up. 185 el.addEventListener( 'transitionend', whenFinished ); 186 el.addEventListener( 'transitioncancel', whenFinished ); 187 pendingTransition = whenFinished; 188 } 189 190 function toggleSlider( button, slider ) { 191 if ( button.classList.contains( 'active' ) ) { 192 button.classList.remove( 'active' ); 193 document.body.classList.remove( 'toggle-active' ); 194 slideUp( slider ); 195 } else { 196 button.classList.add( 'active' ); 197 document.body.classList.add( 'toggle-active' ); 198 slideDown( slider ); 199 } 200 } 201 202 function init() { 203 menuToggle = document.querySelector( '.menu-toggle' ); 204 searchToggle = document.querySelector( '.search-toggle' ); 205 search = document.querySelector( '.mobile-search' ); 206 menu = document.querySelector( '.main-navigation' ); 207 208 if ( ! menuToggle || ! searchToggle || ! search || ! menu ) { 209 return; 210 } 211 212 // Toggle mobile-menu. 213 menuToggle.addEventListener( 'click', function ( e ) { 214 e.preventDefault(); 215 toggleSlider( menuToggle, menu ); 216 217 if ( searchToggle.classList.contains( 'active' ) ) { 218 toggleSlider( searchToggle, search ); 219 } 220 } ); 221 222 // Toggle mobile-search. 223 searchToggle.addEventListener( 'click', function ( e ) { 224 e.preventDefault(); 225 toggleSlider( searchToggle, search ); 226 227 if ( menuToggle.classList.contains( 'active' ) ) { 228 toggleSlider( menuToggle, menu ); 229 } 230 } ); 231 232 // Hide/show mobile menu/search block > 1000. 233 window.addEventListener( 'resize', function () { 234 if ( window.innerWidth > 1000 ) { 235 document.body.classList.remove( 'toggle-active' ); 236 menuToggle.classList.remove( 'active' ); 237 searchToggle.classList.remove( 'active' ); 238 search.style.removeProperty( 'display' ); 239 cleanUp( search ); 240 cleanUp( menu ); 241 } 242 } ); 243 } 244 245 if ( document.readyState !== 'loading' ) { 246 init(); 247 } else { 248 document.addEventListener( 'DOMContentLoaded', init ); 249 } 250} )(); 251; 252( function() { 253 var is_webkit = navigator.userAgent.toLowerCase().indexOf( 'webkit' ) > -1, 254 is_opera = navigator.userAgent.toLowerCase().indexOf( 'opera' ) > -1, 255 is_ie = navigator.userAgent.toLowerCase().indexOf( 'msie' ) > -1; 256 257 if ( ( is_webkit || is_opera || is_ie ) && document.getElementById && window.addEventListener ) { 258 window.addEventListener( 'hashchange', function() { 259 var id = location.hash.substring( 1 ), 260 element; 261 262 if ( ! ( /^[A-z0-9_-]+$/.test( id ) ) ) { 263 return; 264 } 265 266 element = document.getElementById( id ); 267 268 if ( element ) { 269 if ( ! ( /^(?:a|select|input|button|textarea)$/i.test( element.tagName ) ) ) { 270 element.tabIndex = -1; 271 } 272 273 element.focus(); 274 } 275 }, false ); 276 } 277})(); 278; 279/*! This file is auto-generated */ 280window.addComment=function(v){var I,C,h,E=v.document,b={commentReplyClass:"comment-reply-link",commentReplyTitleId:"reply-title",cancelReplyId:"cancel-comment-reply-link",commentFormId:"commentform",temporaryFormId:"wp-temp-form-div",parentIdFieldId:"comment_parent",postIdFieldId:"comment_post_ID"},e=v.MutationObserver||v.WebKitMutationObserver||v.MozMutationObserver,i="querySelector"in E&&"addEventListener"in v,n=!!E.documentElement.dataset;function t(){o(),e&&new e(d).observe(E.body,{childList:!0,subtree:!0})}function o(e){if(i&&(I=g(b.cancelReplyId),C=g(b.commentFormId),I)){I.addEventListener("click",l);function t(e){if((e.metaKey||e.ctrlKey)&&13===e.keyCode&&"a"!==E.activeElement.tagName.toLowerCase())return C.removeEventListener("keydown",t),e.preventDefault(),C.submit.click(),!1}C&&C.addEventListener("keydown",t);for(var n=function(e){var t=b.commentReplyClass;e&&e.childNodes||(e=E);e=E.getElementsByClassName?e.getElementsByClassName(t):e.querySelectorAll("."+t);return e}(e),o=0,d=n.length;o<d;o++)n[o].addEventListener("click",r)}}function l(e){var t,n,o=g(b.temporaryFormId);
280o&&h&&(g(b.parentIdFieldId).value="0",t=o.textContent,o.parentNode.replaceChild(h,o),this.style.display="none",n=(o=(o=g(b.commentReplyTitleId))&&o.firstChild)&&o.nextSibling,o&&o.nodeType===Node.TEXT_NODE&&t&&(n&&"A"===n.nodeName&&n.id!==b.cancelReplyId&&(n.style.display=""),o.textContent=t),e.preventDefault())}function r(e){var t=g(b.commentReplyTitleId),t=t&&t.firstChild.textContent,n=this,o=a(n,"belowelement"),d=a(n,"commentid"),i=a(n,"respondelement"),l=a(n,"postid"),n=a(n,"replyto")||t;o&&d&&i&&l&&!1===v.addComment.moveForm(o,d,i,l,n)&&e.preventDefault()}function d(e){for(var t=e.length;t--;)if(e[t].addedNodes.length)return void o()}function a(e,t){return n?e.dataset[t]:e.getAttribute("data-"+t)}function g(e){return E.getElementById(e)}return i&&"loading"!==E.readyState?t():i&&v.addEventListener("DOMContentLoaded",t,!1),{init:o,moveForm:function(e,t,n,o,d){var i,l,r,a,m,c,s,e=g(e),n=(h=g(n),g(b.parentIdFieldId)),y=g(b.postIdFieldId),p=g(b.commentReplyTitleId),u=(p=p&&p.firstChild)&&p.nextSibling;if(e&&h&&n){void 0===d&&(d=p&&p.textContent),a=h,m=b.temporaryFormId,c=g(m),s=(s=g(b.commentReplyTitleId))?s.firstChild.textContent:"",c||((c=E.createElement("div")).id=m,c.style.display="none",c.textContent=s,a.parentNode.insertBefore(c,a)),o&&y&&(y.value=o),n.value=t,I.style.display="",e.parentNode.insertBefore(h,e.nextSibling),p&&p.nodeType===Node.TEXT_NODE&&(u&&"A"===u.nodeName&&u.id!==b.cancelReplyId&&(u.style.display="none"),p.textContent=d),I.onclick=function(){return!1};try{for(var f=0;f<C.elements.length;f++)if(i=C.elements[f],l=!1,"getComputedStyle"in v?r=v.getComputedStyle(i):E.documentElement.currentStyle&&(r=i.currentStyle),(i.offsetWidth<=0&&i.offsetHeight<=0||"hidden"===r.visibility)&&(l=!0),"hidden"!==i.type&&!i.disabled&&!l){i.focus();break}}catch(e){}return!1}}}}(window);; 281!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.JetpackScriptDataModule=t():e.JetpackScriptDataModule=t()}(globalThis,()=>(()=>{"use strict";var e={729(e,t,r){r.d(t,{$8:()=>n.$8,IT:()=>n.IT,KS:()=>n.KS,L2:()=>n.L2,Sy:()=>n.Sy,au:()=>n.au,d_:()=>n.d_,e5:()=>n.e5,hT:()=>n.hT,lI:()=>n.lI,mH:()=>n.mH,oQ:()=>n.oQ,sV:()=>n.sV});var n=r(336)},336(e,t,r){function n(){return window.JetpackScriptData}function o(){return n()?.site}function i(e=""){return`${n()?.site.admin_url}${e}`}function a(e=""){return i(`admin.php?page=jetpack${e}`)}function u(e=""){return i(`admin.php?page=my-jetpack${e}`)}function p(){return n()?.site.plan?.features?.active??[]}function c(e){return-1!==p().indexOf(e)}function s(){return"wpcom"===n()?.site?.host}function f(){return"woa"===n()?.site?.host}function d(){return n()?.site?.is_wpcom_platform}function l(){return"unknown"===n()?.site?.host}function S(){return s()?"simple":f()?"woa":"jetpack"}function m(e){return n()?.user.current_user.capabilities[e]}r.d(t,{$8:()=>d,IT:()=>c,KS:()=>S,L2:()=>l,Sy:()=>s,au:()=>n,d_:()=>m,e5:()=>u,hT:()=>i,lI:()=>f,mH:()=>p,oQ:()=>a,sV:()=>o})}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{currentUserCan:()=>o.d_,getActiveFeatures:()=>o.mH,getAdminUrl:()=>o.hT,getJetpackAdminPageUrl:()=>o.oQ,getMyJetpackUrl:()=>o.e5,getScriptData:()=>o.au,getSiteData:()=>o.sV,getSiteType:()=>o.KS,isJetpackSelfHostedSite:()=>o.L2,isSimpleSite:()=>o.Sy,isWoASite:()=>o.lI,isWpcomPlatformSite:()=>o.$8,siteHasFeature:()=>o.IT});var o=r(729);return n})());; 282/** 283 * Observe how the user enters content into the comment form in order to determine whether it's a bot or not. 284 * 285 * Note that no actual input is being saved here, only counts and timings between events. 286 */ 287 288( function() { 289 // Passive event listeners are guaranteed to never call e.preventDefault(), 290 // but they're not supported in all browsers. Use this feature detection 291 // to determine whether they're available for use. 292 var supportsPassive = false;
293 294 try { 295 var opts = Object.defineProperty( {}, 'passive', { 296 get : function() { 297 supportsPassive = true; 298 } 299 } ); 300 301 window.addEventListener( 'testPassive', null, opts ); 302 window.removeEventListener( 'testPassive', null, opts ); 303 } catch ( e ) {} 304 305 function init() { 306 var input_begin = ''; 307 308 var keydowns = {}; 309 var lastKeyup = null; 310 var lastKeydown = null; 311 var keypresses = []; 312 313 var modifierKeys = []; 314 var correctionKeys = []; 315 316 var lastMouseup = null; 317 var lastMousedown = null; 318 var mouseclicks = []; 319 var mouseclickCoordinates = []; 320 321 var mousemoveTimer = null; 322 var lastMousemoveX = null; 323 var lastMousemoveY = null; 324 var lastMousemoveTime = null; 325 var mousemoveStart = null; 326 var mousemoves = []; 327 var intervalsBetweenMousemovesAndClicks = []; 328 329 var touchmoveCountTimer = null; 330 var touchmoveCount = 0; 331 332 var lastTouchEnd = null; 333 var lastTouchStart = null; 334 var touchEvents = []; 335 336 var scrollCountTimer = null; 337 var scrollCount = 0; 338 339 var correctionKeyCodes = [ 'Backspace', 'Delete', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Home', 'End', 'PageUp', 'PageDown' ]; 340 var modifierKeyCodes = [ 'Shift', 'CapsLock' ]; 341 342 var forms = document.querySelectorAll( 'form[method=post]' ); 343 344 for ( var i = 0; i < forms.length; i++ ) { 345 var form = forms[i]; 346 347 var formAction = form.getAttribute( 'action' ); 348 349 // Ignore forms that POST directly to other domains; these could be things like payment forms. 350 if ( formAction ) { 351 // Check that the form is posting to an external URL, not a path. 352 if ( formAction.indexOf( 'http://' ) == 0 || formAction.indexOf( 'https://' ) == 0 ) { 353 if ( formAction.indexOf( 'http://' + window.location.hostname + '/' ) != 0 && formAction.indexOf( 'https://' + window.location.hostname + '/' ) != 0 ) { 354 continue; 355 } 356 } 357 } 358 359 form.addEventListener( 'submit', function () { 360 var ak_bkp = prepare_array_for_request( keypresses ); 361 var ak_bmc = prepare_array_for_request( mouseclicks ); 362 var ak_bte = prepare_array_for_request( touchEvents ); 363 var ak_bmm = prepare_array_for_request( mousemoves ); 364 var ak_bcc = prepare_array_for_request( mouseclickCoordinates ); 365 var ak_bibmac = intervalsBetweenMousemovesAndClicks.slice( 0, 100 ).join( ';' ); 366 367 var input_fields = { 368 // When did the user begin entering any input? 369 'bib': input_begin, 370 371 // When was the form submitted? 372 'bfs': Date.now(), 373 374 // How many keypresses did they make? 375 'bkpc': keypresses.length, 376 377 // How quickly did they press a sample of keys, and how long between them? 378 'bkp': ak_bkp, 379 380 // How quickly did they click the mouse, and how long between clicks? 381 'bmc': ak_bmc, 382 383 // How many mouseclicks did they make? 384 'bmcc': mouseclicks.length, 385 386 // When did they press modifier keys (like Shift or Capslock)? 387 'bmk': modifierKeys.join( ';' ), 388 389 // When did they correct themselves? e.g., press Backspace, or use the arrow keys to move the cursor back 390 'bck': correctionKeys.join( ';' ), 391 392 // How many times did they move the mouse? 393 'bmmc': mousemoves.length, 394 395 // How many times did they move around using a touchscreen? 396 'btmc': touchmoveCount, 397 398 // How many times did they scroll? 399 'bsc': scrollCount, 400 401 // How quickly did they perform touch events, and how long between them? 402 'bte': ak_bte, 403 404 // How many touch events were there? 405 'btec' : touchEvents.length, 406 407 // How quickly did they move the mouse, and how long between moves? 408 'bmm' : ak_bmm, 409 410 // Click coordinates 411 'bcc' : ak_bcc, 412 413 // Milliseconds between last mouse movement and each click 414 'bibmac' : ak_bibmac 415 }; 416 417 var akismet_field_prefix = 'ak_'; 418 419 if ( this.getElementsByClassName ) { 420 // Check to see if we've used an alternate field name prefix. We store this as an attribute of the container around some of the Akismet fields. 421 var possible_akismet_containers = this.getElementsByClassName( 'akismet-fields-container' ); 422 423 for ( var containerIndex = 0; containerIndex < possible_akismet_containers.length; containerIndex++ ) { 424 var container = possible_akismet_containers.item( containerIndex ); 425
426 if ( container.getAttribute( 'data-prefix' ) ) { 427 akismet_field_prefix = container.getAttribute( 'data-prefix' ); 428 break; 429 } 430 } 431 } 432 433 for ( var field_name in input_fields ) { 434 var field = document.createElement( 'input' ); 435 field.setAttribute( 'type', 'hidden' ); 436 field.setAttribute( 'name', akismet_field_prefix + field_name ); 437 field.setAttribute( 'value', input_fields[ field_name ] ); 438 this.appendChild( field ); 439 } 440 }, supportsPassive ? { passive: true } : false ); 441 442 form.addEventListener( 'keydown', function ( e ) { 443 // If you hold a key down, some browsers send multiple keydown events in a row. 444 // Ignore any keydown events for a key that hasn't come back up yet. 445 if ( e.key in keydowns ) { 446 return; 447 } 448 449 var keydownTime = ( new Date() ).getTime(); 450 keydowns[ e.key ] = [ keydownTime ]; 451 452 if ( ! input_begin ) { 453 input_begin = keydownTime; 454 } 455 456 // In some situations, we don't want to record an interval since the last keypress -- for example, 457 // on the first keypress, or on a keypress after focus has changed to another element. Normally, 458 // we want to record the time between the last keyup and this keydown. But if they press a 459 // key while already pressing a key, we want to record the time between the two keydowns. 460 461 var lastKeyEvent = Math.max( lastKeydown, lastKeyup ); 462 463 if ( lastKeyEvent ) { 464 keydowns[ e.key ].push( keydownTime - lastKeyEvent ); 465 } 466 467 lastKeydown = keydownTime; 468 }, supportsPassive ? { passive: true } : false ); 469 470 form.addEventListener( 'keyup', function ( e ) { 471 if ( ! ( e.key in keydowns ) ) { 472 // This key was pressed before this script was loaded, or a mouseclick happened during the keypress, or... 473 return; 474 } 475 476 var keyupTime = ( new Date() ).getTime(); 477 478 if ( 'TEXTAREA' === e.target.nodeName || 'INPUT' === e.target.nodeName ) { 479 if ( -1 !== modifierKeyCodes.indexOf( e.key ) ) { 480 modifierKeys.push( keypresses.length - 1 ); 481 } else if ( -1 !== correctionKeyCodes.indexOf( e.key ) ) { 482 correctionKeys.push( keypresses.length - 1 ); 483 } else { 484 // ^ Don't record timings for keys like Shift or backspace, since they 485 // typically get held down for longer than regular typing. 486 487 var keydownTime = keydowns[ e.key ][0]; 488 489 var keypress = []; 490 491 // Keypress duration. 492 keypress.push( keyupTime - keydownTime ); 493 494 // Amount of time between this keypress and the previous keypress. 495 if ( keydowns[ e.key ].length > 1 ) { 496 keypress.push( keydowns[ e.key ][1] ); 497 } 498 499 keypresses.push( keypress ); 500 } 501 } 502 503 delete keydowns[ e.key ]; 504 505 lastKeyup = keyupTime; 506 }, supportsPassive ? { passive: true } : false ); 507 508 form.addEventListener( "focusin", function ( e ) { 509 lastKeydown = null; 510 lastKeyup = null; 511 keydowns = {}; 512 }, supportsPassive ? { passive: true } : false ); 513 514 form.addEventListener( "focusout", function ( e ) { 515 lastKeydown = null; 516 lastKeyup = null; 517 keydowns = {}; 518 }, supportsPassive ? { passive: true } : false ); 519 } 520 521 document.addEventListener( 'mousedown', function ( e ) { 522 lastMousedown = ( new Date() ).getTime(); 523 524 if ( lastMousemoveTime ) { 525 intervalsBetweenMousemovesAndClicks.push( lastMousedown - lastMousemoveTime ); 526 } 527 528 var mouseclickCoordinate = []; 529 530 var rect = e.target.getBoundingClientRect(); 531 var relativeX = e.clientX - rect.left; 532 var relativeY = e.clientY - rect.top; 533 534 // Pixel offset of the click within the target element. 535 mouseclickCoordinate.push( Math.round( relativeX ) ); 536 mouseclickCoordinate.push( Math.round( relativeY ) ); 537 538 // Percentage offset of the click within the target element. 539 mouseclickCoordinate.push( rect.width > 0 ? Math.round( relativeX / rect.width * 100 ) : 0 ); 540 mouseclickCoordinate.push( rect.height > 0 ? Math.round( relativeY / rect.height * 100 ) : 0 ); 541 542 mouseclickCoordinates.push( mouseclickCoordinate ); 543 }, supportsPassive ? { passive: true } : false ); 544 545 document.addEventListener( 'mouseup', function ( e ) { 546 if ( ! lastMousedown ) { 547 // If the mousedown happened before this script was loaded, but the mouseup happened after... 548 return; 549 } 550 551 var now = ( new Date() ).getTime(); 552 553 var mouseclick = []; 554 mouseclick.push( now - lastMousedown ); 555 556 if ( lastMouseup ) { 557 mouseclick.push( lastMousedown - lastMouseup ); 558 } 559 560 mouseclicks.push( mouseclick ); 561 562 lastMouseup = now; 563 564 // If the mouse has been clicked, don't record this time as an interval between keypresses. 565 lastKeydown = null; 566 lastKeyup = null; 567 keydowns = {}; 568 }, supportsPassive ? { passive: true } : false ); 569 570 document.addEventListener( 'mousemove', function ( e ) { 571 lastMousemoveTime = ( new Date() ).getTime(); 572 573 if ( mousemoveTimer ) { 574 clearTimeout( mousemoveTimer ); 575 mousemoveTimer = null; 576 } 577 else { 578 mousemoveStart = lastMousemoveTime; 579 lastMousemoveX = e.offsetX; 580 lastMousemoveY = e.offsetY; 581 } 582 583 mousemoveTimer = setTimeout( function ( theEvent, originalMousemoveStart ) { 584 var now = ( new Date() ).getTime() - 500; // To account for the timer delay. 585 586 var mousemove = []; 587 mousemove.push( now - originalMousemoveStart ); 588 mousemove.push( 589 Math.round( 590 Math.sqrt( 591 Math.pow( theEvent.offsetX - lastMousemoveX, 2 ) + 592 Math.pow( theEvent.offsetY - lastMousemoveY, 2 ) 593 ) 594 ) 595 ); 596 597 if ( mousemove[1] > 0 ) { 598 // If there was no measurable distance, then it wasn't really a move. 599 mousemoves.push( mousemove ); 600 } 601 602 mousemoveStart = null; 603 mousemoveTimer = null; 604 }, 500, e, mousemoveStart ); 605 }, supportsPassive ? { passive: true } : false ); 606 607 document.addEventListener( 'touchmove', function ( e ) { 608 if ( touchmoveCountTimer ) { 609 clearTimeout( touchmoveCountTimer ); 610 } 611 612 touchmoveCountTimer = setTimeout( function () { 613 touchmoveCount++; 614 }, 500 ); 615 }, supportsPassive ? { passive: true } : false ); 616 617 document.addEventListener( 'touchstart', function ( e ) { 618 lastTouchStart = ( new Date() ).getTime(); 619 }, supportsPassive ? { passive: true } : false ); 620 621 document.addEventListener( 'touchend', function ( e ) { 622 if ( ! lastTouchStart ) { 623 // If the touchstart happened before this script was loaded, but the touchend happened after... 624 return; 625 } 626 627 var now = ( new Date() ).getTime(); 628 629 var touchEvent = []; 630 touchEvent.push( now - lastTouchStart ); 631 632 if ( lastTouchEnd ) { 633 touchEvent.push( lastTouchStart - lastTouchEnd ); 634 } 635 636 touchEvents.push( touchEvent ); 637 638 lastTouchEnd = now; 639 640 // Don't record this time as an interval between keypresses. 641 lastKeydown = null; 642 lastKeyup = null; 643 keydowns = {}; 644 }, supportsPassive ? { passive: true } : false ); 645 646 document.addEventListener( 'scroll', function ( e ) {
647 if ( scrollCountTimer ) { 648 clearTimeout( scrollCountTimer ); 649 } 650 651 scrollCountTimer = setTimeout( function () { 652 scrollCount++; 653 }, 500 ); 654 }, supportsPassive ? { passive: true } : false ); 655 } 656 657 /** 658 * For the timing/coordinate data that is collected, don't send more than `limit` data points in the request. 659 * Choose a random slice and send those, with each batch separated by semicolons and the items in each batch 660 * separated by commas. 661 */ 662 function prepare_array_for_request( a, limit ) { 663 if ( ! limit ) { 664 limit = 100; 665 } 666 667 var rv = ''; 668 669 if ( a.length > 0 ) { 670 var random_starting_point = Math.max( 0, Math.floor( Math.random() * a.length - limit ) ); 671 672 for ( var i = 0; i < limit && i < a.length; i++ ) { 673 var entry = a[ random_starting_point + i ]; 674 rv += entry.join( ',' ) + ';'; 675 } 676 } 677 678 return rv; 679 } 680 681 if ( document.readyState !== 'loading' ) { 682 init(); 683 } else { 684 document.addEventListener( 'DOMContentLoaded', init ); 685 } 686})();; 687( function() { 688 var cookieValue = document.cookie.replace( /(?:(?:^|.*;\s*)eucookielaw\s*\=\s*([^;]*).*$)|^.*$/, '$1' ); 689 var overlay = document.querySelector( '#eu-cookie-law' ); 690 var container = document.querySelector( '.widget_eu_cookie_law_widget' ); 691 var initialScrollPosition, scrollFunction; 692 693 function remove( el ) { 694 return el && el.parentElement && el.parentElement.removeChild( el ); 695 } 696 697 function triggerDismissEvent() { 698 try { 699 const dismissEvent = new Event( 'eucookielaw-dismissed' ); 700 document.dispatchEvent( dismissEvent ); 701 } catch ( err ) { } 702 } 703 704 function removeOverlay() { 705 remove( overlay ); 706 triggerDismissEvent(); 707 } 708 709 function fade( el, type, fn ) { 710 var duration = 400; 711 712 el.style.display = 'block'; 713 el.style.transitionProperty = 'opacity'; 714 el.style.transitionDuration = duration + 'ms'; 715 el.style.opacity = type === 'in' ? 0 : 1; 716 717 // Double rAF to ensure styles are applied cross-browser. 718 requestAnimationFrame( function () { 719 requestAnimationFrame( function() { 720 el.style.opacity = type === 'in' ? 1 : 0; 721 // Wait for animation. 722 setTimeout( function () { 723 // Clean up. 724 el.style.removeProperty( 'opacity' ); 725 el.style.removeProperty( 'transition-property' ); 726 el.style.removeProperty( 'transition-duration' ); 727 728 if ( type === 'out' ) { 729 el.style.display = 'none'; 730 } 731 732 if ( typeof fn === 'function' ) { 733 fn(); 734 } 735 }, duration + 50 ); 736 } ); 737 } ); 738 } 739 740 function appendWidget() { 741 document.body.appendChild( container ); 742 overlay.style.display = 'block'; 743 fade( container, 'in' ); 744 } 745 746 if ( typeof wp !== 'undefined' && !! wp.customize ) { 747 appendWidget(); 748 return; 749 } 750 751 if ( ! overlay || ! container ) { 752 return; 753 } 754 755 if ( overlay.classList.contains( 'ads-active' ) ) { 756 var adsCookieValue = document.cookie.replace( /(?:(?:^|.*;\s*)personalized-ads-consent\s*\=\s*([^;]*).*$)|^.*$/, '$1' ); 757 if ( cookieValue !== '' && adsCookieValue !== '' ) { 758 removeOverlay(); 759 } 760 } else if ( cookieValue !== '' ) { 761 removeOverlay(); 762 } 763 764 appendWidget(); 765 766 overlay.querySelector( 'form' ).addEventListener( 'submit', accept ); 767 768 if ( overlay.classList.contains( 'hide-on-scroll' ) ) { 769 initialScrollPosition = window.pageYOffset; 770 771 scrollFunction = function() { 772 if ( Math.abs( window.pageYOffset - initialScrollPosition ) > 50 ) { 773 accept(); 774 } 775 }; 776 777 window.addEventListener( 'scroll', scrollFunction ); 778 } else if ( overlay.classList.contains( 'hide-on-time' ) ) { 779 var timeout = parseInt( overlay.getAttribute( 'data-hide-timeout' ), 10 ) || 0; 780 setTimeout( accept, timeout * 1000 ); 781 } 782 783 var accepted = false; 784 function accept( event ) { 785 if ( accepted ) { 786 return; 787 } 788 accepted = true; 789 790 if ( event && event.preventDefault ) { 791 event.preventDefault(); 792 } 793 794 if ( overlay.classList.contains( 'hide-on-scroll' ) ) { 795 window.removeEventListener( 'scroll', scrollFunction ); 796 } 797 798 var expireTime = new Date(); 799 var consentExpiration = parseInt( overlay.getAttribute( 'data-consent-expiration' ), 10 ) || 0; 800 expireTime.setTime( expireTime.getTime() + ( consentExpiration * 24 * 60 * 60 * 1000 ) ); 801 802 document.cookie = 'eucookielaw=' + expireTime.getTime() + ';path=/;expires=' + expireTime.toGMTString(); 803 if ( overlay.classList.contains( 'ads-active' ) && overlay.classList.contains( 'hide-on-button' ) ) { 804 document.cookie = 'personalized-ads-consent=' + expireTime.getTime() + ';path=/;expires=' + expireTime.toGMTString(); 805 } 806 807 fade( overlay, 'out', function() { 808 removeOverlay(); 809 remove( container ); 810 } ); 811 } 812} )(); 813;
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.