Changeset 2449433
- Timestamp:
- 01/03/2021 03:39:30 PM (5 years ago)
- Location:
- wp-lightbox-2/trunk
- Files:
-
- 9 edited
-
js/dist/wp-lightbox-2.js (modified) (8 diffs)
-
js/dist/wp-lightbox-2.min.js (modified) (1 diff)
-
js/src/lightbox/Display.js (modified) (5 diffs)
-
js/src/lightbox/Helper.js (modified) (2 diffs)
-
js/src/lightbox/Lightbox.js (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
styles/lightbox.css (modified) (1 diff)
-
styles/lightbox.min.css (modified) (1 diff)
-
wp-lightbox-2.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wp-lightbox-2/trunk/js/dist/wp-lightbox-2.js
r2415431 r2449433 114 114 } 115 115 this.doScale(); // once image is preloaded, resize image container 116 this.preloadNeighborImages(); 116 this.preloadNeighborImages(); 117 117 }; 118 118 this.config.imgPreloader.src = this.config.imageArray[this.config.activeImage][0]; … … 120 120 121 121 doScale() { 122 this.updateDetails(); //Kevin: moved updateDetails() here, seems to work fine. 122 123 const overlay = document.getElementById('overlay'); 123 124 if (!overlay || !this.config.imgPreloader) { … … 127 128 var newHeight = this.config.imgPreloader.height; 128 129 var arrayPageSize = this.helper.getPageSize(); 129 var noScrollWidth = (arrayPageSize [2] < arrayPageSize[0]) ? arrayPageSize[0] : arrayPageSize[2]; //if viewport is smaller than page, use page width.130 var noScrollWidth = (arrayPageSize.pageWindowWidth < arrayPageSize.pageDocumentWidth) ? arrayPageSize.pageDocumentWidth : arrayPageSize.pageWindowWidth; //if viewport is smaller than page, use page width. 130 131 overlay.style.width = noScrollWidth + 'px'; 131 overlay.style.height = arrayPageSize [1]+ 'px';132 overlay.style.height = arrayPageSize.pageDocumentHeight + 'px'; 132 133 const imageDataContainer = document.getElementById('imageDataContainer'); 133 var maxHeight = (arrayPageSize [3]) - (imageDataContainer.style.height + (2 * this.config.borderSize));134 var maxWidth = (arrayPageSize [2]) - (2 * this.config.borderSize);134 var maxHeight = (arrayPageSize.viewportHeight) - (imageDataContainer.offsetHeight + (2 * this.config.borderSize)); 135 var maxWidth = (arrayPageSize.pageWindowWidth) - (2 * this.config.borderSize); 135 136 if (this.config.fitToScreen) { 136 137 var displayHeight = maxHeight - this.config.marginSize; … … 150 151 } 151 152 var arrayPageScroll = this.helper.getPageScroll(); 152 var centerY = arrayPageScroll [1]+ (maxHeight * 0.5);153 var centerY = arrayPageScroll.yScroll + (maxHeight * 0.5); 153 154 var newTop = centerY - newHeight * 0.5; 154 var newLeft = arrayPageScroll [0];155 var newLeft = arrayPageScroll.xScroll; 155 156 const lightbox = document.getElementById('lightboxImage'); 156 157 lightbox.style.width = newWidth; … … 173 174 this.config.yScale = (heightNew / this.config.heightCurrent) * 100; 174 175 this.helper.setLightBoxPos(lightboxTop, lightboxLeft); 175 this.updateDetails(); //toyNN: moved updateDetails() here, seems to work fine.176 177 176 178 177 $('#imageDataContainer').animate({ width: widthNew }, this.config.resizeSpeed, 'linear'); … … 390 389 var viewportHeight = document.documentElement.clientHeight - this.config.adminBarHeight; 391 390 var pageWindowWidth = document.documentElement.clientWidth; 392 const pageSize = [393 pageDocumentWidth ,394 pageDocumentHeight ,395 pageWindowWidth ,396 viewportHeight ,397 document .documentElement.scrollHeight398 ];391 const pageSize = { 392 pageDocumentWidth: pageDocumentWidth, 393 pageDocumentHeight: pageDocumentHeight, 394 pageWindowWidth: pageWindowWidth, 395 viewportHeight: viewportHeight, 396 documentScrollHeight: document.documentElement.scrollHeight 397 }; 399 398 return pageSize; 400 399 }; … … 431 430 } 432 431 } 433 return [xScroll, yScroll];432 return {xScroll, yScroll}; 434 433 }; 435 434 setLightBoxPos(newTop, newLeft) { … … 563 562 var newTop = 0; 564 563 const overlay = document.getElementById("overlay"); 565 $("#overlay").hide().css({ width: arrayPageSize [0] + 'px', height: arrayPageSize[1]+ 'px', opacity: this.config.overlayOpacity }).fadeIn(400);566 if (this.config.isIE8 && arrayPageSize [1]== 4096) {567 if (arrayPagePos [1]>= 1000) {568 newTop = arrayPagePos [1]- 1000;569 if ((arrayPageSize [4] - (arrayPagePos[1]+ 3096)) < 0) {570 newTop -= (arrayPagePos [1] + 3096) - arrayPageSize[4];564 $("#overlay").hide().css({ width: arrayPageSize.pageDocumentWidth + 'px', height: arrayPageSize.pageDocumentHeight + 'px', opacity: this.config.overlayOpacity }).fadeIn(400); 565 if (this.config.isIE8 && arrayPageSize.pageDocumentHeight == 4096) { 566 if (arrayPagePos.yScroll >= 1000) { 567 newTop = arrayPagePos.yScroll - 1000; 568 if ((arrayPageSize.documentScrollHeight - (arrayPagePos.yScroll + 3096)) < 0) { 569 newTop -= (arrayPagePos.yScroll + 3096) - arrayPageSize.documentScrollHeight; 571 570 } 572 571 overlay.style.top = newTop + 'px'; -
wp-lightbox-2/trunk/js/dist/wp-lightbox-2.min.js
r2415431 r2449433 1 "use strict";function _readOnlyError(a){throw new Error("\""+a+"\" is read-only")}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),a}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}(function(){function b(d,e,g){function a(j,i){if(!e[j]){if(!d[j]){var f="function"==typeof require&&require;if(!i&&f)return f(j,!0);if(h)return h(j,!0);var c=new Error("Cannot find module '"+j+"'");throw c.code="MODULE_NOT_FOUND",c}var k=e[j]={exports:{}};d[j][0].call(k.exports,function(b){var c=d[j][1][b];return a(c||b)},k,k.exports,b,d,e,g)}return e[j].exports}for(var h="function"==typeof require&&require,c=0;c<g.length;c++)a(g[c]);return a}return b})()({1:[function(a){a("./lightbox")},{"./lightbox":2}],2:[function(a){var b=a("./lightbox/Lightbox");(function(a){a.fn.lightbox={},a.fn.lightbox.parseJsonData=function(b){var c=[];return a.each(b,function(){c.push([this.url,this.title])}),c},a.fn.lightbox.defaults={adminBarHeight:28,overlayOpacity:.8,borderSize:10,imageArray:[],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},a(document).ready(function(a){var c="object"==("undefined"==typeof JQLBSettings?"undefined":_typeof(JQLBSettings));c&&JQLBSettings.resizeSpeed&&(JQLBSettings.resizeSpeed=parseInt(JQLBSettings.resizeSpeed)),c&&JQLBSettings.marginSize&&(JQLBSettings.marginSize=parseInt(JQLBSettings.marginSize));new b(a("a[rel^=\"lightbox\"]"),{adminBarHeight:a("#wpadminbar").height()||0,linkTarget:c&&JQLBSettings.linkTarget.length?JQLBSettings.linkTarget:"_self",displayHelp:!!(c&&JQLBSettings.help.length),marginSize:c&&JQLBSettings.marginSize?JQLBSettings.marginSize:0,fitToScreen:!!(c&&"1"==JQLBSettings.fitToScreen),resizeSpeed:c&&0<=JQLBSettings.resizeSpeed?JQLBSettings.resizeSpeed:400,displayDownloadLink:!(c&&"0"==JQLBSettings.displayDownloadLink),navbarOnTop:!(c&&"0"==JQLBSettings.navbarOnTop),strings:c&&"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"}})})})(jQuery)},{"./lightbox/Lightbox":6}],3:[function(a,b){var c=window.jQuery,d=function(){function a(b,c){_classCallCheck(this,a),this.config=b,this.helper=c}return _createClass(a,[{key:"changeImage",value:function changeImage(a){if(!1==this.config.inprogress){this.config.inprogress=!0,this.config.activeImage=a;var b=document.getElementById("loading"),c=document.getElementById("lightboxImage"),d=document.getElementById("hoverNav"),e=document.getElementById("prevLink"),f=document.getElementById("nextLink");b&&this.helper.show(b),c&&this.helper.hide(c),d&&this.helper.hide(d),e&&this.helper.hide(e),f&&this.helper.hide(f),this.doChangeImage()}}},{key:"doChangeImage",value:function doChangeImage(){var a=this;this.config.imgPreloader=new Image,this.config.imgPreloader.onload=function(){var b=document.getElementById("lightboxImage");b&&(b.src=a.config.imageArray[a.config.activeImage][0]),a.doScale(),a.preloadNeighborImages()},this.config.imgPreloader.src=this.config.imageArray[this.config.activeImage][0]}},{key:"doScale",value:function doScale(){var a=Math.round ,b=document.getElementById("overlay");if(b&&this.config.imgPreloader){var c=this.config.imgPreloader.width,d=this.config.imgPreloader.height,e=this.helper.getPageSize(),f=e[2]<e[0]?e[0]:e[2];b.style.width=f+"px",b.style.height=e[1]+"px";var g=document.getElementById("imageDataContainer"),h=e[3]-(g.style.height+2*this.config.borderSize),i=e[2]-2*this.config.borderSize;if(this.config.fitToScreen){var j=h-this.config.marginSize,k=i-this.config.marginSize,l=1;d>j&&(l=j/d),c*=l,d*=l,l=1,c>k&&(l=k/c),c=a(c*l),d=a(d*l)}var m=this.helper.getPageScroll(),n=m[1]+.5*h,o=n-.5*d,p=m[0],q=document.getElementById("lightboxImage");q.style.width=c,q.style.height=d,this.resizeImageContainer(c,d,o,p)}}},{key:"resizeImageContainer",value:function resizeImageContainer(a,b,d,e){var f=Math.max,g=this,h=document.getElementById("outerImageContainer"),i=document.getElementById("imageDataContainer");if(h&&i){this.config.widthCurrent=h.offsetWidth,this.config.heightCurrent=h.offsetHeight;var j=f(350,a+2*(this.config.borderSize||0)),k=b+2*(this.config.borderSize||0);this.config.xScale=100*(j/this.config.widthCurrent),this.config.yScale=100*(k/this.config.heightCurrent),this.helper.setLightBoxPos(d,e),this.updateDetails(),c("#imageDataContainer").animate({width:j},this.config.resizeSpeed,"linear"),c("#outerImageContainer").animate({width:j},this.config.resizeSpeed,"linear",function(){c("#outerImageContainer").animate({height:k},g.config.resizeSpeed,"linear",function(){g.showImage()})}),this.showNavigationElements(),document.getElementById("prevLink")&&(document.getElementById("prevLink").style.height=b),document.getElementById("nextLink")&&(document.getElementById("nextLink").style.height=b)}}},{key:"showImage",value:function showImage(){this.helper.show(document.getElementById("imageData")),this.helper.show(document.getElementById("caption")),this.helper.hide(document.getElementById("loading")),0<this.config.resizeSpeed?c("#lightboxImage").fadeIn("fast"):this.helper.show(document.getElementById("lightboxImage")),this.config.inprogress=!1}},{key:"preloadNeighborImages",value:function preloadNeighborImages(){if(this.config.loopImages&&1<this.config.imageArray.length){var a=new Image;a.src=this.config.imageArray[this.config.activeImage==this.config.imageArray.length-1?0:this.config.activeImage+1][0];var b=new Image;b.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){var c=new Image;c.src=this.config.imageArray[this.config.activeImage+1][0]}if(0<this.config.activeImage){var d=new Image;d.src=this.config.imageArray[this.config.activeImage-1][0]}}}},{key:"updateDetails",value:function updateDetails(){var a=document.getElementById("numberDisplay");a&&(a.innerHTML="");var b=document.getElementById("caption");b&&(b.innerHTML="",this.helper.hide(b),this.config.imageArray[this.config.activeImage][1]&&(b.innerHTML=this.config.imageArray[this.config.activeImage][1],this.helper.show()));var c="",d="",e=1<this.config.imageArray.length?this.config.strings.image+(this.config.activeImage+1)+this.config.strings.of+this.config.imageArray.length:"",f=this.config.displayDownloadLink?"<a href=\""+this.config.imageArray[this.config.activeImage][0]+"\" id=\"downloadLink\" target=\""+this.config.linkTarget+"\">"+this.config.strings.download+"</a>":"",g="";1<this.config.imageArray.length&&!this.config.disableNavbarLinks&&((0<this.config.activeImage||this.config.loopImages)&&(d="<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)&&(g+="<a title=\""+this.config.strings.nextLinkTitle+"\" href=\"#\" id=\"nextLinkText\">"+this.config.strings.nextLinkText+"</a>")),c=d+c+e+f+g,""!=c&&document.getElementById("numberDisplay")&&(document.getElementById("numberDisplay").innerHTML=c,this.helper.show(document.getElementById("numberDisplay")))}},{key:"showNavigationElements",value:function showNavigationElements(){var a=document.getElementById("prevLink"),b=document.getElementById("prevLinkText"),c=document.getElementById("nextLink"),d=document.getElementById("nextLinkText");1<this.config.imageArray.length&&(this.helper.show(document.getElementById("hoverNav")),this.config.loopImages?(this.helper.show(a),this.helper.show(b),this.helper.show(c),this.helper.show(d)):(0!=this.config.activeImage&&(this.helper.show(a),this.helper.show(b)),this.config.activeImage!=this.config.imageArray.length-1&&(this.helper.show(c),this.helper.show(c))))}}]),a}();b.exports=d},{}],4:[function(a,b){var c=function(){function a(b,c){_classCallCheck(this,a),this.config=b,this.parent=c}return _createClass(a,[{key:"bindNavigationButtons",value:function bindNavigationButtons(a){var b=document.getElementById("prevLink"),c=document.getElementById("prevLinkText"),d=document.getElementById("nextLink"),e=document.getElementById("nextLinkText");b&&b.addEventListener("click",this.onNavigationButtonClick.bind(this,a,"prev")),c&&c.addEventListener("click",this.onNavigationButtonClick.bind(this,a,"prev")),d&&d.addEventListener("click",this.onNavigationButtonClick.bind(this,a,"next")),e&&e.addEventListener("click",this.onNavigationButtonClick.bind(this,a,"next"))}},{key:"onNavigationButtonClick",value:function onNavigationButtonClick(a,b,c){if(c.stopPropagation(),c.preventDefault(),"prev"===b){var d=0==this.config.activeImage?this.config.imageArray.length-1:this.config.activeImage-1;a(d)}if("next"===b){var e=this.config.activeImage==this.config.imageArray.length-1?0:this.config.activeImage+1;a(e)}}},{key:"enableKeyboardNav",value:function enableKeyboardNav(a){document.addEventListener("keydown",this.keyboardAction.bind(this,a))}},{key:"keyboardAction",value:function keyboardAction(a,b){var c=String.fromCharCode,d=this.config,e=b.keyCode,f=c(e).toLowerCase();return"x"==f||"o"==f||"c"==f||e==27?this.parent.end():"p"==f||37==e?d.loopImages?a(0==d.activeImage?d.imageArray.length-1:d.activeImage-1):0!=d.activeImage&&a(d.activeImage-1):("n"==f||39==e)&&(this.config.loopImages?a(d.activeImage==d.imageArray.length-1?0:d.activeImage+1):d.activeImage!=d.imageArray.length-1&&a(d.activeImage+1)),!1}}]),a}();b.exports=c},{}],5:[function(a,b){var c=window.jQuery,d=function(){function a(b){_classCallCheck(this,a),this.config=b}return _createClass(a,[{key:"hide",value:function hide(a){a&&(a.style.display="none")}},{key:"show",value:function show(a){a&&(a.style.display="block")}},{key:"getPageSize",value:function getPageSize(){var a=document.documentElement.scrollHeight,b=document.documentElement.scrollWidth;this.config.isIE8&&4096<a&&(a=(_readOnlyError("pageDocumentHeight"),4096));var c=document.documentElement.clientHeight-this.config.adminBarHeight,d=document.documentElement.clientWidth,e=[b,a,d,c,document.documentElement.scrollHeight];return e}},{key:"isIE8",value:function isIE8(){var a=!1;if(document.createElement){var b=document.createElement("div");b&&b.querySelectorAll&&(b.innerHTML="<object><param name=\"\"></object>",a=1!=b.querySelectorAll("param").length),b=null}return a}},{key:"getPageScroll",value:function getPageScroll(){var a=0,b=0;self.pageYOffset?(b=self.pageYOffset,a=self.pageXOffset):document.documentElement&&document.documentElement.scrollTop?(b=document.documentElement.scrollTop,a=document.documentElement.scrollLeft):document.body&&(b=document.body.scrollTop,a=document.body.scrollLeft);var c=document.getElementById("wpadminbar");if(c){var d=window.getComputedStyle(c),e=d.getPropertyValue("top");this.config.adminBarHeight&&0===parseInt(e,10)&&(b+=this.config.adminBarHeight)}return[a,b]}},{key:"setLightBoxPos",value:function setLightBoxPos(a,b){return 0<this.config.resizeSpeed?(c("#lightbox").animate({top:a},250,"linear"),c("#lightbox").animate({left:b},250,"linear").show()):c("#lightbox").css({top:a+"px",left:b+"px"}).show()}}]),a}();b.exports=d},{}],6:[function(a,b){var c=window.jQuery,d=a("./Helper"),e=a("./Display"),f=a("./Events"),g=function(){function a(b,g){_classCallCheck(this,a),this.config=c.extend({},c.fn.lightbox.defaults,g),this.helper=new d(this.config),this.display=new e(this.config,this.helper),this.events=new f(this.config,this),this.loader(b)}return _createClass(a,[{key:"loader",value:function loader(a){for(var b=0;b<a.length;b++)a[b].addEventListener("click",this.onClick.bind(this,a[b]))}},{key:"onClick",value:function onClick(a,b){b.preventDefault(),this.initialize(),this.start(a)}},{key:"initialize",value:function initialize(){var a=this;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&&0<this.config.jsonData.length){var b=this.config.jsonDataParser?this.config.jsonDataParser:c.fn.lightbox.parseJsonData;this.config.imageArray=[],this.config.imageArray=b(this.config.jsonData)}var d="<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>",e="<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&&(e+="<span id=\"helpDisplay\">"+this.config.strings.help+"</span>"),e+="<a href=\"javascript:void(0);\" id=\"bottomNavClose\" title=\""+this.config.strings.closeTitle+"\"><div id=\"jqlb_closelabel\"></div></a></div></div></div>";var f;this.config.navbarOnTop?(f="<div id=\"overlay\"></div><div id=\"lightbox\">"+e+d+"</div>",c("body").append(f),c("#imageDataContainer").addClass("ontop")):(f="<div id=\"overlay\"></div><div id=\"lightbox\">"+d+e+"</div>",c("body").append(f));var g=document.getElementById("overlay"),h=document.getElementById("lightbox"),i=document.getElementById("loadingLink"),j=document.getElementById("bottomNavClose"),k=document.getElementById("outerImageContainer"),l=document.getElementById("imageDataContainer"),m=document.getElementById("lightboxImage"),n=document.getElementById("hoverNav");g&&(g.addEventListener("click",function(){return a.end()}),this.helper.hide(g)),h&&(h.addEventListener("click",function(){return a.end()}),this.helper.hide(h)),i&&i.addEventListener("click",function(){return a.end()}),j&&j.addEventListener("click",function(){return a.end()}),this.events.bindNavigationButtons(this.display.changeImage.bind(this.display)),this.events.enableKeyboardNav(this.display.changeImage.bind(this.display)),k&&(k.style.width=this.config.widthCurrent+"px",k.style.height=this.config.heightCurrent+"px"),l&&(l.style.width=this.config.widthCurrent+"px")}},{key:"resizeListener",value:function resizeListener(){var a=this;this.config.resizeTimeout&&(clearTimeout(this.config.resizeTimeout),this.config.resizeTimeout=!1),this.config.resizeTimeout=setTimeout(function(){a.display.doScale(!1)},50)}},{key:"start",value:function start(b){var d=this;document.querySelectorAll("select, embed, object").forEach(function(a){d.helper.hide(a)});var e=this.helper.getPageSize(),f=this.helper.getPageScroll(),g=0,h=document.getElementById("overlay");c("#overlay").hide().css({width:e[0]+"px",height:e[1]+"px",opacity:this.config.overlayOpacity}).fadeIn(400),this.config.isIE8&&4096==e[1]&&1e3<=f[1]&&(g=f[1]-1e3,0>e[4]-(f[1]+3096)&&(g-=f[1]+3096-e[4]),h.style.top=g+"px");var k=0;if(!this.config.jsonData)if(this.config.imageArray=[],!b.rel||""==b.rel){var l=b.title||b.parentElement.firstChild.title||"";console.log(b),this.config.imageArray.push([b.href,this.config.displayTitle?l:""])}else document.querySelectorAll("a").forEach(function(c){if(c.href&&c.rel===b.rel){var a="",e=c.parentElement.querySelector("img:first-of-type");c.title?a=c.title:e&&(a=e.title);var f="",g="",h=c.parentElement.parentElement.querySelector(".gallery-caption"),i=c.parentElement.querySelector(".wp-caption-text");h?(f=h.textContent,g=h.innerHTML):i&&(f=i.textContent,g=i.innerHTML),a=a.trim(),g=g.trim(),a.toLowerCase()===g.toLowerCase()&&(a=g,f="");var j="";""!=a&&(j="<span id=\"titleText\">"+a+"</span>"),""!=f&&(""!=a&&(j+="<br />"),j+="<span id=\"captionText\">"+f+"</span>"),d.config.imageArray.push([c.href,d.config.displayTitle?j:""])}});if(1<this.config.imageArray.length){for(var a=0;a<this.config.imageArray.length;a++)for(var i=this.config.imageArray.length-1;i>a;i--)this.config.imageArray[a][0]==this.config.imageArray[i][0]&&this.config.imageArray.splice(i,1);for(;this.config.imageArray[k][0]!=b.href;)k++}this.helper.setLightBoxPos(f[1],f[0]),this.display.changeImage(k)}},{key:"end",value:function end(){var a=this;document.getElementById("lightbox").remove(),c("#overlay").fadeOut(function(){document.getElementById("overlay").remove()}),document.querySelectorAll("select, embed, object").forEach(function(b){a.helper.show(b)})}}]),a}();b.exports=g},{"./Display":3,"./Events":4,"./Helper":5}]},{},[1]);1 "use strict";function _readOnlyError(a){throw new Error("\""+a+"\" is read-only")}function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),a}function _typeof(a){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(a){return typeof a}:function(a){return a&&"function"==typeof Symbol&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},_typeof(a)}(function(){function b(d,e,g){function a(j,i){if(!e[j]){if(!d[j]){var f="function"==typeof require&&require;if(!i&&f)return f(j,!0);if(h)return h(j,!0);var c=new Error("Cannot find module '"+j+"'");throw c.code="MODULE_NOT_FOUND",c}var k=e[j]={exports:{}};d[j][0].call(k.exports,function(b){var c=d[j][1][b];return a(c||b)},k,k.exports,b,d,e,g)}return e[j].exports}for(var h="function"==typeof require&&require,c=0;c<g.length;c++)a(g[c]);return a}return b})()({1:[function(a){a("./lightbox")},{"./lightbox":2}],2:[function(a){var b=a("./lightbox/Lightbox");(function(a){a.fn.lightbox={},a.fn.lightbox.parseJsonData=function(b){var c=[];return a.each(b,function(){c.push([this.url,this.title])}),c},a.fn.lightbox.defaults={adminBarHeight:28,overlayOpacity:.8,borderSize:10,imageArray:[],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},a(document).ready(function(a){var c="object"==("undefined"==typeof JQLBSettings?"undefined":_typeof(JQLBSettings));c&&JQLBSettings.resizeSpeed&&(JQLBSettings.resizeSpeed=parseInt(JQLBSettings.resizeSpeed)),c&&JQLBSettings.marginSize&&(JQLBSettings.marginSize=parseInt(JQLBSettings.marginSize));new b(a("a[rel^=\"lightbox\"]"),{adminBarHeight:a("#wpadminbar").height()||0,linkTarget:c&&JQLBSettings.linkTarget.length?JQLBSettings.linkTarget:"_self",displayHelp:!!(c&&JQLBSettings.help.length),marginSize:c&&JQLBSettings.marginSize?JQLBSettings.marginSize:0,fitToScreen:!!(c&&"1"==JQLBSettings.fitToScreen),resizeSpeed:c&&0<=JQLBSettings.resizeSpeed?JQLBSettings.resizeSpeed:400,displayDownloadLink:!(c&&"0"==JQLBSettings.displayDownloadLink),navbarOnTop:!(c&&"0"==JQLBSettings.navbarOnTop),strings:c&&"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"}})})})(jQuery)},{"./lightbox/Lightbox":6}],3:[function(a,b){var c=window.jQuery,d=function(){function a(b,c){_classCallCheck(this,a),this.config=b,this.helper=c}return _createClass(a,[{key:"changeImage",value:function changeImage(a){if(!1==this.config.inprogress){this.config.inprogress=!0,this.config.activeImage=a;var b=document.getElementById("loading"),c=document.getElementById("lightboxImage"),d=document.getElementById("hoverNav"),e=document.getElementById("prevLink"),f=document.getElementById("nextLink");b&&this.helper.show(b),c&&this.helper.hide(c),d&&this.helper.hide(d),e&&this.helper.hide(e),f&&this.helper.hide(f),this.doChangeImage()}}},{key:"doChangeImage",value:function doChangeImage(){var a=this;this.config.imgPreloader=new Image,this.config.imgPreloader.onload=function(){var b=document.getElementById("lightboxImage");b&&(b.src=a.config.imageArray[a.config.activeImage][0]),a.doScale(),a.preloadNeighborImages()},this.config.imgPreloader.src=this.config.imageArray[this.config.activeImage][0]}},{key:"doScale",value:function doScale(){var a=Math.round;this.updateDetails();var b=document.getElementById("overlay");if(b&&this.config.imgPreloader){var c=this.config.imgPreloader.width,d=this.config.imgPreloader.height,e=this.helper.getPageSize(),f=e.pageWindowWidth<e.pageDocumentWidth?e.pageDocumentWidth:e.pageWindowWidth;b.style.width=f+"px",b.style.height=e.pageDocumentHeight+"px";var g=document.getElementById("imageDataContainer"),h=e.viewportHeight-(g.offsetHeight+2*this.config.borderSize),i=e.pageWindowWidth-2*this.config.borderSize;if(this.config.fitToScreen){var j=h-this.config.marginSize,k=i-this.config.marginSize,l=1;d>j&&(l=j/d),c*=l,d*=l,l=1,c>k&&(l=k/c),c=a(c*l),d=a(d*l)}var m=this.helper.getPageScroll(),n=m.yScroll+.5*h,o=n-.5*d,p=m.xScroll,q=document.getElementById("lightboxImage");q.style.width=c,q.style.height=d,this.resizeImageContainer(c,d,o,p)}}},{key:"resizeImageContainer",value:function resizeImageContainer(a,b,d,e){var f=Math.max,g=this,h=document.getElementById("outerImageContainer"),i=document.getElementById("imageDataContainer");if(h&&i){this.config.widthCurrent=h.offsetWidth,this.config.heightCurrent=h.offsetHeight;var j=f(350,a+2*(this.config.borderSize||0)),k=b+2*(this.config.borderSize||0);this.config.xScale=100*(j/this.config.widthCurrent),this.config.yScale=100*(k/this.config.heightCurrent),this.helper.setLightBoxPos(d,e),c("#imageDataContainer").animate({width:j},this.config.resizeSpeed,"linear"),c("#outerImageContainer").animate({width:j},this.config.resizeSpeed,"linear",function(){c("#outerImageContainer").animate({height:k},g.config.resizeSpeed,"linear",function(){g.showImage()})}),this.showNavigationElements(),document.getElementById("prevLink")&&(document.getElementById("prevLink").style.height=b),document.getElementById("nextLink")&&(document.getElementById("nextLink").style.height=b)}}},{key:"showImage",value:function showImage(){this.helper.show(document.getElementById("imageData")),this.helper.show(document.getElementById("caption")),this.helper.hide(document.getElementById("loading")),0<this.config.resizeSpeed?c("#lightboxImage").fadeIn("fast"):this.helper.show(document.getElementById("lightboxImage")),this.config.inprogress=!1}},{key:"preloadNeighborImages",value:function preloadNeighborImages(){if(this.config.loopImages&&1<this.config.imageArray.length){var a=new Image;a.src=this.config.imageArray[this.config.activeImage==this.config.imageArray.length-1?0:this.config.activeImage+1][0];var b=new Image;b.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){var c=new Image;c.src=this.config.imageArray[this.config.activeImage+1][0]}if(0<this.config.activeImage){var d=new Image;d.src=this.config.imageArray[this.config.activeImage-1][0]}}}},{key:"updateDetails",value:function updateDetails(){var a=document.getElementById("numberDisplay");a&&(a.innerHTML="");var b=document.getElementById("caption");b&&(b.innerHTML="",this.helper.hide(b),this.config.imageArray[this.config.activeImage][1]&&(b.innerHTML=this.config.imageArray[this.config.activeImage][1],this.helper.show()));var c="",d="",e=1<this.config.imageArray.length?this.config.strings.image+(this.config.activeImage+1)+this.config.strings.of+this.config.imageArray.length:"",f=this.config.displayDownloadLink?"<a href=\""+this.config.imageArray[this.config.activeImage][0]+"\" id=\"downloadLink\" target=\""+this.config.linkTarget+"\">"+this.config.strings.download+"</a>":"",g="";1<this.config.imageArray.length&&!this.config.disableNavbarLinks&&((0<this.config.activeImage||this.config.loopImages)&&(d="<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)&&(g+="<a title=\""+this.config.strings.nextLinkTitle+"\" href=\"#\" id=\"nextLinkText\">"+this.config.strings.nextLinkText+"</a>")),c=d+c+e+f+g,""!=c&&document.getElementById("numberDisplay")&&(document.getElementById("numberDisplay").innerHTML=c,this.helper.show(document.getElementById("numberDisplay")))}},{key:"showNavigationElements",value:function showNavigationElements(){var a=document.getElementById("prevLink"),b=document.getElementById("prevLinkText"),c=document.getElementById("nextLink"),d=document.getElementById("nextLinkText");1<this.config.imageArray.length&&(this.helper.show(document.getElementById("hoverNav")),this.config.loopImages?(this.helper.show(a),this.helper.show(b),this.helper.show(c),this.helper.show(d)):(0!=this.config.activeImage&&(this.helper.show(a),this.helper.show(b)),this.config.activeImage!=this.config.imageArray.length-1&&(this.helper.show(c),this.helper.show(c))))}}]),a}();b.exports=d},{}],4:[function(a,b){var c=function(){function a(b,c){_classCallCheck(this,a),this.config=b,this.parent=c}return _createClass(a,[{key:"bindNavigationButtons",value:function bindNavigationButtons(a){var b=document.getElementById("prevLink"),c=document.getElementById("prevLinkText"),d=document.getElementById("nextLink"),e=document.getElementById("nextLinkText");b&&b.addEventListener("click",this.onNavigationButtonClick.bind(this,a,"prev")),c&&c.addEventListener("click",this.onNavigationButtonClick.bind(this,a,"prev")),d&&d.addEventListener("click",this.onNavigationButtonClick.bind(this,a,"next")),e&&e.addEventListener("click",this.onNavigationButtonClick.bind(this,a,"next"))}},{key:"onNavigationButtonClick",value:function onNavigationButtonClick(a,b,c){if(c.stopPropagation(),c.preventDefault(),"prev"===b){var d=0==this.config.activeImage?this.config.imageArray.length-1:this.config.activeImage-1;a(d)}if("next"===b){var e=this.config.activeImage==this.config.imageArray.length-1?0:this.config.activeImage+1;a(e)}}},{key:"enableKeyboardNav",value:function enableKeyboardNav(a){document.addEventListener("keydown",this.keyboardAction.bind(this,a))}},{key:"keyboardAction",value:function keyboardAction(a,b){var c=String.fromCharCode,d=this.config,e=b.keyCode,f=c(e).toLowerCase();return"x"==f||"o"==f||"c"==f||e==27?this.parent.end():"p"==f||37==e?d.loopImages?a(0==d.activeImage?d.imageArray.length-1:d.activeImage-1):0!=d.activeImage&&a(d.activeImage-1):("n"==f||39==e)&&(this.config.loopImages?a(d.activeImage==d.imageArray.length-1?0:d.activeImage+1):d.activeImage!=d.imageArray.length-1&&a(d.activeImage+1)),!1}}]),a}();b.exports=c},{}],5:[function(a,b){var c=window.jQuery,d=function(){function a(b){_classCallCheck(this,a),this.config=b}return _createClass(a,[{key:"hide",value:function hide(a){a&&(a.style.display="none")}},{key:"show",value:function show(a){a&&(a.style.display="block")}},{key:"getPageSize",value:function getPageSize(){var a=document.documentElement.scrollHeight,b=document.documentElement.scrollWidth;this.config.isIE8&&4096<a&&(a=(_readOnlyError("pageDocumentHeight"),4096));var c=document.documentElement.clientHeight-this.config.adminBarHeight,d=document.documentElement.clientWidth,e={pageDocumentWidth:b,pageDocumentHeight:a,pageWindowWidth:d,viewportHeight:c,documentScrollHeight:document.documentElement.scrollHeight};return e}},{key:"isIE8",value:function isIE8(){var a=!1;if(document.createElement){var b=document.createElement("div");b&&b.querySelectorAll&&(b.innerHTML="<object><param name=\"\"></object>",a=1!=b.querySelectorAll("param").length),b=null}return a}},{key:"getPageScroll",value:function getPageScroll(){var a=0,b=0;self.pageYOffset?(b=self.pageYOffset,a=self.pageXOffset):document.documentElement&&document.documentElement.scrollTop?(b=document.documentElement.scrollTop,a=document.documentElement.scrollLeft):document.body&&(b=document.body.scrollTop,a=document.body.scrollLeft);var c=document.getElementById("wpadminbar");if(c){var d=window.getComputedStyle(c),e=d.getPropertyValue("top");this.config.adminBarHeight&&0===parseInt(e,10)&&(b+=this.config.adminBarHeight)}return{xScroll:a,yScroll:b}}},{key:"setLightBoxPos",value:function setLightBoxPos(a,b){return 0<this.config.resizeSpeed?(c("#lightbox").animate({top:a},250,"linear"),c("#lightbox").animate({left:b},250,"linear").show()):c("#lightbox").css({top:a+"px",left:b+"px"}).show()}}]),a}();b.exports=d},{}],6:[function(a,b){var c=window.jQuery,d=a("./Helper"),e=a("./Display"),f=a("./Events"),g=function(){function a(b,g){_classCallCheck(this,a),this.config=c.extend({},c.fn.lightbox.defaults,g),this.helper=new d(this.config),this.display=new e(this.config,this.helper),this.events=new f(this.config,this),this.loader(b)}return _createClass(a,[{key:"loader",value:function loader(a){for(var b=0;b<a.length;b++)a[b].addEventListener("click",this.onClick.bind(this,a[b]))}},{key:"onClick",value:function onClick(a,b){b.preventDefault(),this.initialize(),this.start(a)}},{key:"initialize",value:function initialize(){var a=this;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&&0<this.config.jsonData.length){var b=this.config.jsonDataParser?this.config.jsonDataParser:c.fn.lightbox.parseJsonData;this.config.imageArray=[],this.config.imageArray=b(this.config.jsonData)}var d="<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>",e="<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&&(e+="<span id=\"helpDisplay\">"+this.config.strings.help+"</span>"),e+="<a href=\"javascript:void(0);\" id=\"bottomNavClose\" title=\""+this.config.strings.closeTitle+"\"><div id=\"jqlb_closelabel\"></div></a></div></div></div>";var f;this.config.navbarOnTop?(f="<div id=\"overlay\"></div><div id=\"lightbox\">"+e+d+"</div>",c("body").append(f),c("#imageDataContainer").addClass("ontop")):(f="<div id=\"overlay\"></div><div id=\"lightbox\">"+d+e+"</div>",c("body").append(f));var g=document.getElementById("overlay"),h=document.getElementById("lightbox"),i=document.getElementById("loadingLink"),j=document.getElementById("bottomNavClose"),k=document.getElementById("outerImageContainer"),l=document.getElementById("imageDataContainer"),m=document.getElementById("lightboxImage"),n=document.getElementById("hoverNav");g&&(g.addEventListener("click",function(){return a.end()}),this.helper.hide(g)),h&&(h.addEventListener("click",function(){return a.end()}),this.helper.hide(h)),i&&i.addEventListener("click",function(){return a.end()}),j&&j.addEventListener("click",function(){return a.end()}),this.events.bindNavigationButtons(this.display.changeImage.bind(this.display)),this.events.enableKeyboardNav(this.display.changeImage.bind(this.display)),k&&(k.style.width=this.config.widthCurrent+"px",k.style.height=this.config.heightCurrent+"px"),l&&(l.style.width=this.config.widthCurrent+"px")}},{key:"resizeListener",value:function resizeListener(){var a=this;this.config.resizeTimeout&&(clearTimeout(this.config.resizeTimeout),this.config.resizeTimeout=!1),this.config.resizeTimeout=setTimeout(function(){a.display.doScale(!1)},50)}},{key:"start",value:function start(b){var d=this;document.querySelectorAll("select, embed, object").forEach(function(a){d.helper.hide(a)});var e=this.helper.getPageSize(),f=this.helper.getPageScroll(),g=0,h=document.getElementById("overlay");c("#overlay").hide().css({width:e.pageDocumentWidth+"px",height:e.pageDocumentHeight+"px",opacity:this.config.overlayOpacity}).fadeIn(400),this.config.isIE8&&4096==e.pageDocumentHeight&&1e3<=f.yScroll&&(g=f.yScroll-1e3,0>e.documentScrollHeight-(f.yScroll+3096)&&(g-=f.yScroll+3096-e.documentScrollHeight),h.style.top=g+"px");var k=0;if(!this.config.jsonData)if(this.config.imageArray=[],!b.rel||""==b.rel){var l=b.title||b.parentElement.firstChild.title||"";console.log(b),this.config.imageArray.push([b.href,this.config.displayTitle?l:""])}else document.querySelectorAll("a").forEach(function(c){if(c.href&&c.rel===b.rel){var a="",e=c.parentElement.querySelector("img:first-of-type");c.title?a=c.title:e&&(a=e.title);var f="",g="",h=c.parentElement.parentElement.querySelector(".gallery-caption"),i=c.parentElement.querySelector(".wp-caption-text");h?(f=h.textContent,g=h.innerHTML):i&&(f=i.textContent,g=i.innerHTML),a=a.trim(),g=g.trim(),a.toLowerCase()===g.toLowerCase()&&(a=g,f="");var j="";""!=a&&(j="<span id=\"titleText\">"+a+"</span>"),""!=f&&(""!=a&&(j+="<br />"),j+="<span id=\"captionText\">"+f+"</span>"),d.config.imageArray.push([c.href,d.config.displayTitle?j:""])}});if(1<this.config.imageArray.length){for(var a=0;a<this.config.imageArray.length;a++)for(var i=this.config.imageArray.length-1;i>a;i--)this.config.imageArray[a][0]==this.config.imageArray[i][0]&&this.config.imageArray.splice(i,1);for(;this.config.imageArray[k][0]!=b.href;)k++}this.helper.setLightBoxPos(f[1],f[0]),this.display.changeImage(k)}},{key:"end",value:function end(){var a=this;document.getElementById("lightbox").remove(),c("#overlay").fadeOut(function(){document.getElementById("overlay").remove()}),document.querySelectorAll("select, embed, object").forEach(function(b){a.helper.show(b)})}}]),a}();b.exports=g},{"./Display":3,"./Events":4,"./Helper":5}]},{},[1]); -
wp-lightbox-2/trunk/js/src/lightbox/Display.js
r2392340 r2449433 45 45 } 46 46 this.doScale(); // once image is preloaded, resize image container 47 this.preloadNeighborImages(); 47 this.preloadNeighborImages(); 48 48 }; 49 49 this.config.imgPreloader.src = this.config.imageArray[this.config.activeImage][0]; … … 51 51 52 52 doScale() { 53 this.updateDetails(); //Kevin: moved updateDetails() here, seems to work fine. 53 54 const overlay = document.getElementById('overlay'); 54 55 if (!overlay || !this.config.imgPreloader) { … … 58 59 var newHeight = this.config.imgPreloader.height; 59 60 var arrayPageSize = this.helper.getPageSize(); 60 var noScrollWidth = (arrayPageSize [2] < arrayPageSize[0]) ? arrayPageSize[0] : arrayPageSize[2]; //if viewport is smaller than page, use page width.61 var noScrollWidth = (arrayPageSize.pageWindowWidth < arrayPageSize.pageDocumentWidth) ? arrayPageSize.pageDocumentWidth : arrayPageSize.pageWindowWidth; //if viewport is smaller than page, use page width. 61 62 overlay.style.width = noScrollWidth + 'px'; 62 overlay.style.height = arrayPageSize [1]+ 'px';63 overlay.style.height = arrayPageSize.pageDocumentHeight + 'px'; 63 64 const imageDataContainer = document.getElementById('imageDataContainer'); 64 var maxHeight = (arrayPageSize [3]) - (imageDataContainer.style.height + (2 * this.config.borderSize));65 var maxWidth = (arrayPageSize [2]) - (2 * this.config.borderSize);65 var maxHeight = (arrayPageSize.viewportHeight) - (imageDataContainer.offsetHeight + (2 * this.config.borderSize)); 66 var maxWidth = (arrayPageSize.pageWindowWidth) - (2 * this.config.borderSize); 66 67 if (this.config.fitToScreen) { 67 68 var displayHeight = maxHeight - this.config.marginSize; … … 81 82 } 82 83 var arrayPageScroll = this.helper.getPageScroll(); 83 var centerY = arrayPageScroll [1]+ (maxHeight * 0.5);84 var centerY = arrayPageScroll.yScroll + (maxHeight * 0.5); 84 85 var newTop = centerY - newHeight * 0.5; 85 var newLeft = arrayPageScroll [0];86 var newLeft = arrayPageScroll.xScroll; 86 87 const lightbox = document.getElementById('lightboxImage'); 87 88 lightbox.style.width = newWidth; … … 104 105 this.config.yScale = (heightNew / this.config.heightCurrent) * 100; 105 106 this.helper.setLightBoxPos(lightboxTop, lightboxLeft); 106 this.updateDetails(); //toyNN: moved updateDetails() here, seems to work fine.107 108 107 109 108 $('#imageDataContainer').animate({ width: widthNew }, this.config.resizeSpeed, 'linear'); -
wp-lightbox-2/trunk/js/src/lightbox/Helper.js
r2392340 r2449433 23 23 var viewportHeight = document.documentElement.clientHeight - this.config.adminBarHeight; 24 24 var pageWindowWidth = document.documentElement.clientWidth; 25 const pageSize = [26 pageDocumentWidth ,27 pageDocumentHeight ,28 pageWindowWidth ,29 viewportHeight ,30 document .documentElement.scrollHeight31 ];25 const pageSize = { 26 pageDocumentWidth: pageDocumentWidth, 27 pageDocumentHeight: pageDocumentHeight, 28 pageWindowWidth: pageWindowWidth, 29 viewportHeight: viewportHeight, 30 documentScrollHeight: document.documentElement.scrollHeight 31 }; 32 32 return pageSize; 33 33 }; … … 64 64 } 65 65 } 66 return [xScroll, yScroll];66 return {xScroll, yScroll}; 67 67 }; 68 68 setLightBoxPos(newTop, newLeft) { -
wp-lightbox-2/trunk/js/src/lightbox/Lightbox.js
r2415431 r2449433 118 118 var newTop = 0; 119 119 const overlay = document.getElementById("overlay"); 120 $("#overlay").hide().css({ width: arrayPageSize [0] + 'px', height: arrayPageSize[1]+ 'px', opacity: this.config.overlayOpacity }).fadeIn(400);121 if (this.config.isIE8 && arrayPageSize [1]== 4096) {122 if (arrayPagePos [1]>= 1000) {123 newTop = arrayPagePos [1]- 1000;124 if ((arrayPageSize [4] - (arrayPagePos[1]+ 3096)) < 0) {125 newTop -= (arrayPagePos [1] + 3096) - arrayPageSize[4];120 $("#overlay").hide().css({ width: arrayPageSize.pageDocumentWidth + 'px', height: arrayPageSize.pageDocumentHeight + 'px', opacity: this.config.overlayOpacity }).fadeIn(400); 121 if (this.config.isIE8 && arrayPageSize.pageDocumentHeight == 4096) { 122 if (arrayPagePos.yScroll >= 1000) { 123 newTop = arrayPagePos.yScroll - 1000; 124 if ((arrayPageSize.documentScrollHeight - (arrayPagePos.yScroll + 3096)) < 0) { 125 newTop -= (arrayPagePos.yScroll + 3096) - arrayPageSize.documentScrollHeight; 126 126 } 127 127 overlay.style.top = newTop + 'px'; -
wp-lightbox-2/trunk/readme.txt
r2415431 r2449433 5 5 Tags: lightbox, image, gallery, photo gallery, lightbox popup, responsive lightbox, wordpress lightbox, lightbox gallery, gallery lightbox, wordpress image lightbox, image lightbox, popup lightbox, wordpress slideshow lightbox, lightbox image, popup images, popup image, wordpress video gallery lightbox, google map lightbox popup, swipe, google map lightbox, popup bar, popup block 6 6 Requires at least: 3.0 7 Tested up to: 5. 57 Tested up to: 5.6 8 8 Stable tag: trunk 9 9 License: GPLv2 or later … … 95 95 96 96 == Changelog == 97 98 = 3.0.6.5 = 99 * Compatible Lightbox with wordpress 5.6. 100 * Fix: Fit to screen bug has been resolved 101 * Fix: Close button not shown bug has been resolved 97 102 98 103 = 3.0.6.4 = -
wp-lightbox-2/trunk/styles/lightbox.css
r1093840 r2449433 108 108 #imageData #caption{ font-weight: bold; } 109 109 #imageData #numberDisplay{ display: block; clear: left; padding-bottom: 1.0em; } 110 #imageData #bottomNavClose{ float: right; padding-bottom: 0.7em; }110 #imageData #bottomNavClose{ width: 66px; float: right; padding-bottom: 0.7em; } 111 111 #imageData #helpDisplay {clear: left; float: left; display: block; } 112 112 -
wp-lightbox-2/trunk/styles/lightbox.min.css
r1093840 r2449433 108 108 #imageData #caption{ font-weight: bold; } 109 109 #imageData #numberDisplay{ display: block; clear: left; padding-bottom: 1.0em; } 110 #imageData #bottomNavClose{ float: right; padding-bottom: 0.7em; }110 #imageData #bottomNavClose{ width: 66px; float: right; padding-bottom: 0.7em; } 111 111 #imageData #helpDisplay {clear: left; float: left; display: block; } 112 112 -
wp-lightbox-2/trunk/wp-lightbox-2.php
r2415431 r2449433 4 4 * Plugin URI: http://wpdevart.com/wordpress-lightbox-plugin 5 5 * Description: WP Lightbox 2 is awesome tool for adding responsive lightbox (overlay) effect for images and also create lightbox for photo albums/galleries on your WordPress blog. WordPress Lightbox is one of the most useful plugins for your website. 6 * Version: 3.0.6. 46 * Version: 3.0.6.5 7 7 * Author:Syed Balkhi 8 8 * Author URI: http://syedbalkhi.com
Note: See TracChangeset
for help on using the changeset viewer.