Edit File by line
/home/zeestwma/richards.../wp-conte.../plugins/jetpack/modules/carousel
File: jetpack-carousel.js
/* global wpcom, jetpackCarouselStrings, DocumentTouch */
[0] Fix | Delete
/* eslint-disable no-shadow */
[1] Fix | Delete
[2] Fix | Delete
( function () {
[3] Fix | Delete
'use strict';
[4] Fix | Delete
var swiper;
[5] Fix | Delete
/////////////////////////////////////
[6] Fix | Delete
// Utility functions
[7] Fix | Delete
/////////////////////////////////////
[8] Fix | Delete
var util = ( function () {
[9] Fix | Delete
var noop = function () {};
[10] Fix | Delete
[11] Fix | Delete
function texturize( text ) {
[12] Fix | Delete
// Ensure we get a string.
[13] Fix | Delete
text = text + '';
[14] Fix | Delete
text = text.replace( /'/g, '’' ).replace( /'/g, '’' );
[15] Fix | Delete
text = text
[16] Fix | Delete
.replace( /"/g, '”' )
[17] Fix | Delete
.replace( /"/g, '”' )
[18] Fix | Delete
.replace( /"/g, '”' )
[19] Fix | Delete
.replace( /[\u201D]/g, '”' );
[20] Fix | Delete
// Untexturize allowed HTML tags params double-quotes.
[21] Fix | Delete
text = text.replace( /([\w]+)=&#[\d]+;(.+?)&#[\d]+;/g, '$1="$2"' );
[22] Fix | Delete
return text.trim();
[23] Fix | Delete
}
[24] Fix | Delete
[25] Fix | Delete
function applyReplacements( text, replacements ) {
[26] Fix | Delete
if ( ! text ) {
[27] Fix | Delete
return;
[28] Fix | Delete
}
[29] Fix | Delete
if ( ! replacements ) {
[30] Fix | Delete
return text;
[31] Fix | Delete
}
[32] Fix | Delete
return text.replace( /{(\d+)}/g, function ( match, number ) {
[33] Fix | Delete
return typeof replacements[ number ] !== 'undefined' ? replacements[ number ] : match;
[34] Fix | Delete
} );
[35] Fix | Delete
}
[36] Fix | Delete
[37] Fix | Delete
function getBackgroundImage( imgEl ) {
[38] Fix | Delete
var canvas = document.createElement( 'canvas' ),
[39] Fix | Delete
context = canvas.getContext && canvas.getContext( '2d' );
[40] Fix | Delete
[41] Fix | Delete
if ( ! imgEl ) {
[42] Fix | Delete
return;
[43] Fix | Delete
}
[44] Fix | Delete
[45] Fix | Delete
context.filter = 'blur(20px) ';
[46] Fix | Delete
context.drawImage( imgEl, 0, 0 );
[47] Fix | Delete
var url = canvas.toDataURL( 'image/png' );
[48] Fix | Delete
canvas = null;
[49] Fix | Delete
[50] Fix | Delete
return url;
[51] Fix | Delete
}
[52] Fix | Delete
[53] Fix | Delete
return {
[54] Fix | Delete
noop: noop,
[55] Fix | Delete
texturize: texturize,
[56] Fix | Delete
applyReplacements: applyReplacements,
[57] Fix | Delete
getBackgroundImage: getBackgroundImage,
[58] Fix | Delete
};
[59] Fix | Delete
} )();
[60] Fix | Delete
[61] Fix | Delete
/////////////////////////////////////
[62] Fix | Delete
// DOM-related utility functions
[63] Fix | Delete
/////////////////////////////////////
[64] Fix | Delete
var domUtil = ( function () {
[65] Fix | Delete
// Helper matches function (not a polyfill), compatible with IE 11.
[66] Fix | Delete
function matches( el, sel ) {
[67] Fix | Delete
if ( Element.prototype.matches ) {
[68] Fix | Delete
return el.matches( sel );
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
if ( Element.prototype.msMatchesSelector ) {
[72] Fix | Delete
return el.msMatchesSelector( sel );
[73] Fix | Delete
}
[74] Fix | Delete
}
[75] Fix | Delete
[76] Fix | Delete
// Helper closest parent node function (not a polyfill) based on
[77] Fix | Delete
// https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill
[78] Fix | Delete
function closest( el, sel ) {
[79] Fix | Delete
if ( el.closest ) {
[80] Fix | Delete
return el.closest( sel );
[81] Fix | Delete
}
[82] Fix | Delete
[83] Fix | Delete
var current = el;
[84] Fix | Delete
[85] Fix | Delete
do {
[86] Fix | Delete
if ( matches( current, sel ) ) {
[87] Fix | Delete
return current;
[88] Fix | Delete
}
[89] Fix | Delete
current = current.parentElement || current.parentNode;
[90] Fix | Delete
} while ( current !== null && current.nodeType === 1 );
[91] Fix | Delete
[92] Fix | Delete
return null;
[93] Fix | Delete
}
[94] Fix | Delete
[95] Fix | Delete
function hide( el ) {
[96] Fix | Delete
if ( el ) {
[97] Fix | Delete
el.style.display = 'none';
[98] Fix | Delete
}
[99] Fix | Delete
}
[100] Fix | Delete
[101] Fix | Delete
function show( el ) {
[102] Fix | Delete
if ( el ) {
[103] Fix | Delete
// Everything we show and hide in Carousel is currently a block,
[104] Fix | Delete
// so we can make this really straightforward.
[105] Fix | Delete
el.style.display = 'block';
[106] Fix | Delete
}
[107] Fix | Delete
}
[108] Fix | Delete
[109] Fix | Delete
function fade( el, start, end, callback ) {
[110] Fix | Delete
if ( ! el ) {
[111] Fix | Delete
return callback();
[112] Fix | Delete
}
[113] Fix | Delete
[114] Fix | Delete
// Prepare for transition.
[115] Fix | Delete
// Ensure the item is in the render tree, in its initial state.
[116] Fix | Delete
el.style.removeProperty( 'display' );
[117] Fix | Delete
el.style.opacity = start;
[118] Fix | Delete
el.style.pointerEvents = 'none';
[119] Fix | Delete
[120] Fix | Delete
var animate = function ( t0, duration ) {
[121] Fix | Delete
var t = performance.now();
[122] Fix | Delete
var diff = t - t0;
[123] Fix | Delete
var ratio = diff / duration;
[124] Fix | Delete
[125] Fix | Delete
if ( ratio < 1 ) {
[126] Fix | Delete
el.style.opacity = start + ( end - start ) * ratio;
[127] Fix | Delete
requestAnimationFrame( () => animate( t0, duration ) );
[128] Fix | Delete
} else {
[129] Fix | Delete
el.style.opacity = end;
[130] Fix | Delete
el.style.removeProperty( 'pointer-events' );
[131] Fix | Delete
callback();
[132] Fix | Delete
}
[133] Fix | Delete
};
[134] Fix | Delete
[135] Fix | Delete
requestAnimationFrame( function () {
[136] Fix | Delete
// Double rAF for browser compatibility.
[137] Fix | Delete
requestAnimationFrame( function () {
[138] Fix | Delete
animate( performance.now(), 200 );
[139] Fix | Delete
} );
[140] Fix | Delete
} );
[141] Fix | Delete
}
[142] Fix | Delete
[143] Fix | Delete
function fadeIn( el, callback ) {
[144] Fix | Delete
callback = callback || util.noop;
[145] Fix | Delete
fade( el, 0, 1, callback );
[146] Fix | Delete
}
[147] Fix | Delete
[148] Fix | Delete
function fadeOut( el, callback ) {
[149] Fix | Delete
callback = callback || util.noop;
[150] Fix | Delete
fade( el, 1, 0, function () {
[151] Fix | Delete
if ( el ) {
[152] Fix | Delete
el.style.display = 'none';
[153] Fix | Delete
}
[154] Fix | Delete
callback();
[155] Fix | Delete
} );
[156] Fix | Delete
}
[157] Fix | Delete
[158] Fix | Delete
function emitEvent( el, type, detail ) {
[159] Fix | Delete
var e;
[160] Fix | Delete
try {
[161] Fix | Delete
e = new CustomEvent( type, {
[162] Fix | Delete
bubbles: true,
[163] Fix | Delete
cancelable: true,
[164] Fix | Delete
detail: detail || null,
[165] Fix | Delete
} );
[166] Fix | Delete
} catch {
[167] Fix | Delete
e = document.createEvent( 'CustomEvent' );
[168] Fix | Delete
e.initCustomEvent( type, true, true, detail || null );
[169] Fix | Delete
}
[170] Fix | Delete
el.dispatchEvent( e );
[171] Fix | Delete
}
[172] Fix | Delete
[173] Fix | Delete
// From: https://easings.net/#easeInOutQuad
[174] Fix | Delete
function easeInOutQuad( num ) {
[175] Fix | Delete
return num < 0.5 ? 2 * num * num : 1 - Math.pow( -2 * num + 2, 2 ) / 2;
[176] Fix | Delete
}
[177] Fix | Delete
[178] Fix | Delete
function getFooterClearance( container ) {
[179] Fix | Delete
var footer = container.querySelector( '.jp-carousel-info-footer' );
[180] Fix | Delete
var infoArea = container.querySelector( '.jp-carousel-info-extra' );
[181] Fix | Delete
var contentArea = container.querySelector( '.jp-carousel-info-content-wrapper' );
[182] Fix | Delete
[183] Fix | Delete
if ( footer && infoArea && contentArea ) {
[184] Fix | Delete
var styles = window.getComputedStyle( infoArea );
[185] Fix | Delete
var padding = parseInt( styles.paddingTop, 10 ) + parseInt( styles.paddingBottom, 10 );
[186] Fix | Delete
padding = isNaN( padding ) ? 0 : padding;
[187] Fix | Delete
return contentArea.offsetHeight + footer.offsetHeight + padding;
[188] Fix | Delete
}
[189] Fix | Delete
return 0;
[190] Fix | Delete
}
[191] Fix | Delete
[192] Fix | Delete
function isTouch() {
[193] Fix | Delete
return (
[194] Fix | Delete
'ontouchstart' in window || ( window.DocumentTouch && document instanceof DocumentTouch )
[195] Fix | Delete
);
[196] Fix | Delete
}
[197] Fix | Delete
[198] Fix | Delete
function scrollToElement( el, container, callback ) {
[199] Fix | Delete
if ( ! el || ! container ) {
[200] Fix | Delete
if ( callback ) {
[201] Fix | Delete
return callback();
[202] Fix | Delete
}
[203] Fix | Delete
return;
[204] Fix | Delete
}
[205] Fix | Delete
[206] Fix | Delete
// For iOS Safari compatibility, use JS to set the minimum height.
[207] Fix | Delete
var infoArea = container.querySelector( '.jp-carousel-info-extra' );
[208] Fix | Delete
if ( infoArea ) {
[209] Fix | Delete
// 64px is the same height as `.jp-carousel-info-footer` in the CSS.
[210] Fix | Delete
infoArea.style.minHeight = window.innerHeight - 64 + 'px';
[211] Fix | Delete
}
[212] Fix | Delete
[213] Fix | Delete
var isScrolling = true;
[214] Fix | Delete
var startTime = Date.now();
[215] Fix | Delete
var duration = 300;
[216] Fix | Delete
var originalPosition = container.scrollTop;
[217] Fix | Delete
var targetPosition = Math.max(
[218] Fix | Delete
0,
[219] Fix | Delete
el.offsetTop - Math.max( 0, window.innerHeight - getFooterClearance( container ) )
[220] Fix | Delete
);
[221] Fix | Delete
var distance = targetPosition - container.scrollTop;
[222] Fix | Delete
distance = Math.min( distance, container.scrollHeight - window.innerHeight );
[223] Fix | Delete
[224] Fix | Delete
function stopScroll() {
[225] Fix | Delete
isScrolling = false;
[226] Fix | Delete
}
[227] Fix | Delete
[228] Fix | Delete
function runScroll() {
[229] Fix | Delete
var now = Date.now();
[230] Fix | Delete
var progress = easeInOutQuad( ( now - startTime ) / duration );
[231] Fix | Delete
[232] Fix | Delete
progress = progress > 1 ? 1 : progress;
[233] Fix | Delete
var newVal = progress * distance;
[234] Fix | Delete
container.scrollTop = originalPosition + newVal;
[235] Fix | Delete
[236] Fix | Delete
if ( now <= startTime + duration && isScrolling ) {
[237] Fix | Delete
return requestAnimationFrame( runScroll );
[238] Fix | Delete
}
[239] Fix | Delete
if ( callback ) {
[240] Fix | Delete
callback();
[241] Fix | Delete
}
[242] Fix | Delete
if ( infoArea ) {
[243] Fix | Delete
infoArea.style.minHeight = '';
[244] Fix | Delete
}
[245] Fix | Delete
isScrolling = false;
[246] Fix | Delete
container.removeEventListener( 'wheel', stopScroll );
[247] Fix | Delete
}
[248] Fix | Delete
[249] Fix | Delete
// Allow scroll to be cancelled by user interaction.
[250] Fix | Delete
container.addEventListener( 'wheel', stopScroll );
[251] Fix | Delete
runScroll();
[252] Fix | Delete
}
[253] Fix | Delete
[254] Fix | Delete
function getJSONAttribute( el, attr ) {
[255] Fix | Delete
if ( ! el || ! el.hasAttribute( attr ) ) {
[256] Fix | Delete
return undefined;
[257] Fix | Delete
}
[258] Fix | Delete
[259] Fix | Delete
try {
[260] Fix | Delete
return JSON.parse( el.getAttribute( attr ) );
[261] Fix | Delete
} catch {
[262] Fix | Delete
return undefined;
[263] Fix | Delete
}
[264] Fix | Delete
}
[265] Fix | Delete
[266] Fix | Delete
function convertToPlainText( html ) {
[267] Fix | Delete
var dummy = document.createElement( 'div' );
[268] Fix | Delete
dummy.textContent = html;
[269] Fix | Delete
return dummy.innerHTML;
[270] Fix | Delete
}
[271] Fix | Delete
[272] Fix | Delete
function stripHTML( text ) {
[273] Fix | Delete
return text.replace( /<[^>]*>?/gm, '' );
[274] Fix | Delete
}
[275] Fix | Delete
[276] Fix | Delete
return {
[277] Fix | Delete
closest: closest,
[278] Fix | Delete
matches: matches,
[279] Fix | Delete
hide: hide,
[280] Fix | Delete
show: show,
[281] Fix | Delete
fadeIn: fadeIn,
[282] Fix | Delete
fadeOut: fadeOut,
[283] Fix | Delete
scrollToElement: scrollToElement,
[284] Fix | Delete
getJSONAttribute: getJSONAttribute,
[285] Fix | Delete
convertToPlainText: convertToPlainText,
[286] Fix | Delete
stripHTML: stripHTML,
[287] Fix | Delete
emitEvent: emitEvent,
[288] Fix | Delete
isTouch: isTouch,
[289] Fix | Delete
};
[290] Fix | Delete
} )();
[291] Fix | Delete
[292] Fix | Delete
/////////////////////////////////////
[293] Fix | Delete
// Carousel implementation
[294] Fix | Delete
/////////////////////////////////////
[295] Fix | Delete
function init() {
[296] Fix | Delete
var commentInterval;
[297] Fix | Delete
var screenPadding;
[298] Fix | Delete
var originalOverflow;
[299] Fix | Delete
var originalHOverflow;
[300] Fix | Delete
var scrollPos;
[301] Fix | Delete
[302] Fix | Delete
var lastKnownLocationHash = '';
[303] Fix | Delete
var isUserTyping = false;
[304] Fix | Delete
[305] Fix | Delete
var gallerySelector =
[306] Fix | Delete
'div.gallery, div.tiled-gallery, ul.wp-block-gallery, ul.blocks-gallery-grid, ' +
[307] Fix | Delete
'figure.wp-block-gallery.has-nested-images, div.wp-block-jetpack-tiled-gallery, a.single-image-gallery';
[308] Fix | Delete
[309] Fix | Delete
// Selector for items within a gallery or tiled gallery.
[310] Fix | Delete
var galleryItemSelector =
[311] Fix | Delete
'.gallery-item, .tiled-gallery-item, .blocks-gallery-item, ' + ' .tiled-gallery__item';
[312] Fix | Delete
[313] Fix | Delete
// Selector for all items including single images.
[314] Fix | Delete
var itemSelector = galleryItemSelector + ', .wp-block-image';
[315] Fix | Delete
[316] Fix | Delete
var carousel = {};
[317] Fix | Delete
[318] Fix | Delete
var stat =
[319] Fix | Delete
typeof wpcom !== 'undefined' && wpcom.carousel && wpcom.carousel.stat
[320] Fix | Delete
? wpcom.carousel.stat
[321] Fix | Delete
: util.noop;
[322] Fix | Delete
[323] Fix | Delete
var pageview =
[324] Fix | Delete
typeof wpcom !== 'undefined' && wpcom.carousel && wpcom.carousel.pageview
[325] Fix | Delete
? wpcom.carousel.pageview
[326] Fix | Delete
: util.noop;
[327] Fix | Delete
[328] Fix | Delete
function handleKeyboardEvent( e ) {
[329] Fix | Delete
if ( ! isUserTyping ) {
[330] Fix | Delete
switch ( e.which ) {
[331] Fix | Delete
case 38: // up
[332] Fix | Delete
e.preventDefault();
[333] Fix | Delete
carousel.overlay.scrollTop -= 100;
[334] Fix | Delete
break;
[335] Fix | Delete
case 40: // down
[336] Fix | Delete
e.preventDefault();
[337] Fix | Delete
carousel.overlay.scrollTop += 100;
[338] Fix | Delete
break;
[339] Fix | Delete
case 39: // right
[340] Fix | Delete
e.preventDefault();
[341] Fix | Delete
swiper.slideNext();
[342] Fix | Delete
break;
[343] Fix | Delete
case 37: // left
[344] Fix | Delete
case 8: // backspace
[345] Fix | Delete
e.preventDefault();
[346] Fix | Delete
swiper.slidePrev();
[347] Fix | Delete
break;
[348] Fix | Delete
case 27: // escape
[349] Fix | Delete
e.preventDefault();
[350] Fix | Delete
closeCarousel();
[351] Fix | Delete
break;
[352] Fix | Delete
default:
[353] Fix | Delete
break;
[354] Fix | Delete
}
[355] Fix | Delete
}
[356] Fix | Delete
}
[357] Fix | Delete
[358] Fix | Delete
function disableKeyboardNavigation() {
[359] Fix | Delete
isUserTyping = true;
[360] Fix | Delete
}
[361] Fix | Delete
[362] Fix | Delete
function enableKeyboardNavigation() {
[363] Fix | Delete
isUserTyping = false;
[364] Fix | Delete
}
[365] Fix | Delete
[366] Fix | Delete
function calculatePadding() {
[367] Fix | Delete
var baseScreenPadding = 110;
[368] Fix | Delete
screenPadding = baseScreenPadding;
[369] Fix | Delete
[370] Fix | Delete
if ( window.innerWidth <= 760 ) {
[371] Fix | Delete
screenPadding = Math.round( ( window.innerWidth / 760 ) * baseScreenPadding );
[372] Fix | Delete
[373] Fix | Delete
if ( screenPadding < 40 && domUtil.isTouch() ) {
[374] Fix | Delete
screenPadding = 0;
[375] Fix | Delete
}
[376] Fix | Delete
}
[377] Fix | Delete
}
[378] Fix | Delete
[379] Fix | Delete
function makeGalleryImageAccessible( img ) {
[380] Fix | Delete
img.role = 'button';
[381] Fix | Delete
img.tabIndex = 0;
[382] Fix | Delete
img.ariaLabel = jetpackCarouselStrings.image_label;
[383] Fix | Delete
}
[384] Fix | Delete
[385] Fix | Delete
function initializeCarousel() {
[386] Fix | Delete
if ( ! carousel.overlay ) {
[387] Fix | Delete
carousel.overlay = document.querySelector( '.jp-carousel-overlay' );
[388] Fix | Delete
carousel.container = carousel.overlay.querySelector( '.jp-carousel-wrap' );
[389] Fix | Delete
carousel.gallery = carousel.container.querySelector( '.jp-carousel' );
[390] Fix | Delete
carousel.info = carousel.overlay.querySelector( '.jp-carousel-info' );
[391] Fix | Delete
carousel.caption = carousel.info.querySelector( '.jp-carousel-caption' );
[392] Fix | Delete
carousel.commentField = carousel.overlay.querySelector(
[393] Fix | Delete
'#jp-carousel-comment-form-comment-field'
[394] Fix | Delete
);
[395] Fix | Delete
carousel.emailField = carousel.overlay.querySelector(
[396] Fix | Delete
'#jp-carousel-comment-form-email-field'
[397] Fix | Delete
);
[398] Fix | Delete
carousel.authorField = carousel.overlay.querySelector(
[399] Fix | Delete
'#jp-carousel-comment-form-author-field'
[400] Fix | Delete
);
[401] Fix | Delete
carousel.urlField = carousel.overlay.querySelector( '#jp-carousel-comment-form-url-field' );
[402] Fix | Delete
[403] Fix | Delete
calculatePadding();
[404] Fix | Delete
[405] Fix | Delete
[
[406] Fix | Delete
carousel.commentField,
[407] Fix | Delete
carousel.emailField,
[408] Fix | Delete
carousel.authorField,
[409] Fix | Delete
carousel.urlField,
[410] Fix | Delete
].forEach( function ( field ) {
[411] Fix | Delete
if ( field ) {
[412] Fix | Delete
field.addEventListener( 'focus', disableKeyboardNavigation );
[413] Fix | Delete
field.addEventListener( 'blur', enableKeyboardNavigation );
[414] Fix | Delete
}
[415] Fix | Delete
} );
[416] Fix | Delete
[417] Fix | Delete
carousel.overlay.addEventListener( 'click', function ( e ) {
[418] Fix | Delete
var target = e.target;
[419] Fix | Delete
var isTargetCloseHint = !! domUtil.closest( target, '.jp-carousel-close-hint' );
[420] Fix | Delete
var isSmallScreen = !! window.matchMedia( '(max-device-width: 760px)' ).matches;
[421] Fix | Delete
if ( target === carousel.overlay ) {
[422] Fix | Delete
if ( ! isSmallScreen ) {
[423] Fix | Delete
closeCarousel();
[424] Fix | Delete
}
[425] Fix | Delete
} else if ( isTargetCloseHint ) {
[426] Fix | Delete
closeCarousel();
[427] Fix | Delete
} else if ( target.classList.contains( 'jp-carousel-image-download' ) ) {
[428] Fix | Delete
stat( 'download_original_click' );
[429] Fix | Delete
} else if ( target.classList.contains( 'jp-carousel-comment-login' ) ) {
[430] Fix | Delete
handleCommentLoginClick( e );
[431] Fix | Delete
} else if ( domUtil.closest( target, '#jp-carousel-comment-form-container' ) ) {
[432] Fix | Delete
handleCommentFormClick( e );
[433] Fix | Delete
} else if (
[434] Fix | Delete
domUtil.closest( target, '.jp-carousel-photo-icons-container' ) ||
[435] Fix | Delete
target.classList.contains( 'jp-carousel-photo-title' )
[436] Fix | Delete
) {
[437] Fix | Delete
handleFooterElementClick( e );
[438] Fix | Delete
}
[439] Fix | Delete
} );
[440] Fix | Delete
[441] Fix | Delete
window.addEventListener( 'keydown', handleKeyboardEvent );
[442] Fix | Delete
[443] Fix | Delete
carousel.overlay.addEventListener( 'jp_carousel.afterOpen', function () {
[444] Fix | Delete
enableKeyboardNavigation();
[445] Fix | Delete
[446] Fix | Delete
// Don't show navigation if there's only one image.
[447] Fix | Delete
if ( carousel.slides.length <= 1 ) {
[448] Fix | Delete
return;
[449] Fix | Delete
}
[450] Fix | Delete
// Show dot pagination if slide count is <= 5, otherwise show n/total.
[451] Fix | Delete
if ( carousel.slides.length <= 5 ) {
[452] Fix | Delete
domUtil.show( carousel.info.querySelector( '.jp-swiper-pagination' ) );
[453] Fix | Delete
} else {
[454] Fix | Delete
domUtil.show( carousel.info.querySelector( '.jp-carousel-pagination' ) );
[455] Fix | Delete
}
[456] Fix | Delete
} );
[457] Fix | Delete
[458] Fix | Delete
carousel.overlay.addEventListener( 'jp_carousel.beforeClose', function () {
[459] Fix | Delete
disableKeyboardNavigation();
[460] Fix | Delete
[461] Fix | Delete
// Fixes some themes where closing carousel brings view back to top.
[462] Fix | Delete
document.documentElement.style.removeProperty( 'height' );
[463] Fix | Delete
[464] Fix | Delete
// If we disable the swiper (because there's only one image)
[465] Fix | Delete
// we have to re-enable it here again as Swiper doesn't, for some reason,
[466] Fix | Delete
// show the navigation buttons again after reinitialization.
[467] Fix | Delete
if ( swiper ) {
[468] Fix | Delete
swiper.enable();
[469] Fix | Delete
}
[470] Fix | Delete
[471] Fix | Delete
// Hide pagination.
[472] Fix | Delete
domUtil.hide( carousel.info.querySelector( '.jp-swiper-pagination' ) );
[473] Fix | Delete
domUtil.hide( carousel.info.querySelector( '.jp-carousel-pagination' ) );
[474] Fix | Delete
} );
[475] Fix | Delete
[476] Fix | Delete
carousel.overlay.addEventListener( 'jp_carousel.afterClose', function () {
[477] Fix | Delete
// don't force the browser back when the carousel closes.
[478] Fix | Delete
if ( window.history.pushState ) {
[479] Fix | Delete
history.pushState(
[480] Fix | Delete
'',
[481] Fix | Delete
document.title,
[482] Fix | Delete
window.location.pathname + window.location.search
[483] Fix | Delete
);
[484] Fix | Delete
} else {
[485] Fix | Delete
window.location.href = '';
[486] Fix | Delete
}
[487] Fix | Delete
lastKnownLocationHash = '';
[488] Fix | Delete
carousel.isOpen = false;
[489] Fix | Delete
} );
[490] Fix | Delete
[491] Fix | Delete
// Prevent native browser zooming
[492] Fix | Delete
carousel.overlay.addEventListener( 'touchstart', function ( e ) {
[493] Fix | Delete
if ( e.touches.length > 1 ) {
[494] Fix | Delete
e.preventDefault();
[495] Fix | Delete
}
[496] Fix | Delete
} );
[497] Fix | Delete
}
[498] Fix | Delete
}
[499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function