Files
roi-theme/wp-content/plugins/ajax-search-pro/js/min/external/photostack.js
root a22573bf0b Commit inicial - WordPress Análisis de Precios Unitarios
- WordPress core y plugins
- Tema Twenty Twenty-Four configurado
- Plugin allow-unfiltered-html.php simplificado
- .gitignore configurado para excluir wp-config.php y uploads

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-03 21:04:30 -06:00

2 lines
7.1 KiB
JavaScript
Executable File

(function(){"use strict";function _(t,e){for(let i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return t}function E(t){if(typeof t>"u"||typeof t[0]>"u")return!1;let e=[],i=t.length,n=t[0].length;for(let a=0;a<i;a++)e=e.concat(t[a]);e=T(e);let r=[],o=0;for(let a=0;a<i;a++){let f=[];for(let u=0;u<n;u++)f.push(e[o]),o++;r.push(f)}return r}function T(t){let e=t.length,i,n;for(;e;)n=Math.floor(Math.random()*e--),i=t[e],t[e]=t[n],t[n]=i;return t}function h(t,e){this.el=t,this.inner=this.el.querySelector("div"),this.allItems=[].slice.call(this.inner.children),this.allItemsCount=this.allItems.length,this.allItemsCount&&(this.items=[].slice.call(this.inner.querySelectorAll("figure:not([data-dummy])")),this.itemsCount=this.items.length,this.current=0,this.options=_({},this.options),_(this.options,e),this._init())}h.prototype.options={},h.prototype._init=function(){this.currentItem=this.items[this.current],this._addNavigation(),this._getSizes(),this._initEvents()},h.prototype._addNavigation=function(){this.nav=document.createElement("nav");let t="";for(let e=0;e<this.itemsCount;++e)t+="<span></span>";this.nav.innerHTML=t,this.el.appendChild(this.nav),this.navDots=[].slice.call(this.nav.children)},h.prototype._initEvents=function(){let t=this,e=this.el.classList.contains("photostack-start"),i=function(){let n=function(){t.el.classList.add("photostack-transition")};e?(this.removeEventListener("click",i),t.el.classList.remove("photostack-start"),n()):(t.openDefault=!0,setTimeout(n,25)),t.started=!0,t._showPhoto(t.current)};e?(this._shuffle(),this.el.addEventListener("click",i)):i(),this.navDots.forEach(function(n,r){n.addEventListener("click",function(){if(r===t.current)t._rotateItem();else{let o=function(){t._showPhoto(r)};t.flipped?t._rotateItem(o):o()}})})},h.prototype._resizeHandler=function(){let t=this;function e(){t._resize(),t._resizeTimeout=null}this._resizeTimeout&&clearTimeout(this._resizeTimeout),this._resizeTimeout=setTimeout(e,100)},h.prototype._resize=function(){let t=this,e=function(){t._shuffle(!0)};this._getSizes(),this.started&&this.flipped?this._rotateItem(e):e()},h.prototype._showPhoto=function(t){if(this.isShuffling)return!1;this.isShuffling=!0,this.currentItem.classList.contains("photostack-flip")&&(this._removeItemPerspective(),this.navDots[this.current].classList.remove("flippable")),this.navDots[this.current].classList.remove("current"),this.currentItem.classList.remove("photostack-current"),this.current=t,this.currentItem=this.items[this.current],this.navDots[this.current].classList.add("current"),this.currentItem.querySelector(".photostack-back")&&this.navDots[t].classList.add("flippable"),this._shuffle()},h.prototype._shuffle=function(t){let e=t?1:this.currentItem.getAttribute("data-shuffle-iteration")||1;(e<=0||!this.started||this.openDefault)&&(e=1),this.openDefault&&(this.currentItem.classList.add("photostack-flip"),this.openDefault=!1,this.isShuffling=!1);let i=.5,n=Math.ceil(this.sizes.inner.width/(this.sizes.item.width*i)),r=Math.ceil(this.sizes.inner.height/(this.sizes.item.height*i)),o=n*this.sizes.item.width*i+this.sizes.item.width/2-this.sizes.inner.width,a=r*this.sizes.item.height*i+this.sizes.item.height/2-this.sizes.inner.height,f=o/2,u=a/2,m=35,p=-35,s=this,L=function(){--e;let v=[];for(let c=0;c<r;++c){let x=v[c]=[];for(let l=0;l<n;++l){let d=l*(s.sizes.item.width*i)-f,M=c*(s.sizes.item.height*i)-u,g=0,z=0;if(s.started&&e===0){let k=s._isOverlapping({x:d,y:M});if(k.overlapping)switch(g=k.noOverlap.x,z=k.noOverlap.y,Math.floor(Math.random()*3)){case 0:g=0;break;case 1:z=0;break}}x[l]={x:d+g,y:M+z}}}v=E(v);let y=0,I=0,w=0;s.allItems.forEach(function(c){y===n-1?(I=I===r-1?0:I+1,y=1):++y;let x=v[I][y-1],l={x:x.x,y:x.y},d=function(){++w,this.removeEventListener("transitionend",d),w===s.allItemsCount&&(e>0?L.call():(s.currentItem.classList.add("photostack-flip"),s.isShuffling=!1,typeof s.options.callback=="function"&&s.options.callback(s.currentItem)))};s.items.indexOf(c)===s.current&&s.started&&e===0?(s.currentItem.style.WebkitTransform="translate("+s.centerItem.x+"px,"+s.centerItem.y+"px) rotate(0deg)",s.currentItem.style.msTransform="translate("+s.centerItem.x+"px,"+s.centerItem.y+"px) rotate(0deg)",s.currentItem.style.transform="translate("+s.centerItem.x+"px,"+s.centerItem.y+"px) rotate(0deg)",s.currentItem.querySelector(".photostack-back")&&s._addItemPerspective(),s.currentItem.classList.add("photostack-current")):(c.style.WebkitTransform="translate("+l.x+"px,"+l.y+"px) rotate("+Math.floor(Math.random()*(m-p+1)+p)+"deg)",c.style.msTransform="translate("+l.x+"px,"+l.y+"px) rotate("+Math.floor(Math.random()*(m-p+1)+p)+"deg)",c.style.transform="translate("+l.x+"px,"+l.y+"px) rotate("+Math.floor(Math.random()*(m-p+1)+p)+"deg)"),s.started&&c.addEventListener("transitionend",d)})};L.call()},h.prototype._getSizes=function(){this.sizes={inner:{width:this.inner.offsetWidth,height:this.inner.offsetHeight},item:{width:this.currentItem.offsetWidth,height:this.currentItem.offsetHeight}},this.centerItem={x:this.sizes.inner.width/2-this.sizes.item.width/2,y:this.sizes.inner.height/2-this.sizes.item.height/2}},h.prototype._isOverlapping=function(t){let e=this.sizes.item.width+this.sizes.item.width/3,i=this.sizes.item.height+this.sizes.item.height/3,n={x:this.sizes.inner.width/2-e/2,y:this.sizes.inner.height/2-i/2},r=this.sizes.item.width,o=this.sizes.item.height;if(!(t.x+r<n.x||t.x>n.x+e||t.y+o<n.y||t.y>n.y+i)){let a=Math.random()<.5,f=Math.floor(Math.random()*(r/4+1)),u=Math.floor(Math.random()*(o/4+1)),m=a?(t.x-n.x+r)*-1-f:n.x+e-(t.x+r)+r+f,p=a?(t.y-n.y+o)*-1-u:n.y+i-(t.y+o)+o+u;return{overlapping:!0,noOverlap:{x:m,y:p}}}return{overlapping:!1}},h.prototype._addItemPerspective=function(){this.el.classList.add("photostack-perspective")},h.prototype._removeItemPerspective=function(){this.el.classList.remove("photostack-perspective"),this.currentItem.classList.remove("photostack-flip")},h.prototype._rotateItem=function(t){if(this.el.classList.contains("photostack-perspective")&&!this.isRotating&&!this.isShuffling){this.isRotating=!0;let e=this,i=function(){this.removeEventListener("transitionend",i),e.isRotating=!1,typeof t=="function"&&t()};this.flipped?(this.navDots[this.current].classList.remove("flip"),this.currentItem.style.WebkitTransform="translate("+this.centerItem.x+"px,"+this.centerItem.y+"px) rotateY(0deg)",this.currentItem.style.transform="translate("+this.centerItem.x+"px,"+this.centerItem.y+"px) rotateY(0deg)"):(this.navDots[this.current].classList.add("flip"),this.currentItem.style.WebkitTransform="translate("+this.centerItem.x+"px,"+this.centerItem.y+"px) translate("+this.sizes.item.width+"px) rotateY(-179.9deg)",this.currentItem.style.transform="translate("+this.centerItem.x+"px,"+this.centerItem.y+"px) translate("+this.sizes.item.width+"px) rotateY(-179.9deg)"),this.flipped=!this.flipped,this.currentItem.addEventListener("transitionend",i),this.currentItem.addEventListener("transitionstart",function n(r){const o=getComputedStyle(e.currentItem),f=parseFloat(o.transitionDuration)*1e3/2;setTimeout(()=>{e.flipped?e.currentItem.classList.add("photostack-flipped"):e.currentItem.classList.remove("photostack-flipped")},f),e.currentItem.removeEventListener("transitionstart",n)})}},window.Photostack=h})();