woocommerce/assets/js/photoswipe/photoswipe.min.js

4 lines
31 KiB
JavaScript
Raw Normal View History

2019-02-14 11:07:16 +00:00
/*! PhotoSwipe - v4.1.3 - 2019-01-08
Add/product galleries (#11665) * register prettyPhoto but don't enqueue. #10721 * Remove lightbox option. #10721 Also registers the prettyPhoto styles instead of enqueueing * Stip all prettyPhoto related stuff from the templates and tidy up some logic. #10721 * Add flexslider assets #10721 * styling and re-adds `woocommerce_single_product_image_thumbnail_html`. #10721. * Add zoom functionality. #10721 * Move js to single-product.js. #10721 * styling of the gallery thumbnails when using the `product_page` shortcode. #10721 * Only enable the zoom if the image is large enough. #10721 * Use a 4 column layout by default. #10721 * Make the carousel options filterable. #10721 * rtl styles for gallery. #10721 * Don't zoom on handheld devices. #10721 * markup tweaks in prep for photoswipe * disable zoom for now * Add and enqueue photoswipe assets * add the photoswipe template * initialise photoswipe - it's alive! * tidy up js. add title. add separate trigger. #10721 * Move photoswipe functions to single-product.js. #10721 * reactivate the zoom! #10721 * style the photoswipe trigger. #10721 * disable flexslider animation loop. #10721 * js tidy up. #10721 * Fix jshint * Abstract the product gallery scripts * Minify * Fixed conflict with the admin bar * Photoswipe conflict with admin bar * Index. #10721 * photoswipe button styles. #10721 * Styling. #10721 * No animation on zoom * Image width on mobile * No shadows please. #10721 Looking at you, Twenty Twelve. * code tidy and add class to placeholder figure. #10721 * simplify rtl query * photoswipe button styles * Comma should not be here * zoom icon #10721 * gallery thumb styles. #10721 * trigger icon. #10721 * Image margins. #10721 * icon hover states. #10721 * Variation handling * Fix zoom and heights * Resize after timeout
2016-10-13 14:25:42 +00:00
* http://photoswipe.com
2019-02-14 11:07:16 +00:00
* Copyright (c) 2019 Dmitry Semenov; */
2020-07-17 04:44:49 +00:00
!function(e,t){"function"==typeof define&&define.amd?define(t):"object"==typeof exports?module.exports=t():e.PhotoSwipe=t()}(this,function(){"use strict";return function(p,i,e,t){var f={features:null,bind:function(e,t,n,i){var o=(i?"remove":"add")+"EventListener";t=t.split(" ");for(var a=0;a<t.length;a++)t[a]&&e[o](t[a],n,!1)},isArray:function(e){return e instanceof Array},createEl:function(e,t){var n=document.createElement(t||"div");return e&&(n.className=e),n},getScrollY:function(){var e=window.pageYOffset;return e!==undefined?e:document.documentElement.scrollTop},unbind:function(e,t,n){f.bind(e,t,n,!0)},removeClass:function(e,t){var n=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").replace(/^\s\s*/,"").replace(/\s\s*$/,"")},addClass:function(e,t){f.hasClass(e,t)||(e.className+=(e.className?" ":"")+t)},hasClass:function(e,t){return e.className&&new RegExp("(^|\\s)"+t+"(\\s|$)").test(e.className)},getChildByClass:function(e,t){for(var n=e.firstChild;n;){if(f.hasClass(n,t))return n;n=n.nextSibling}},arraySearch:function(e,t,n){for(var i=e.length;i--;)if(e[i][n]===t)return i;return-1},extend:function(e,t,n){for(var i in t)if(t.hasOwnProperty(i)){if(n&&e.hasOwnProperty(i))continue;e[i]=t[i]}},easing:{sine:{out:function(e){return Math.sin(e*(Math.PI/2))},inOut:function(e){return-(Math.cos(Math.PI*e)-1)/2}},cubic:{out:function(e){return--e*e*e+1}}},detectFeatures:function(){if(f.features)return f.features;var e=f.createEl().style,t="",n={};if(n.oldIE=document.all&&!document.addEventListener,n.touch="ontouchstart"in window,window.requestAnimationFrame&&(n.raf=window.requestAnimationFrame,n.caf=window.cancelAnimationFrame),n.pointerEvent=!!window.PointerEvent||navigator.msPointerEnabled,!n.pointerEvent){var i=navigator.userAgent;if(/iP(hone|od)/.test(navigator.platform)){var o=navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/);o&&0<o.length&&1<=(o=parseInt(o[1],10))&&o<8&&(n.isOldIOSPhone=!0)}var a=i.match(/Android\s([0-9\.]*)/),r=a?a[1]:0;1<=(r=parseFloat(r))&&(r<4.4&&(n.isOldAndroid=!0),n.androidVersion=r),n.isMobileOpera=/opera mini|opera mobi/i.test(i)}for(var l,s,u=["transform","perspective","animationName"],c=["","webkit","Moz","ms","O"],d=0;d<4;d++){t=c[d];for(var m=0;m<3;m++)l=u[m],s=t+(t?l.charAt(0).toUpperCase()+l.slice(1):l),!n[l]&&s in e&&(n[l]=s);t&&!n.raf&&(t=t.toLowerCase(),n.raf=window[t+"RequestAnimationFrame"],n.raf&&(n.caf=window[t+"CancelAnimationFrame"]||window[t+"CancelRequestAnimationFrame"]))}if(!n.raf){var p=0;n.raf=function(e){var t=(new Date).getTime(),n=Math.max(0,16-(t-p)),i=window.setTimeout(function(){e(t+n)},n);return p=t+n,i},n.caf=function(e){clearTimeout(e)}}return n.svg=!!document.createElementNS&&!!document.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect,f.features=n}};f.detectFeatures(),f.features.oldIE&&(f.bind=function(e,t,n,i){t=t.split(" ");for(var o,a=(i?"detach":"attach")+"Event",r=function(){n.handleEvent.call(n)},l=0;l<t.length;l++)if(o=t[l])if("object"==typeof n&&n.handleEvent){if(i){if(!n["oldIE"+o])return!1}else n["oldIE"+o]=r;e[a]("on"+o,n["oldIE"+o])}else e[a]("on"+o,n)});var h=this,y={allowPanToNext:!0,spacing:.12,bgOpacity:1,mouseUsed:!1,loop:!0,pinchToClose:!0,closeOnScroll:!0,closeOnVerticalDrag:!0,verticalDragRange:.75,hideAnimationDuration:333,showAnimationDuration:333,showHideOpacity:!1,focus:!0,escKey:!0,arrowKeys:!0,mainScrollEndFriction:.35,panEndFriction:.35,isClickableElement:function(e){return"A"===e.tagName},getDoubleTapZoom:function(e,t){return e?1:t.initialZoomLevel<.7?1:1.33},maxSpreadZoom:1.33,modal:!0,scaleMode:"fit"};f.extend(y,t);function n(e,t){f.extend(h,t.publicMethods),$e.push(e)}function s(e){var t=Gt();return t-1<e?e-t:e<0?t+e:e}function a(e,t){return Qe[e]||(Qe[e]=[]),Qe[e].push(t)}function x(e){var t=Qe[e];if(t){var n=Array.prototype.slice.call(arguments);n.shift();for(var i=0;i<t.length;i++)t[i].apply(h,n)}}function c(){return(new Date).getTime()}function v(e){_e=e,h.bg.style.opacity=e*y.bgOpacity}function o(e,t,n,i,o){(!Je||o&&o!==h.currItem)&&(i/=o?o.fitRatio:h.currItem.fitRatio),e[re]=$+t+"px, "+n+"