D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
var
/
www
/
oems
/
wp-content
/
plugins
/
wp-lightbox-2
/
js
/
dist
/
Filename :
wp-lightbox-2.min.js
back
Copy
!function e(t,i,n){function o(s,r){if(!i[s]){if(!t[s]){var g="function"==typeof require&&require;if(!r&&g)return g(s,!0);if(a)return a(s,!0);var h=new Error("Cannot find module '"+s+"'");throw h.code="MODULE_NOT_FOUND",h}var l=i[s]={exports:{}};t[s][0].call(l.exports,function(e){return o(t[s][1][e]||e)},l,l.exports,e,t,i,n)}return i[s].exports}for(var a="function"==typeof require&&require,s=0;s<n.length;s++)o(n[s]);return o}({1:[function(e,t,i){e("./lightbox")},{"./lightbox":2}],2:[function(e,t,i){const n=e("./lightbox/Lightbox");var o;(o=jQuery).fn.lightbox={},o.fn.lightbox.parseJsonData=function(e){var t=[];return o.each(e,function(){t.push(new Array(this.url,this.title))}),t},o.fn.lightbox.defaults={adminBarHeight:28,overlayOpacity:.8,borderSize:10,imageArray:new Array,activeImage:null,inprogress:!1,widthCurrent:250,heightCurrent:250,xScale:1,yScale:1,displayTitle:!0,disableNavbarLinks:!0,loopImages:!0,imageClickClose:!0,jsonData:null,jsonDataParser:null,followScroll:!1,isIE8:!1},o(document).ready(function(e){var t="object"==typeof JQLBSettings;t&&JQLBSettings.resizeSpeed&&(JQLBSettings.resizeSpeed=parseInt(JQLBSettings.resizeSpeed)),t&&JQLBSettings.marginSize&&(JQLBSettings.marginSize=parseInt(JQLBSettings.marginSize)),new n(e('a[rel^="lightbox"]'),{adminBarHeight:e("#wpadminbar").height()||0,linkTarget:t&&JQLBSettings.linkTarget.length?JQLBSettings.linkTarget:"_self",displayHelp:!(!t||!JQLBSettings.help.length),marginSize:t&&JQLBSettings.marginSize?JQLBSettings.marginSize:0,fitToScreen:!(!t||"1"!=JQLBSettings.fitToScreen),resizeSpeed:t&&JQLBSettings.resizeSpeed>=0?JQLBSettings.resizeSpeed:400,displayDownloadLink:!t||"0"!=JQLBSettings.displayDownloadLink,navbarOnTop:!t||"0"!=JQLBSettings.navbarOnTop,strings:t&&"string"==typeof JQLBSettings.help?JQLBSettings:{help:" Browse images with your keyboard: Arrows or P(revious)/N(ext) and X/C/ESC for close.",prevLinkTitle:"previous image",nextLinkTitle:"next image",prevLinkText:"« Previous",nextLinkText:"Next »",closeTitle:"close image gallery",image:"Image ",of:" of ",download:"Download"}})})},{"./lightbox/Lightbox":6}],3:[function(e,t,i){const n=window.jQuery;t.exports=class{constructor(e,t){this.config=e,this.helper=t}changeImage(e){if(0==this.config.inprogress){this.config.inprogress=!0,this.config.activeImage=e;const t=document.getElementById("loading"),i=document.getElementById("lightboxImage"),n=document.getElementById("hoverNav"),o=document.getElementById("prevLink"),a=document.getElementById("nextLink");t&&this.helper.show(t),i&&this.helper.hide(i),n&&this.helper.hide(n),o&&this.helper.hide(o),a&&this.helper.hide(a),this.doChangeImage()}}doChangeImage(){this.config.imgPreloader=new Image,this.config.imgPreloader.onload=e=>{const t=document.getElementById("lightboxImage");t&&(t.src=this.config.imageArray[this.config.activeImage][0]),this.doScale(),this.preloadNeighborImages()},this.config.imgPreloader.src=this.config.imageArray[this.config.activeImage][0]}doScale(){this.updateDetails();const e=document.getElementById("overlay");if(!e||!this.config.imgPreloader)return;var t=this.config.imgPreloader.width,i=this.config.imgPreloader.height,n=this.helper.getPageSize(),o=n.pageWindowWidth<n.pageDocumentWidth?n.pageDocumentWidth:n.pageWindowWidth;e.style.width=o+"px",e.style.height=n.pageDocumentHeight+"px";const a=document.getElementById("imageDataContainer");var s=n.viewportHeight-(a.offsetHeight+2*this.config.borderSize),r=n.pageWindowWidth-2*this.config.borderSize;if(this.config.fitToScreen){var g=s-this.config.marginSize,h=r-this.config.marginSize,l=1;i>g&&(l=g/i),t*=l,i*=l,l=1,t>h&&(l=h/t),t=Math.round(t*l),i=Math.round(i*l)}var c=this.helper.getPageScroll(),d=c.yScroll+.5*s-.5*i,m=c.xScroll;const f=document.getElementById("lightboxImage");f.style.width=t,f.style.height=i,this.resizeImageContainer(t,i,d,m)}resizeImageContainer(e,t,i,o){const a=document.getElementById("outerImageContainer"),s=document.getElementById("imageDataContainer");if(a&&s){this.config.widthCurrent=a.offsetWidth,this.config.heightCurrent=a.offsetHeight;var r=Math.max(350,e+2*(this.config.borderSize||0)),g=t+2*(this.config.borderSize||0);this.config.xScale=r/this.config.widthCurrent*100,this.config.yScale=g/this.config.heightCurrent*100,this.helper.setLightBoxPos(i,o),n("#imageDataContainer").animate({width:r},this.config.resizeSpeed,"linear"),n("#outerImageContainer").animate({width:r},this.config.resizeSpeed,"linear",e=>{n("#outerImageContainer").animate({height:g},this.config.resizeSpeed,"linear",e=>{this.showImage()})}),this.showNavigationElements(),document.getElementById("prevLink")&&(document.getElementById("prevLink").style.height=t),document.getElementById("nextLink")&&(document.getElementById("nextLink").style.height=t)}}showImage(){this.helper.show(document.getElementById("imageData")),this.helper.show(document.getElementById("caption")),this.helper.hide(document.getElementById("loading")),this.config.resizeSpeed>0?n("#lightboxImage").fadeIn("fast"):this.helper.show(document.getElementById("lightboxImage")),this.config.inprogress=!1}preloadNeighborImages(){if(this.config.loopImages&&this.config.imageArray.length>1){(new Image).src=this.config.imageArray[this.config.activeImage==this.config.imageArray.length-1?0:this.config.activeImage+1][0],(new Image).src=this.config.imageArray[0==this.config.activeImage?this.config.imageArray.length-1:this.config.activeImage-1][0]}else{if(this.config.imageArray.length-1>this.config.activeImage){(new Image).src=this.config.imageArray[this.config.activeImage+1][0]}if(this.config.activeImage>0){(new Image).src=this.config.imageArray[this.config.activeImage-1][0]}}}updateDetails(){const e=document.getElementById("numberDisplay");e&&(e.innerHTML="");const t=document.getElementById("caption");t&&(t.innerHTML="",this.helper.hide(t),this.config.imageArray[this.config.activeImage][1]&&(t.innerHTML=this.config.imageArray[this.config.activeImage][1],this.helper.show()));var i="",n="",o=this.config.imageArray.length>1?this.config.strings.image+(this.config.activeImage+1)+this.config.strings.of+this.config.imageArray.length:"",a=this.config.displayDownloadLink?'<a href="'+this.config.imageArray[this.config.activeImage][0]+'" id="downloadLink" target="'+this.config.linkTarget+'">'+this.config.strings.download+"</a>":"",s="";this.config.imageArray.length>1&&!this.config.disableNavbarLinks&&((this.config.activeImage>0||this.config.loopImages)&&(n='<a title="'+this.config.strings.prevLinkTitle+'" href="#" id="prevLinkText">'+this.config.strings.prevLinkText+"</a>"),(this.config.activeImage+1<this.config.imageArray.length||this.config.loopImages)&&(s+='<a title="'+this.config.strings.nextLinkTitle+'" href="#" id="nextLinkText">'+this.config.strings.nextLinkText+"</a>")),""!=(i=n+i+o+a+s)&&document.getElementById("numberDisplay")&&(document.getElementById("numberDisplay").innerHTML=i,this.helper.show(document.getElementById("numberDisplay")))}showNavigationElements(){const e=document.getElementById("prevLink"),t=document.getElementById("prevLinkText"),i=document.getElementById("nextLink"),n=document.getElementById("nextLinkText");this.config.imageArray.length>1&&(this.helper.show(document.getElementById("hoverNav")),this.config.loopImages?(this.helper.show(e),this.helper.show(t),this.helper.show(i),this.helper.show(n)):(0!=this.config.activeImage&&(this.helper.show(e),this.helper.show(t)),this.config.activeImage!=this.config.imageArray.length-1&&(this.helper.show(i),this.helper.show(i))))}}},{}],4:[function(e,t,i){t.exports=class{constructor(e,t){this.config=e,this.parent=t}bindNavigationButtons(e){const t=document.getElementById("prevLink"),i=document.getElementById("prevLinkText"),n=document.getElementById("nextLink"),o=document.getElementById("nextLinkText");t&&t.addEventListener("click",this.onNavigationButtonClick.bind(this,e,"prev")),i&&i.addEventListener("click",this.onNavigationButtonClick.bind(this,e,"prev")),n&&n.addEventListener("click",this.onNavigationButtonClick.bind(this,e,"next")),o&&o.addEventListener("click",this.onNavigationButtonClick.bind(this,e,"next"))}onNavigationButtonClick(e,t,i){if(i.stopPropagation(),i.preventDefault(),"prev"===t){e(0==this.config.activeImage?this.config.imageArray.length-1:this.config.activeImage-1)}if("next"===t){e(this.config.activeImage==this.config.imageArray.length-1?0:this.config.activeImage+1)}}enableKeyboardNav(e){document.addEventListener("keydown",this.keyboardAction.bind(this,e))}keyboardAction(e,t){var i=this.config,n=t.keyCode,o=String.fromCharCode(n).toLowerCase();return"x"==o||"o"==o||"c"==o||27==n?this.parent.end():"p"==o||37==n?i.loopImages?e(0==i.activeImage?i.imageArray.length-1:i.activeImage-1):0!=i.activeImage&&e(i.activeImage-1):"n"!=o&&39!=n||(this.config.loopImages?e(i.activeImage==i.imageArray.length-1?0:i.activeImage+1):i.activeImage!=i.imageArray.length-1&&e(i.activeImage+1)),!1}}},{}],5:[function(e,t,i){const n=window.jQuery;t.exports=class{constructor(e){this.config=e}hide(e){e&&(e.style.display="none")}show(e){e&&(e.style.display="block")}getPageSize(){const e=document.documentElement.scrollHeight,t=document.documentElement.scrollWidth;this.config.isIE8&&e>4096&&(e=4096);var i=document.documentElement.clientHeight-this.config.adminBarHeight;return{pageDocumentWidth:t,pageDocumentHeight:e,pageWindowWidth:document.documentElement.clientWidth,viewportHeight:i,documentScrollHeight:document.documentElement.scrollHeight}}isIE8(){var e=!1;if(document.createElement){var t=document.createElement("div");t&&t.querySelectorAll&&(t.innerHTML='<object><param name=""></object>',e=1!=t.querySelectorAll("param").length),t=null}return e}getPageScroll(){var e=0,t=0;self.pageYOffset?(t=self.pageYOffset,e=self.pageXOffset):document.documentElement&&document.documentElement.scrollTop?(t=document.documentElement.scrollTop,e=document.documentElement.scrollLeft):document.body&&(t=document.body.scrollTop,e=document.body.scrollLeft);const i=document.getElementById("wpadminbar");if(i){const e=window.getComputedStyle(i).getPropertyValue("top");this.config.adminBarHeight&&0===parseInt(e,10)&&(t+=this.config.adminBarHeight)}return{xScroll:e,yScroll:t}}setLightBoxPos(e,t){return this.config.resizeSpeed>0?(n("#lightbox").animate({top:e},250,"linear"),n("#lightbox").animate({left:t},250,"linear").show()):n("#lightbox").css({top:e+"px",left:t+"px"}).show()}}},{}],6:[function(e,t,i){const n=window.jQuery,o=e("./Helper"),a=e("./Display"),s=e("./Events");t.exports=class{constructor(e,t){this.config=n.extend({},n.fn.lightbox.defaults,t),this.helper=new o(this.config),this.display=new a(this.config,this.helper),this.events=new s(this.config,this),this.loader(e)}loader(e){for(let t=0;t<e.length;t++)e[t].addEventListener("click",this.onClick.bind(this,e[t]))}onClick(e,t){t.preventDefault(),this.initialize(),this.start(e)}escapeHTML(e){const t=document.createElement("div");return t.textContent=e,t.innerHTML}initialize(){if(window.addEventListener("orientationchange",this.resizeListener.bind(this)),window.addEventListener("resize",this.resizeListener.bind(this)),document.getElementById("overlay")&&document.getElementById("overlay").remove(),document.getElementById("lightbox")&&document.getElementById("lightbox").remove(),this.config.isIE8=this.helper.isIE8(),this.config.inprogress=!1,this.config.jsonData&&this.config.jsonData.length>0){var e=this.config.jsonDataParser?this.config.jsonDataParser:n.fn.lightbox.parseJsonData;this.config.imageArray=[],this.config.imageArray=e(this.config.jsonData)}var t,i='<div id="outerImageContainer"><div id="imageContainer"><img id="lightboxImage"><div id="hoverNav"><a href="javascript:void(0);" title="'+this.config.strings.prevLinkTitle+'" id="prevLink"></a><a href="javascript:void(0);" id="nextLink" title="'+this.config.strings.nextLinkTitle+'"></a></div><div id="loading"><a href="javascript:void(0);" id="loadingLink"><div id="jqlb_loading"></div></a></div></div></div>',o='<div id="imageDataContainer" class="clearfix"><div id="imageData"><div id="imageDetails"><span id="caption"></span><span id="numberDisplay"></span></div><div id="bottomNav">';this.config.displayHelp&&(o+='<span id="helpDisplay">'+this.config.strings.help+"</span>"),o+='<a href="javascript:void(0);" id="bottomNavClose" title="'+this.config.strings.closeTitle+'"><div id="jqlb_closelabel"></div></a></div></div></div>',this.config.navbarOnTop?(t='<div id="overlay"></div><div id="lightbox">'+o+i+"</div>",n("body").append(t),n("#imageDataContainer").addClass("ontop")):(t='<div id="overlay"></div><div id="lightbox">'+i+o+"</div>",n("body").append(t));const a=document.getElementById("overlay"),s=document.getElementById("lightbox"),r=document.getElementById("loadingLink"),g=document.getElementById("bottomNavClose"),h=document.getElementById("outerImageContainer"),l=document.getElementById("imageDataContainer");document.getElementById("lightboxImage"),document.getElementById("hoverNav");a&&(a.addEventListener("click",e=>this.end()),this.helper.hide(a)),s&&(s.addEventListener("click",e=>this.end()),this.helper.hide(s)),r&&r.addEventListener("click",e=>this.end()),g&&g.addEventListener("click",e=>this.end()),this.events.bindNavigationButtons(this.display.changeImage.bind(this.display)),this.events.enableKeyboardNav(this.display.changeImage.bind(this.display)),h&&(h.style.width=this.config.widthCurrent+"px",h.style.height=this.config.heightCurrent+"px"),l&&(l.style.width=this.config.widthCurrent+"px")}resizeListener(e){this.config.resizeTimeout&&(clearTimeout(this.config.resizeTimeout),this.config.resizeTimeout=!1),this.config.resizeTimeout=setTimeout(e=>{this.display.doScale(!1)},50)}start(e){document.querySelectorAll("select, embed, object").forEach(e=>{this.helper.hide(e)});var t=this.helper.getPageSize(),i=this.helper.getPageScroll(),o=0;const a=document.getElementById("overlay");n("#overlay").hide().css({width:t.pageDocumentWidth+"px",height:t.pageDocumentHeight+"px",opacity:this.config.overlayOpacity}).fadeIn(400),this.config.isIE8&&4096==t.pageDocumentHeight&&i.yScroll>=1e3&&(o=i.yScroll-1e3,t.documentScrollHeight-(i.yScroll+3096)<0&&(o-=i.yScroll+3096-t.documentScrollHeight),a.style.top=o+"px");let s=0;if(!this.config.jsonData)if(this.config.imageArray=[],e.rel&&""!=e.rel)document.querySelectorAll("a").forEach(t=>{if(t.href&&t.rel===e.rel){let e="",i=t.parentElement.querySelector("img:first-of-type");t.title?e=t.title:i&&(e=i.title);let n="",o="";const a=t.parentElement.parentElement.querySelector(".gallery-caption"),s=t.parentElement.querySelector(".wp-caption-text");a?(n=a.textContent,o=a.innerHTML):s&&(n=s.textContent,o=s.innerHTML),e=e.trim(),o=o.trim(),e.toLowerCase()===o.toLowerCase()&&(e=o,n="");let r="";""!=e&&(r='<span id="titleText">'+this.escapeHTML(e)+"</span>"),""!=n&&(""!=e&&(r+="<br />"),r+='<span id="captionText">'+this.escapeHTML(n)+"</span>"),this.config.imageArray.push([t.href,this.config.displayTitle?r:""])}});else{var r=e.title||e.parentElement.firstChild.title||"";console.log(e),this.config.imageArray.push([e.href,this.config.displayTitle?r:""])}if(this.config.imageArray.length>1){for(let e=0;e<this.config.imageArray.length;e++)for(let t=this.config.imageArray.length-1;t>e;t--)this.config.imageArray[e][0]==this.config.imageArray[t][0]&&this.config.imageArray.splice(t,1);for(;this.config.imageArray[s][0]!=e.href;)s++}this.helper.setLightBoxPos(i[1],i[0]),this.display.changeImage(s)}end(){document.getElementById("lightbox").remove(),n("#overlay").fadeOut(e=>{document.getElementById("overlay").remove()}),document.querySelectorAll("select, embed, object").forEach(e=>{this.helper.show(e)})}}},{"./Display":3,"./Events":4,"./Helper":5}]},{},[1]);