var _____WB$wombat$assign$function_____ = function(name) {return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; };
if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { this.__WB_source = obj; return this; } }
{
let window = _____WB$wombat$assign$function_____("window");
let self = _____WB$wombat$assign$function_____("self");
let document = _____WB$wombat$assign$function_____("document");
let location = _____WB$wombat$assign$function_____("location");
let top = _____WB$wombat$assign$function_____("top");
let parent = _____WB$wombat$assign$function_____("parent");
let frames = _____WB$wombat$assign$function_____("frames");
let opener = _____WB$wombat$assign$function_____("opener");
window.addEventListener( 'load', () => {
const FRONTEND_SELECTOR = '.wp-block-jetpack-contact-form-container';
const EDITOR_SELECTOR = '[data-type="jetpack/contact-form"]';
const observer = new MutationObserver( () => {
generateStyleVariables( FRONTEND_SELECTOR );
generateStyleVariables( EDITOR_SELECTOR );
} );
observer.observe( document.querySelector( 'body' ), {
childList: true,
subtree: true,
} );
//Make sure to execute at least once if not triggered by the observer
setTimeout( () => {
generateStyleVariables( FRONTEND_SELECTOR );
generateStyleVariables( EDITOR_SELECTOR );
}, 300 );
} );
function generateStyleVariables( selector, outputSelector = 'body' ) {
const STYLE_PROBE_CLASS = 'contact-form__style-probe';
const STYLE_PROBE_STYLE =
'position: absolute; z-index: -1; width: 1px; height: 1px; visibility: hidden';
const HTML = `
`;
const iframeCanvas = document.querySelector( 'iframe[name="editor-canvas"]' );
const doc = iframeCanvas ? iframeCanvas.contentDocument : document;
if (
! doc.querySelectorAll( selector ).length ||
doc.querySelectorAll( `.${ STYLE_PROBE_CLASS }` ).length
) {
return;
}
const styleProbe = doc.createElement( 'div' );
styleProbe.className = STYLE_PROBE_CLASS;
styleProbe.style = STYLE_PROBE_STYLE;
styleProbe.innerHTML = HTML;
const container = doc.querySelector( selector );
container.appendChild( styleProbe );
const bodyNode = doc.querySelector( 'body' );
const buttonNode = styleProbe.querySelector( '.wp-block-button__link' );
const inputNode = styleProbe.querySelector( 'input[type="text"]' );
const backgroundColor = window.getComputedStyle( bodyNode ).backgroundColor;
const primaryColor = window.getComputedStyle( buttonNode ).borderColor;
const {
color: textColor,
padding: inputPadding,
backgroundColor: inputBackground,
border,
borderColor,
borderWidth,
borderStyle,
borderRadius,
fontSize,
fontFamily,
lineHeight,
} = window.getComputedStyle( inputNode );
const outputContainer = doc.querySelector( outputSelector );
outputContainer.style.setProperty( '--jetpack--contact-form--primary-color', primaryColor );
outputContainer.style.setProperty( '--jetpack--contact-form--background-color', backgroundColor );
outputContainer.style.setProperty( '--jetpack--contact-form--text-color', textColor );
outputContainer.style.setProperty( '--jetpack--contact-form--border', border );
outputContainer.style.setProperty( '--jetpack--contact-form--border-color', borderColor );
outputContainer.style.setProperty( '--jetpack--contact-form--border-size', borderWidth );
outputContainer.style.setProperty( '--jetpack--contact-form--border-style', borderStyle );
outputContainer.style.setProperty( '--jetpack--contact-form--border-radius', borderRadius );
outputContainer.style.setProperty( '--jetpack--contact-form--input-background', inputBackground );
outputContainer.style.setProperty( '--jetpack--contact-form--input-padding', inputPadding );
outputContainer.style.setProperty( '--jetpack--contact-form--font-size', fontSize );
outputContainer.style.setProperty( '--jetpack--contact-form--font-family', fontFamily );
outputContainer.style.setProperty( '--jetpack--contact-form--line-height', lineHeight );
}
;
/* Detect-zoom
* -----------
* Cross Browser Zoom and Pixel Ratio Detector
* Version 1.0.4 | Apr 1 2013
* dual-licensed under the WTFPL and MIT license
* Maintained by https://github/tombigel
* Original developer https://github.com/yonran
*/
//AMD and CommonJS initialization copied from https://github.com/zohararad/audio5js
(function (root, ns, factory) {
"use strict";
if (typeof (module) !== 'undefined' && module.exports) { // CommonJS
module.exports = factory(ns, root);
} else if (typeof (define) === 'function' && define.amd) { // AMD
define("factory", function () {
return factory(ns, root);
});
} else {
root[ns] = factory(ns, root);
}
}(window, 'detectZoom', function () {
/**
* Use devicePixelRatio if supported by the browser
* @return {Number}
* @private
*/
var devicePixelRatio = function () {
return window.devicePixelRatio || 1;
};
/**
* Fallback function to set default values
* @return {Object}
* @private
*/
var fallback = function () {
return {
zoom: 1,
devicePxPerCssPx: 1
};
};
/**
* IE 8 and 9: no trick needed!
* TODO: Test on IE10 and Windows 8 RT
* @return {Object}
* @private
**/
var ie8 = function () {
var zoom = Math.round((screen.deviceXDPI / screen.logicalXDPI) * 100) / 100;
return {
zoom: zoom,
devicePxPerCssPx: zoom * devicePixelRatio()
};
};
/**
* For IE10 we need to change our technique again...
* thanks https://github.com/stefanvanburen
* @return {Object}
* @private
*/
var ie10 = function () {
var zoom = Math.round((document.documentElement.offsetHeight / window.innerHeight) * 100) / 100;
return {
zoom: zoom,
devicePxPerCssPx: zoom * devicePixelRatio()
};
};
/**
* Mobile WebKit
* the trick: window.innerWIdth is in CSS pixels, while
* screen.width and screen.height are in system pixels.
* And there are no scrollbars to mess up the measurement.
* @return {Object}
* @private
*/
var webkitMobile = function () {
var deviceWidth = (Math.abs(window.orientation) == 90) ? screen.height : screen.width;
var zoom = deviceWidth / window.innerWidth;
return {
zoom: zoom,
devicePxPerCssPx: zoom * devicePixelRatio()
};
};
/**
* Desktop Webkit
* the trick: an element's clientHeight is in CSS pixels, while you can
* set its line-height in system pixels using font-size and
* -webkit-text-size-adjust:none.
* device-pixel-ratio: http://www.webkit.org/blog/55/high-dpi-web-sites/
*
* Previous trick (used before http://trac.webkit.org/changeset/100847):
* documentElement.scrollWidth is in CSS pixels, while
* document.width was in system pixels. Note that this is the
* layout width of the document, which is slightly different from viewport
* because document width does not include scrollbars and might be wider
* due to big elements.
* @return {Object}
* @private
*/
var webkit = function () {
var important = function (str) {
return str.replace(/;/g, " !important;");
};
var div = document.createElement('div');
div.innerHTML = "1
2
3
4
5
6
7
8
9
0";
div.setAttribute('style', important('font: 100px/1em sans-serif; -webkit-text-size-adjust: none; text-size-adjust: none; height: auto; width: 1em; padding: 0; overflow: visible;'));
// The container exists so that the div will be laid out in its own flow
// while not impacting the layout, viewport size, or display of the
// webpage as a whole.
// Add !important and relevant CSS rule resets
// so that other rules cannot affect the results.
var container = document.createElement('div');
container.setAttribute('style', important('width:0; height:0; overflow:hidden; visibility:hidden; position: absolute;'));
container.appendChild(div);
document.body.appendChild(container);
var zoom = 1000 / div.clientHeight;
zoom = Math.round(zoom * 100) / 100;
document.body.removeChild(container);
return{
zoom: zoom,
devicePxPerCssPx: zoom * devicePixelRatio()
};
};
/**
* no real trick; device-pixel-ratio is the ratio of device dpi / css dpi.
* (Note that this is a different interpretation than Webkit's device
* pixel ratio, which is the ratio device dpi / system dpi).
*
* Also, for Mozilla, there is no difference between the zoom factor and the device ratio.
*
* @return {Object}
* @private
*/
var firefox4 = function () {
var zoom = mediaQueryBinarySearch('min--moz-device-pixel-ratio', '', 0, 10, 20, 0.0001);
zoom = Math.round(zoom * 100) / 100;
return {
zoom: zoom,
devicePxPerCssPx: zoom
};
};
/**
* Firefox 18.x
* Mozilla added support for devicePixelRatio to Firefox 18,
* but it is affected by the zoom level, so, like in older
* Firefox we can't tell if we are in zoom mode or in a device
* with a different pixel ratio
* @return {Object}
* @private
*/
var firefox18 = function () {
return {
zoom: firefox4().zoom,
devicePxPerCssPx: devicePixelRatio()
};
};
/**
* works starting Opera 11.11
* the trick: outerWidth is the viewport width including scrollbars in
* system px, while innerWidth is the viewport width including scrollbars
* in CSS px
* @return {Object}
* @private
*/
var opera11 = function () {
var zoom = window.top.outerWidth / window.top.innerWidth;
zoom = Math.round(zoom * 100) / 100;
return {
zoom: zoom,
devicePxPerCssPx: zoom * devicePixelRatio()
};
};
/**
* Use a binary search through media queries to find zoom level in Firefox
* @param property
* @param unit
* @param a
* @param b
* @param maxIter
* @param epsilon
* @return {Number}
*/
var mediaQueryBinarySearch = function (property, unit, a, b, maxIter, epsilon) {
var matchMedia;
var head, style, div;
if (window.matchMedia) {
matchMedia = window.matchMedia;
} else {
head = document.getElementsByTagName('head')[0];
style = document.createElement('style');
head.appendChild(style);
div = document.createElement('div');
div.className = 'mediaQueryBinarySearch';
div.style.display = 'none';
document.body.appendChild(div);
matchMedia = function (query) {
style.sheet.insertRule('@media ' + query + '{.mediaQueryBinarySearch ' + '{text-decoration: underline} }', 0);
var matched = getComputedStyle(div, null).textDecoration == 'underline';
style.sheet.deleteRule(0);
return {matches: matched};
};
}
var ratio = binarySearch(a, b, maxIter);
if (div) {
head.removeChild(style);
document.body.removeChild(div);
}
return ratio;
function binarySearch(a, b, maxIter) {
var mid = (a + b) / 2;
if (maxIter <= 0 || b - a < epsilon) {
return mid;
}
var query = "(" + property + ":" + mid + unit + ")";
if (matchMedia(query).matches) {
return binarySearch(mid, b, maxIter - 1);
} else {
return binarySearch(a, mid, maxIter - 1);
}
}
};
/**
* Generate detection function
* @private
*/
var detectFunction = (function () {
var func = fallback;
//IE8+
if (!isNaN(screen.logicalXDPI) && !isNaN(screen.systemXDPI)) {
func = ie8;
}
// IE10+ / Touch
else if (window.navigator.msMaxTouchPoints) {
func = ie10;
}
//Mobile Webkit
else if ('orientation' in window && typeof document.body.style.webkitMarquee === 'string') {
func = webkitMobile;
}
//WebKit
else if (typeof document.body.style.webkitMarquee === 'string') {
func = webkit;
}
//Opera
else if (navigator.userAgent.indexOf('Opera') >= 0) {
func = opera11;
}
//Last one is Firefox
//FF 18.x
else if (window.devicePixelRatio) {
func = firefox18;
}
//FF 4.0 - 17.x
else if (firefox4().zoom > 0.001) {
func = firefox4;
}
return func;
}());
return ({
/**
* Ratios.zoom shorthand
* @return {Number} Zoom level
*/
zoom: function () {
return detectFunction().zoom;
},
/**
* Ratios.devicePxPerCssPx shorthand
* @return {Number} devicePxPerCssPx level
*/
device: function () {
return detectFunction().devicePxPerCssPx;
}
});
}));
var wpcom_img_zoomer = {
clientHintSupport: {
gravatar: false,
files: false,
photon: false,
mshots: false,
staticAssets: false,
latex: false,
imgpress: false,
},
useHints: false,
zoomed: false,
timer: null,
interval: 1000, // zoom polling interval in millisecond
// Should we apply width/height attributes to control the image size?
imgNeedsSizeAtts: function( img ) {
// Do not overwrite existing width/height attributes.
if ( img.getAttribute('width') !== null || img.getAttribute('height') !== null )
return false;
// Do not apply the attributes if the image is already constrained by a parent element.
if ( img.width < img.naturalWidth || img.height < img.naturalHeight )
return false;
return true;
},
hintsFor: function( service ) {
if ( this.useHints === false ) {
return false;
}
if ( this.hints() === false ) {
return false;
}
if ( typeof this.clientHintSupport[service] === "undefined" ) {
return false;
}
if ( this.clientHintSupport[service] === true ) {
return true;
}
return false;
},
hints: function() {
try {
var chrome = window.navigator.userAgent.match(/\sChrome\/([0-9]+)\.[.0-9]+\s/)
if (chrome !== null) {
var version = parseInt(chrome[1], 10)
if (isNaN(version) === false && version >= 46) {
return true
}
}
} catch (e) {
return false
}
return false
},
init: function() {
var t = this;
try{
t.zoomImages();
t.timer = setInterval( function() { t.zoomImages(); }, t.interval );
}
catch(e){
}
},
stop: function() {
if ( this.timer )
clearInterval( this.timer );
},
getScale: function() {
var scale = detectZoom.device();
// Round up to 1.5 or the next integer below the cap.
if ( scale <= 1.0 ) scale = 1.0;
else if ( scale <= 1.5 ) scale = 1.5;
else if ( scale <= 2.0 ) scale = 2.0;
else if ( scale <= 3.0 ) scale = 3.0;
else if ( scale <= 4.0 ) scale = 4.0;
else scale = 5.0;
return scale;
},
shouldZoom: function( scale ) {
var t = this;
// Do not operate on hidden frames.
if ( "innerWidth" in window && !window.innerWidth )
return false;
// Don't do anything until scale > 1
if ( scale == 1.0 && t.zoomed == false )
return false;
return true;
},
zoomImages: function() {
var t = this;
var scale = t.getScale();
if ( ! t.shouldZoom( scale ) ){
return;
}
t.zoomed = true;
// Loop through all the
elements on the page.
var imgs = document.getElementsByTagName("img");
for ( var i = 0; i < imgs.length; i++ ) {
// Wait for original images to load
if ( "complete" in imgs[i] && ! imgs[i].complete )
continue;
// Skip images that have srcset attributes.
if ( imgs[i].hasAttribute('srcset') ) {
continue;
}
// Skip images that don't need processing.
var imgScale = imgs[i].getAttribute("scale");
if ( imgScale == scale || imgScale == "0" )
continue;
// Skip images that have already failed at this scale
var scaleFail = imgs[i].getAttribute("scale-fail");
if ( scaleFail && scaleFail <= scale )
continue;
// Skip images that have no dimensions yet.
if ( ! ( imgs[i].width && imgs[i].height ) )
continue;
// Skip images from Lazy Load plugins
if ( ! imgScale && imgs[i].getAttribute("data-lazy-src") && (imgs[i].getAttribute("data-lazy-src") !== imgs[i].getAttribute("src")))
continue;
if ( t.scaleImage( imgs[i], scale ) ) {
// Mark the img as having been processed at this scale.
imgs[i].setAttribute("scale", scale);
}
else {
// Set the flag to skip this image.
imgs[i].setAttribute("scale", "0");
}
}
},
scaleImage: function( img, scale ) {
var t = this;
var newSrc = img.src;
var isFiles = false;
var isLatex = false;
var isPhoton = false;
// Skip slideshow images
if ( img.parentNode.className.match(/slideshow-slide/) )
return false;
// Skip CoBlocks Lightbox images
if ( img.parentNode.className.match(/coblocks-lightbox__image/) )
return false;
// Scale gravatars that have ?s= or ?size=
if ( img.src.match( /^https?:\/\/([^\/]*\.)?gravatar\.com\/.+[?&](s|size)=/ ) ) {
if ( this.hintsFor( "gravatar" ) === true ) {
return false;
}
newSrc = img.src.replace( /([?&](s|size)=)(\d+)/, function( $0, $1, $2, $3 ) {
// Stash the original size
var originalAtt = "originals",
originalSize = img.getAttribute(originalAtt);
if ( originalSize === null ) {
originalSize = $3;
img.setAttribute(originalAtt, originalSize);
if ( t.imgNeedsSizeAtts( img ) ) {
// Fix width and height attributes to rendered dimensions.
img.width = img.width;
img.height = img.height;
}
}
// Get the width/height of the image in CSS pixels
var size = img.clientWidth;
// Convert CSS pixels to device pixels
var targetSize = Math.ceil(img.clientWidth * scale);
// Don't go smaller than the original size
targetSize = Math.max( targetSize, originalSize );
// Don't go larger than the service supports
targetSize = Math.min( targetSize, 512 );
return $1 + targetSize;
});
}
// Scale mshots that have width
else if ( img.src.match(/^https?:\/\/([^\/]+\.)*(wordpress|wp)\.com\/mshots\/.+[?&]w=\d+/) ) {
if ( this.hintsFor( "mshots" ) === true ) {
return false;
}
newSrc = img.src.replace( /([?&]w=)(\d+)/, function($0, $1, $2) {
// Stash the original size
var originalAtt = 'originalw', originalSize = img.getAttribute(originalAtt);
if ( originalSize === null ) {
originalSize = $2;
img.setAttribute(originalAtt, originalSize);
if ( t.imgNeedsSizeAtts( img ) ) {
// Fix width and height attributes to rendered dimensions.
img.width = img.width;
img.height = img.height;
}
}
// Get the width of the image in CSS pixels
var size = img.clientWidth;
// Convert CSS pixels to device pixels
var targetSize = Math.ceil(size * scale);
// Don't go smaller than the original size
targetSize = Math.max( targetSize, originalSize );
// Don't go bigger unless the current one is actually lacking
if ( scale > img.getAttribute("scale") && targetSize <= img.naturalWidth )
targetSize = $2;
if ( $2 != targetSize )
return $1 + targetSize;
return $0;
});
// Update height attribute to match width
newSrc = newSrc.replace( /([?&]h=)(\d+)/, function($0, $1, $2) {
if ( newSrc == img.src ) {
return $0;
}
// Stash the original size
var originalAtt = 'originalh', originalSize = img.getAttribute(originalAtt);
if ( originalSize === null ) {
originalSize = $2;
img.setAttribute(originalAtt, originalSize);
}
// Get the height of the image in CSS pixels
var size = img.clientHeight;
// Convert CSS pixels to device pixels
var targetSize = Math.ceil(size * scale);
// Don't go smaller than the original size
targetSize = Math.max( targetSize, originalSize );
// Don't go bigger unless the current one is actually lacking
if ( scale > img.getAttribute("scale") && targetSize <= img.naturalHeight )
targetSize = $2;
if ( $2 != targetSize )
return $1 + targetSize;
return $0;
});
}
// Scale simple imgpress queries (s0.wp.com) that only specify w/h/fit
else if ( img.src.match(/^https?:\/\/([^\/.]+\.)*(wp|wordpress)\.com\/imgpress\?(.+)/) ) {
if ( this.hintsFor( "imgpress" ) === true ) {
return false;
}
var imgpressSafeFunctions = ["zoom", "url", "h", "w", "fit", "filter", "brightness", "contrast", "colorize", "smooth", "unsharpmask"];
// Search the query string for unsupported functions.
var qs = RegExp.$3.split('&');
for ( var q in qs ) {
q = qs[q].split('=')[0];
if ( imgpressSafeFunctions.indexOf(q) == -1 ) {
return false;
}
}
// Fix width and height attributes to rendered dimensions.
img.width = img.width;
img.height = img.height;
// Compute new src
if ( scale == 1 )
newSrc = img.src.replace(/\?(zoom=[^&]+&)?/, '?');
else
newSrc = img.src.replace(/\?(zoom=[^&]+&)?/, '?zoom=' + scale + '&');
}
// Scale files.wordpress.com, LaTeX, or Photon images (i#.wp.com)
else if (
( isFiles = img.src.match(/^https?:\/\/([^\/]+)\.files\.wordpress\.com\/.+[?&][wh]=/) ) ||
( isLatex = img.src.match(/^https?:\/\/([^\/.]+\.)*(wp|wordpress)\.com\/latex\.php\?(latex|zoom)=(.+)/) ) ||
( isPhoton = img.src.match(/^https?:\/\/i[\d]{1}\.wp\.com\/(.+)/) )
) {
if ( false !== isFiles && this.hintsFor( "files" ) === true ) {
return false
}
if ( false !== isLatex && this.hintsFor( "latex" ) === true ) {
return false
}
if ( false !== isPhoton && this.hintsFor( "photon" ) === true ) {
return false
}
// Fix width and height attributes to rendered dimensions.
img.width = img.width;
img.height = img.height;
// Compute new src
if ( scale == 1 ) {
newSrc = img.src.replace(/\?(zoom=[^&]+&)?/, '?');
} else {
newSrc = img.src;
var url_var = newSrc.match( /([?&]w=)(\d+)/ );
if ( url_var !== null && url_var[2] ) {
newSrc = newSrc.replace( url_var[0], url_var[1] + img.width );
}
url_var = newSrc.match( /([?&]h=)(\d+)/ );
if ( url_var !== null && url_var[2] ) {
newSrc = newSrc.replace( url_var[0], url_var[1] + img.height );
}
var zoom_arg = '&zoom=2';
if ( !newSrc.match( /\?/ ) ) {
zoom_arg = '?zoom=2';
}
img.setAttribute( 'srcset', newSrc + zoom_arg + ' ' + scale + 'x' );
}
}
// Scale static assets that have a name matching *-1x.png or *@1x.png
else if ( img.src.match(/^https?:\/\/[^\/]+\/.*[-@]([12])x\.(gif|jpeg|jpg|png)(\?|$)/) ) {
if ( this.hintsFor( "staticAssets" ) === true ) {
return false;
}
// Fix width and height attributes to rendered dimensions.
img.width = img.width;
img.height = img.height;
var currentSize = RegExp.$1, newSize = currentSize;
if ( scale <= 1 )
newSize = 1;
else
newSize = 2;
if ( currentSize != newSize )
newSrc = img.src.replace(/([-@])[12]x\.(gif|jpeg|jpg|png)(\?|$)/, '$1'+newSize+'x.$2$3');
}
else {
return false;
}
// Don't set img.src unless it has changed. This avoids unnecessary reloads.
if ( newSrc != img.src ) {
// Store the original img.src
var prevSrc, origSrc = img.getAttribute("src-orig");
if ( !origSrc ) {
origSrc = img.src;
img.setAttribute("src-orig", origSrc);
}
// In case of error, revert img.src
prevSrc = img.src;
img.onerror = function(){
img.src = prevSrc;
if ( img.getAttribute("scale-fail") < scale )
img.setAttribute("scale-fail", scale);
img.onerror = null;
};
// Finally load the new image
img.src = newSrc;
}
return true;
}
};
wpcom_img_zoomer.init();
;
/**
* Comment Likes - JavaScript
*
* This handles liking and unliking comments, as well as viewing who has
* liked a particular comment.
*
* @dependency Swipe (dynamically loaded when needed)
*
* @package Comment_Likes
* @subpackage JavaScript
*/
(function () {
function init() {
let extWin;
let extWinCheck;
let commentLikeEvent;
// Only run once.
if (window.comment_likes_loaded) {
return;
}
window.comment_likes_loaded = true;
// Client-side cache of who liked a particular comment to avoid
// having to hit the server multiple times for the same data.
const commentLikeCache = {};
let swipeLibPromise;
// Load the Swipe library, if it's not already loaded.
function swipeLibLoader() {
if (!swipeLibPromise) {
swipeLibPromise = new Promise((resolve, reject) => {
if (window.Swipe) {
resolve(window.Swipe);
} else {
const swipeScript = document.createElement('script');
swipeScript.src = comment_like_text.swipeUrl;
swipeScript.async = true;
document.body.appendChild(swipeScript);
swipeScript.addEventListener('load', () => resolve(window.Swipe));
swipeScript.addEventListener('error', error => reject(error));
}
});
}
return swipeLibPromise;
}
/**
* Parse the comment ID from a comment like link.
*/
function getCommentId(link) {
const commentId =
link && link.getAttribute('href') && link.getAttribute('href').split('like_comment=');
return commentId[1].split('&_wpnonce=')[0];
}
/**
* Handle an ajax action on the comment like link.
*/
function handleLinkAction(link, action, commentId, callback) {
const nonce =
link && link.getAttribute('href') && link.getAttribute('href').split('_wpnonce=')[1];
fetch('/wp-admin/admin-ajax.php', {
method: 'POST',
body: new URLSearchParams({
action: action,
_wpnonce: nonce,
like_comment: commentId,
blog_id: Number(link.dataset.blog),
}),
headers: {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'X-Requested-With': 'XMLHttpRequest',
Accept: 'application/json',
'cache-control': 'no-cache',
pragma: 'no-cache',
},
})
.then(response => response.json())
.then(callback);
}
function startPolling() {
// Append cookie polling login iframe to this window to wait for user to finish logging in (or cancel)
const loginIframe = document.createElement('iframe');
loginIframe.id = 'wp-login-polling-iframe';
loginIframe.src = 'http://web.archive.org/web/20230119080029/https://wordpress.com/public.api/connect/?iframe=true';
document.body.appendChild(loginIframe);
loginIframe.style.display = 'none';
}
function stopPolling() {
const iframe = document.querySelector('#wp-login-polling-iframe');
if (iframe) {
iframe.remove();
}
}
function hide(el) {
if (el && el.style) {
el.style.display = 'none';
}
}
function show(el) {
if (el && el.style) {
el.style.removeProperty('display');
}
}
// Overlay used for displaying comment like info.
class Overlay {
constructor() {
// Overlay element.
this.el = document.createElement('div');
this.el.classList.add('comment-likes-overlay');
document.body.appendChild(this.el);
hide(this.el);
this.el.addEventListener('mouseenter', () => {
// Don't hide the overlay if the user is mousing over it.
overlay.cancelHide();
});
this.el.addEventListener('mouseleave', () => overlay.requestHide());
// Inner contents of overlay.
this.innerEl = null;
// Instance of the Swipe library.
this.swipe = null;
// Timeout used for hiding the overlay.
this.hideTimeout = null;
}
// Initialise the overlay for use, removing any old content.
clear() {
// Unload any previous instance of Swipe (to avoid leaking a global
// event handler). This is done before clearing the contents of the
// overlay because Swipe expects the slides to still be present.
if (this.swipe) {
this.swipe.kill();
this.swipe = null;
}
this.el.innerHTML = '';
this.innerEl = document.createElement('div');
this.innerEl.classList.add('inner');
this.el.appendChild(this.innerEl);
}
/**
* Construct a list () of user (gravatar, name) details.
*
* @param data liker data returned from the server
* @param klass CSS class to apply to the element
* @param start index of user to start at
* @param length number of users to include in the list
*
* @return A container element with the list
*/
getUserBits(data, klass, start, length) {
start = start || 0;
let last = start + (length || data.length);
last = last > data.length ? data.length : last;
const container = document.createElement('div');
container.classList.add('liker-list');
let html = `';
container.innerHTML = html;
return container;
}
/**
* Render the display of who has liked this comment. The type of
* display depends on how many people have liked the comment.
* If more than 10 people have liked the comment, this function
* renders navigation controls and sets up the Swipe library for
* changing between pages.
*
* @param link the element over which the user is hovering
* @param data the results retrieved from the server
*/
showLikes(link, data) {
this.clear();
link.dataset.likeCount = data.length;
if (data.length === 0) {
// No likers after all.
hide(this.el);
return;
}
this.innerEl.style.padding = '12px';
if (data.length < 6) {
// Only one column needed.
this.innerEl.style.maxWidth = '200px';
this.innerEl.innerHTML = '';
this.innerEl.appendChild(this.getUserBits(data, 'single'));
this.setPosition(link);
} else if (data.length < 11) {
// Two columns, but only one page.
this.innerEl.innerHTML = '';
this.innerEl.appendChild(this.getUserBits(data, 'double'));
this.setPosition(link);
} else {
// Multiple pages.
this.renderLikesWithPagination(data, link);
}
}
/**
* Render multiple pages of likes with pagination controls.
* This function is intended to be called by `showLikes` above.
*
* @param data the results retrieved from the server
*/
renderLikesWithPagination(data, link) {
swipeLibLoader().then(() => {
const page_count = Math.ceil(data.length / 10);
// Swipe requires two nested containers.
const swipe = document.createElement('div');
swipe.classList.add('swipe');
this.innerEl.appendChild(swipe);
const wrap = document.createElement('div');
wrap.classList.add('swipe-wrap');
swipe.appendChild(wrap);
for (let i = 0; i < page_count; ++i) {
wrap.appendChild(this.getUserBits(data, 'double', i * 10, 10));
}
/**
* Navigation controls.
* This is based on the Newdash controls found in
* reader/recommendations-templates.php
*/
const nav = document.createElement('nav');
nav.classList.add('slider-nav');
let navContents = `
`;
for (let i = 0; i < page_count; ++i) {
navContents += `•`;
}
navContents += `
`;
this.innerEl.appendChild(nav);
nav.innerHTML = navContents;
/** Set up Swipe. **/
// Swipe cannot be set up successfully unless its container
// is visible, so we show it now.
show(this.el);
this.setPosition(link);
this.swipe = new Swipe(swipe, {
callback: function (pos) {
// Update the pagination indicators.
//
// If there are exactly two pages, Swipe has a weird
// special case where it duplicates both pages and
// can return index 2 and 3 even though those aren't
// real pages (see swipe.js, line 47). To deal with
// this, we use the expression `pos % page_count`.
pos = pos % page_count;
nav.querySelectorAll('em').forEach(em => {
const page = Number(em.dataset.page);
em.setAttribute('class', pos === page ? 'on' : '');
});
},
});
nav.querySelectorAll('em').forEach(em => {
em.addEventListener('click', e => {
// Go to the page corresponding to the indicator clicked.
this.swipe.slide(Number(em.dataset.page));
e.preventDefault();
});
});
// Previous and next buttons.
nav.querySelector('.prev').addEventListener('click', e => {
this.swipe.prev();
e.preventDefault();
});
nav.querySelector('.next').addEventListener('click', e => {
this.swipe.next();
e.preventDefault();
});
});
}
/**
* Open the overlay and show a loading message.
*/
showLoadingMessage(link) {
this.clear();
this.innerEl.textContent = comment_like_text.loading;
this.setPosition(link);
}
/**
* Position the overlay near the current comment.
*
* @param link element near which to position the overlay
*/
setPosition(link) {
// Prepare a down arrow icon for the bottom of the overlay.
const icon = document.createElement('span');
this.el.appendChild(icon);
icon.classList.add('icon', 'noticon', 'noticon-downarrow');
icon.style.textShadow = '0px 1px 1px rgb(223, 223, 223)';
const rect = link.getBoundingClientRect();
const win = document.defaultView;
const offset = {
top: rect.top + win.scrollY,
left: rect.left + win.scrollX,
};
// Take measurements with the element fully visible.
show(this.el);
let left = offset.left - (this.el.offsetWidth - link.offsetWidth) / 2;
left = left < 5 ? 5 : left;
let top = offset.top - this.el.offsetHeight + 5;
hide(this.el);
const adminBar = document.querySelector('#wpadminbar');
// Check if the overlay would appear off the screen.
if (top < win.scrollY + ((adminBar && adminBar.offsetHeight) || 0)) {
// We'll display the overlay beneath the link instead.
top = offset.top + link.offsetHeight;
// Instead of using the down arrow icon, use an up arrow.
icon.remove();
this.el.prepend(icon);
icon.classList.remove('noticon-downarrow');
icon.classList.add('noticon-uparrow');
icon.style.textShadow = '0px -1px 1px rgb(223, 223, 223)';
icon.style.verticalAlign = 'bottom';
}
this.el.style.left = `${left}px`;
this.el.style.top = `${top}px`;
show(this.el);
// The height of the arrow icon differs slightly between browsers,
// so we compute the margin here to make sure it isn't disjointed
// from the overlay.
icon.style.marginTop = `${icon.scrollHeight - 26}px`;
icon.style.marginBottom = `${20 - icon.scrollHeight}px`;
// Position the arrow to be horizontally centred on the link.
icon.style.paddingLeft = `${
offset.left - left + (link.offsetWidth - icon.scrollWidth) / 2
}px`;
}
/**
* Return whether the overlay is visible.
*/
isVisible() {
return this.el.style.getPropertyValue('display') !== 'none';
}
/**
* Request that the overlay be hidden after a short delay.
*/
requestHide() {
if (this.hideTimeout !== null) {
return;
}
this.hideTimeout = setTimeout(() => {
hide(this.el);
this.clear();
}, 300);
}
/**
* Cancel a request to hide the overlay.
*/
cancelHide() {
if (this.hideTimeout !== null) {
clearTimeout(this.hideTimeout);
this.hideTimeout = null;
}
}
}
// Overlay used for displaying comment like info.
const overlay = new Overlay();
// The most recent comment for which the user has requested to see
// who liked it.
var relevantComment;
// Precache after this timeout.
var precacheTimeout = null;
/**
* Fetch the like data for a particular comment.
*/
function fetchLikeData(link, commentId) {
commentLikeCache[commentId] = null;
const container = link && link.parentElement && link.parentElement.parentElement;
const star = container.querySelector('a.comment-like-link');
star &&
handleLinkAction(star, 'view_comment_likes', commentId, data => {
// Populate the cache.
commentLikeCache[commentId] = data;
// Only show the overlay if the user is interested.
if (overlay.isVisible() && relevantComment === commentId) {
overlay.showLikes(link, data);
}
});
}
function readCookie(c) {
const nameEQ = c + '=';
const cookieStrings = document.cookie.split(';');
for (let i = 0; i < cookieStrings.length; i++) {
let cookieString = cookieStrings[i];
while (cookieString.charAt(0) === ' ') {
cookieString = cookieString.substring(1, cookieString.length);
}
if (cookieString.indexOf(nameEQ) === 0) {
const chunk = cookieString.substring(nameEQ.length, cookieString.length);
const pairs = chunk.split('&');
const cookieData = {};
for (let num = pairs.length - 1; num >= 0; num--) {
const pair = pairs[num].split('=');
cookieData[pair[0]] = decodeURIComponent(pair[1]);
}
return cookieData;
}
}
return null;
}
function getServiceData() {
const data = readCookie('wpc_wpc');
if (data === null || typeof data.access_token === 'undefined' || !data.access_token) {
return false;
}
return data;
}
function readMessage(msg) {
const event = msg.data;
if (typeof event.event === 'undefined') {
return;
}
if (event.event === 'login' && event.success) {
extWinCheck = setInterval(function () {
if (!extWin || extWin.closed) {
clearInterval(extWinCheck);
if (getServiceData()) {
// Load page in an iframe to get the current comment nonce
const nonceIframe = document.createElement('iframe');
nonceIframe.id = 'wp-login-comment-nonce-iframe';
nonceIframe.style.display = 'none';
nonceIframe.src = commentLikeEvent + '';
document.body.appendChild(nonceIframe);
const commentLikeId = (commentLikeEvent + '')
.split('like_comment=')[1]
.split('&_wpnonce=')[0];
let c;
// Set a 5 second timeout to redirect to the comment page without doing the Like as a fallback
const commentLikeTimeout = setTimeout(() => {
window.location = commentLikeEvent;
}, 5000);
// Check for a new nonced redirect and use that if available before timing out
const commentLikeCheck = setInterval(() => {
const iframe = document.querySelector('#wp-login-comment-nonce-iframe');
if (iframe) {
c = iframe.querySelector(`#comment-like-${commentLikeId} .comment-like-link`);
}
if (c && typeof c.href !== 'undefined') {
clearTimeout(commentLikeTimeout);
clearInterval(commentLikeCheck);
window.location = c.href;
}
}, 100);
}
}
}, 100);
if (extWin) {
if (!extWin.closed) {
extWin.close();
}
extWin = false;
}
stopPolling();
}
}
if (typeof window.postMessage !== 'undefined') {
window.addEventListener('message', e => {
let message = e && e.data;
if (typeof message === 'string') {
try {
message = JSON.parse(message);
} catch (err) {
return;
}
}
const type = message && message.type;
if (type === 'loginMessage') {
readMessage(message);
}
});
}
document.body.addEventListener('click', e => {
let target = e.target;
// Don't do anything when clicking on the "X people" link.
if (target.matches('p.comment-likes a.view-likers')) {
e.preventDefault();
return;
}
// Retrieve the surrounding paragraph to the star, if it hasn't been liked.
const notLikedPar = target.closest('p.comment-not-liked');
// Return if not clicking on star or surrounding paragraph.
if (!target.matches('a.comment-like-link') && !notLikedPar) {
return;
}
// When a comment hasn't been liked, make the text clickable, too.
if (notLikedPar) {
target = notLikedPar.querySelector('a.comment-like-link');
if (!target) {
return;
}
}
if (target.classList.contains('needs-login')) {
e.preventDefault();
commentLikeEvent = target;
if (extWin) {
if (!extWin.closed) {
extWin.close();
}
extWin = false;
}
stopPolling();
const url = 'http://web.archive.org/web/20230119080029/https://wordpress.com/public.api/connect/?action=request&service=wordpress';
extWin = window.open(
url,
'likeconn',
'status=0,toolbar=0,location=1,menubar=0,directories=0,resizable=1,scrollbars=1,height=560,width=500'
);
startPolling();
return false;
}
// Record that the user likes or does not like this comment.
const commentId = getCommentId(target);
target.classList.add('loading');
let commentEl = document.querySelector(`p#comment-like-${commentId}`);
// Determine whether to like or unlike based on whether the comment is
// currently liked.
const action =
commentEl && commentEl.dataset.liked === 'comment-liked'
? 'unlike_comment'
: 'like_comment';
handleLinkAction(target, action, commentId, data => {
// Invalidate the like cache for this comment.
delete commentLikeCache[commentId];
const countEl = document.querySelector(`#comment-like-count-${data.context}`);
if (countEl) {
countEl.innerHTML = data.display;
}
commentEl = document.querySelector(`p#comment-like-${data.context}`);
if (action === 'like_comment') {
commentEl.classList.remove('comment-not-liked');
commentEl.classList.add('comment-liked');
commentEl.dataset.liked = 'comment-liked';
} else {
commentEl.classList.remove('comment-liked');
commentEl.classList.add('comment-not-liked');
commentEl.dataset.liked = 'comment-not-liked';
}
// Prefetch new data for this comment (if there are likers left).
const parent = target.closest('.comment-likes');
const link = parent && parent.querySelector('a.view-likers');
if (link) {
fetchLikeData(link, commentId);
}
target.classList.remove('loading');
});
e.preventDefault();
e.stopPropagation();
});
document.body.addEventListener(
'mouseenter',
function (e) {
if (!e.target.matches('p.comment-likes a.view-likers')) {
return;
}
// Show the user a list of who has liked this comment.
const link = e.target;
if (Number(link.dataset.likeCount || 0) === 0) {
// No one has liked this comment.
return;
}
// Don't hide the overlay.
overlay.cancelHide();
// Get the comment ID.
const container = link.parentElement && link.parentElement.parentElement;
const star = container && container.querySelector('a.comment-like-link');
const commentId = star && getCommentId(star);
relevantComment = commentId;
// Check if the list of likes for this comment is already in
// the cache.
if (commentId in commentLikeCache) {
const entry = commentLikeCache[commentId];
// Only display the likes if the ajax request is
// actually done.
if (entry !== null) {
overlay.showLikes(link, entry);
} else {
// Make sure the overlay is visible (in case
// the user moved the mouse away while loading
// but then came back before it finished
// loading).
overlay.showLoadingMessage(link);
}
return;
}
// Position the "Loading..." overlay.
overlay.showLoadingMessage(link);
// Fetch the data.
fetchLikeData(link, commentId);
},
true
);
document.body.addEventListener(
'mouseleave',
e => {
if (!e.target.matches('p.comment-likes a.view-likers')) {
return;
}
// User has moved cursor away - hide the overlay.
overlay.requestHide();
},
true
);
document.body.addEventListener(
'mouseenter',
e => {
if (!e.target.matches('.comment') || !e.target.querySelector('a.comment-like-link')) {
return;
}
// User is moving over a comment - precache the comment like data.
if (precacheTimeout !== null) {
clearTimeout(precacheTimeout);
precacheTimeout = null;
}
const star = e.target.querySelector('a.comment-like-link');
const parent = star.closest('.comment-likes');
const link = parent && parent.querySelector('a.view-likers');
if (!link || Number(link.dataset.likeCount || 0) === 0) {
// No likes.
return;
}
const commentId = getCommentId(star);
if (commentId in commentLikeCache) {
// Already in cache.
return;
}
precacheTimeout = setTimeout(() => {
precacheTimeout = null;
if (commentId in commentLikeCache) {
// Was cached in the interim.
return;
}
fetchLikeData(link, commentId);
}, 1000);
},
true
);
}
if (document.readyState !== 'loading') {
init();
} else {
document.addEventListener('DOMContentLoaded', init);
}
})();
;
/* globals JSON */
( function () {
var eventName = 'wpcom_masterbar_click';
var linksTracksEvents = {
// top level items
'wp-admin-bar-blog' : 'my_sites',
'wp-admin-bar-newdash' : 'reader',
'wp-admin-bar-ab-new-post' : 'write_button',
'wp-admin-bar-my-account' : 'my_account',
'wp-admin-bar-notes' : 'notifications',
// my sites - top items
'wp-admin-bar-switch-site' : 'my_sites_switch_site',
'wp-admin-bar-blog-info' : 'my_sites_site_info',
'wp-admin-bar-site-view' : 'my_sites_view_site',
'wp-admin-bar-blog-stats' : 'my_sites_site_stats',
'wp-admin-bar-plan' : 'my_sites_plan',
'wp-admin-bar-plan-badge' : 'my_sites_plan_badge',
// my sites - manage
'wp-admin-bar-edit-page' : 'my_sites_manage_site_pages',
'wp-admin-bar-new-page-badge' : 'my_sites_manage_add_page',
'wp-admin-bar-edit-post' : 'my_sites_manage_blog_posts',
'wp-admin-bar-new-post-badge' : 'my_sites_manage_add_post',
'wp-admin-bar-edit-attachment' : 'my_sites_manage_media',
'wp-admin-bar-new-attachment-badge' : 'my_sites_manage_add_media',
'wp-admin-bar-comments' : 'my_sites_manage_comments',
'wp-admin-bar-edit-jetpack-testimonial' : 'my_sites_manage_testimonials',
'wp-admin-bar-new-jetpack-testimonial' : 'my_sites_manage_add_testimonial',
'wp-admin-bar-edit-jetpack-portfolio' : 'my_sites_manage_portfolio',
'wp-admin-bar-new-jetpack-portfolio' : 'my_sites_manage_add_portfolio',
// my sites - personalize
'wp-admin-bar-themes' : 'my_sites_personalize_themes',
'wp-admin-bar-cmz' : 'my_sites_personalize_themes_customize',
// my sites - configure
'wp-admin-bar-sharing' : 'my_sites_configure_sharing',
'wp-admin-bar-people' : 'my_sites_configure_people',
'wp-admin-bar-people-add' : 'my_sites_configure_people_add_button',
'wp-admin-bar-plugins' : 'my_sites_configure_plugins',
'wp-admin-bar-domains' : 'my_sites_configure_domains',
'wp-admin-bar-domains-add' : 'my_sites_configure_add_domain',
'wp-admin-bar-blog-settings' : 'my_sites_configure_settings',
'wp-admin-bar-legacy-dashboard' : 'my_sites_configure_wp_admin',
// reader
'wp-admin-bar-followed-sites' : 'reader_followed_sites',
'wp-admin-bar-reader-followed-sites-manage': 'reader_manage_followed_sites',
'wp-admin-bar-discover-discover' : 'reader_discover',
'wp-admin-bar-discover-search' : 'reader_search',
'wp-admin-bar-my-activity-my-likes' : 'reader_my_likes',
// account
'wp-admin-bar-user-info' : 'my_account_user_name',
// account - profile
'wp-admin-bar-my-profile' : 'my_account_profile_my_profile',
'wp-admin-bar-account-settings' : 'my_account_profile_account_settings',
'wp-admin-bar-billing' : 'my_account_profile_manage_purchases',
'wp-admin-bar-security' : 'my_account_profile_security',
'wp-admin-bar-notifications' : 'my_account_profile_notifications',
// account - special
'wp-admin-bar-get-apps' : 'my_account_special_get_apps',
'wp-admin-bar-next-steps' : 'my_account_special_next_steps',
'wp-admin-bar-help' : 'my_account_special_help',
};
var notesTracksEvents = {
openSite: function ( data ) {
return {
clicked: 'masterbar_notifications_panel_site',
site_id: data.siteId
};
},
openPost: function ( data ) {
return {
clicked: 'masterbar_notifications_panel_post',
site_id: data.siteId,
post_id: data.postId
};
},
openComment: function ( data ) {
return {
clicked: 'masterbar_notifications_panel_comment',
site_id: data.siteId,
post_id: data.postId,
comment_id: data.commentId
};
}
};
// Element.prototype.matches as a standalone function, with old browser fallback
function matches( node, selector ) {
if ( ! node ) {
return undefined;
}
if ( ! Element.prototype.matches && ! Element.prototype.msMatchesSelector ) {
throw new Error( 'Unsupported browser' );
}
return Element.prototype.matches ? node.matches( selector ) : node.msMatchesSelector( selector );
}
// Element.prototype.closest as a standalone function, with old browser fallback
function closest( node, selector ) {
if ( ! node ) {
return undefined;
}
if ( Element.prototype.closest ) {
return node.closest( selector );
}
do {
if ( matches( node, selector ) ) {
return node;
}
node = node.parentElement || node.parentNode;
} while ( node !== null && node.nodeType === 1 );
return null;
}
function recordTracksEvent( eventProps ) {
eventProps = eventProps || {};
window._tkq = window._tkq || [];
window._tkq.push( [ 'recordEvent', eventName, eventProps ] );
}
function parseJson( s, defaultValue ) {
try {
return JSON.parse( s );
} catch ( e ) {
return defaultValue;
}
}
function createTrackableLinkEventHandler( link ) {
return function () {
var parent = closest( link, 'li' );
if ( ! parent ) {
return;
}
var trackingId = link.getAttribute( 'ID' ) || parent.getAttribute( 'ID' );
if ( ! linksTracksEvents.hasOwnProperty( trackingId ) ) {
return;
}
var eventProps = { 'clicked': linksTracksEvents[ trackingId ] };
recordTracksEvent( eventProps );
}
}
function init() {
var trackableLinkSelector = '.mb-trackable .ab-item:not(div),' +
'#wp-admin-bar-notes .ab-item,' +
'#wp-admin-bar-user-info .ab-item,' +
'.mb-trackable .ab-secondary';
var trackableLinks = document.querySelectorAll( trackableLinkSelector );
for ( var i = 0; i < trackableLinks.length; i++ ) {
var link = trackableLinks[ i ];
var handler = createTrackableLinkEventHandler( link );
link.addEventListener( 'click', handler );
link.addEventListener( 'touchstart', handler );
}
}
if ( document.readyState === 'loading' ) {
document.addEventListener( 'DOMContentLoaded', init );
} else {
init();
}
// listen for postMessage events from the notifications iframe
window.addEventListener( 'message', function ( event ) {
if ( event.origin !== 'http://web.archive.org/web/20230119080029/https://widgets.wp.com' ) {
return;
}
var data = ( typeof event.data === 'string' ) ? parseJson( event.data, {} ) : event.data;
if ( data.type !== 'notesIframeMessage' ) {
return;
}
var eventData = notesTracksEvents[ data.action ];
if ( ! eventData ) {
return;
}
recordTracksEvent( eventData( data ) );
}, false );
} )();
;
var runtime=function(t){"use strict";var r,e=Object.prototype,n=e.hasOwnProperty,o=(m="function"==typeof Symbol?Symbol:{}).iterator||"@@iterator",i=m.asyncIterator||"@@asyncIterator",a=m.toStringTag||"@@toStringTag";function c(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{c({},"")}catch(e){c=function(t,r,e){return t[r]=e}}function u(t,e,n,o){var i,a,c,u;e=e&&e.prototype instanceof g?e:g,e=Object.create(e.prototype),o=new j(o||[]);return e._invoke=(i=t,a=n,c=o,u=l,function(t,e){if(u===s)throw new Error("Generator is already running");if(u===p){if("throw"===t)throw e;return k()}for(c.method=t,c.arg=e;;){var n=c.delegate;if(n&&(n=function t(e,n){var o=e.iterator[n.method];if(o===r){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=r,t(e,n),"throw"===n.method))return y;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return y}return"throw"===(o=h(o,e.iterator,n.arg)).type?(n.method="throw",n.arg=o.arg,n.delegate=null,y):(o=o.arg)?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=r),n.delegate=null,y):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}(n,c),n)){if(n===y)continue;return n}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if(u===l)throw u=p,c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);if(u=s,"normal"===(n=h(i,a,c)).type){if(u=c.done?p:f,n.arg!==y)return{value:n.arg,done:c.done}}else"throw"===n.type&&(u=p,c.method="throw",c.arg=n.arg)}}),e}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var l="suspendedStart",f="suspendedYield",s="executing",p="completed",y={};function g(){}function d(){}function v(){}var m,w,L=((w=(w=(c(m={},o,(function(){return this})),Object.getPrototypeOf))&&w(w(O([]))))&&w!==e&&n.call(w,o)&&(m=w),v.prototype=g.prototype=Object.create(m));function x(t){["next","throw","return"].forEach((function(r){c(t,r,(function(t){return this._invoke(r,t)}))}))}function b(t,r){var e;this._invoke=function(o,i){function a(){return new r((function(e,a){!function e(o,i,a,c){var u;if("throw"!==(o=h(t[o],t,i)).type)return(i=(u=o.arg).value)&&"object"==typeof i&&n.call(i,"__await")?r.resolve(i.__await).then((function(t){e("next",t,a,c)}),(function(t){e("throw",t,a,c)})):r.resolve(i).then((function(t){u.value=t,a(u)}),(function(t){return e("throw",t,a,c)}));c(o.arg)}(o,i,e,a)}))}return e=e?e.then(a,a):a()}}function E(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function _(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function j(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function O(t){if(t){var e,i=t[o];if(i)return i.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length))return e=-1,(i=function o(){for(;++ea;)o(e,r=n[a++])&&(~u(p,r)||f(p,r));return p}},function(t,n,r){var e=r(10),o=r(55),i=r(57);r=function(t){return function(n,r,u){var c,f=e(n),a=i(f),p=o(u,a);if(t&&r!=r){for(;p"+t+""+v+">"}var u,c=e(42),f=e(64),a=e(59),p=e(48),s=e(66),l=e(39),y=(e=e(47),"prototype"),v="script",d=e("IE_PROTO"),b=function(){try{u=new ActiveXObject("htmlfile")}catch(t){}var t;b="undefined"==typeof document||document.domain&&u?function(t){t.write(i("")),t.close();var n=t.parentWindow.Object;return t=null,n}(u):((t=l("iframe")).style.display="none",s.appendChild(t),t.src=String("javascript:"),(t=t.contentWindow.document).open(),t.write(i("document.F=Object")),t.close(),t.F);for(var n=a.length;n--;)delete b[y][a[n]];return b()};p[d]=!0,n.exports=Object.create||function(n,r){var e;return null!==n?(o[y]=c(n),e=new o,o[y]=null,e[d]=n):e=b(),r===t?e:f(e,r)}},function(t,n,r){var e=r(5),o=r(41),i=r(42),u=r(10),c=r(65);t.exports=e?Object.defineProperties:function(t,n){i(t);for(var r,e=u(n),f=c(n),a=f.length,p=0;p{"use strict";var t={706:()=>{},8439:(t,e,r)=>{r(706);function n(t,e){const r=new XMLHttpRequest;r.onreadystatechange=()=>{if(4===r.readyState){if(r.status>=200&&r.status<300){const e=JSON.parse(r.responseText);return t.onSuccess(e)}return e?n(t,e-1):t.onError()}},r.open("GET",t.url),r.send()}function o(t,e){return Object.prototype.hasOwnProperty.call(t,e)}Array.prototype.forEach.call(document.querySelectorAll(".wp-block-newspack-blocks-homepage-articles.has-more-button"),(function(t){const e=t.querySelector("[data-next]");if(!e)return;const r=t.querySelector("[data-posts]");let s=!1,i=!1;e.addEventListener("click",(()=>{if(s||i)return!1;s=!0,t.classList.remove("is-error"),t.classList.add("is-loading");function a(){s=!1,t.classList.remove("is-loading"),t.classList.add("is-error")}n({url:e.getAttribute("data-next")+"&exclude_ids="+function(){const t=document.querySelectorAll("[class^='wp-block-newspack-blocks'] [data-post-id]"),e=Array.from(t).map((t=>t.getAttribute("data-post-id")));return e.push(document.querySelector("div[data-current-post-id]").getAttribute("data-current-post-id")),[...new Set(e)]}().join(","),onSuccess:function(n){if(!function(t){let e=!1;t&&o(t,"items")&&Array.isArray(t.items)&&o(t,"next")&&"string"==typeof t.next&&(e=!0,!t.items.length||o(t.items[0],"html")&&"string"==typeof t.items[0].html||(e=!1));return e}(n))return a();if(n.items.length){const t=n.items.map((t=>t.html)).join("");r.insertAdjacentHTML("beforeend",t)}n.next&&e.setAttribute("data-next",n.next);n.items.length&&n.next||(i=!0,t.classList.remove("has-more-button"));s=!1,t.classList.remove("is-loading")},onError:a},3)}))}))}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var s=e[n]={exports:{}};return t[n](s,s.exports,r),s.exports}r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{r.r(n);r(8439)})(),window.EditingToolkit=n})();
//# sourceMappingURL=blog-posts-block-view.min.js.map;
!function(){"use strict";var e,t={noop:function(){},texturize:function(e){return(e=(e=(e=(e+="").replace(/'/g,"’").replace(/'/g,"’")).replace(/"/g,"”").replace(/"/g,"”").replace(/"/g,"”").replace(/[\u201D]/g,"”")).replace(/([\w]+)=[\d]+;(.+?)[\d]+;/g,'$1="$2"')).trim()},applyReplacements:function(e,t){if(e)return t?e.replace(/{(\d+)}/g,(function(e,r){return void 0!==t[r]?t[r]:e})):e},getBackgroundImage:function(e){var t=document.createElement("canvas"),r=t.getContext&&t.getContext("2d");if(e){r.filter="blur(20px) ",r.drawImage(e,0,0);var o=t.toDataURL("image/png");return t=null,o}}},r=function(){function e(e,t){return Element.prototype.matches?e.matches(t):Element.prototype.msMatchesSelector?e.msMatchesSelector(t):void 0}function r(e,t,r,o){if(!e)return o();e.style.removeProperty("display"),e.style.opacity=t,e.style.transition="opacity 0.2s",e.style.pointerEvents="none";var a=function(t){t.target===e&&"opacity"===t.propertyName&&(e.style.removeProperty("transition"),e.style.removeProperty("opacity"),e.style.removeProperty("pointer-events"),e.removeEventListener("transitionend",a),e.removeEventListener("transitioncancel",a),o())};requestAnimationFrame((function(){requestAnimationFrame((function(){e.addEventListener("transitionend",a),e.addEventListener("transitioncancel",a),e.style.opacity=r}))}))}return{closest:function(t,r){if(t.closest)return t.closest(r);var o=t;do{if(e(o,r))return o;o=o.parentElement||o.parentNode}while(null!==o&&1===o.nodeType);return null},matches:e,hide:function(e){e&&(e.style.display="none")},show:function(e){e&&(e.style.display="block")},fadeIn:function(e,o){r(e,"0","1",o=o||t.noop)},fadeOut:function(e,o){o=o||t.noop,r(e,"1","0",(function(){e&&(e.style.display="none"),o()}))},scrollToElement:function(e,t,r){if(!e||!t)return r?r():void 0;var o=t.querySelector(".jp-carousel-info-extra");o&&(o.style.minHeight=window.innerHeight-64+"px");var a=!0,i=Date.now(),n=t.scrollTop,l=Math.max(0,e.offsetTop-Math.max(0,window.innerHeight-function(e){var t=e.querySelector(".jp-carousel-info-footer"),r=e.querySelector(".jp-carousel-info-extra"),o=e.querySelector(".jp-carousel-info-content-wrapper");if(t&&r&&o){var a=window.getComputedStyle(r),i=parseInt(a.paddingTop,10)+parseInt(a.paddingBottom,10);return i=isNaN(i)?0:i,o.offsetHeight+t.offsetHeight+i}return 0}(t)))-t.scrollTop;function s(){a=!1}l=Math.min(l,t.scrollHeight-window.innerHeight),t.addEventListener("wheel",s),function e(){var c,u=Date.now(),d=(c=(u-i)/300)<.5?2*c*c:1-Math.pow(-2*c+2,2)/2,p=(d=d>1?1:d)*l;if(t.scrollTop=n+p,u<=i+300&&a)return requestAnimationFrame(e);r&&r(),o&&(o.style.minHeight=""),a=!1,t.removeEventListener("wheel",s)}()},getJSONAttribute:function(e,t){if(e&&e.hasAttribute(t))try{return JSON.parse(e.getAttribute(t))}catch(e){return}},convertToPlainText:function(e){var t=document.createElement("div");return t.textContent=e,t.innerHTML},stripHTML:function(e){return e.replace(/<[^>]*>?/gm,"")},emitEvent:function(e,t,r){var o;try{o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r||null})}catch(e){(o=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,r||null)}e.dispatchEvent(o)},isTouch:function(){return"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch}}}();function o(){var o,a,i,n,l="",s=!1,c="div.gallery, div.tiled-gallery, ul.wp-block-gallery, ul.blocks-gallery-grid, figure.wp-block-gallery.has-nested-images, div.wp-block-jetpack-tiled-gallery, a.single-image-gallery",u=".gallery-item, .tiled-gallery-item, .blocks-gallery-item, .tiled-gallery__item",d=u+", .wp-block-image",p={},m="undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.stat?wpcom.carousel.stat:t.noop,g="undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.pageview?wpcom.carousel.pageview:t.noop;function h(t){if(!s)switch(t.which){case 38:t.preventDefault(),p.overlay.scrollTop-=100;break;case 40:t.preventDefault(),p.overlay.scrollTop+=100;break;case 39:t.preventDefault(),e.slideNext();break;case 37:case 8:t.preventDefault(),e.slidePrev();break;case 27:t.preventDefault(),b()}}function f(){s=!0}function v(){s=!1}function y(){p.overlay||(p.overlay=document.querySelector(".jp-carousel-overlay"),p.container=p.overlay.querySelector(".jp-carousel-wrap"),p.gallery=p.container.querySelector(".jp-carousel"),p.info=p.overlay.querySelector(".jp-carousel-info"),p.caption=p.info.querySelector(".jp-carousel-caption"),p.commentField=p.overlay.querySelector("#jp-carousel-comment-form-comment-field"),p.emailField=p.overlay.querySelector("#jp-carousel-comment-form-email-field"),p.authorField=p.overlay.querySelector("#jp-carousel-comment-form-author-field"),p.urlField=p.overlay.querySelector("#jp-carousel-comment-form-url-field"),window.innerWidth<=760&&Math.round(window.innerWidth/760*110)<40&&r.isTouch(),[p.commentField,p.emailField,p.authorField,p.urlField].forEach((function(e){e&&(e.addEventListener("focus",f),e.addEventListener("blur",v))})),p.overlay.addEventListener("click",(function(e){var t,o,a=e.target,i=!!r.closest(a,".jp-carousel-close-hint"),n=!!window.matchMedia("(max-device-width: 760px)").matches;if(a===p.overlay){if(n)return;b()}else if(i)b();else if(a.classList.contains("jp-carousel-image-download"))m("download_original_click");else if(a.classList.contains("jp-carousel-comment-login"))t=p.currentSlide,o=t?t.attrs.attachmentId:"0",window.location.href=jetpackCarouselStrings.login_url+"%23jp-carousel-"+o;else if(r.closest(a,"#jp-carousel-comment-form-container"))!function(e){var t=e.target,o=r.getJSONAttribute(p.container,"data-carousel-extra")||{},a=p.currentSlide.attrs.attachmentId,i=document.querySelector("#jp-carousel-comment-form-submit-and-info-wrapper"),n=document.querySelector("#jp-carousel-comment-form-spinner"),l=document.querySelector("#jp-carousel-comment-form-button-submit"),s=document.querySelector("#jp-carousel-comment-form");if(p.commentField&&p.commentField.getAttribute("id")===t.getAttribute("id"))f(),r.show(i);else if(r.matches(t,'input[type="submit"]')){e.preventDefault(),e.stopPropagation(),r.show(n),s.classList.add("jp-carousel-is-disabled");var c={action:"post_attachment_comment",nonce:jetpackCarouselStrings.nonce,blog_id:o.blog_id,id:a,comment:p.commentField.value};if(!c.comment.length)return void w(jetpackCarouselStrings.no_comment_text,!1);if(1!==Number(jetpackCarouselStrings.is_logged_in)&&(c.email=p.emailField.value,c.author=p.authorField.value,c.url=p.urlField.value,1===Number(jetpackCarouselStrings.require_name_email))){if(!c.email.length||!c.email.match("@"))return void w(jetpackCarouselStrings.no_comment_email,!1);if(!c.author.length)return void w(jetpackCarouselStrings.no_comment_author,!1)}var u=new XMLHttpRequest;u.open("POST",jetpackCarouselStrings.ajaxurl,!0),u.setRequestHeader("X-Requested-With","XMLHttpRequest"),u.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),u.onreadystatechange=function(){if(this.readyState===XMLHttpRequest.DONE&&this.status>=200&&this.status<300){var e;try{e=JSON.parse(this.response)}catch(e){return void w(jetpackCarouselStrings.comment_post_error,!1)}"approved"===e.comment_status?w(jetpackCarouselStrings.comment_approved,!0):"unapproved"===e.comment_status?w(jetpackCarouselStrings.comment_unapproved,!0):w(jetpackCarouselStrings.comment_post_error,!1),E(),q(a),l.value=jetpackCarouselStrings.post_comment,r.hide(n),s.classList.remove("jp-carousel-is-disabled")}else w(jetpackCarouselStrings.comment_post_error,!1)};var d=[];for(var m in c)if(m){var g=encodeURIComponent(m)+"="+encodeURIComponent(c[m]);d.push(g.replace(/%20/g,"+"))}var h=d.join("&");u.send(h)}}(e);else if(r.closest(a,".jp-carousel-photo-icons-container")||a.classList.contains("jp-carousel-photo-title"))!function(e){e.preventDefault();var t=e.target,o=p.info.querySelector(".jp-carousel-info-extra"),a=p.info.querySelector(".jp-carousel-image-meta"),i=p.info.querySelector(".jp-carousel-comments-wrapper"),n=p.info.querySelector(".jp-carousel-icon-info"),l=p.info.querySelector(".jp-carousel-icon-comments");function s(){l&&l.classList.remove("jp-carousel-selected"),n.classList.toggle("jp-carousel-selected"),i&&i.classList.remove("jp-carousel-show"),a&&(a.classList.toggle("jp-carousel-show"),a.classList.contains("jp-carousel-show")?o.classList.add("jp-carousel-show"):o.classList.remove("jp-carousel-show"))}function c(){n&&n.classList.remove("jp-carousel-selected"),l.classList.toggle("jp-carousel-selected"),a&&a.classList.remove("jp-carousel-show"),i&&(i.classList.toggle("jp-carousel-show"),i.classList.contains("jp-carousel-show")?o.classList.add("jp-carousel-show"):o.classList.remove("jp-carousel-show"))}(r.closest(t,".jp-carousel-icon-info")||t.classList.contains("jp-carousel-photo-title"))&&(a&&a.classList.contains("jp-carousel-show")?r.scrollToElement(p.overlay,p.overlay,s):(s(),r.scrollToElement(p.info,p.overlay))),r.closest(t,".jp-carousel-icon-comments")&&(i&&i.classList.contains("jp-carousel-show")?r.scrollToElement(p.overlay,p.overlay,c):(c(),r.scrollToElement(p.info,p.overlay)))}(e);else if(!r.closest(a,".jp-carousel-info"))return})),window.addEventListener("keydown",h),p.overlay.addEventListener("jp_carousel.afterOpen",(function(){v(),p.slides.length<=1||(p.slides.length<=5?r.show(p.info.querySelector(".jp-swiper-pagination")):r.show(p.info.querySelector(".jp-carousel-pagination")))})),p.overlay.addEventListener("jp_carousel.beforeClose",(function(){f(),document.documentElement.style.removeProperty("height"),e&&e.enable(),r.hide(p.info.querySelector(".jp-swiper-pagination")),r.hide(p.info.querySelector(".jp-carousel-pagination"))})),p.overlay.addEventListener("jp_carousel.afterClose",(function(){window.history.pushState?history.pushState("",document.title,window.location.pathname+window.location.search):window.location.href="",l="",p.isOpen=!1})),p.overlay.addEventListener("touchstart",(function(e){e.touches.length>1&&e.preventDefault()})))}function w(e,t){var o=p.overlay.querySelector("#jp-carousel-comment-post-results"),a="jp-carousel-comment-post-"+(t?"success":"error");o.innerHTML=''+e+"",r.hide(p.overlay.querySelector("#jp-carousel-comment-form-spinner")),p.overlay.querySelector("#jp-carousel-comment-form").classList.remove("jp-carousel-is-disabled"),r.show(o)}function j(){var e=document.querySelectorAll("a img[data-attachment-id]");Array.prototype.forEach.call(e,(function(e){var t=e.parentElement,o=t.parentElement;if(!o.classList.contains("gallery-icon")&&!r.closest(o,u)&&t.hasAttribute("href")){var a=!1;t.getAttribute("href").split("?")[0]===e.getAttribute("data-orig-file").split("?")[0]&&1===Number(jetpackCarouselStrings.single_image_gallery_media_file)&&(a=!0),t.getAttribute("href")===e.getAttribute("data-permalink")&&(a=!0),a&&(t.classList.add("single-image-gallery"),t.setAttribute("data-carousel-extra",JSON.stringify({blog_id:Number(jetpackCarouselStrings.blog_id)})))}}))}function S(o){(!o||o<0||o>p.slides.length)&&(o=0),p.currentSlide=p.slides[o];var a,i,n=p.currentSlide,s=n.attrs.attachmentId,c=p.info.querySelector(".jp-carousel-icon-info"),u=p.info.querySelector(".jp-carousel-icon-comments");(c&&c.classList.contains("jp-carousel-selected")||u&&u.classList.contains("jp-carousel-selected"))&&0!==p.overlay.scrollTop&&r.scrollToElement(p.overlay,p.overlay),function(e){var t=e.el,r=e.attrs,o=t.querySelector("img");if(!o.hasAttribute("data-loaded")){var a=!!r.previewImage,i=r.thumbSize;!a||i&&t.offsetWidth>i.width?o.src=r.src:o.src=r.previewImage,o.setAttribute("itemprop","image"),o.setAttribute("data-loaded",1)}}(p.slides[o]),1!==Number(jetpackCarouselStrings.display_background_image)||p.slides[o].backgroundImage||function(t){var r=t.el;e&&e.slides&&(r=e.slides[e.activeIndex]);var o=t.attrs.originalElement;o.complete&&0!==o.naturalHeight?A(t,r,o):o.onload=function(){A(t,r,o)}}(p.slides[o]),r.hide(p.caption),function(e){var t,o,a,i,n="",l="",s="";if(t=p.overlay.querySelector(".jp-carousel-photo-caption"),o=p.overlay.querySelector(".jp-carousel-caption"),a=p.overlay.querySelector(".jp-carousel-photo-title"),i=p.overlay.querySelector(".jp-carousel-photo-description"),r.hide(t),r.hide(o),r.hide(a),r.hide(i),n=k(e.caption)||"",l=k(e.title)||"",s=k(e.desc)||"",(n||l||s)&&(n&&(t.innerHTML=n,o.innerHTML=n,r.show(t),r.show(o)),r.stripHTML(n)===r.stripHTML(l)&&(l=""),r.stripHTML(n)===r.stripHTML(s)&&(s=""),r.stripHTML(l)===r.stripHTML(s)&&(s=""),s&&(i.innerHTML=s,r.show(i),l||n||(t.innerHTML=r.stripHTML(s),r.show(t))),l)){var c=r.stripHTML(l);a.innerHTML=c,n||(t.innerHTML=c,o.innerHTML=c,r.show(t)),r.show(a)}}({caption:n.attrs.caption,title:n.attrs.title,desc:n.attrs.desc}),function(e){if(!e||1!==Number(jetpackCarouselStrings.display_exif))return!1;var t=p.info.querySelector(".jp-carousel-image-meta ul.jp-carousel-image-exif"),r="";for(var o in e){var a=e[o],i=jetpackCarouselStrings.meta_data||[];if(0!==parseFloat(a)&&a.length&&-1!==i.indexOf(o)){switch(o){case"focal_length":a+="mm";break;case"shutter_speed":a=x(a);break;case"aperture":a="f/"+a}r+=""+jetpackCarouselStrings[o]+"
"+a+" "}}t.innerHTML=r,t.style.removeProperty("display")}(p.slides[o].attrs.imageMeta),function(e){if(!e)return!1;var r,o=[e.attrs.origWidth,e.attrs.origHeight],a=document.createElement("a");a.href=e.attrs.src.replace(/\?.+$/,""),r=null!==a.hostname.match(/^i[\d]{1}\.wp\.com$/i)?a.href:e.attrs.origFile.replace(/\?.+$/,"");var i=p.info.querySelector(".jp-carousel-download-text"),n=p.info.querySelector(".jp-carousel-image-download");i.innerHTML=t.applyReplacements(jetpackCarouselStrings.download_original,o),n.setAttribute("href",r),n.style.removeProperty("display")}(n),1===Number(jetpackCarouselStrings.display_comments)&&(a=p.slides[o].attrs.commentsOpened,i=p.container.querySelector(".jp-carousel-comment-form-container"),1===parseInt(a,10)?r.fadeIn(i):r.fadeOut(i),q(s),r.hide(p.info.querySelector("#jp-carousel-comment-post-results")));var d=p.info.querySelector(".jp-carousel-pagination");if(d&&p.slides.length>5){var m=o+1;d.innerHTML=""+m+" / "+p.slides.length+""}jetpackCarouselStrings.stats&&((new Image).src=document.location.protocol+"//web.archive.org/web/20230119080029/https://pixel.wp.com/g.gif?"+jetpackCarouselStrings.stats+"&post="+encodeURIComponent(s)+"&rand="+Math.random()),g(s),window.location.hash=l="#jp-carousel-"+s}function b(){document.body.style.overflow=a,document.documentElement.style.overflow=i,E(),f(),r.emitEvent(p.overlay,"jp_carousel.beforeClose"),window.scrollTo(window.scrollX||window.pageXOffset||0,n||0),e.destroy(),p.isOpen=!1,p.slides=[],p.currentSlide=void 0,p.gallery.innerHTML="",r.fadeOut(p.overlay,(function(){r.emitEvent(p.overlay,"jp_carousel.afterClose")}))}function L(e,t,r){var o=r?e.replace(/.*=([\d]+%2C[\d]+).*$/,"$1"):e.replace(/.*-([\d]+x[\d]+)\..+$/,"$1"),a=o!==e?r?o.split("%2C"):o.split("x"):[t,0];return"9999"===a[0]&&(a[0]="0"),"9999"===a[1]&&(a[1]="0"),a}function x(e){return e>=1?Math.round(10*e)/10+"s":"1/"+Math.round(1/e)+"s"}function k(e){return!e.match(" ")&&e.match("_")?"":e}function q(e,t){var a=void 0===t,i=p.info.querySelector(".jp-carousel-icon-comments .jp-carousel-has-comments-indicator");if(i.classList.remove("jp-carousel-show"),clearInterval(o),e){(!t||t<1)&&(t=0);var n=p.info.querySelector(".jp-carousel-comments"),l=p.info.querySelector("#jp-carousel-comments-loading");r.show(l),a&&(r.hide(n),n.innerHTML="");var s=new XMLHttpRequest,c=jetpackCarouselStrings.ajaxurl+"?action=get_attachment_comments&nonce="+jetpackCarouselStrings.nonce+"&id="+e+"&offset="+t;s.open("GET",c),s.setRequestHeader("X-Requested-With","XMLHttpRequest");var u=function(){r.fadeIn(n),r.fadeOut(l)};s.onload=function(){if(p.currentSlide&&p.currentSlide.attrs.attachmentId===e){var c,d=s.status>=200&&s.status<300;try{c=JSON.parse(s.responseText)}catch(e){}if(!d||!c||!Array.isArray(c))return u();a&&(n.innerHTML="");for(var m=0;m