Файловый менеджер - Редактировать - /home/kunzqhe/photostocker/wp-content/themes/themify-ultra/themify/js/modules/lottie.min.js
Назад
let TF_Lottie;((f,m,y)=>{"use strict";let e,d,p=0;const i=new Map,a=new WeakSet,t=t=>{if(!e){const c=new Set,a=async function(){if(0<c.size)for(let l of c){let o=d.get(l);if(o&&"scroll"===o.action.st&&l.isConnected){(t=>{})(l);let s=(t=>{const{top:e,height:i}=t.getBoundingClientRect(),s=m.h;return(s-e)/(s+i)})(l),a=o.action,n=a.vis,e=a.s_ev;if(s>=n[0]&&s<=n[1]){o.player.loop=!1;let t=o.player.isPaused;if("seek"===e){if(!a.min){let t=o.player.firstFrame||0;a.min=Math.min(...a.segment)-t,a.max=Math.max(...a.segment)-t}let e=a.min,t=a.max,i;if(1)o.player.resetSegments(!0),i=Math.round((s-n[0])/(n[1]-n[0])*(t-e));else{const r=window.scrollY,h=r>p?1:-1;p=r,i=o.player.currentFrame+h}if(i=-1===a.dir?t-i:e+i,(i*=a.sp)>t?i=t:i<e&&(i=e),o.player.goToAndStop(parseInt(i),!0),0){let t=o.index+1;i===e&&(t-=2)<0&&(t=0),d.delete(l),c.delete(l),await o.loadNext(t)}}else t&&(await o.play(),await o.loadNext())}else if(s<n[0]||s>n[1]){let t=o.index+1;s<n[0]&&(t-=2)<0&&(t=0),d.delete(l),c.delete(l),await o.loadNext(t)}}else d.delete(l),c.delete(l)}};window.tfOn("scroll",a,{passive:!0}),e=new IntersectionObserver((i,s)=>{if(0<i.length)for(let t=i.length-1;-1<t;--t){let e=i[t].target;if(0<i[t].intersectionRatio){let t=d.get(e);"scroll"===t?.action.st?c.has(e)||(c.add(e),t.isScrolled)||(t.isScrolled=!0,a()):(s.unobserve(e),c.delete(e),d.delete(e))}else c.delete(e)}0===d.size&&(s.disconnect(),window.tfOff("scroll",a,{passive:!0}),c.clear(),e=d=null)}),d=new WeakMap}d.set(t.el,t),e.unobserve(t.el),e.observe(t.el)},s=t=>{if(!t.shadowRoot&&!a.has(t)){const e=t.tfTag("template")[0]||t.tfTag("script")[0],i=e?.content.textContent||t.dataset.args;if(i){a.add(t);const s=new TF_Lottie(t,JSON.parse(i.replace(/[”“″]/g,'"')));s.run()}}};class n extends HTMLElement{connectedCallback(){this.dataset.lazy||s(this)}attributeChangedCallback(t,e,i){(!i&&"data-lazy"===t||m.is_builder_active)&&s(this)}disconnectedCallback(){if(window.lottie){const e=lottie.getRegisteredAnimations(),i=this.dataset.id;if(i)for(let t=e.length-1;-1<t;--t)if(e[t].animationID===i){setTimeout(()=>{this.isConnected||e[t].destroy()},100);break}}}static get observedAttributes(){return["data-lazy"]}}TF_Lottie=class{constructor(t,e){const i=e.actions||e;this.el=t,this.actions=Array.isArray(i)?i:[i],this.loop=!!e.loop,this.type=e.type||"svg",this.index=0}static async getJson(t){let e=i.get(t);return e?e=JSON.parse(e):(e=await m.fetch("",null,{credentials:"omit",method:"GET",mode:"cors"},TF_Lottie.getJsonUrl(t)),i.set(t,JSON.stringify(e))),e}static getJsonUrl(i){if(!i.includes(".json")){let t=Math.floor(10*Math.random()+1),e="https://assets"+t+".lottiefiles.com";"/"!==i[0]&&(e+="/packages/"),i=encodeURI(e+i+".json")}return i}isLive(){return!(!this.el?.isConnected||!this.player?._cbs)||(this.destroy(),!1)}destroy(t){if(this.player?.destroy(),t&&this.actions)for(let t=this.actions.length-1;-1<t;--t)this.actions[t].path&&i.delete(this.actions[t].path);this.el&&a.delete(this.el),this.el=this.player=this.actions=this.action=null}loadChain(){const a=[];for(let i=this.index,s=0;i<this.actions.length;++i){let t=this.actions[i],e=i<1;if(t.data)a.push(t.data);else if(t.path){if(!1===e){if(2<++s)break;1===s&&(e=!0)}!0===e&&a.push(TF_Lottie.getJson(t.path))}}return a}run(){return new Promise(async t=>{if(0===this.actions.length)t();else{const i=this.actions[this.index],e=[m.loadJs("https://cdnjs.cloudflare.com/ajax/libs/lottie-web/5.12.2/lottie.min.js",!!window.lottie),...this.loadChain()],s=("click"!==i.st&&"hover"!==i.st||e.push(m.loadCss("lottie.min","tf_lottie")),await Promise.all(e)),a=()=>{this.player?.removeEventListener("DOMLoaded",a),this.el?.classList.remove("tf_lazy"),this.init(),this.el&&(this.el.dataset.id=this.player.animationID),t()};if(this.el){let t=i.r||"svg",e=this.el.shadowRoot;"c"===t?t="canvas":"h"===t&&(t="html"),e?(this.player?.destroy(),e=e.firstChild):(e=f.createElement("div"),this.el.attachShadow({mode:"open"}).appendChild(e),e.style.width=e.style.height="100%",e.style.display="flex",lottie.setQuality("medium"));try{this.player=lottie.loadAnimation({container:e,animationData:s[1],renderer:t,loop:!1,autoplay:!1,rendererSettings:{progressiveLoad:!0}}),this.player.addEventListener("DOMLoaded",a)}catch(t){console.log(t,this.action)}}else t()}})}async init(){if(this.isLive()){this.action=this.actions[this.index];const s=this.action,a=this.player;let t=s.st;if(a.resetSegments(!0),!s.segment){t=t||(s.st="autoplay"),s.dir=parseInt(s.dir)<0?-1:1,s.sp=0<s.sp?parseFloat(s.sp):1;let i=[0,a.getDuration(!0)];if(s.fid||s.seg){let e;if(s.fid&&(e=a.getMarkerData(s.fid.trim()))&&(i[0]=e.time,i[1]=e.time+e.duration),s.seg)for(let t=(e=s.seg.split(",")).length-1;-1<t;--t)e[t]=parseInt(e[t].trim()),(e[t]<i[0]||e[t]>i[1])&&(e[t]=0===t?i[0]:i[1]);i=e}-1===s.dir&&i.reverse(),"scroll"===t?(s.count=0,s.vis?(s.vis=s.vis.split(","),s.vis[0]=s.vis[0]/100,s.vis[1]=s.vis[1]/100):s.vis=[0,1],s.min=Math.min(...i),s.max=Math.max(...i)):"hold"===t||"pausehold"===t?s.count=0:(s.sp<1&&"seek"===t&&(s.sp=1),s.count=0<s.count?parseInt(s.count):1),"click"!==t&&"hover"!==t&&s.sel&&"parent"!==s.sel&&(s.sel=""),i[0]+=a.firstFrame,i[1]+=a.firstFrame,s.segment=i}a.loop=!1,a.setSpeed(s.sp),a.goToAndStop(s.segment[0],!0);try{const e=this.el.classList;if(0<this.index&&e.remove("tf_lottie_"+this.actions[this.index-1].st),e.add("tf_lottie_"+t),"none"!==t)await this[t]();else if(1===this.actions.length)return;"scroll"!==t&&await this.loadNext()}catch(t){console.log(t)}}}getParent(){return this.el.closest("a,button")||this.el.closest("em,i")||this.el}async autoplay(){for(let t=this.action.count-1;-1<t;--t)await this.play()}click(t,p){return new Promise(a=>{let n=0,o=!1,l=(p===y&&(p=this.action.count),t||m.click),r=l===m.click?null:{passive:!0},h=this.action.sel,c=h?f.body:this.el,d=async t=>{if(!h||!t||t.target.closest(h)){const e=r?null:t?.target.closest("a");if(e&&t.preventDefault(),!o){if(o=!0,++n>=p){c.tfOff(l,d,r);const i=t?.target;try{await this.play()}catch(t){}if(e&&!m.is_builder_active){const s=e.getAttribute("href");s&&"#"!==s&&m.triggerEvent(i,l)}n=c=h=l=r=null,a()}o=null}}};if("parent"===h&&(h="",c=this.getParent()),c.tfOn(l,d,r),t!==y&&this.player.isPaused){const e=h?f.querySelectorAll(h):[c];for(let t=e.length-1;-1<t;--t)if(e[t].matches(":hover")){d();break}}})}hover(){const t=this.action.sel;return this.click(t&&"parent"!==t?"pointerover":"pointerenter")}hold(l){return new Promise(t=>{let e=this.action.segment.slice(),i=e[0]-this.player.firstFrame,s=this.player.renderer,a="parent"===this.action.sel?this.getParent():this.el;this.player.goToAndStop(i,!0);const n=async()=>{if(this.player.pause(),this.player.trigger("reject"),"pausehold"!==l)try{const t=[s.renderedFrame,i+this.player.firstFrame];this.player.resetSegments(!0),await this.play(t)}catch(t){}},o=async()=>{try{this.player.trigger("reject"),a.tfOff("pointerleave",n,{passive:!0,once:!0}).tfOn("pointerleave",n,{passive:!0,once:!0}),e[0]=s.renderedFrame,await this.play(e),a.tfOff("pointerenter",o,{passive:!0}).tfOff("pointerleave",n,{passive:!0,once:!0}),e=i=s=null,t()}catch(t){}};a.tfOn("pointerenter",o,{passive:!0}),this.player.isPaused&&a.matches(":hover")&&o()})}pausehold(){return this.hold("pausehold")}scroll(){t(this)}seek(){return new Promise(c=>{const d="parent"===this.action.sel?this.getParent():this.el,p=()=>{let t=d.getBoundingClientRect(),s=t.width,a=Math.max(...this.action.segment)-this.player.firstFrame,n=Math.min(...this.action.segment)-this.player.firstFrame,o=a-n,l=-1===this.action.dir,e,r=0;const h=t=>{d.tfOff("pointermove",i,{passive:!0}).tfOff("pointerleave",h,{passive:!0,once:!0}),e&&cancelAnimationFrame(e),t&&i(t),requestAnimationFrame(()=>{s=o=r=e=a=n=l=null})},i=i=>{e=requestAnimationFrame(()=>{if(null!==n){let t=0===i.offsetX?i.layerX-i.target.offsetLeft:i.offsetX,e=(t<0&&(t=0),Math.ceil(parseInt(parseFloat(t/s)*o)*this.action.sp));(e=l?a-e:n+e)>a?e=a:e<n&&(e=n),r!==e&&(r=e,this.player.goToAndStop(e,!0)),(!l&&e>=a-1||l&&e<=n+1)&&(d.tfOff("pointerenter",p,{passive:!0}),h(),c())}})};d.tfOn("pointerleave",h,{passive:!0,once:!0}).tfOn("pointermove",i,{passive:!0})};d.tfOn("pointerenter",p,{passive:!0}),this.player.isPaused&&d.matches(":hover")&&p()})}basket(){return new Promise(e=>{jQuery("body").one("added_to_cart",async t=>{try{for(let t=this.action.count-1;-1<t;--t)await this.play()}catch(t){}e()})})}loadNext(a){return new Promise(t=>{if(null===this.actions)t();else{if((a=a===y?this.index+1:a)>=this.actions.length){if(!0!==this.loop)return;a=0}const e=this.index,i=0<this.action.del?1e3*parseFloat(this.action.del):0,s=async()=>{this.index=a,this.actions[a].path===this.actions[e].path?await this.init():await this.run(),t()};0<i?setTimeout(()=>{s()},i):s()}})}play(t){return new Promise((a,n)=>{requestAnimationFrame(()=>{const e=()=>!!this.isLive()||(n(),!1);if(e()){const i=this.player.loop?"loopComplete":"complete",s=t=>{e()&&(this.player.removeEventListener(i,s),this.player.removeEventListener("reject",s)),t?.type===i?a():n("rejected")};(t=t||this.action.segment)[0]===t[1]?(this.player.goToAndStop(t[0],!0),a()):(this.player.addEventListener(i,s),this.player.addEventListener("reject",s),this.player.playSegments(t,!0))}})})}},customElements.define("tf-lottie",n)})(document,Themify,void 0);
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка