File Editor
Directories:
.. (Back)
Files:
view.asset.php
view.css
view.js
view.rtl.css
Create New File
Create
Edit File: view.js
(()=>{var t={79366:(t,e,i)=>{"object"==typeof window&&window.Jetpack_Block_Assets_Base_Url&&(i.p=window.Jetpack_Block_Assets_Base_Url)},98490:t=>{"use strict";t.exports=window.wp.domReady}},e={};function i(s){var n=e[s];if(void 0!==n)return n.exports;var r=e[s]={exports:{}};return t[s](r,r.exports,i),r.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{var t;i.g.importScripts&&(t=i.g.location+"");var e=i.g.document;if(!t&&e&&(e.currentScript&&"SCRIPT"===e.currentScript.tagName.toUpperCase()&&(t=e.currentScript.src),!t)){var s=e.getElementsByTagName("script");if(s.length)for(var n=s.length-1;n>-1&&(!t||!/^http(s?):/.test(t));)t=s[n--].src}if(!t)throw new Error("Automatic publicPath is not supported in this browser");t=t.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=t+"../"})(),(()=>{"use strict";i(79366)})(),(()=>{"use strict";var t=i(98490);i.n(t)()((function(){const t={sliders:[],OPTIMIZATION_ACCEPTED:1,OPTIMIZATION_WAS_CONSTRAINED:2};function e(t,e){const i=this;this.image=new Image,this.loaded=!1,this.image.onload=function(){i.loaded=!0,e._onLoaded()},this.image.src=t.src,this.image.alt=t.alt||"",this.label=t.label||!1}function i(t,e){t&&t.classList.add(e)}function s(t,e){t&&t.classList.remove(e)}function n(t){return{width:parseInt(window.getComputedStyle(t).width,10),height:parseInt(window.getComputedStyle(t).height,10)}}function r(t,e){let i;if("string"==typeof e||"number"==typeof e)i=parseInt(e,10);else{const s=t.getBoundingClientRect(),n={top:s.top+document.body.scrollTop+document.documentElement.scrollTop,left:s.left+document.body.scrollLeft+document.documentElement.scrollLeft},r=t.offsetWidth;i=(function(t){let e;return e=t.pageX?t.pageX:t.touches?t.touches[0].pageX:t.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,e}(e)-n.left)/r*100}return i}function o(t,e,i){let s;if("string"==typeof e||"number"==typeof e)s=parseInt(e,10);else{const n=t.getBoundingClientRect(),r={top:n.top+i.body.scrollTop+i.documentElement.scrollTop,left:n.left+i.body.scrollLeft+i.documentElement.scrollLeft},o=t.offsetHeight;s=(function(t){let e;return e=t.pageY?t.pageY:t.touches?t.touches[0].pageY:t.clientY+document.body.scrollTop+document.documentElement.scrollTop,e}(e)-r.top)/o*100}return s}const a={animate:!0,showLabels:!0,makeResponsive:!0};function l(t,i,s){let n;for(n in this.element=t,this.options={animate:!0,showLabels:!0,makeResponsive:!0,startingPosition:"50%",mode:"horizontal",callback:null},this.options)n in s&&(this.options[n]=n in a?"string"!=typeof(r=s[n])?Boolean(r):!("false"===r||""===r):s[n]);var r;2===i.length&&(this.imgBefore=new e(i[0],this),this.imgAfter=new e(i[1],this))}l.prototype={updateSlider:function(t,e){let n;n="vertical"===this.options.mode?o(this.slider,t,this.sliderParentDocument):r(this.slider,t),n=n.toFixed(2)+"%";const a=parseFloat(n),l=100-a+"%";a>0&&a<100&&(s(this.handle,"transition"),s(this.rightImage,"transition"),s(this.leftImage,"transition"),this.options.animate&&e&&(i(this.handle,"transition"),i(this.leftImage,"transition"),i(this.rightImage,"transition")),"vertical"===this.options.mode?(this.handle.style.top=n,this.leftImage.style.height=n,this.rightImage.style.height=l):(this.handle.style.left=n,this.leftImage.style.width=n,this.rightImage.style.width=l),this.sliderPosition=n)},getPosition:function(){return this.sliderPosition},displayLabel:function(t,e){const i=document.createElement("div");i.className="jx-label",i.setAttribute("tabindex",0),function(t,e){document.body.textContent?t.textContent=e:t.innerText=e}(i,e),t.appendChild(i)},setStartingPosition:function(t){this.options.startingPosition=t},calculateDims:function(t,e){const i=(s=this.imgBefore.image,{width:s.naturalWidth,height:s.naturalHeight,aspect:function(){return this.width/this.height}}).aspect();var s;return t?e=t/i:e&&(t=e*i),{width:t,height:e,ratio:i}},responsivizeIframe:function(t){return t.height<window.innerHeight?t.ratio>=1&&(this.wrapper.style.paddingTop=parseInt((window.innerHeight-t.height)/2)+"px"):t.height>window.innerHeight&&(t=this.calculateDims(0,window.innerHeight),this.wrapper.style.paddingLeft=parseInt((window.innerWidth-t.width)/2)+"px"),t},setWrapperDimensions:function(){const t=n(this.wrapper.parentNode).width,e=n(this.wrapper.parentNode).height;let i=this.calculateDims(t,e);window.location===window.parent.location||this.options.makeResponsive||(i=this.responsivizeIframe(i)),this.wrapper.style.height=parseInt(i.height)+"px",this.wrapper.style.width=parseInt(i.width)+"px"},optimizeWrapper:function(e){let i=t.OPTIMIZATION_ACCEPTED;return this.imgBefore.image.naturalWidth>=e&&this.imgAfter.image.naturalWidth>=e?(this.wrapper.style.width=e+"px",i=t.OPTIMIZATION_WAS_CONSTRAINED):this.imgAfter.image.naturalWidth<e?this.wrapper.style.width=this.imgAfter.image.naturalWidth+"px":this.wrapper.style.width=this.imgBefore.image.naturalWidth+"px",this.setWrapperDimensions(),i},_onLoaded:function(){if(this.imgBefore&&!0===this.imgBefore.loaded&&this.imgAfter&&!0===this.imgAfter.loaded){if(this.wrapper=this.element,!this.wrapper||this.wrapper.querySelector(".jx-slider"))return;i(this.wrapper,"juxtapose"),this.wrapper.style.width=this.imgBefore.image.naturalWidth,this.setWrapperDimensions(),this.slider=document.createElement("div"),this.slider.className="jx-slider",this.wrapper.appendChild(this.slider),this.sliderParentDocument=this.wrapper.ownerDocument,"horizontal"!==this.options.mode&&i(this.slider,this.options.mode),this.handle=document.createElement("div"),this.handle.className="jx-handle",this.rightImage=document.createElement("div"),this.rightImage.className="jx-image jx-right",this.rightImage.appendChild(this.imgAfter.image),this.leftImage=document.createElement("div"),this.leftImage.className="jx-image jx-left",this.leftImage.appendChild(this.imgBefore.image),this.slider.appendChild(this.handle),this.slider.appendChild(this.leftImage),this.slider.appendChild(this.rightImage),this.leftArrow=document.createElement("div"),this.rightArrow=document.createElement("div"),this.control=document.createElement("div"),this.controller=document.createElement("div"),this.leftArrow.className="jx-arrow jx-left",this.rightArrow.className="jx-arrow jx-right",this.control.className="jx-control",this.controller.className="jx-controller",this.controller.setAttribute("tabindex",0),this.controller.setAttribute("role","slider"),this.controller.setAttribute("aria-valuenow",50),this.controller.setAttribute("aria-valuemin",0),this.controller.setAttribute("aria-valuemax",100),this.controller.setAttribute("aria-label",window.imageCompareHandle?.msg||"Slide to compare images"),this.handle.appendChild(this.leftArrow),this.handle.appendChild(this.control),this.handle.appendChild(this.rightArrow),this.control.appendChild(this.controller),this._init()}},_init:function(){this.updateSlider(this.options.startingPosition,!1),!0===this.options.showLabels&&(this.imgBefore.label&&this.displayLabel(this.leftImage,this.imgBefore.label),this.imgAfter.label&&this.displayLabel(this.rightImage,this.imgAfter.label));const e=this;window.addEventListener("resize",(function(){e.setWrapperDimensions()})),this.slider.addEventListener("mousedown",(function(t){t.preventDefault(),e.updateSlider(t,!0);let i=!0;this.addEventListener("mousemove",(function(t){t.preventDefault(),i&&e.updateSlider(t,!1)})),this.addEventListener("mouseup",(function(t){t.preventDefault(),t.stopPropagation(),i=!1}))})),this.slider.addEventListener("touchstart",(function(t){t.preventDefault(),t.stopPropagation(),e.updateSlider(t,!0),this.addEventListener("touchmove",(function(t){t.preventDefault(),t.stopPropagation(),e.updateSlider(t,!1)}))})),this.handle.addEventListener("keydown",(function(t){const i=t.which||t.keyCode;let s=parseFloat(this.style.left);if(37===i){s-=1;const t=parseFloat(this.style.left)-1;e.updateSlider(t,!1),e.controller.setAttribute("aria-valuenow",s)}if(39===i){s+=1;const t=parseFloat(this.style.left)+1;e.updateSlider(t,!1),e.controller.setAttribute("aria-valuenow",s)}})),this.leftImage.addEventListener("keydown",(function(t){const i=t.which||t.keyCode;13!==i&&32!==i||(e.updateSlider("90%",!0),e.controller.setAttribute("aria-valuenow",91))})),this.rightImage.addEventListener("keydown",(function(t){const i=t.which||t.keyCode;13!==i&&32!==i||(e.updateSlider("10%",!0),e.controller.setAttribute("aria-valuenow",10))})),t.sliders.push(this),this.options.callback&&"function"==typeof this.options.callback&&this.options.callback(this)}},t.makeSlider=function(e,s){void 0===s&&(s=t.sliders.length);const n=e,r=n.querySelectorAll("img");if(r.length<2)return;const o={};n.getAttribute("data-animate")&&(o.animate=n.getAttribute("data-animate")),n.getAttribute("data-showlabels")&&(o.showLabels=n.getAttribute("data-showlabels")),n.getAttribute("data-startingposition")&&(o.startingPosition=n.getAttribute("data-startingposition")),n.getAttribute("data-mode")&&(o.mode=n.getAttribute("data-mode")),n.getAttribute("data-makeresponsive")&&(o.mode=n.getAttribute("data-makeresponsive"));return i(e,"juxtapose-"+s),n.innerHTML?n.innerHTML="":n.innerText="",new t.JXSlider(e,[{src:r[0].src,label:r[0].getAttribute("data-label"),alt:r[0].alt},{src:r[1].src,label:r[1].getAttribute("data-label"),alt:r[1].alt}],o)},t.scanPage=function(){const e=document.querySelectorAll(".juxtapose");for(let i=0;i<e.length;i++)t.makeSlider(e[i],i)},t.JXSlider=l,window.juxtapose=t,t.scanPage()}))})()})();
Save Changes
Rename File
Rename