1// NOTICE! This file exists in WPCOM & WPCOMSH. Updates need to be synced to both repos. 2 3(function () { 4 document.addEventListener("DOMContentLoaded", function () { 5 const hostnames = ['wordpress.com', 'w.link', 'automattic.com']; 6 // Make sure we never show the banner on these hostnames. 7 if (hostnames.includes(window.location.hostname)) { 8 return; 9 } 10 11 var bumpStat = function (statName) { 12 new Image().src = 13 document.location.protocol + 14 "//pixel.wp.com/b.gif" + 15 "?v=wpcom-no-pv" + 16 "&x_simple_gifting_banner=" + 17 statName + 18 "&rand=" + 19 Math.random(); 20 }; 21 22 if (!document.cookie.includes("wpcom_gifting_banner_gifter=true")) { 23 giftingBanner(); 24 bumpStat("viewed_total"); 25 26 document.getElementById("wpcom-gifting-banner-button").onclick = 27 function () { 28 bumpStat("clicked"); 29 window.location.href = gifting_banner.checkout_link; 30 }; 31 document.getElementById("wpcom-gifting-banner-more-info-button").onclick = 32 function () { 33 bumpStat("moreinfo"); 34 window.open(gifting_banner.more_info_link, "_blank"); 35 }; 36 } 37 }); 38 39 function giftingBanner() { 40 // Check for hash in URL to see if we should dismiss the banner 41 var hash = location.hash; 42 if ("#gift-thank-you" === hash) { 43 var expiration = new Date(); 44 expiration.setTime( 45 expiration.getTime() + 46 1000 * 60 * 60 * 24 * gifting_banner.dismiss_days_count 47 ); 48 var expires = "expires=" + expiration.toUTCString(); 49 document.cookie = 50 "wpcom_gifting_banner_gifter=true;" + expires + ";path=/"; 51 location.hash = ""; 52 return; 53 } 54 var notice = document.createElement("div"); 55 notice.setAttribute("id", "wpcom-gifting-banner"); 56 notice.classList.add("wpcom-gifting-banner"); 57 document.documentElement.classList.add("has-wpcom-gifting-banner"); 58 notice.innerHTML = 59 '<div class="wpcom-gifting-banner__inner">' + 60 '<svg class="wpcom-gifting-banner__logo" xmlns="http://www.w3.org/2000/svg">\ 61 <path d="M12.158,12.786L9.46,20.625c0.806,0.237,1.657,0.366,2.54,0.366c1.047,0,2.051-0.181,2.986-0.51 \ 62 c-0.024-0.038-0.046-0.079-0.065-0.124L12.158,12.786z M3.009,12c0,3.559,2.068,6.634,5.067,8.092L3.788,8.341\ 63 C3.289,9.459,3.009,10.696,3.009,12z M18.069,11.546c0-1.112-0.399-1.881-0.741-2.48c-0.456-0.741-0.883-1.368-0.883-2.109\ 64 c0-0.826,0.627-1.596,1.51-1.596c0.04,0,0.078,0.005,0.116,0.007C16.472,3.904,14.34,3.009,12,3.009\ 65 c-3.141,0-5.904,1.612-7.512,4.052c0.211,0.007,0.41,0.011,0.579,0.011c0.94,0,2.396-0.114,2.396-0.114\ 66 C7.947,6.93,8.004,7.642,7.52,7.699c0,0-0.487,0.057-1.029,0.085l3.274,9.739l1.968-5.901l-1.401-3.838\ 67 C9.848,7.756,9.389,7.699,9.389,7.699C8.904,7.67,8.961,6.93,9.446,6.958c0,0,1.484,0.114,2.368,0.114\ 68 c0.94,0,2.397-0.114,2.397-0.114c0.485-0.028,0.542,0.684,0.057,0.741c0,0-0.488,0.057-1.029,0.085l3.249,9.665l0.897-2.996\ 69 C17.841,13.284,18.069,12.316,18.069,11.546z M19.889,7.686c0.039,0.286,0.06,0.593,0.06,0.924c0,0.912-0.171,1.938-0.684,3.22\ 70 l-2.746,7.94c2.673-1.558,4.47-4.454,4.47-7.771C20.991,10.436,20.591,8.967,19.889,7.686z M12,22C6.486,22,2,17.514,2,12\ 71 C2,6.486,6.486,2,12,2c5.514,0,10,4.486,10,10C22,17.514,17.514,22,12,22z" transform="scale(1.2)"/>\ 72 </svg>' + 73 '<div class="wpcom-gifting-banner__wrapper">' + 74 '<span class="wpcom-gifting-banner__title"></span>' + 75 '<img class="wpcom-gifting-banner__img" alt="ð" src="https://s.w.org/images/core/emoji/14.0.0/svg/1f381.svg"/>' + 76 '<span class="wpcom-gifting-banner__subtitle"></span>' + 77 "</div>" + 78 '<button id="wpcom-gifting-banner-button" class="wpcom-gifting-banner__button"></button>' + 79 "</div>"; 80 81 const title = document.createTextNode(gifting_banner.i18n.title); 82 const subtitle = document.createTextNode(gifting_banner.i18n.subtitle); 83 const more_info_button = document.createElement("BUTTON"); 84 more_info_button.setAttribute( 85 "id", 86 "wpcom-gifting-banner-more-info-button" 87 ); 88 more_info_button.setAttribute( 89 "class", 90 "wpcom-gifting-banner__more-info-button" 91 ); 92 const button_text = document.createTextNode( 93 gifting_banner.i18n.button_text 94 ); 95 96 notice 97 .getElementsByClassName("wpcom-gifting-banner__title")[0] 98 .appendChild(title); 99 notice 100 .getElementsByClassName("wpcom-gifting-banner__subtitle")[0] 101 .appendChild(subtitle); 102 notice 103 .getElementsByClassName("wpcom-gifting-banner__subtitle")[0] 104 .appendChild(more_info_button); 105 notice 106 .getElementsByClassName("wpcom-gifting-banner__button")[0] 107 .appendChild(button_text); 108 109 document.body.prepend(notice); 110 } 111})(); 112; 113/** 114 * Observe how the user enters content into the comment form in order to determine whether it's a bot or not. 115 *
116 * Note that no actual input is being saved here, only counts and timings between events. 117 */ 118 119( function() { 120 // Passive event listeners are guaranteed to never call e.preventDefault(), 121 // but they're not supported in all browsers. Use this feature detection 122 // to determine whether they're available for use. 123 var supportsPassive = false; 124 125 try { 126 var opts = Object.defineProperty( {}, 'passive', { 127 get : function() { 128 supportsPassive = true; 129 } 130 } ); 131 132 window.addEventListener( 'testPassive', null, opts ); 133 window.removeEventListener( 'testPassive', null, opts ); 134 } catch ( e ) {} 135 136 function init() { 137 var input_begin = ''; 138 139 var keydowns = {}; 140 var lastKeyup = null; 141 var lastKeydown = null; 142 var keypresses = []; 143 144 var modifierKeys = []; 145 var correctionKeys = []; 146 147 var lastMouseup = null; 148 var lastMousedown = null; 149 var mouseclicks = []; 150 var mouseclickCoordinates = []; 151 152 var mousemoveTimer = null; 153 var lastMousemoveX = null; 154 var lastMousemoveY = null; 155 var lastMousemoveTime = null; 156 var mousemoveStart = null; 157 var mousemoves = []; 158 var intervalsBetweenMousemovesAndClicks = []; 159 160 var touchmoveCountTimer = null; 161 var touchmoveCount = 0; 162 163 var lastTouchEnd = null; 164 var lastTouchStart = null; 165 var touchEvents = []; 166 167 var scrollCountTimer = null; 168 var scrollCount = 0; 169 170 var correctionKeyCodes = [ 'Backspace', 'Delete', 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Home', 'End', 'PageUp', 'PageDown' ]; 171 var modifierKeyCodes = [ 'Shift', 'CapsLock' ]; 172 173 var forms = document.querySelectorAll( 'form[method=post]' ); 174 175 for ( var i = 0; i < forms.length; i++ ) { 176 var form = forms[i]; 177 178 var formAction = form.getAttribute( 'action' ); 179 180 // Ignore forms that POST directly to other domains; these could be things like payment forms. 181 if ( formAction ) { 182 // Check that the form is posting to an external URL, not a path. 183 if ( formAction.indexOf( 'http://' ) == 0 || formAction.indexOf( 'https://' ) == 0 ) { 184 if ( formAction.indexOf( 'http://' + window.location.hostname + '/' ) != 0 && formAction.indexOf( 'https://' + window.location.hostname + '/' ) != 0 ) { 185 continue; 186 } 187 } 188 } 189 190 form.addEventListener( 'submit', function () { 191 var ak_bkp = prepare_array_for_request( keypresses ); 192 var ak_bmc = prepare_array_for_request( mouseclicks ); 193 var ak_bte = prepare_array_for_request( touchEvents ); 194 var ak_bmm = prepare_array_for_request( mousemoves ); 195 var ak_bcc = prepare_array_for_request( mouseclickCoordinates ); 196 var ak_bibmac = intervalsBetweenMousemovesAndClicks.slice( 0, 100 ).join( ';' ); 197 198 var input_fields = { 199 // When did the user begin entering any input? 200 'bib': input_begin, 201 202 // When was the form submitted? 203 'bfs': Date.now(), 204 205 // How many keypresses did they make? 206 'bkpc': keypresses.length, 207 208 // How quickly did they press a sample of keys, and how long between them? 209 'bkp': ak_bkp, 210 211 // How quickly did they click the mouse, and how long between clicks? 212 'bmc': ak_bmc, 213 214 // How many mouseclicks did they make? 215 'bmcc': mouseclicks.length, 216 217 // When did they press modifier keys (like Shift or Capslock)? 218 'bmk': modifierKeys.join( ';' ), 219 220 // When did they correct themselves? e.g., press Backspace, or use the arrow keys to move the cursor back 221 'bck': correctionKeys.join( ';' ), 222 223 // How many times did they move the mouse? 224 'bmmc': mousemoves.length, 225 226 // How many times did they move around using a touchscreen? 227 'btmc': touchmoveCount, 228 229 // How many times did they scroll? 230 'bsc': scrollCount, 231 232 // How quickly did they perform touch events, and how long between them? 233 'bte': ak_bte, 234 235 // How many touch events were there? 236 'btec' : touchEvents.length, 237 238 // How quickly did they move the mouse, and how long between moves? 239 'bmm' : ak_bmm, 240 241 // Click coordinates 242 'bcc' : ak_bcc, 243 244 // Milliseconds between last mouse movement and each click 245 'bibmac' : ak_bibmac 246 }; 247 248 var akismet_field_prefix = 'ak_'; 249 250 if ( this.getElementsByClassName ) { 251 // 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. 252 var possible_akismet_containers = this.getElementsByClassName( 'akismet-fields-container' ); 253 254 for ( var containerIndex = 0; containerIndex < possible_akismet_containers.length; containerIndex++ ) { 255 var container = possible_akismet_containers.item( containerIndex ); 256
257 if ( container.getAttribute( 'data-prefix' ) ) { 258 akismet_field_prefix = container.getAttribute( 'data-prefix' ); 259 break; 260 } 261 } 262 } 263 264 for ( var field_name in input_fields ) { 265 var field = document.createElement( 'input' ); 266 field.setAttribute( 'type', 'hidden' ); 267 field.setAttribute( 'name', akismet_field_prefix + field_name ); 268 field.setAttribute( 'value', input_fields[ field_name ] ); 269 this.appendChild( field ); 270 } 271 }, supportsPassive ? { passive: true } : false ); 272 273 form.addEventListener( 'keydown', function ( e ) { 274 // If you hold a key down, some browsers send multiple keydown events in a row. 275 // Ignore any keydown events for a key that hasn't come back up yet. 276 if ( e.key in keydowns ) { 277 return; 278 } 279 280 var keydownTime = ( new Date() ).getTime(); 281 keydowns[ e.key ] = [ keydownTime ]; 282 283 if ( ! input_begin ) { 284 input_begin = keydownTime; 285 } 286 287 // In some situations, we don't want to record an interval since the last keypress -- for example, 288 // on the first keypress, or on a keypress after focus has changed to another element. Normally, 289 // we want to record the time between the last keyup and this keydown. But if they press a 290 // key while already pressing a key, we want to record the time between the two keydowns. 291 292 var lastKeyEvent = Math.max( lastKeydown, lastKeyup ); 293 294 if ( lastKeyEvent ) { 295 keydowns[ e.key ].push( keydownTime - lastKeyEvent ); 296 } 297 298 lastKeydown = keydownTime; 299 }, supportsPassive ? { passive: true } : false ); 300 301 form.addEventListener( 'keyup', function ( e ) { 302 if ( ! ( e.key in keydowns ) ) { 303 // This key was pressed before this script was loaded, or a mouseclick happened during the keypress, or... 304 return; 305 } 306 307 var keyupTime = ( new Date() ).getTime(); 308 309 if ( 'TEXTAREA' === e.target.nodeName || 'INPUT' === e.target.nodeName ) { 310 if ( -1 !== modifierKeyCodes.indexOf( e.key ) ) { 311 modifierKeys.push( keypresses.length - 1 ); 312 } else if ( -1 !== correctionKeyCodes.indexOf( e.key ) ) { 313 correctionKeys.push( keypresses.length - 1 ); 314 } else { 315 // ^ Don't record timings for keys like Shift or backspace, since they 316 // typically get held down for longer than regular typing. 317 318 var keydownTime = keydowns[ e.key ][0]; 319 320 var keypress = []; 321 322 // Keypress duration. 323 keypress.push( keyupTime - keydownTime ); 324 325 // Amount of time between this keypress and the previous keypress. 326 if ( keydowns[ e.key ].length > 1 ) { 327 keypress.push( keydowns[ e.key ][1] ); 328 } 329 330 keypresses.push( keypress ); 331 } 332 } 333 334 delete keydowns[ e.key ]; 335 336 lastKeyup = keyupTime; 337 }, supportsPassive ? { passive: true } : false ); 338 339 form.addEventListener( "focusin", function ( e ) { 340 lastKeydown = null; 341 lastKeyup = null; 342 keydowns = {}; 343 }, supportsPassive ? { passive: true } : false ); 344 345 form.addEventListener( "focusout", function ( e ) { 346 lastKeydown = null; 347 lastKeyup = null; 348 keydowns = {}; 349 }, supportsPassive ? { passive: true } : false ); 350 } 351 352 document.addEventListener( 'mousedown', function ( e ) { 353 lastMousedown = ( new Date() ).getTime(); 354 355 if ( lastMousemoveTime ) { 356 intervalsBetweenMousemovesAndClicks.push( lastMousedown - lastMousemoveTime ); 357 } 358 359 var mouseclickCoordinate = []; 360 361 var rect = e.target.getBoundingClientRect(); 362 var relativeX = e.clientX - rect.left; 363 var relativeY = e.clientY - rect.top; 364 365 // Pixel offset of the click within the target element. 366 mouseclickCoordinate.push( Math.round( relativeX ) ); 367 mouseclickCoordinate.push( Math.round( relativeY ) ); 368 369 // Percentage offset of the click within the target element. 370 mouseclickCoordinate.push( rect.width > 0 ? Math.round( relativeX / rect.width * 100 ) : 0 ); 371 mouseclickCoordinate.push( rect.height > 0 ? Math.round( relativeY / rect.height * 100 ) : 0 ); 372 373 mouseclickCoordinates.push( mouseclickCoordinate ); 374 }, supportsPassive ? { passive: true } : false ); 375 376 document.addEventListener( 'mouseup', function ( e ) { 377 if ( ! lastMousedown ) { 378 // If the mousedown happened before this script was loaded, but the mouseup happened after... 379 return; 380 } 381 382 var now = ( new Date() ).getTime(); 383 384 var mouseclick = []; 385 mouseclick.push( now - lastMousedown ); 386 387 if ( lastMouseup ) { 388 mouseclick.push( lastMousedown - lastMouseup ); 389 } 390 391 mouseclicks.push( mouseclick ); 392 393 lastMouseup = now; 394 395 // If the mouse has been clicked, don't record this time as an interval between keypresses. 396 lastKeydown = null; 397 lastKeyup = null; 398 keydowns = {}; 399 }, supportsPassive ? { passive: true } : false ); 400 401 document.addEventListener( 'mousemove', function ( e ) { 402 lastMousemoveTime = ( new Date() ).getTime(); 403 404 if ( mousemoveTimer ) { 405 clearTimeout( mousemoveTimer ); 406 mousemoveTimer = null; 407 } 408 else { 409 mousemoveStart = lastMousemoveTime; 410 lastMousemoveX = e.offsetX; 411 lastMousemoveY = e.offsetY; 412 } 413 414 mousemoveTimer = setTimeout( function ( theEvent, originalMousemoveStart ) { 415 var now = ( new Date() ).getTime() - 500; // To account for the timer delay. 416 417 var mousemove = []; 418 mousemove.push( now - originalMousemoveStart ); 419 mousemove.push( 420 Math.round( 421 Math.sqrt( 422 Math.pow( theEvent.offsetX - lastMousemoveX, 2 ) + 423 Math.pow( theEvent.offsetY - lastMousemoveY, 2 ) 424 ) 425 ) 426 ); 427 428 if ( mousemove[1] > 0 ) { 429 // If there was no measurable distance, then it wasn't really a move. 430 mousemoves.push( mousemove ); 431 } 432 433 mousemoveStart = null; 434 mousemoveTimer = null; 435 }, 500, e, mousemoveStart ); 436 }, supportsPassive ? { passive: true } : false ); 437 438 document.addEventListener( 'touchmove', function ( e ) { 439 if ( touchmoveCountTimer ) { 440 clearTimeout( touchmoveCountTimer ); 441 } 442 443 touchmoveCountTimer = setTimeout( function () { 444 touchmoveCount++; 445 }, 500 ); 446 }, supportsPassive ? { passive: true } : false ); 447 448 document.addEventListener( 'touchstart', function ( e ) { 449 lastTouchStart = ( new Date() ).getTime(); 450 }, supportsPassive ? { passive: true } : false ); 451 452 document.addEventListener( 'touchend', function ( e ) { 453 if ( ! lastTouchStart ) { 454 // If the touchstart happened before this script was loaded, but the touchend happened after... 455 return; 456 } 457 458 var now = ( new Date() ).getTime(); 459 460 var touchEvent = []; 461 touchEvent.push( now - lastTouchStart ); 462 463 if ( lastTouchEnd ) { 464 touchEvent.push( lastTouchStart - lastTouchEnd ); 465 } 466 467 touchEvents.push( touchEvent ); 468 469 lastTouchEnd = now; 470 471 // Don't record this time as an interval between keypresses. 472 lastKeydown = null; 473 lastKeyup = null; 474 keydowns = {}; 475 }, supportsPassive ? { passive: true } : false ); 476 477 document.addEventListener( 'scroll', function ( e ) {
478 if ( scrollCountTimer ) { 479 clearTimeout( scrollCountTimer ); 480 } 481 482 scrollCountTimer = setTimeout( function () { 483 scrollCount++; 484 }, 500 ); 485 }, supportsPassive ? { passive: true } : false ); 486 } 487 488 /** 489 * For the timing/coordinate data that is collected, don't send more than `limit` data points in the request. 490 * Choose a random slice and send those, with each batch separated by semicolons and the items in each batch 491 * separated by commas. 492 */ 493 function prepare_array_for_request( a, limit ) { 494 if ( ! limit ) { 495 limit = 100; 496 } 497 498 var rv = ''; 499 500 if ( a.length > 0 ) { 501 var random_starting_point = Math.max( 0, Math.floor( Math.random() * a.length - limit ) ); 502 503 for ( var i = 0; i < limit && i < a.length; i++ ) { 504 var entry = a[ random_starting_point + i ]; 505 rv += entry.join( ',' ) + ';'; 506 } 507 } 508 509 return rv; 510 } 511 512 if ( document.readyState !== 'loading' ) { 513 init(); 514 } else { 515 document.addEventListener( 'DOMContentLoaded', init ); 516 } 517})();; 518( function () { 519 'use strict'; 520 521 if ( typeof window.wpcom === 'undefined' ) { 522 window.wpcom = {}; 523 } 524 525 if ( window.wpcom.carousel ) { 526 return; 527 } 528 529 var prebuilt_widths = jetpackCarouselStrings.widths; 530 var pageviews_stats_args = jetpackCarouselStrings.stats_query_args; 531 532 var findFirstLargeEnoughWidth = function ( original_w, original_h, dest_w, dest_h ) { 533 var inverse_ratio = original_h / original_w; 534 535 for ( var i = 0; i < prebuilt_widths.length; ++i ) { 536 if ( prebuilt_widths[ i ] >= dest_w || prebuilt_widths[ i ] * inverse_ratio >= dest_h ) { 537 return prebuilt_widths[ i ]; 538 } 539 } 540 541 return original_w; 542 }; 543 544 var removeResizeFromImageURL = function ( url ) { 545 return removeArgFromURL( url, 'resize' ); 546 }; 547 548 var removeArgFromURL = function ( url, arg ) { 549 var re = new RegExp( '[\\?&]' + arg + '(=[^?&]+)?' ); 550 if ( url.match( re ) ) { 551 return url.replace( re, '' ); 552 } 553 return url; 554 }; 555 556 var addWidthToImageURL = function ( url, width ) { 557 width = parseInt( width, 10 ); 558 // Give devices with a higher devicePixelRatio higher-res images (Retina display = 2, Android phones = 1.5, etc) 559 if ( 'undefined' !== typeof window.devicePixelRatio && window.devicePixelRatio > 1 ) { 560 width = Math.round( width * window.devicePixelRatio ); 561 } 562 url = addArgToURL( url, 'w', width ); 563 url = addArgToURL( url, 'h', '' ); 564 return url; 565 }; 566 567 var addArgToURL = function ( url, arg, value ) { 568 var re = new RegExp( arg + '=[^?&]+' ); 569 if ( url.match( re ) ) { 570 return url.replace( re, arg + '=' + value ); 571 } else { 572 var divider = url.indexOf( '?' ) !== -1 ? '&' : '?'; 573 return url + divider + arg + '=' + value; 574 } 575 }; 576 577 var stat = function ( names ) { 578 if ( typeof names !== 'string' ) { 579 names = names.join( ',' ); 580 } 581 582 new Image().src = window.location.protocol + 583 '//pixel.wp.com/g.gif?v=wpcom-no-pv' + 584 '&x_carousel=' + names + 585 '&baba=' + Math.random(); 586 }; 587 588 var lastTrackedPostId = null; 589 590 var pageview = function ( post_id ) { 591 // Prevent duplicate tracking of the same post during slide transitions 592 if ( post_id === lastTrackedPostId ) { 593 return; 594 } 595 596 lastTrackedPostId = post_id; 597 598 new Image().src = window.location.protocol + 599 '//pixel.wp.com/g.gif?host=' + encodeURIComponent( window.location.host ) + 600 '&ref=' + encodeURIComponent( document.referrer ) + 601 '&rand=' + Math.random() + 602 '&' + pageviews_stats_args + 603 '&post=' + encodeURIComponent( post_id ); 604 }; 605 606 var generateImgSrc = function ( srcItem, max ) { 607 var origSize = srcItem.getAttribute( 'data-orig-size' ) || ''; 608 609 var src = srcItem.getAttribute( 'src' ) || srcItem.getAttribute( 'original' ) || srcItem.getAttribute( 'data-original' ) || srcItem.getAttribute( 'data-lazy-src' ); 610 if ( src.indexOf( 'imgpress' ) !== -1 ) { 611 src = srcItem.getAttribute( 'data-orig-file' ); 612 } 613 // Square/Circle galleries use a resize param that needs to be removed. 614 src = removeResizeFromImageURL( src ); 615 src = addWidthToImageURL( 616 src, 617 findFirstLargeEnoughWidth( origSize.width, origSize.height, max.width, max.height ) 618 ); 619 620 return src; 621 }; 622 623 window.wpcom.carousel = { 624 findFirstLargeEnoughWidth: findFirstLargeEnoughWidth, 625 removeResizeFromImageURL: removeResizeFromImageURL, 626 addWidthToImageURL: addWidthToImageURL, 627 stat: stat, 628 pageview: pageview, 629 generateImgSrc: generateImgSrc 630 }; 631 632} )(); 633; 634!function(){var e=document.currentScript;function t(t){var n=document.createElement("script"),o=e||document.getElementsByTagName("script")[0];n.setAttribute("async",!0),n.setAttribute("src",t),o.parentNode.insertBefore(n,o)}function n(e,t){return Element.prototype.matches?e.matches(t):Element.prototype.msMatchesSelector?e.msMatchesSelector(t):void 0}function o(e,t){if(e.closest)return e.closest(t);var o=e;do{if(n(o,t))return o;o=o.parentElement||o.parentNode}while(null!==o&&1===o.nodeType);return null}function i(e,t){for(var n=0;n<e.length;n++)t(e[n],n,e)}var r,s=".sharing-hidden .inner",a="data-sharing-more-button-id";function c(e){this.button=e,this.pane=o(e,"div").querySelector(s),this.openedBy=null,this.recentlyOpenedByHover=!1,c.instances.push(this),this.pane.setAttribute(a,c.instances.length-1),this.attachHandlers()}if(c.instances=[],c.hoverOpenDelay=200,c.recentOpenDelay=400,c.hoverCloseDelay=300,c.instantiateOrReuse=function(e){var t=o(e,"div").querySelector(s),n=t&&t.getAttribute(a),i=c.instances[n];return i||new c(e)},c.getButtonInstanceFromPane=function(e){var t=e&&e.getAttribute(a);return c.instances[t]},c.closeAll=function(){for(var e=0;e<c.instances.length;e++)c.instances[e].close()},c.prototype.open=function(){var e,t,n=[0,0];function o(e){var t=e.getBoundingClientRect();return[t.left+(window.scrollX||window.pageXOffset||0),t.top+(window.scrollY||window.pageYOffset||0)]}function i(e,t){return parseInt(getComputedStyle(e).getPropertyValue(t)||0)}for(e=o(this.button),t=this.button.offsetParent||document.documentElement;t&&(t===document.body||t===document.documentElement)&&"static"===getComputedStyle(t).getPropertyValue("position");)t=t.parentNode;t&&t!==this.button&&1===t.nodeType&&(n=[(n=o(t))[0]+i(t,"border-left-width"),n[1]+i(t,"border-top-width")]);var r,s=e[0]-n[0]-i(this.button,"margin-left"),a=e[1]-n[1]-i(this.button,"margin-top");this.pane.style.left=s+"px",this.pane.style.top=a+this.button.offsetHeight+3+"px",(r=this.pane)&&r.style.removeProperty("display")},c.prototype.close=function(){var e;(e=this.pane)&&(e.style.display="none"),this.openedBy=null},c.prototype.toggle=function(){var e;(e=this.pane)&&"none"!==e.style.display?this.close():this.open()}
634,c.prototype.nonHoverOpen=function(){clearTimeout(this.openTimer),clearTimeout(this.closeTimer),this.recentlyOpenedByHover?(this.recentlyOpenedByHover=!1,clearTimeout(this.hoverOpenTimer),this.open()):this.toggle()},c.prototype.resetCloseTimer=function(){clearTimeout(this.closeTimer),this.closeTimer=setTimeout(this.close.bind(this),c.hoverCloseDelay)},c.prototype.attachHandlers=function(){this.buttonClick=function(e){e.preventDefault(),e.stopPropagation(),this.openedBy="click",this.nonHoverOpen()}.bind(this),this.buttonKeydown=function(e){13!==e.keyCode&&32!==e.keyCode||(e.preventDefault(),e.stopPropagation(),this.openedBy="keydown",this.nonHoverOpen())}.bind(this),this.buttonEnter=function(){this.openedBy||(this.openTimer=setTimeout(function(){this.open(),this.openedBy="hover",this.recentlyOpenedByHover=!0,this.hoverOpenTimer=setTimeout(function(){this.recentlyOpenedByHover=!1}.bind(this),c.recentOpenDelay)}.bind(this),c.hoverOpenDelay)),clearTimeout(this.closeTimer)}.bind(this),this.buttonLeave=function(){"hover"===this.openedBy&&this.resetCloseTimer(),clearTimeout(this.openTimer)}.bind(this),this.paneEnter=function(){clearTimeout(this.closeTimer)}.bind(this),this.paneLeave=function(){"hover"===this.openedBy&&this.resetCloseTimer()}.bind(this),this.documentClick=function(){this.close()}.bind(this),this.button.addEventListener("click",this.buttonClick),this.button.addEventListener("keydown",this.buttonKeydown),document.addEventListener("click",this.documentClick),void 0===document.ontouchstart&&(this.button.addEventListener("mouseenter",this.buttonEnter),this.button.addEventListener("mouseleave",this.buttonLeave),this.pane.addEventListener("mouseenter",this.paneEnter),this.pane.addEventListener("mouseleave",this.paneLeave))},window.sharing_js_options&&window.sharing_js_options.counts){var u={done_urls:[],get_counts:function(){var e,n,o,i,r;if("undefined"!=typeof WPCOM_sharing_counts)for(e in WPCOM_sharing_counts)if(o=WPCOM_sharing_counts[e],void 0===u.done_urls[o]){for(i in n={pinterest:[window.location.protocol+"//api.pinterest.com/v1/urls/count.json?callback=WPCOMSharing.update_pinterest_count&url="+encodeURIComponent(e)]})if(document.querySelector("a[data-shared=sharing-"+i+"-"+o+"]")){for(;r=n[i].pop();)t(r);window.sharing_js_options.is_stats_active&&u.bump_sharing_count_stat(i)}u.done_urls[o]=!0}},update_pinterest_count:function(e){void 0!==e.count&&1*e.count>0&&u.inject_share_count("sharing-pinterest-"+WPCOM_sharing_counts[e.url],e.count)},inject_share_count:function(e,t){i(document.querySelectorAll("a[data-shared="+e+"] > span"),function(e){var n,o=e.querySelector(".share-count");(n=o)&&n.parentNode&&n.parentNode.removeChild(n);var i=document.createElement("span");i.className="share-count",i.textContent=u.format_count(t),e.appendChild(i)})},format_count:function(e){return e<1e3?e:e>=1e3&&e<1e4?String(e).substring(0,1)+"K+":"10K+"},bump_sharing_count_stat:function(e){(new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?v=wpcom-no-pv&x_sharing-count-request="+e+"&r="+Math.random()}};window.WPCOMSharing=u}function d(e,t){e.setAttribute("jetpack-share-click-count",t)}function l(e){var t=e.getAttribute("jetpack-share-click-count");return null===t?0:parseInt(t,10)}function h(e,t){var n,o=new XMLHttpRequest;o.open("POST",e,!0),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),o.setRequestHeader("x-requested-with","XMLHttpRequest"),o.send((n=t,(encodeURIComponent("email-share-nonce")+"="+encodeURIComponent(n)).replace(/%20/g,"+")))}function p(){m()}function m(){window.WPCOMSharing&&window.WPCOMSharing.get_counts(),i(document.querySelectorAll(".sharedaddy a"),function(e){var t=e.getAttribute("href");t&&-1!==t.indexOf("share=")&&-1===t.indexOf("&nb=1")&&e.setAttribute("href",t+"&nb=1")}),i(document.querySelectorAll(".sharedaddy a.sharing-anchor"),function(e){c.instantiateOrReuse(e)}),void 0!==document.ontouchstart&&document.body.classList.add("jp-sharing-input-touch"),i(document.querySelectorAll(".sharedaddy ul"),function(e){"true"!==e.getAttribute("data-sharing-events-added")&&(e.setAttribute("data-sharing-events-added","true"),i(e.querySelectorAll("a.share-print"),function(e){e.addEventListener("click",function(t){t.preventDefault(),t.stopPropagation();var n=e.getAttribute("href")||"",i=function(){if(-1===n.indexOf("#print")){var e=(new Date).getTime();t=e,o=n,(i=document.createElement("iframe")).setAttribute("style","position:fixed; top:100; left:100; height:1px; width:1px; border:none;"),i.setAttribute("id","printFrame-"+t),i.setAttribute("name",i.getAttribute("id")),i.setAttribute("src",o),i.setAttribute("onload",'frames["printFrame-'+t+'"].focus();frames["printFrame-'+t+'"].print();'),document.body.appendChild(i)}else window.print();var t,o,i}
634,r=o(e,s);if(r){var a=c.getButtonInstanceFromPane(r);a&&(a.close(),i())}else i()})}),i(e.querySelectorAll("a.share-press-this"),function(e){var t="wp-press-this-"+Math.random().toString(36).slice(2);e.addEventListener("click",function(n){n.preventDefault(),n.stopPropagation();var o="";if(window.getSelection?o=window.getSelection():document.getSelection?o=document.getSelection():document.selection&&(o=document.selection.createRange().text),o){var i=e.getAttribute("href");e.setAttribute("href",i+"&sel="+encodeURI(o))}window.open(e.getAttribute("href"),t,"toolbar=0,resizable=1,scrollbars=1,status=1,width=720,height=570")||(document.location.href=e.getAttribute("href"))})}),i(e.querySelectorAll("a.share-email"),function(t){d(t,0);var n,o,r=t.getAttribute("data-email-share-nonce"),s=t.getAttribute("data-email-share-track-url");r&&s&&(n=s,o=window.location.protocol+"//"+window.location.hostname+"/",0===String(n).indexOf(o))&&t.addEventListener("click",function(){var n;d(n=t,l(n)+1),l(t)>2&&function(e,t){var n=t.parentElement;if(n.classList.contains("sd-content")){i(n.querySelectorAll(".share-email-error"),function(e){e.parentElement.removeChild(e)});var o=document.createElement("div");o.className="share-email-error";var r=document.createElement("h6");r.className="share-email-error-title",r.innerText=e.getAttribute("data-email-share-error-title"),o.appendChild(r);var s=document.createElement("p");s.className="share-email-error-text",s.innerText=e.getAttribute("data-email-share-error-text"),o.appendChild(s),n.appendChild(o)}}(t,e),h(s,r)})}))}),i(document.querySelectorAll("li.share-email, li.share-custom a.sharing-anchor"),function(e){e.classList.add("share-service-visible")})}"loading"!==document.readyState?p():document.addEventListener("DOMContentLoaded",p),document.body.addEventListener("is.post-load",m);var f={};!0!==window.WPCOM_sharing_popups_bound&&(document.body.addEventListener("click",function(e){var t=e.target;if(t&&1===t.nodeType){var n=function(e){if("A"===e.nodeName)return e;var t=e.parentNode;return t&&"A"===t.nodeName?t:null}(t);if(n){var o=function(e){var t=window.WPCOM_sharing_popups;if(!t)return null;for(var n="share-",o=(e.getAttribute("class")||"").split(/\s+/),i=0;i<o.length;i++)if(0===o[i].indexOf(n)){var r=o[i].slice(6);if("string"==typeof t[r])return r}return null}(n);o&&(e.preventDefault(),r&&r.close(),r=window.open(n.getAttribute("href"),function(e){return"string"!=typeof f[e]&&(f[e]="wpcom"+e+"-"+Math.random().toString(36).slice(2)),f[e]}(o),window.WPCOM_sharing_popups[o]))}}}),window.WPCOM_sharing_popups_bound=!0)}();;
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.