1(function () { 2 "use strict"; 3 4 var defaults = { 5 mode: "lg-slide", 6 7 // Ex : 'ease' 8 cssEasing: "ease", 9 10 //'for jquery animation' 11 easing: "linear", 12 speed: 600, 13 height: "100%", 14 width: "70%", 15 addClass: "", 16 startClass: "lg-start-zoom", 17 backdropDuration: 150, 18 hideBarsDelay: 6000, 19 20 originalAdInFullGallery: null, 21 adInFullGallery: null, 22 numberOfAds: 0, 23 adWidth: "30%", 24 adHeight: "100%", 25 26 useLeft: false, 27 28 // aria-labelledby attribute fot gallery 29 ariaLabelledby: "", 30 31 //aria-describedby attribute for gallery 32 ariaDescribedby: "", 33 34 closable: true, 35 loop: true, 36 escKey: true, 37 keyPress: true, 38 controls: true, 39 slideEndAnimatoin: true, 40 hideControlOnEnd: false, 41 mousewheel: true, 42 43 getCaptionFromTitleOrAlt: true, 44 45 // .lg-item || '.lg-sub-html' 46 appendSubHtmlTo: ".lg-sub-html", 47 48 subHtmlSelectorRelative: false, 49 50 /** 51 * @desc number of preload slides 52 * will exicute only after the current slide is fully loaded. 53 * 54 * @ex you clicked on 4th image and if preload = 1 then 3rd slide and 5th 55 * slide will be loaded in the background after the 4th slide is fully loaded.. 56 * if preload is 2 then 2nd 3rd 5th 6th slides will be preloaded.. ... ... 57 * 58 */ 59 preload: 1, 60 showAfterLoad: true, 61 selector: "", 62 selectWithin: "", 63 nextHtml: "", 64 prevHtml: "", 65 66 // 0, 1 67 index: false, 68 69 iframeMaxWidth: "100%", 70 71 download: true, 72 counter: true, 73 appendCounterTo: ".lg-toolbar", 74 75 swipeThreshold: 50, 76 enableSwipe: true, 77 enableDrag: true, 78 79 dynamic: false, 80 dynamicEl: [], 81 galleryId: 1, 82 }; 83 84 function generateNewAdDiv(divNumId) { 85 var newAdDiv = document.createElement("div"); 86 newAdDiv.id = "div-gpt-ad-" + divNumId; 87 var script = document.createElement("script"); 88 script.id = "script-ad-" + divNumId; 89 script.innerHTML = 90 'var renderedAndRefreshed = false;\ 91 function renderThisSlot(){\ 92 var thisAdSlot = searchAdFromScriptId("script-ad-' + 93 divNumId + 94 '");\ 95 if (!thisAdSlot){\ 96 return;\ 97 }\ 98 bmwblogRenderThisAdSlot(thisAdSlot);\ 99 }\ 100 function hideThisSlot(){\ 101 var adDiv = document.getElementById("div-gpt-ad-' + 102 divNumId + 103 '");\ 104 if (adDiv){\ 105 adDiv.style.display = "none";\ 106 }\ 107 }\ 108 if (!window.bmwblogAllFetch){\ 109 window.addEventListener("allFetch", function(){\ 110 if (window.adsAllowedToLoad && window.hasGoogleAdsConsent){\ 111 renderThisSlot();\ 112 }\ 113 }, false);\ 114 }\ 115 else if (window.adsAllowedToLoad && window.hasGoogleAdsConsent){\ 116 renderThisSlot();\ 117 }\ 118 window.addEventListener("consentChanged", function(){\ 119 if (window.adsAllowedToLoad && window.hasGoogleAdsConsent){\ 120 if (!renderedAndRefreshed){\ 121 renderThisSlot();\ 122 renderedAndRefreshed = true;\ 123 }\ 124 else {\ 125 document.getElementById("div-gpt-ad-' + 126 divNumId + 127 '").style.display = "block";\ 128 }\ 129 }\ 130 else {\ 131 hideThisSlot();\ 132 }\ 133 }, false);\ 134 window.addEventListener("consentRevoked", function(){\ 135 hideThisSlot();\ 136 }, false);'; 137 newAdDiv.appendChild(script); 138 139 setTimeout(function () { 140 if (!window.bmwblogAllFetch) { 141 window.addEventListener( 142 "allFetch", 143 function () { 144 if (window.adsAllowedToLoad && window.hasGoogleAdsConsent) { 145 var thisAdSlot = searchAdFromScriptId(script.id); 146 bmwblogRenderThisAdSlot(thisAdSlot); 147 } 148 }, 149 false 150 ); 151 } else if (window.adsAllowedToLoad && window.hasGoogleAdsConsent) { 152 var thisAdSlot = searchAdFromScriptId(script.id); 153 bmwblogRenderThisAdSlot(thisAdSlot); 154 } 155 }, 700); 156 157 return newAdDiv; 158 } 159 160 function Plugin(element, options) { 161 // Current lightGallery element 162 this.el = element; 163 164 // Current jquery element 165 this.$el = $(element); 166 167 // lightGallery settings 168 this.s = $.extend({}, defaults, options); 169 170 // When using dynamic mode, ensure dynamicEl is an array 171 if ( 172 this.s.dynamic && 173 this.s.dynamicEl !== "undefined" && 174 this.s.dynamicEl.constructor === Array && 175 !this.s.dynamicEl.length 176 ) { 177 throw "When using dynamic mode, you must also define dynamicEl as an Array."; 178 } 179 180 // lightGallery modules 181 this.modules = {}; 182 183 // false when lightgallery complete first slide; 184 this.lGalleryOn = false;
185 186 this.lgBusy = false; 187 188 // Timeout function for hiding controls; 189 this.hideBartimeout = false; 190 191 // To determine browser supports for touch events; 192 this.isTouch = "ontouchstart" in document.documentElement; 193 194 // Disable hideControlOnEnd if sildeEndAnimation is true 195 if (this.s.slideEndAnimatoin) { 196 this.s.hideControlOnEnd = false; 197 } 198 199 // Gallery items 200 if (this.s.dynamic) { 201 this.$items = this.s.dynamicEl; 202 } else { 203 if (this.s.selector === "this") { 204 this.$items = this.$el; 205 } else if (this.s.selector !== "") { 206 if (this.s.selectWithin) { 207 this.$items = $(this.s.selectWithin).find(this.s.selector); 208 } else { 209 this.$items = this.$el.find($(this.s.selector)); 210 } 211 } else { 212 this.$items = this.$el.children(); 213 } 214 } 215 216 this.lastAdRefreshIndex = null; 217 this.actionsCount = 0; 218 this.adInFullGallery = null; 219 this.originalAdInFullGallery = generateNewAdDiv("1592419226573-0"); 220 var addToFirst = true; 221 222 var adCounter = 0; 223 for (var x = 0; x < this.$items.length; x++) { 224 if ((x + 1) % 5 == 0) { 225 var newAdSlot = document.createElement("div"); 226 newAdSlot.id = "bmwbl-adInFullGallery" + ++adCounter; 227 newAdSlot.className = "bmwbl-adInFullGallery"; 228 229 if (addToFirst) { 230 newAdSlot.appendChild(this.originalAdInFullGallery); 231 addToFirst = false; 232 } 233 this.numberOfAds++; 234 235 this.$items.splice(x, 0, newAdSlot); 236 237 x++; 238 239 //PLEASE DO NOT PUSH THIS TO PRODUCTION YET!!!! 240 /*var newPassiveAd = { 241 ads:{ 242 ADV_ID: { 243 blog_id: 1, 244 content: $(newAdSlot).outerHTML, 245 debugmode: false, 246 expiry_date: 0, 247 id: ADV_ID, 248 once_per_page: 0, 249 position: "", 250 privacy: { 251 ignore: false, 252 needs_consent: false 253 }, 254 title: ADV_TIT, 255 type: "plain", 256 visitors: [] 257 }, 258 elementid: [newAdSlot.id], 259 id: ADV_ID, 260 inject_before: [""], 261 placement_info: { 262 id: ADV_TIT(WITHOUT SPACES!!!!), 263 item: "ad_ADV_ID", 264 name: ADV_TIT, 265 options: { 266 lazy_load: "disabled", 267 placement_position: "center" 268 }, 269 type: "post_content" 270 }, 271 test_id: null, 272 type: "ad" 273 } 274 } 275 276 window.advads_passive_placements[ADV_TIT(WITHOUT SPACES!!!)] = newPassiveAd;*/ 277 } 278 } 279 280 // .lg-item 281 this.$slide = ""; 282 283 // .lg-outer 284 this.$outer = ""; 285 286 this.init(); 287 288 return this; 289 } 290 291 Plugin.prototype.init = function () { 292 var _this = this; 293 294 // s.preload should not be more than $item.length 295 if (_this.s.preload > _this.$items.length) { 296 _this.s.preload = _this.$items.length; 297 } 298 299 // if dynamic option is enabled execute immediately 300 var _hash = window.location.hash; 301 if (_hash.indexOf("lg=" + this.s.galleryId) > 0) { 302 _this.index = parseInt(_hash.split("&slide=")[1], 10); 303 304 $("body").addClass("lg-from-hash"); 305 if (!$("body").hasClass("lg-on")) { 306 setTimeout(function () { 307 _this.build(_this.index); 308 }); 309 310 $("body").addClass("lg-on"); 311 } 312 } 313 314 if (_this.s.dynamic) { 315 _this.$el.trigger("onBeforeOpen.lg"); 316 317 _this.index = _this.s.index || 0; 318 319 // prevent accidental double execution 320 if (!$("body").hasClass("lg-on")) { 321 setTimeout(function () { 322 _this.build(_this.index); 323 $("body").addClass("lg-on"); 324 }); 325 } 326 } else { 327 // Using different namespace for click because click event should not unbind if selector is same object('this') 328 _this.$items.on("click.lgcustom", function (event) { 329 // For IE8 330 try { 331 event.preventDefault(); 332 event.preventDefault(); 333 } catch (er) { 334 event.returnValue = false;
335 } 336 337 _this.$el.trigger("onBeforeOpen.lg"); 338 339 _this.index = _this.s.index || _this.$items.index(this); 340 341 // prevent accidental double execution 342 if (!$("body").hasClass("lg-on")) { 343 _this.build(_this.index); 344 $("body").addClass("lg-on"); 345 } 346 }); 347 } 348 }; 349 350 Plugin.prototype.build = function (index) { 351 var _this = this; 352 353 _this.structure(); 354 355 // module constructor 356 $.each($.fn.lightGallery.modules, function (key) { 357 _this.modules[key] = new $.fn.lightGallery.modules[key](_this.el); 358 }); 359 360 // initiate slide function 361 _this.slide(index, false, false, false); 362 363 if (_this.s.keyPress) { 364 _this.keyPress(); 365 } 366 367 if (_this.$items.length > 1) { 368 _this.arrow(); 369 370 setTimeout(function () { 371 _this.enableDrag(); 372 _this.enableSwipe(); 373 }, 50); 374 375 if (_this.s.mousewheel) { 376 _this.mousewheel(); 377 } 378 } else { 379 _this.$slide.on("click.lg", function () { 380 _this.$el.trigger("onSlideClick.lg"); 381 }); 382 } 383 384 _this.counter(); 385 386 _this.closeGallery(); 387 388 _this.$el.trigger("onAfterOpen.lg"); 389 390 // Hide controllers if mouse doesn't move for some period 391 _this.$outer.on("mousemove.lg click.lg touchstart.lg", function () { 392 _this.$outer.removeClass("lg-hide-items"); 393 394 clearTimeout(_this.hideBartimeout); 395 396 // Timeout will be cleared on each slide movement also 397 _this.hideBartimeout = setTimeout(function () { 398 _this.$outer.addClass("lg-hide-items"); 399 }, _this.s.hideBarsDelay); 400 }); 401 402 _this.$outer.trigger("mousemove.lg"); 403 }; 404 405 Plugin.prototype.structure = function () { 406 var list = ""; 407 var controls = ""; 408 var i = 0; 409 var subHtmlCont = ""; 410 var template; 411 var _this = this; 412 413 $("body").append('<div class="lg-backdrop"></div>'); 414 $(".lg-backdrop").css( 415 "transition-duration", 416 this.s.backdropDuration + "ms" 417 ); 418 419 // Create gallery items 420 for (i = 0; i < this.$items.length; i++) { 421 list += '<div class="lg-item"></div>'; 422 } 423 424 // Create controlls 425 if (this.s.controls && this.$items.length > 1) { 426 controls = 427 '<div class="lg-actions">' + 428 '<button aria-label="Previous slide" class="lg-prev lg-icon">' + 429 this.s.prevHtml + 430 "</button>" + 431 '<button aria-label="Next slide" class="lg-next lg-icon">' + 432 this.s.nextHtml + 433 "</button>" + 434 "</div>"; 435 } 436 437 if (this.s.appendSubHtmlTo === ".lg-sub-html") { 438 subHtmlCont = 439 '<div role="status" aria-live="polite" class="lg-sub-html"></div>'; 440 } 441 442 var ariaLabelledby = this.s.ariaLabelledby 443 ? 'aria-labelledby="' + this.s.ariaLabelledby + '"' 444 : ""; 445 var ariaDescribedby = this.s.ariaDescribedby 446 ? 'aria-describedby="' + this.s.ariaDescribedby + '"' 447 : ""; 448 449 template = 450 '<div tabindex="-1" aria-modal="true" ' + 451 ariaLabelledby + 452 " " + 453 ariaDescribedby + 454 ' role="dialog" class="lg-outer ' + 455 this.s.addClass + 456 " " + 457 this.s.startClass + 458 '">' + 459 '<div class="lg">' + 460 '<div class="lg-inner">' + 461 list + 462 "</div>" + 463 '<div class="lg-toolbar lg-group">' + 464 '<button aria-label="Close gallery" class="lg-close lg-icon"></button>' + 465 "</div>" + 466 controls + 467 subHtmlCont + 468 "</div>" + 469 '<div class="lg-galleryAdContainer" id="bmwbl-fullGalleryAdContainer" style="text-align:center;" >\ 470 <div id="div-gpt-ad-1617837670757-0">\ 471 <script id="script-ad-1617837670757-0">\ 472 var renderedAndRefreshed = false;\ 473 function renderThisSlot(){\ 474 var thisAdSlot = searchAdFromScriptId("script-ad-1617837670757-0");\ 475 if (!thisAdSlot){\ 476 return;\ 477 }\ 478 window.lateralGallerySlot = thisAdSlot;\ 479 window.lateralAdJustCreated = true;\ 480 bmwblogRenderThisAdSlot(thisAdSlot);\ 481 }\ 482 function hideThisSlot(){\ 483 var adDiv = document.getElementById("div-gpt-ad-1617837670757-0");\ 484 if (adDiv){\ 485 adDiv.style.display = "none";\ 486 }\ 487 }\ 488 if (!window.bmwblogAllFetch){\ 489 window.addEventListener("allFetch", function(){\ 490 if (window.adsAllowedToLoad && window.hasGoogleAdsConsent){\ 491 renderThisSlot();\ 492 }\ 493 }, false);\ 494 }\ 495 else if (window.adsAllowedToLoad && window.hasGoogleAdsConsent){\ 496 renderThisSlot();\ 497 }\ 498 window.addEventListener("consentChanged", function(){\ 499 if (window.adsAllowedToLoad && window.hasGoogleAdsConsent){\ 500 if (!renderedAndRefreshed){\ 501 renderThisSlot();\ 502 document.getElementById("div-gpt-ad-1617837670757-0").style.display = "block";\ 503 renderedAndRefreshed = true;\ 504 }\ 505 else {\ 506 document.getElementById("div-gpt-ad-1617837670757-0").style.display = "block";\ 507 }\ 508 }\ 509 else {\ 510 hideThisSlot();\ 511 }\ 512 }, false);\ 513 window.addEventListener("consentRevoked", function(){\ 514 hideThisSlot();\ 515 }, false);\ 516 </script>\ 517 </div>\ 518 </div>' + 519 /*'<div class="lg-galleryAdContainer" id="bmwbl-fullGalleryAdContainer"></div>' +*/ 520 "</div>"; 521 522 $("body").append(template); 523 524 setTimeout(function () { 525 if (!window.lateralGallerySlot && !window.bmwblogAllFetch) { 526 window.addEventListener( 527 "allFetch", 528 function () { 529 if (window.adsAllowedToLoad && window.hasGoogleAdsConsent) { 530 var thisAdSlot = searchAdFromScriptId("script-ad-1617837670757-0"); 531 window.lateralGallerySlot = thisAdSlot; 532 window.lateralAdJustCreated = true; 533 bmwblogRenderThisAdSlot(thisAdSlot); 534 } 535 }, 536 false 537 ); 538 } else if (window.adsAllowedToLoad && window.hasGoogleAdsConsent) { 539 var thisAdSlot = searchAdFromScriptId("script-ad-1617837670757-0"); 540 window.lateralGallerySlot = thisAdSlot; 541 window.lateralAdJustCreated = true; 542 bmwblogRenderThisAdSlot(thisAdSlot); 543 } 544 }, 700); 545 546 this.$outer = $(".lg-outer"); 547 this.$outer.focus(); 548 this.$slide = this.$outer.find(".lg-item"); 549 550 if (this.s.useLeft) { 551 this.$outer.addClass("lg-use-left"); 552 553 // Set mode lg-slide if use left is true; 554 this.s.mode = "lg-slide"; 555 } else { 556 this.$outer.addClass("lg-use-css3"); 557 } 558 559 // For fixed height gallery 560 _this.setTop(); 561 $(window).on("resize.lg orientationchange.lg", function () { 562 setTimeout(function () { 563 _this.setTop(); 564 }, 100); 565 }); 566 567 // add class lg-current to remove initial transition 568 this.$slide.eq(this.index).addClass("lg-current"); 569
570 // add Class for css support and transition mode 571 if (this.doCss()) { 572 this.$outer.addClass("lg-css3"); 573 } else { 574 this.$outer.addClass("lg-css"); 575 576 // Set speed 0 because no animation will happen if browser doesn't support css3 577 this.s.speed = 0; 578 } 579 580 this.$outer.addClass(this.s.mode); 581 582 if (this.s.enableDrag && this.$items.length > 1) { 583 this.$outer.addClass("lg-grab"); 584 } 585 586 if (this.s.showAfterLoad) { 587 this.$outer.addClass("lg-show-after-load"); 588 } 589 590 if (this.doCss()) { 591 var $inner = this.$outer.find(".lg-inner"); 592 $inner.css("transition-timing-function", this.s.cssEasing); 593 $inner.css("transition-duration", this.s.speed + "ms"); 594 } 595 596 setTimeout(function () { 597 $(".lg-backdrop").addClass("in"); 598 }); 599 600 setTimeout(function () { 601 _this.$outer.addClass("lg-visible"); 602 }, this.s.backdropDuration); 603 604 if (this.s.download) { 605 this.$outer 606 .find(".lg-toolbar") 607 .append( 608 '<a id="lg-download" aria-label="Download" target="_blank" download class="lg-download lg-icon"></a>' 609 ); 610 } 611 612 // Store the current scroll top value to scroll back after closing the gallery.. 613 this.prevScrollTop = $(window).scrollTop(); 614 }; 615 616 // For fixed height gallery 617 Plugin.prototype.setTop = function () { 618 if (this.s.height !== "100%") { 619 var wH = $(window).height(); 620 var top = (wH - parseInt(this.s.height, 10)) / 2; 621 var $lGallery = this.$outer.find(".lg"); 622 if (wH >= parseInt(this.s.height, 10)) { 623 $lGallery.css("top", top + "px"); 624 } else { 625 $lGallery.css("top", "0px"); 626 } 627 } 628 }; 629 630 // Find css3 support 631 Plugin.prototype.doCss = function () { 632 // check for css animation support 633 var support = function () { 634 var transition = [ 635 "transition", 636 "MozTransition", 637 "WebkitTransition", 638 "OTransition", 639 "msTransition", 640 "KhtmlTransition", 641 ]; 642 var root = document.documentElement; 643 var i = 0; 644 for (i = 0; i < transition.length; i++) { 645 if (transition[i] in root.style) { 646 return true; 647 } 648 } 649 }; 650 651 if (support()) { 652 return true; 653 } 654 655 return false; 656 }; 657 658 /** 659 * @desc Check the given src is video 660 * @param {String} src 661 * @return {Object} video type 662 * Ex:{ youtube : ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] } 663 */ 664 Plugin.prototype.isVideo = function (src, index) { 665 var html; 666 if (this.s.dynamic) { 667 html = this.s.dynamicEl[index].html; 668 } else { 669 html = this.$items.eq(index).attr("data-html"); 670 } 671 672 if (!src) { 673 if (html) { 674 return { 675 html5: true, 676 }; 677 } else { 678 //console.error('lightGallery :- data-src is not provided on slide item ' + (index + 1) + '. Please make sure the selector property is properly configured. More info - http://sachinchoolur.github.io/lightGallery/demos/html-markup.html'); 679 return false; 680 } 681 } 682 683 var youtube = src.match( 684 /\/\/(?:www\.)?youtu(?:\.be|be\.com|be-nocookie\.com)\/(?:watch\?v=|embed\/)?([a-z0-9\-\_\%]+)/i 685 ); 686 var vimeo = src.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i); 687 var dailymotion = src.match(/\/\/(?:www\.)?dai.ly\/([0-9a-z\-_]+)/i); 688 var vk = src.match( 689 /\/\/(?:www\.)?(?:vk\.com|vkontakte\.ru)\/(?:video_ext\.php\?)(.*)/i 690 ); 691 692 if (youtube) { 693 return { 694 youtube: youtube, 695 }; 696 } else if (vimeo) { 697 return { 698 vimeo: vimeo, 699 }; 700 } else if (dailymotion) { 701 return { 702 dailymotion: dailymotion, 703 }; 704 } else if (vk) { 705 return { 706 vk: vk, 707 }; 708 } 709 }; 710 711 /** 712 * @desc Create image counter 713 * Ex: 1/10 714 */ 715 Plugin.prototype.counter = function () { 716 if (this.s.counter) { 717 $(this.s.appendCounterTo).append( 718 '<div id="lg-counter" role="status" aria-live="polite"><span id="lg-counter-current">' + 719 (parseInt(this.index, 10) + 1) + 720 '</span> / <span id="lg-counter-all">' + 721 this.$items.length + 722 "</span></div>" 723 ); 724 } 725 }; 726 727 /** 728 * @desc add sub-html into the slide 729 * @param {Number} index - index of the slide 730 */ 731 Plugin.prototype.addHtml = function (index) { 732 var subHtml = null; 733 var subHtmlUrl; 734 var $currentEle; 735 if (this.s.dynamic) { 736 if (this.s.dynamicEl[index].subHtmlUrl) { 737 subHtmlUrl = this.s.dynamicEl[index].subHtmlUrl; 738 } else { 739 subHtml = this.s.dynamicEl[index].subHtml; 740 } 741 } else { 742 $currentEle = this.$items.eq(index); 743 if ($currentEle.attr("data-sub-html-url")) { 744 subHtmlUrl = $currentEle.attr("data-sub-html-url"); 745 } else { 746 subHtml = $currentEle.attr("data-sub-html"); 747 if (this.s.getCaptionFromTitleOrAlt && !subHtml) { 748 subHtml = 749 $currentEle.attr("title") || 750 $currentEle.find("img").first().attr("alt"); 751 } 752 } 753 } 754 755 if (!subHtmlUrl) { 756 if (typeof subHtml !== "undefined" && subHtml !== null) { 757 // get first letter of subhtml 758 // if first letter starts with . or # get the html form the jQuery object 759 var fL = subHtml.substring(0, 1); 760 if (fL === "." || fL === "#") { 761 if (this.s.subHtmlSelectorRelative && !this.s.dynamic) { 762 subHtml = $currentEle.find(subHtml).html(); 763 } else { 764 subHtml = $(subHtml).html(); 765 } 766 } 767 } else { 768 subHtml = ""; 769 } 770 } 771 772 if (this.s.appendSubHtmlTo === ".lg-sub-html") { 773 if (subHtmlUrl) { 774 this.$outer.find(this.s.appendSubHtmlTo).load(subHtmlUrl); 775 } else { 776 this.$outer.find(this.s.appendSubHtmlTo).html(subHtml); 777 } 778 } else { 779 if (subHtmlUrl) { 780 this.$slide.eq(index).load(subHtmlUrl); 781 } else { 782 this.$slide.eq(index).append(subHtml); 783 } 784 } 785 786 // Add lg-empty-html class if title doesn't exist 787 if (typeof subHtml !== "undefined" && subHtml !== null) { 788 if (subHtml === "") { 789 this.$outer.find(this.s.appendSubHtmlTo).addClass("lg-empty-html"); 790 } else { 791 this.$outer.find(this.s.appendSubHtmlTo).removeClass("lg-empty-html"); 792 } 793 } 794 795 this.$el.trigger("onAfterAppendSubHtml.lg", [index]); 796 }; 797 798 /** 799 * @desc Preload slides 800 * @param {Number} index - index of the slide 801 */ 802 Plugin.prototype.preload = function (index) { 803 var i = 1; 804 var j = 1; 805 for (i = 1; i <= this.s.preload; i++) { 806 if (i >= this.$items.length - index) { 807 break; 808 } 809 810 this.loadContent(index + i, false, 0); 811 } 812 813 for (j = 1; j <= this.s.preload; j++) { 814 if (index - j < 0) { 815 break; 816 } 817 818 this.loadContent(index - j, false, 0, true); 819 } 820 }; 821 822 /**
823 * @desc Load slide content into slide. 824 * @param {Number} index - index of the slide. 825 * @param {Boolean} rec - if true call loadcontent() function again. 826 * @param {Boolean} delay - delay for adding complete class. it is 0 except first time. 827 * @param {Boolean} comesFromPreload - true if this comes from preload. Used to filter true actions that cause a load from foreshadow loadings 828 */ 829 Plugin.prototype.loadContent = function ( 830 index, 831 rec, 832 delay, 833 comesFromPreload 834 ) { 835 if (typeof comesFromPreload === "undefined") { 836 comesFromPreload = false; 837 } 838 839 var _this = this; 840 var _hasPoster = false; 841 var _$img; 842 var _src; 843 var _poster; 844 var _srcset; 845 var _sizes; 846 var _html; 847 var _alt; 848 var _adText = ""; 849 var _isAd = false; 850 var getResponsiveSrc = function (srcItms) { 851 var rsWidth = []; 852 var rsSrc = []; 853 for (var i = 0; i < srcItms.length; i++) { 854 var __src = srcItms[i].split(" "); 855 856 // Manage empty space 857 if (__src[0] === "") { 858 __src.splice(0, 1); 859 } 860 861 rsSrc.push(__src[0]); 862 rsWidth.push(__src[1]); 863 } 864 865 var wWidth = $(window).width(); 866 for (var j = 0; j < rsWidth.length; j++) { 867 if (parseInt(rsWidth[j], 10) > wWidth) { 868 _src = rsSrc[j]; 869 break; 870 } 871 } 872 }; 873 874 if (_this.s.dynamic) { 875 if (_this.s.dynamicEl[index].poster) { 876 _hasPoster = true; 877 _poster = _this.s.dynamicEl[index].poster; 878 } 879 880 _html = _this.s.dynamicEl[index].html; 881 _src = _this.s.dynamicEl[index].src; 882 _alt = _this.s.dynamicEl[index].alt; 883 884 if (_this.s.dynamicEl[index].responsive) { 885 var srcDyItms = _this.s.dynamicEl[index].responsive.split(","); 886 getResponsiveSrc(srcDyItms); 887 } 888 889 _srcset = _this.s.dynamicEl[index].srcset; 890 _sizes = _this.s.dynamicEl[index].sizes; 891 } else { 892 var $currentEle = _this.$items.eq(index); 893 if ($currentEle.attr("data-poster")) { 894 _hasPoster = true; 895 _poster = $currentEle.attr("data-poster"); 896 } 897 898 _html = $currentEle.attr("data-html"); 899 _isAd = $currentEle.hasClass("bmwbl-adInFullGallery"); 900 if (_isAd) _adText = $currentEle.text(); 901 _src = $currentEle.attr("href") || $currentEle.attr("data-src"); 902 _alt = 903 $currentEle.attr("title") || 904 $currentEle.find("img").first().attr("alt"); 905 906 if ($currentEle.attr("data-responsive")) { 907 var srcItms = $currentEle.attr("data-responsive").split(","); 908 getResponsiveSrc(srcItms); 909 } 910 911 _srcset = $currentEle.attr("data-srcset"); 912 _sizes = $currentEle.attr("data-sizes"); 913 } 914 915 //if (_src || _srcset || _sizes || _poster) { 916 917 var iframe = false; 918 if (_this.s.dynamic) { 919 if (_this.s.dynamicEl[index].iframe) { 920 iframe = true; 921 } 922 } else { 923 if (_this.$items.eq(index).attr("data-iframe") === "true") { 924 iframe = true; 925 } 926 } 927 928 var _isVideo = false; 929 930 if (!_isAd) _isVideo = _this.isVideo(_src, index); 931 else if (!comesFromPreload && index != this.lastAdRefreshIndex) { 932 this.lastAdRefreshIndex = index; 933 this.actionsCount++; 934 if ( 935 window.lateralAdJustCreated || 936 this.actionsCount == 6 || 937 (this.actionsCount > 6 && this.actionsCount % 4 == 0) 938 ) { 939 if ( 940 window.adsAllowedToLoad && 941 window.hasGoogleAdsConsent && 942 typeof googletag !== "undefined" && 943 window.lateralGallerySlot && 944 window.lateralGallerySlot.slot 945 ) { 946 googletag.cmd.push(function () { 947 googletag.pubads().refresh([window.lateralGallerySlot.slot]); 948 googletag.display(window.lateralGallerySlot.divId); 949 }); 950 } 951 } 952 } 953 if (!_this.$slide.eq(index).hasClass("lg-loaded") || _isAd) { 954 if (iframe) { 955 _this.$slide 956 .eq(index) 957 .prepend( 958 '<div class="lg-video-cont lg-has-iframe" style="max-width:' + 959 _this.s.iframeMaxWidth + 960 '"><div class="lg-video"><iframe class="lg-object" frameborder="0" src="' + 961 _src + 962 '" allowfullscreen="true"></iframe></div></div>' 963 ); 964 } else if (_hasPoster) { 965 var videoClass = ""; 966 if (_isVideo && _isVideo.youtube) { 967 videoClass = "lg-has-youtube"; 968 } else if (_isVideo && _isVideo.vimeo) { 969 videoClass = "lg-has-vimeo"; 970 } else { 971 videoClass = "lg-has-html5"; 972 } 973 974 _this.$slide 975 .eq(index) 976 .prepend( 977 '<div class="lg-video-cont ' + 978 videoClass + 979 ' "><div class="lg-video"><span class="lg-video-play"></span><img class="lg-object lg-has-poster" src="' + 980 _poster + 981 '" /></div></div>' 982 ); 983 } else if (_isAd) { 984 if ( 985 $(_this.$slide.eq(index)).find("#div-gpt-ad-1592419226573-0") 986 .length == 0 987 ) { 988 $("#" + this.originalAdInFullGallery.id).remove(); 989 _this.$slide 990 .eq(index) 991 .prepend( 992 '<div id="bmwbl-adInFullGallery' + 993 Math.round(index / 5) + 994 '" class="bmwbl-adInFullGallery">' + 995 (this.adInFullGallery == null 996 ? this.originalAdInFullGallery.outerHTML 997 : this.adInFullGallery.outerHTML) + 998 "</div>" 999 ); 1000 $("#" + "bmwbl-adInFullGallery" + Math.round(index / 5)) 1001 .parent() 1002 .addClass("lg-item-adslot"); 1003 1004 if ( 1005 this.adInFullGallery == null && 1006 window.adsAllowedToLoad && 1007 window.hasGoogleAdsConsent && 1008 typeof googletag !== "undefined" 1009 ) { 1010 googletag.cmd.push(function () { 1011 var thisAd = searchAdFromScriptId( 1012 "script-ad-" + "1592419226573-0" 1013 ); 1014 if (!thisAd) { 1015 return; 1016 } 1017 googletag.display(thisAd.divId); 1018 googletag.pubads().refresh([thisAd.slot]); 1019 this.adInFullGallery = document.getElementById( 1020 "div-gpt-ad-1592419226573-0" 1021 ); 1022 }); 1023 } 1024 } 1025 1026 //document.getElementById("bmwbl-adInFullGallery" + (index % 4 + 1)).appendChild(this.adInFullGallery); 1027 } else if (_isVideo) { 1028 _this.$slide 1029 .eq(index) 1030 .prepend( 1031 '<div class="lg-video-cont "><div class="lg-video"></div></div>' 1032 ); 1033 _this.$el.trigger("hasVideo.lg", [index, _src, _html]); 1034 } else { 1035 _alt = _alt ? 'alt="' + _alt + '"' : ""; 1036 _this.$slide 1037 .eq(index) 1038 .prepend( 1039 '<div class="lg-img-wrap"><img class="lg-object lg-image" ' + 1040 _alt + 1041 ' src="' + 1042 _src + 1043 '" /></div>' 1044 ); 1045 } 1046 1047 _this.$el.trigger("onAferAppendSlide.lg", [index]); 1048 1049 _$img = _this.$slide.eq(index).find(".lg-object"); 1050 if (_sizes) { 1051 _$img.attr("sizes", _sizes); 1052 } 1053 1054 if (_srcset) { 1055 _$img.attr("srcset", _srcset); 1056 try { 1057 picturefill({ 1058 elements: [_$img[0]], 1059 }); 1060 } catch (e) { 1061 console.warn( 1062 "lightGallery :- If you want srcset to be supported for older browser please include picturefil version 2 javascript library in your document." 1063 ); 1064 } 1065 } 1066 1067 if (this.s.appendSubHtmlTo !== ".lg-sub-html") { 1068 _this.addHtml(index); 1069 } 1070 1071 _this.$slide.eq(index).addClass("lg-loaded"); 1072 } 1073 1074 _this.$slide 1075 .eq(index) 1076 .find(".lg-object") 1077 .on("load.lg error.lg", function () { 1078 // For first time add some delay for displaying the start animation. 1079 var _speed = 0; 1080
1081 // Do not change the delay value because it is required for zoom plugin. 1082 // If gallery opened from direct url (hash) speed value should be 0 1083 if (delay && !$("body").hasClass("lg-from-hash")) { 1084 _speed = delay; 1085 } 1086 1087 setTimeout(function () { 1088 _this.$slide.eq(index).addClass("lg-complete"); 1089 _this.$el.trigger("onSlideItemLoad.lg", [index, delay || 0]); 1090 }, _speed); 1091 }); 1092 1093 // @todo check load state for html5 videos 1094 if (_isVideo && _isVideo.html5 && !_hasPoster) { 1095 _this.$slide.eq(index).addClass("lg-complete"); 1096 } 1097 1098 if (rec === true) { 1099 if (!_this.$slide.eq(index).hasClass("lg-complete")) { 1100 _this.$slide 1101 .eq(index) 1102 .find(".lg-object") 1103 .on("load.lg error.lg", function () { 1104 _this.preload(index); 1105 }); 1106 } else { 1107 _this.preload(index); 1108 } 1109 } 1110 1111 //} 1112 }; 1113 1114 /** 1115 * @desc slide function for lightgallery 1116 ** Slide() gets call on start 1117 ** ** Set lg.on true once slide() function gets called. 1118 ** Call loadContent() on slide() function inside setTimeout 1119 ** ** On first slide we do not want any animation like slide of fade 1120 ** ** So on first slide( if lg.on if false that is first slide) loadContent() should start loading immediately 1121 ** ** Else loadContent() should wait for the transition to complete. 1122 ** ** So set timeout s.speed + 50 1123 <=> ** loadContent() will load slide content in to the particular slide 1124 ** ** It has recursion (rec) parameter. if rec === true loadContent() will call preload() function. 1125 ** ** preload will execute only when the previous slide is fully loaded (images iframe) 1126 ** ** avoid simultaneous image load 1127 <=> ** Preload() will check for s.preload value and call loadContent() again accoring to preload value 1128 ** loadContent() <====> Preload(); 1129 1130 * @param {Number} index - index of the slide 1131 * @param {Boolean} fromTouch - true if slide function called via touch event or mouse drag 1132 * @param {Boolean} fromThumb - true if slide function called via thumbnail click 1133 * @param {String} direction - Direction of the slide(next/prev) 1134 */ 1135 Plugin.prototype.slide = function (index, fromTouch, fromThumb, direction) { 1136 var _prevIndex = this.$outer.find(".lg-current").index(); 1137 var _this = this; 1138 1139 // Prevent if multiple call 1140 // Required for hsh plugin 1141 if (_this.lGalleryOn && _prevIndex === index) { 1142 return; 1143 } 1144 1145 var _length = this.$slide.length; 1146 var _time = _this.lGalleryOn ? this.s.speed : 0; 1147 1148 if (!_this.lgBusy) { 1149 if (this.s.download) { 1150 var _src; 1151 if (_this.s.dynamic) { 1152 _src = 1153 _this.s.dynamicEl[index].downloadUrl !== false && 1154 (_this.s.dynamicEl[index].downloadUrl || 1155 _this.s.dynamicEl[index].src); 1156 } else { 1157 _src = 1158 _this.$items.eq(index).attr("data-download-url") !== "false" && 1159 (_this.$items.eq(index).attr("data-download-url") || 1160 _this.$items.eq(index).attr("href") || 1161 _this.$items.eq(index).attr("data-src")); 1162 } 1163 1164 if (_src) { 1165 $("#lg-download").attr("href", _src); 1166 _this.$outer.removeClass("lg-hide-download"); 1167 } else { 1168 _this.$outer.addClass("lg-hide-download"); 1169 } 1170 } 1171 1172 this.$el.trigger("onBeforeSlide.lg", [ 1173 _prevIndex, 1174 index, 1175 fromTouch, 1176 fromThumb, 1177 ]); 1178 1179 _this.lgBusy = true; 1180 1181 clearTimeout(_this.hideBartimeout); 1182 1183 // Add title if this.s.appendSubHtmlTo === lg-sub-html 1184 if (this.s.appendSubHtmlTo === ".lg-sub-html") { 1185 // wait for slide animation to complete 1186 setTimeout(function () { 1187 _this.addHtml(index); 1188 }, _time); 1189 } 1190 1191 this.arrowDisable(index); 1192 1193 if (!direction) { 1194 if (index < _prevIndex) { 1195 direction = "prev"; 1196 } else if (index > _prevIndex) { 1197 direction = "next"; 1198 } 1199 } 1200 1201 if (!fromTouch) { 1202 // remove all transitions 1203 _this.$outer.addClass("lg-no-trans"); 1204 1205 this.$slide.removeClass("lg-prev-slide lg-next-slide"); 1206 1207 if (direction === "prev") { 1208 //prevslide 1209 this.$slide.eq(index).addClass("lg-prev-slide"); 1210 this.$slide.eq(_prevIndex).addClass("lg-next-slide"); 1211 } else { 1212 // next slide 1213 this.$slide.eq(index).addClass("lg-next-slide"); 1214 this.$slide.eq(_prevIndex).addClass("lg-prev-slide"); 1215 } 1216 1217 // give 50 ms for browser to add/remove class 1218 setTimeout(function () { 1219 _this.$slide.removeClass("lg-current"); 1220 1221 //_this.$slide.eq(_prevIndex).removeClass('lg-current'); 1222 _this.$slide.eq(index).addClass("lg-current"); 1223 1224 // reset all transitions 1225 _this.$outer.removeClass("lg-no-trans"); 1226 }, 50); 1227 } else { 1228 this.$slide.removeClass("lg-prev-slide lg-current lg-next-slide"); 1229 var touchPrev; 1230 var touchNext; 1231 if (_length > 2) { 1232 touchPrev = index - 1; 1233 touchNext = index + 1; 1234 1235 if (index === 0 && _prevIndex === _length - 1) { 1236 // next slide 1237 touchNext = 0; 1238 touchPrev = _length - 1; 1239 } else if (index === _length - 1 && _prevIndex === 0) { 1240 // prev slide 1241 touchNext = 0; 1242 touchPrev = _length - 1; 1243 } 1244 } else { 1245 touchPrev = 0; 1246 touchNext = 1; 1247 } 1248 1249 if (direction === "prev") { 1250 _this.$slide.eq(touchNext).addClass("lg-next-slide"); 1251 } else { 1252 _this.$slide.eq(touchPrev).addClass("lg-prev-slide"); 1253 } 1254 1255 _this.$slide.eq(index).addClass("lg-current"); 1256 } 1257 1258 if (_this.lGalleryOn) { 1259 setTimeout(function () { 1260 _this.loadContent(index, true, 0); 1261 }, this.s.speed + 50); 1262 1263 setTimeout(function () { 1264 _this.lgBusy = false;
1265 _this.$el.trigger("onAfterSlide.lg", [ 1266 _prevIndex, 1267 index, 1268 fromTouch, 1269 fromThumb, 1270 ]); 1271 }, this.s.speed); 1272 } else { 1273 _this.loadContent(index, true, _this.s.backdropDuration); 1274 1275 _this.lgBusy = false; 1276 _this.$el.trigger("onAfterSlide.lg", [ 1277 _prevIndex, 1278 index, 1279 fromTouch, 1280 fromThumb, 1281 ]); 1282 } 1283 1284 _this.lGalleryOn = true; 1285 1286 if (this.s.counter) { 1287 $("#lg-counter-current").text(index + 1); 1288 } 1289 } 1290 _this.index = index; 1291 }; 1292 1293 /** 1294 * @desc Go to next slide 1295 * @param {Boolean} fromTouch - true if slide function called via touch event 1296 */ 1297 Plugin.prototype.goToNextSlide = function (fromTouch) { 1298 var _this = this; 1299 var _loop = _this.s.loop; 1300 if (fromTouch && _this.$slide.length < 3) { 1301 _loop = false; 1302 } 1303 1304 if (!_this.lgBusy) { 1305 if (_this.index + 1 < _this.$slide.length) { 1306 _this.index++; 1307 _this.$el.trigger("onBeforeNextSlide.lg", [_this.index]); 1308 _this.slide(_this.index, fromTouch, false, "next"); 1309 } else { 1310 if (_loop) { 1311 _this.index = 0; 1312 _this.$el.trigger("onBeforeNextSlide.lg", [_this.index]); 1313 _this.slide(_this.index, fromTouch, false, "next"); 1314 } else if (_this.s.slideEndAnimatoin && !fromTouch) { 1315 _this.$outer.addClass("lg-right-end"); 1316 setTimeout(function () { 1317 _this.$outer.removeClass("lg-right-end"); 1318 }, 400); 1319 } 1320 } 1321 } 1322 }; 1323 1324 /** 1325 * @desc Go to previous slide 1326 * @param {Boolean} fromTouch - true if slide function called via touch event 1327 */ 1328 Plugin.prototype.goToPrevSlide = function (fromTouch) { 1329 var _this = this; 1330 var _loop = _this.s.loop; 1331 if (fromTouch && _this.$slide.length < 3) { 1332 _loop = false; 1333 } 1334 1335 if (!_this.lgBusy) { 1336 if (_this.index > 0) { 1337 _this.index--; 1338 _this.$el.trigger("onBeforePrevSlide.lg", [_this.index, fromTouch]); 1339 _this.slide(_this.index, fromTouch, false, "prev"); 1340 } else { 1341 if (_loop) { 1342 _this.index = _this.$items.length - 1; 1343 _this.$el.trigger("onBeforePrevSlide.lg", [_this.index, fromTouch]); 1344 _this.slide(_this.index, fromTouch, false, "prev"); 1345 } else if (_this.s.slideEndAnimatoin && !fromTouch) { 1346 _this.$outer.addClass("lg-left-end"); 1347 setTimeout(function () { 1348 _this.$outer.removeClass("lg-left-end"); 1349 }, 400); 1350 } 1351 } 1352 } 1353 }; 1354 1355 Plugin.prototype.keyPress = function () { 1356 var _this = this; 1357 if (this.$items.length > 1) { 1358 $(window).on("keyup.lg", function (e) { 1359 if (_this.$items.length > 1) { 1360 if (e.keyCode === 37) { 1361 e.preventDefault(); 1362 _this.goToPrevSlide(); 1363 } 1364 1365 if (e.keyCode === 39) { 1366 e.preventDefault(); 1367 _this.goToNextSlide(); 1368 } 1369 } 1370 }); 1371 } 1372 1373 $(window).on("keydown.lg", function (e) { 1374 if (_this.s.escKey === true && e.keyCode === 27) { 1375 e.preventDefault(); 1376 if (!_this.$outer.hasClass("lg-thumb-open")) { 1377 _this.destroy(); 1378 } else { 1379 _this.$outer.removeClass("lg-thumb-open"); 1380 } 1381 } 1382 }); 1383 }; 1384 1385 Plugin.prototype.arrow = function () { 1386 var _this = this; 1387 this.$outer.find(".lg-prev").on("click.lg", function () { 1388 _this.goToPrevSlide(); 1389 }); 1390 1391 this.$outer.find(".lg-next").on("click.lg", function () { 1392 _this.goToNextSlide(); 1393 }); 1394 }; 1395 1396 Plugin.prototype.arrowDisable = function (index) { 1397 // Disable arrows if s.hideControlOnEnd is true 1398 if (!this.s.loop && this.s.hideControlOnEnd) { 1399 if (index + 1 < this.$slide.length) { 1400 this.$outer 1401 .find(".lg-next") 1402 .removeAttr("disabled") 1403 .removeClass("disabled"); 1404 } else { 1405 this.$outer 1406 .find(".lg-next") 1407 .attr("disabled", "disabled") 1408 .addClass("disabled"); 1409 } 1410 1411 if (index > 0) { 1412 this.$outer 1413 .find(".lg-prev") 1414 .removeAttr("disabled") 1415 .removeClass("disabled"); 1416 } else { 1417 this.$outer 1418 .find(".lg-prev") 1419 .attr("disabled", "disabled") 1420 .addClass("disabled"); 1421 } 1422 } 1423 }; 1424 1425 Plugin.prototype.setTranslate = function ($el, xValue, yValue) { 1426 // jQuery supports Automatic CSS prefixing since jQuery 1.8.0 1427 if (this.s.useLeft) { 1428 $el.css("left", xValue); 1429 } else { 1430 $el.css({ 1431 transform: "translate3d(" + xValue + "px, " + yValue + "px, 0px)", 1432 }); 1433 } 1434 }; 1435 1436 Plugin.prototype.touchMove = function (startCoords, endCoords) { 1437 var distance = endCoords - startCoords; 1438 1439 if (Math.abs(distance) > 15) { 1440 // reset opacity and transition duration 1441 this.$outer.addClass("lg-dragging"); 1442 1443 // move current slide 1444 this.setTranslate(this.$slide.eq(this.index), distance, 0); 1445 1446 // move next and prev slide with current slide 1447 this.setTranslate( 1448 $(".lg-prev-slide"), 1449 -this.$slide.eq(this.index).width() + distance, 1450 0 1451 ); 1452 this.setTranslate( 1453 $(".lg-next-slide"), 1454 this.$slide.eq(this.index).width() + distance, 1455 0 1456 ); 1457 } 1458 }; 1459 1460 Plugin.prototype.touchEnd = function (distance) { 1461 var _this = this; 1462 1463 // keep slide animation for any mode while dragg/swipe 1464 if (_this.s.mode !== "lg-slide") { 1465 _this.$outer.addClass("lg-slide"); 1466 } 1467 1468 this.$slide 1469 .not(".lg-current, .lg-prev-slide, .lg-next-slide") 1470 .css("opacity", "0"); 1471 1472 // set transition duration 1473 setTimeout(function () { 1474 _this.$outer.removeClass("lg-dragging"); 1475 if (distance < 0 && Math.abs(distance) > _this.s.swipeThreshold) { 1476 _this.goToNextSlide(true); 1477 } else if (distance > 0 && Math.abs(distance) > _this.s.swipeThreshold) { 1478 _this.goToPrevSlide(true); 1479 } else if (Math.abs(distance) < 5) { 1480 // Trigger click if distance is less than 5 pix 1481 _this.$el.trigger("onSlideClick.lg"); 1482 } 1483 1484 _this.$slide.removeAttr("style"); 1485 }); 1486 1487 // remove slide class once drag/swipe is completed if mode is not slide 1488 setTimeout(function () { 1489 if ( 1490 !_this.$outer.hasClass("lg-dragging") && 1491 _this.s.mode !== "lg-slide" 1492 ) { 1493 _this.$outer.removeClass("lg-slide"); 1494 } 1495 }, _this.s.speed + 100); 1496 }; 1497 1498 Plugin.prototype.enableSwipe = function () { 1499 var _this = this; 1500 var startCoords = 0; 1501 var endCoords = 0; 1502 var isMoved = false;
1503 1504 if (_this.s.enableSwipe && _this.doCss()) { 1505 _this.$slide.on("touchstart.lg", function (e) { 1506 if (!_this.$outer.hasClass("lg-zoomed") && !_this.lgBusy) { 1507 e.preventDefault(); 1508 _this.manageSwipeClass(); 1509 startCoords = e.originalEvent.targetTouches[0].pageX; 1510 } 1511 }); 1512 1513 _this.$slide.on("touchmove.lg", function (e) { 1514 if (!_this.$outer.hasClass("lg-zoomed")) { 1515 e.preventDefault(); 1516 endCoords = e.originalEvent.targetTouches[0].pageX; 1517 _this.touchMove(startCoords, endCoords); 1518 isMoved = true; 1519 } 1520 }); 1521 1522 _this.$slide.on("touchend.lg", function () { 1523 if (!_this.$outer.hasClass("lg-zoomed")) { 1524 if (isMoved) { 1525 isMoved = false; 1526 _this.touchEnd(endCoords - startCoords); 1527 } else { 1528 _this.$el.trigger("onSlideClick.lg"); 1529 } 1530 } 1531 }); 1532 } 1533 }; 1534 1535 Plugin.prototype.enableDrag = function () { 1536 var _this = this; 1537 var startCoords = 0; 1538 var endCoords = 0; 1539 var isDraging = false; 1540 var isMoved = false; 1541 if (_this.s.enableDrag && _this.doCss()) { 1542 _this.$slide.on("mousedown.lg", function (e) { 1543 if ( 1544 !_this.$outer.hasClass("lg-zoomed") && 1545 !_this.lgBusy && 1546 !$(e.target).text().trim() 1547 ) { 1548 e.preventDefault(); 1549 _this.manageSwipeClass(); 1550 startCoords = e.pageX; 1551 isDraging = true; 1552 1553 // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723 1554 _this.$outer.scrollLeft += 1; 1555 _this.$outer.scrollLeft -= 1; 1556 1557 // * 1558 1559 _this.$outer.removeClass("lg-grab").addClass("lg-grabbing"); 1560 1561 _this.$el.trigger("onDragstart.lg"); 1562 } 1563 }); 1564 1565 $(window).on("mousemove.lg", function (e) { 1566 if (isDraging) { 1567 isMoved = true; 1568 endCoords = e.pageX; 1569 _this.touchMove(startCoords, endCoords); 1570 _this.$el.trigger("onDragmove.lg"); 1571 } 1572 }); 1573 1574 $(window).on("mouseup.lg", function (e) { 1575 if (isMoved) { 1576 isMoved = false; 1577 _this.touchEnd(endCoords - startCoords); 1578 _this.$el.trigger("onDragend.lg"); 1579 } else if ( 1580 $(e.target).hasClass("lg-object") || 1581 $(e.target).hasClass("lg-video-play") 1582 ) { 1583 _this.$el.trigger("onSlideClick.lg"); 1584 } 1585 1586 // Prevent execution on click 1587 if (isDraging) { 1588 isDraging = false; 1589 _this.$outer.removeClass("lg-grabbing").addClass("lg-grab"); 1590 } 1591 }); 1592 } 1593 }; 1594 1595 Plugin.prototype.manageSwipeClass = function () { 1596 var _touchNext = this.index + 1; 1597 var _touchPrev = this.index - 1; 1598 if (this.s.loop && this.$slide.length > 2) { 1599 if (this.index === 0) { 1600 _touchPrev = this.$slide.length - 1; 1601 } else if (this.index === this.$slide.length - 1) { 1602 _touchNext = 0; 1603 } 1604 } 1605 1606 this.$slide.removeClass("lg-next-slide lg-prev-slide"); 1607 if (_touchPrev > -1) { 1608 this.$slide.eq(_touchPrev).addClass("lg-prev-slide"); 1609 } 1610 1611 this.$slide.eq(_touchNext).addClass("lg-next-slide"); 1612 }; 1613 1614 Plugin.prototype.mousewheel = function () { 1615 var _this = this; 1616 _this.$outer.on("mousewheel.lg", function (e) { 1617 if (!e.deltaY) { 1618 return; 1619 } 1620 1621 if (e.deltaY > 0) { 1622 _this.goToPrevSlide(); 1623 } else { 1624 _this.goToNextSlide(); 1625 } 1626 1627 e.preventDefault(); 1628 }); 1629 }; 1630 1631 Plugin.prototype.closeGallery = function () { 1632 var _this = this; 1633 var mousedown = false; 1634 this.$outer.find(".lg-close").on("click.lg", function () { 1635 _this.destroy(); 1636 }); 1637 1638 if (_this.s.closable) { 1639 // If you drag the slide and release outside gallery gets close on chrome 1640 // for preventing this check mousedown and mouseup happened on .lg-item or lg-outer 1641 _this.$outer.on("mousedown.lg", function (e) { 1642 if ( 1643 $(e.target).is(".lg-outer") || 1644 $(e.target).is(".lg-item ") || 1645 $(e.target).is(".lg-img-wrap") 1646 ) { 1647 mousedown = true; 1648 } else { 1649 mousedown = false;
1650 } 1651 }); 1652 1653 _this.$outer.on("mousemove.lg", function () { 1654 mousedown = false; 1655 }); 1656 1657 _this.$outer.on("mouseup.lg", function (e) { 1658 if ( 1659 $(e.target).is(".lg-outer") || 1660 $(e.target).is(".lg-item ") || 1661 ($(e.target).is(".lg-img-wrap") && mousedown) 1662 ) { 1663 if (!_this.$outer.hasClass("lg-dragging")) { 1664 _this.destroy(); 1665 } 1666 } 1667 }); 1668 } 1669 }; 1670 1671 Plugin.prototype.destroy = function (d) { 1672 var _this = this; 1673 1674 if (!d) { 1675 _this.$el.trigger("onBeforeClose.lg"); 1676 $(window).scrollTop(_this.prevScrollTop); 1677 } 1678 1679 /** 1680 * if d is false or undefined destroy will only close the gallery 1681 * plugins instance remains with the element 1682 * 1683 * if d is true destroy will completely remove the plugin 1684 */ 1685 1686 if (d) { 1687 if (!_this.s.dynamic) { 1688 // only when not using dynamic mode is $items a jquery collection 1689 this.$items.off("click.lg click.lgcustom"); 1690 } 1691 1692 $.removeData(_this.el, "lightGallery"); 1693 } 1694 1695 // Unbind all events added by lightGallery 1696 this.$el.off(".lg.tm"); 1697 1698 // destroy all lightGallery modules 1699 $.each($.fn.lightGallery.modules, function (key) { 1700 if (_this.modules[key]) { 1701 _this.modules[key].destroy(); 1702 } 1703 }); 1704 1705 this.lGalleryOn = false; 1706 1707 clearTimeout(_this.hideBartimeout); 1708 this.hideBartimeout = false; 1709 $(window).off(".lg"); 1710 $("body").removeClass("lg-on lg-from-hash"); 1711 1712 if (_this.$outer) { 1713 _this.$outer.removeClass("lg-visible"); 1714 } 1715 1716 $(".lg-backdrop").removeClass("in"); 1717 1718 setTimeout(function () { 1719 if (_this.$outer) { 1720 _this.$outer.remove(); 1721 } 1722 1723 $(".lg-backdrop").remove(); 1724 1725 if (!d) { 1726 _this.$el.trigger("onCloseAfter.lg"); 1727 } 1728 _this.$el.focus(); 1729 }, _this.s.backdropDuration + 50); 1730 }; 1731 1732 $.fn.lightGallery = function (options) { 1733 return this.each(function () { 1734 if (!$.data(this, "lightGallery")) { 1735 $.data(this, "lightGallery", new Plugin(this, options)); 1736 } else { 1737 try { 1738 $(this).data("lightGallery").init(); 1739 } catch (err) { 1740 console.error("lightGallery has not initiated properly"); 1741 } 1742 } 1743 }); 1744 }; 1745 1746 $.fn.lightGallery.modules = {}; 1747})(); 1748 1749/*! lg-hash - v1.0.4 - 2017-12-20 1750 * http://sachinchoolur.github.io/lightGallery 1751 * Copyright (c) 2017 Sachin N; Licensed GPLv3 */ 1752 1753(function (root, factory) { 1754 if (typeof define === "function" && define.amd) { 1755 // AMD. Register as an anonymous module unless amdModuleId is set 1756 define(["jquery"], function (a0) { 1757 return factory(a0); 1758 }); 1759 } else if (typeof exports === "object") { 1760 // Node. Does not work with strict CommonJS, but 1761 // only CommonJS-like environments that support module.exports, 1762 // like Node. 1763 module.exports = factory(require("jquery")); 1764 } else { 1765 factory(jQuery); 1766 } 1767})(this, function ($) { 1768 (function () { 1769 "use strict"; 1770 1771 var defaults = { 1772 hash: true, 1773 }; 1774 1775 var Hash = function (element) { 1776 this.core = $(element).data("lightGallery"); 1777 1778 this.core.s = $.extend({}, defaults, this.core.s); 1779 1780 if (this.core.s.hash) { 1781 this.oldHash = window.location.hash; 1782 this.init(); 1783 } 1784 1785 return this; 1786 }; 1787 1788 Hash.prototype.init = function () { 1789 var _this = this; 1790 var _hash; 1791 1792 // Change hash value on after each slide transition 1793 _this.core.$el.on( 1794 "onAfterSlide.lg.tm", 1795 function (event, prevIndex, index) { 1796 if (history.replaceState) { 1797 history.replaceState( 1798 null, 1799 null, 1800 window.location.pathname + 1801 window.location.search + 1802 "#lg=" + 1803 _this.core.s.galleryId + 1804 "&slide=" + 1805 index 1806 ); 1807 } else { 1808 window.location.hash = 1809 "lg=" + _this.core.s.galleryId + "&slide=" + index; 1810 } 1811 } 1812 ); 1813 1814 // Listen hash change and change the slide according to slide value 1815 $(window).on("hashchange.lg.hash", function () { 1816 _hash = window.location.hash; 1817 var _idx = parseInt(_hash.split("&slide=")[1], 10); 1818 1819 // it galleryId doesn't exist in the url close the gallery 1820 if (_hash.indexOf("lg=" + _this.core.s.galleryId) > -1) { 1821 _this.core.slide(_idx, false, false); 1822 } else if (_this.core.lGalleryOn) { 1823 _this.core.destroy(); 1824 } 1825 }); 1826 }; 1827 1828 Hash.prototype.destroy = function () { 1829 if (!this.core.s.hash) { 1830 return; 1831 } 1832 1833 // Reset to old hash value 1834 if ( 1835 this.oldHash && 1836 this.oldHash.indexOf("lg=" + this.core.s.galleryId) < 0 1837 ) { 1838 if (history.replaceState) { 1839 history.replaceState(null, null, this.oldHash); 1840 } else { 1841 window.location.hash = this.oldHash; 1842 } 1843 } else { 1844 if (history.replaceState) { 1845 history.replaceState( 1846 null, 1847 document.title, 1848 window.location.pathname + window.location.search 1849 ); 1850 } else { 1851 window.location.hash = ""; 1852 } 1853 } 1854 1855 this.core.$el.off(".lg.hash"); 1856 }; 1857 1858 $.fn.lightGallery.modules.hash = Hash; 1859 })(); 1860}); 1861 1862/*! lg-fullscreen - v1.2.0 - 2020-05-03 1863 * http://sachinchoolur.github.io/lightGallery 1864 * Copyright (c) 2020 Sachin N; Licensed GPLv3 */ 1865!(function (a, b) { 1866 "function" == typeof define && define.amd 1867 ? define(["jquery"], function (a) { 1868 return b(a); 1869 }) 1870 : "object" == typeof module && module.exports 1871 ? (module.exports = b(require("jquery"))) 1872 : b(a.jQuery); 1873})(this, function (a) { 1874 !(function () { 1875 "use strict"; 1876 function b() { 1877 return ( 1878 document.fullscreenElement || 1879 document.mozFullScreenElement || 1880 document.webkitFullscreenElement || 1881 document.msFullscreenElement 1882 ); 1883 } 1884 var c = { fullScreen: !0 }, 1885 d = function (b) { 1886 return ( 1887 (this.core = a(b).data("lightGallery")), 1888 (this.$el = a(b)), 1889 (this.core.s = a.extend({}, c, this.core.s)), 1890 this.init(), 1891 this 1892 ); 1893 }; 1894 (d.prototype.init = function () { 1895 var a = ""; 1896 if (this.core.s.fullScreen) { 1897 if ( 1898 !( 1899 document.fullscreenEnabled || 1900 document.webkitFullscreenEnabled || 1901 document.mozFullScreenEnabled || 1902 document.msFullscreenEnabled 1903 ) 1904 ) 1905 return; 1906 (a = 1907 '<button aria-label="Toggle fullscreen" class="lg-fullscreen lg-icon"></button>'), 1908 this.core.$outer.find(".lg-toolbar").append(a), 1909 this.fullScreen(); 1910 } 1911 }), 1912 (d.prototype.requestFullscreen = function () { 1913 var a = document.documentElement; 1914 a.requestFullscreen 1915 ? a.requestFullscreen() 1916 : a.msRequestFullscreen 1917 ? a.msRequestFullscreen() 1918 : a.mozRequestFullScreen 1919 ? a.mozRequestFullScreen() 1920 : a.webkitRequestFullscreen && a.webkitRequestFullscreen(); 1921 }), 1922 (d.prototype.exitFullscreen = function () { 1923 document.exitFullscreen 1924 ? document.exitFullscreen() 1925 : document.msExitFullscreen 1926 ? document.msExitFullscreen() 1927 : document.mozCancelFullScreen 1928 ? document.mozCancelFullScreen() 1929 : document.webkitExitFullscreen && document.webkitExitFullscreen(); 1930 }), 1931 (d.prototype.fullScreen = function () { 1932 var c = this; 1933 a(document).on( 1934 "fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg", 1935 function () { 1936 c.core.$outer.toggleClass("lg-fullscreen-on"); 1937 } 1938 ), 1939 this.core.$outer.find(".lg-fullscreen").on("click.lg", function () { 1940 b() ? c.exitFullscreen() : c.requestFullscreen(); 1941 }); 1942 }), 1943 (d.prototype.destroy = function () { 1944 b() && this.exitFullscreen(), 1945 a(document).off( 1946 "fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg" 1947 ); 1948 }), 1949 (a.fn.lightGallery.modules.fullscreen = d); 1950 })(); 1951}); 1952 1953/*! lg-pager - v1.0.2 - 2017-01-22 1954 * http://sachinchoolur.github.io/lightGallery 1955 * Copyright (c) 2017 Sachin N; Licensed GPLv3 */ 1956 1957(function (root, factory) { 1958 if (typeof define === "function" && define.amd) { 1959 // AMD. Register as an anonymous module unless amdModuleId is set 1960 define(["jquery"], function (a0) { 1961 return factory(a0); 1962 }); 1963 } else if (typeof exports === "object") { 1964 // Node. Does not work with strict CommonJS, but 1965 // only CommonJS-like environments that support module.exports, 1966 // like Node. 1967 module.exports = factory(require("jquery")); 1968 } else { 1969 factory(jQuery); 1970 } 1971})(this, function ($) { 1972 (function () { 1973 "use strict"; 1974 1975 var defaults = { 1976 pager: false, 1977 }; 1978 1979 var Pager = function (element) { 1980 this.core = $(element).data("lightGallery"); 1981 1982 this.$el = $(element); 1983 this.core.s = $.extend({}, defaults, this.core.s); 1984 if (this.core.s.pager && this.core.$items.length > 1) { 1985 this.init(); 1986 } 1987 1988 return this; 1989 }; 1990 1991 Pager.prototype.init = function () { 1992 var _this = this; 1993 var pagerList = ""; 1994 var $pagerCont; 1995 var $pagerOuter; 1996 var timeout; 1997 1998 _this.core.$outer 1999 .find(".lg") 2000 .append('<div class="lg-pager-outer"></div>'); 2001 2002 if (_this.core.s.dynamic) { 2003 for (var i = 0; i < _this.core.s.dynamicEl.length; i++) { 2004 pagerList += 2005 '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + 2006 _this.core.s.dynamicEl[i].thumb + 2007 '" /></div></span>'; 2008 } 2009 } else { 2010 _this.core.$items.each(function () { 2011 if (!_this.core.s.exThumbImage) { 2012 pagerList += 2013 '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + 2014 $(this).find("img").attr("src") + 2015 '" /></div></span>'; 2016 } else { 2017 pagerList += 2018 '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + 2019 $(this).attr(_this.core.s.exThumbImage) + 2020 '" /></div></span>'; 2021 } 2022 }); 2023 } 2024 2025 $pagerOuter = _this.core.$outer.find(".lg-pager-outer"); 2026
2027 $pagerOuter.html(pagerList); 2028 2029 $pagerCont = _this.core.$outer.find(".lg-pager-cont"); 2030 $pagerCont.on("click.lg touchend.lg", function () { 2031 var _$this = $(this); 2032 _this.core.index = _$this.index(); 2033 _this.core.slide(_this.core.index, false, true, false); 2034 }); 2035 2036 $pagerOuter.on("mouseover.lg", function () { 2037 clearTimeout(timeout); 2038 $pagerOuter.addClass("lg-pager-hover"); 2039 }); 2040 2041 $pagerOuter.on("mouseout.lg", function () { 2042 timeout = setTimeout(function () { 2043 $pagerOuter.removeClass("lg-pager-hover"); 2044 }); 2045 }); 2046 2047 _this.core.$el.on("onBeforeSlide.lg.tm", function (e, prevIndex, index) { 2048 $pagerCont.removeClass("lg-pager-active"); 2049 $pagerCont.eq(index).addClass("lg-pager-active"); 2050 }); 2051 }; 2052 2053 Pager.prototype.destroy = function () {}; 2054 2055 $.fn.lightGallery.modules.pager = Pager; 2056 })(); 2057}); 2058 2059/*! lg-share - v1.1.0 - 2020-05-03 2060 * http://sachinchoolur.github.io/lightGallery 2061 * Copyright (c) 2020 Sachin N; Licensed GPLv3 */ 2062 2063(function (root, factory) { 2064 if (typeof define === "function" && define.amd) { 2065 // AMD. Register as an anonymous module unless amdModuleId is set 2066 define(["jquery"], function (a0) { 2067 return factory(a0); 2068 }); 2069 } else if (typeof module === "object" && module.exports) { 2070 // Node. Does not work with strict CommonJS, but 2071 // only CommonJS-like environments that support module.exports, 2072 // like Node. 2073 module.exports = factory(require("jquery")); 2074 } else { 2075 factory(root["jQuery"]); 2076 } 2077})(this, function ($) { 2078 (function () { 2079 "use strict"; 2080 2081 var defaults = { 2082 share: true, 2083 facebook: true, 2084 facebookDropdownText: "Facebook", 2085 twitter: true, 2086 twitterDropdownText: "Twitter", 2087 googlePlus: true, 2088 googlePlusDropdownText: "GooglePlus", 2089 pinterest: true, 2090 pinterestDropdownText: "Pinterest", 2091 }; 2092 2093 var Share = function (element) { 2094 this.core = $(element).data("lightGallery"); 2095 2096 this.core.s = $.extend({}, defaults, this.core.s); 2097 if (this.core.s.share) { 2098 this.init(); 2099 } 2100 2101 return this; 2102 }; 2103 2104 Share.prototype.init = function () { 2105 var _this = this; 2106 2107 var shareHtml = 2108 '<button aria-label="Share" id="lg-share" class="lg-icon" aria-haspopup="true" aria-expanded="false">' + 2109 '<ul class="lg-dropdown" style="position: absolute;">'; 2110 shareHtml += _this.core.s.facebook 2111 ? '<li><a id="lg-share-facebook" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">' + 2112 this.core.s.facebookDropdownText + 2113 "</span></a></li>" 2114 : ""; 2115 shareHtml += _this.core.s.twitter 2116 ? '<li><a id="lg-share-twitter" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">' + 2117 this.core.s.twitterDropdownText + 2118 "</span></a></li>" 2119 : ""; 2120 shareHtml += _this.core.s.googlePlus 2121 ? '<li><a id="lg-share-googleplus" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">' + 2122 this.core.s.googlePlusDropdownText + 2123 "</span></a></li>" 2124 : ""; 2125 shareHtml += _this.core.s.pinterest 2126 ? '<li><a id="lg-share-pinterest" target="_blank"><span class="lg-icon"></span><span class="lg-dropdown-text">' + 2127 this.core.s.pinterestDropdownText + 2128 "</span></a></li>" 2129 : ""; 2130 shareHtml += "</ul></button>"; 2131 2132 this.core.$outer.find(".lg-toolbar").append(shareHtml); 2133 this.core.$outer 2134 .find(".lg") 2135 .append('<div id="lg-dropdown-overlay"></div>'); 2136 $("#lg-share").on("click.lg", function () { 2137 _this.core.$outer.toggleClass("lg-dropdown-active"); 2138 var ariaExpanded = $("#lg-share").attr("aria-expanded"); 2139 $("#lg-share").attr( 2140 "aria-expanded", 2141 ariaExpanded === "true" ? false : true 2142 ); 2143 }); 2144 2145 $("#lg-dropdown-overlay").on("click.lg", function () { 2146 _this.core.$outer.removeClass("lg-dropdown-active"); 2147 $("#lg-share").attr("aria-expanded", false); 2148 }); 2149 2150 _this.core.$el.on( 2151 "onAfterSlide.lg.tm", 2152 function (event, prevIndex, index) { 2153 setTimeout(function () { 2154 $("#lg-share-facebook").attr( 2155 "href", 2156 "https://www.facebook.com/sharer/sharer.php?u=" + 2157 encodeURIComponent(
2158 _this.getSahreProps(index, "facebookShareUrl") || 2159 window.location.href 2160 ) 2161 ); 2162 2163 $("#lg-share-twitter").attr( 2164 "href", 2165 "https://twitter.com/intent/tweet?text=" + 2166 _this.getSahreProps(index, "tweetText") + 2167 "&url=" + 2168 encodeURIComponent( 2169 _this.getSahreProps(index, "twitterShareUrl") || 2170 window.location.href 2171 ) 2172 ); 2173 2174 $("#lg-share-googleplus").attr( 2175 "href", 2176 "https://plus.google.com/share?url=" + 2177 encodeURIComponent( 2178 _this.getSahreProps(index, "googleplusShareUrl") || 2179 window.location.href 2180 ) 2181 ); 2182 2183 $("#lg-share-pinterest").attr( 2184 "href", 2185 "http://www.pinterest.com/pin/create/button/?url=" + 2186 encodeURIComponent( 2187 _this.getSahreProps(index, "pinterestShareUrl") || 2188 window.location.href 2189 ) + 2190 "&media=" + 2191 encodeURIComponent(_this.getSahreProps(index, "src")) + 2192 "&description=" +
2193 _this.getSahreProps(index, "pinterestText") 2194 ); 2195 }, 100); 2196 } 2197 ); 2198 }; 2199 2200 Share.prototype.getSahreProps = function (index, prop) { 2201 var shareProp = ""; 2202 if (this.core.s.dynamic) { 2203 shareProp = this.core.s.dynamicEl[index][prop]; 2204 } else { 2205 var _href = this.core.$items.eq(index).attr("href"); 2206 var _prop = this.core.$items.eq(index).data(prop); 2207 shareProp = prop === "src" ? _href || _prop : _prop; 2208 } 2209 return shareProp; 2210 }; 2211 2212 Share.prototype.destroy = function () {}; 2213 2214 $.fn.lightGallery.modules.share = Share; 2215 })(); 2216}); 2217 2218/*! lg-thumbnail - v1.2.0 - 2020-05-03 2219 * http://sachinchoolur.github.io/lightGallery 2220 * Copyright (c) 2020 Sachin N; Licensed GPLv3 */ 2221!(function (a, b) { 2222 "function" == typeof define && define.amd 2223 ? define(["jquery"], function (a) { 2224 return b(a); 2225 }) 2226 : "object" == typeof module && module.exports 2227 ? (module.exports = b(require("jquery"))) 2228 : b(a.jQuery); 2229})(this, function (a) { 2230 !(function () { 2231 "use strict"; 2232 var b = { 2233 thumbnail: !0, 2234 animateThumb: !0, 2235 currentPagerPosition: "middle", 2236 thumbWidth: 100, 2237 thumbHeight: "80px", 2238 thumbContHeight: 100, 2239 thumbMargin: 5, 2240 thumbnail: false, 2241 exThumbImage: !1, 2242 showThumbByDefault: !0, 2243 toogleThumb: !0, 2244 pullCaptionUp: !0, 2245 enableThumbDrag: !0, 2246 enableThumbSwipe: !0, 2247 swipeThreshold: 50, 2248 loadYoutubeThumbnail: !0, 2249 youtubeThumbSize: 1, 2250 loadVimeoThumbnail: !0, 2251 vimeoThumbSize: "thumbnail_small", 2252 loadDailymotionThumbnail: !0, 2253 }, 2254 c = function (c) { 2255 return ( 2256 (this.core = a(c).data("lightGallery")), 2257 (this.core.s = a.extend({}, b, this.core.s)), 2258 (this.$el = a(c)), 2259 (this.$thumbOuter = null), 2260 (this.thumbOuterWidth = 0), 2261 (this.thumbTotalWidth = 2262 this.core.$items.length * 2263 (this.core.s.thumbWidth + this.core.s.thumbMargin)), 2264 (this.thumbIndex = this.core.index), 2265 this.core.s.animateThumb && (this.core.s.thumbHeight = "100%"), 2266 (this.left = 0), 2267 this.init(), 2268 this 2269 ); 2270 }; 2271 (c.prototype.init = function () { 2272 var a = this; 2273 this.core.s.thumbnail && 2274 this.core.$items.length > 1 && 2275 (this.core.s.showThumbByDefault && 2276 setTimeout(function () { 2277 a.core.$outer.addClass("lg-thumb-open"); 2278 }, 700), 2279 this.core.s.pullCaptionUp && 2280 this.core.$outer.addClass("lg-pull-caption-up"), 2281 this.build(), 2282 this.core.s.animateThumb && this.core.doCss() 2283 ? (this.core.s.enableThumbDrag && this.enableThumbDrag(), 2284 this.core.s.enableThumbSwipe && this.enableThumbSwipe(), 2285 (this.thumbClickable = !1)) 2286 : (this.thumbClickable = !0), 2287 this.toogle(), 2288 this.thumbkeyPress()); 2289 }), 2290 (c.prototype.build = function () { 2291 function b(a, b, c) { 2292 var g, 2293 h = d.core.isVideo(a, c) || {}, 2294 i = ""; 2295 h.youtube || h.vimeo || h.dailymotion 2296 ? h.youtube 2297 ? (g = d.core.s.loadYoutubeThumbnail 2298 ? "//img.youtube.com/vi/" + 2299 h.youtube[1] + 2300 "/" + 2301 d.core.s.youtubeThumbSize + 2302 ".jpg" 2303 : b) 2304 : h.vimeo 2305 ? d.core.s.loadVimeoThumbnail 2306 ? ((g = "//i.vimeocdn.com/video/error_" + f + ".jpg"), 2307 (i = h.vimeo[1])) 2308 : (g = b) 2309 : h.dailymotion && 2310 (g = d.core.s.loadDailymotionThumbnail 2311 ? "//www.dailymotion.com/thumbnail/video/" + h.dailymotion[1] 2312 : b) 2313 : (g = a), 2314 (e += 2315 '<div data-vimeo-id="' + 2316 i + 2317 '" class="lg-thumb-item" style="width:' + 2318 d.core.s.thumbWidth + 2319 "px; height: " +
2320 d.core.s.thumbHeight + 2321 "; margin-right: " + 2322 d.core.s.thumbMargin + 2323 "px; " + 2324 (typeof g == "undefined" ? "display: none;" : "") + 2325 '"><img src="' + 2326 g + 2327 '" /></div>'), 2328 (i = ""); 2329 var xxx = 0; 2330 } 2331 var c, 2332 d = this, 2333 e = "", 2334 f = "", 2335 g = 2336 '<div class="lg-thumb-outer"><div class="lg-thumb lg-group"></div></div>'; 2337 switch (this.core.s.vimeoThumbSize) { 2338 case "thumbnail_large": 2339 f = "640"; 2340 break; 2341 case "thumbnail_medium": 2342 f = "200x150"; 2343 break; 2344 case "thumbnail_small": 2345 f = "100x75"; 2346 } 2347 if ( 2348 (d.core.$outer.addClass("lg-has-thumb"), 2349 d.core.$outer.find(".lg").append(g), 2350 (d.$thumbOuter = d.core.$outer.find(".lg-thumb-outer")), 2351 (d.thumbOuterWidth = d.$thumbOuter.width()), 2352 d.core.s.animateThumb && 2353 d.core.$outer 2354 .find(".lg-thumb") 2355 .css({ width: d.thumbTotalWidth + "px", position: "relative" }), 2356 this.core.s.animateThumb && 2357 d.$thumbOuter.css("height", d.core.s.thumbContHeight + "px"), 2358 d.core.s.dynamic) 2359 ) 2360 for (var h = 0; h < d.core.s.dynamicEl.length; h++) 2361 b(d.core.s.dynamicEl[h].src, d.core.s.dynamicEl[h].thumb, h); 2362 else 2363 d.core.$items.each(function (c) { 2364 d.core.s.exThumbImage 2365 ? b( 2366 a(this).attr("href") || a(this).attr("data-src"), 2367 a(this).attr(d.core.s.exThumbImage), 2368 c 2369 ) 2370 : b( 2371 a(this).attr("href") || a(this).attr("data-src"), 2372 a(this).find("img").attr("src"), 2373 c 2374 ); 2375 }); 2376 d.core.$outer.find(".lg-thumb").html(e), 2377 (c = d.core.$outer.find(".lg-thumb-item")), 2378 c.each(function () { 2379 var b = a(this), 2380 c = b.attr("data-vimeo-id"); 2381 c && 2382 a.getJSON( 2383 "//www.vimeo.com/api/v2/video/" + c + ".json?callback=?", 2384 { format: "json" }, 2385 function (a) { 2386 b.find("img").attr("src", a[0][d.core.s.vimeoThumbSize]); 2387 } 2388 ); 2389 }), 2390 c.eq(d.core.index).addClass("active"), 2391 d.core.$el.on("onBeforeSlide.lg.tm", function () { 2392 c.removeClass("active"), c.eq(d.core.index).addClass("active"); 2393 }), 2394 c.on("click.lg touchend.lg", function () { 2395 var b = a(this); 2396 setTimeout(function () { 2397 ((d.thumbClickable && !d.core.lgBusy) || !d.core.doCss()) && 2398 ((d.core.index = b.index()), 2399 d.core.slide(d.core.index, !1, !0, !1)); 2400 }, 50); 2401 }), 2402 d.core.$el.on("onBeforeSlide.lg.tm", function () { 2403 d.animateThumb(d.core.index); 2404 }), 2405 a(window).on( 2406 "resize.lg.thumb orientationchange.lg.thumb", 2407 function () { 2408 setTimeout(function () { 2409 d.animateThumb(d.core.index), 2410 (d.thumbOuterWidth = d.$thumbOuter.width()); 2411 }, 200); 2412 } 2413 ); 2414 }), 2415 (c.prototype.setTranslate = function (a) { 2416 this.core.$outer 2417 .find(".lg-thumb") 2418 .css({ transform: "translate3d(-" + a + "px, 0px, 0px)" }); 2419 }), 2420 (c.prototype.animateThumb = function (a) { 2421 var b = this.core.$outer.find(".lg-thumb"); 2422 if (this.core.s.animateThumb) { 2423 var c; 2424 switch (this.core.s.currentPagerPosition) { 2425 case "left": 2426 c = 0; 2427 break; 2428 case "middle": 2429 c = this.thumbOuterWidth / 2 - this.core.s.thumbWidth / 2; 2430 break; 2431 case "right": 2432 c = this.thumbOuterWidth - this.core.s.thumbWidth; 2433 } 2434 (this.left = 2435 (this.core.s.thumbWidth + this.core.s.thumbMargin) * a - 1 - c), 2436 this.left > this.thumbTotalWidth - this.thumbOuterWidth && 2437 (this.left = this.thumbTotalWidth - this.thumbOuterWidth), 2438 this.left < 0 && (this.left = 0), 2439 this.core.lGalleryOn 2440 ? (b.hasClass("on") || 2441 this.core.$outer 2442 .find(".lg-thumb") 2443 .css("transition-duration", this.core.s.speed + "ms"), 2444 this.core.doCss() || 2445 b.animate({ left: -this.left + "px" }, this.core.s.speed)) 2446 : this.core.doCss() || b.css("left", -this.left + "px"), 2447 this.setTranslate(this.left); 2448 } 2449 }), 2450 (c.prototype.enableThumbDrag = function () { 2451 var b = this, 2452 c = 0, 2453 d = 0, 2454 e = !1, 2455 f = !1, 2456 g = 0; 2457 b.$thumbOuter.addClass("lg-grab"), 2458 b.core.$outer 2459 .find(".lg-thumb") 2460 .on("mousedown.lg.thumb", function (a) { 2461 b.thumbTotalWidth > b.thumbOuterWidth && 2462 (a.preventDefault(), 2463 (c = a.pageX), 2464 (e = !0), 2465 (b.core.$outer.scrollLeft += 1), 2466 (b.core.$outer.scrollLeft -= 1), 2467 (b.thumbClickable = !1), 2468 b.$thumbOuter.removeClass("lg-grab").addClass("lg-grabbing")); 2469 }), 2470 a(window).on("mousemove.lg.thumb", function (a) { 2471 e && 2472 ((g = b.left), 2473 (f = !0), 2474 (d = a.pageX), 2475 b.$thumbOuter.addClass("lg-dragging"), 2476 (g -= d - c), 2477 g > b.thumbTotalWidth - b.thumbOuterWidth && 2478 (g = b.thumbTotalWidth - b.thumbOuterWidth), 2479 g < 0 && (g = 0), 2480 b.setTranslate(g)); 2481 }), 2482 a(window).on("mouseup.lg.thumb", function () { 2483 f 2484 ? ((f = !1), 2485 b.$thumbOuter.removeClass("lg-dragging"), 2486 (b.left = g), 2487 Math.abs(d - c) < b.core.s.swipeThreshold && 2488 (b.thumbClickable = !0)) 2489 : (b.thumbClickable = !0), 2490 e && 2491 ((e = !1), 2492 b.$thumbOuter.removeClass("lg-grabbing").addClass("lg-grab")); 2493 }); 2494 }), 2495 (c.prototype.enableThumbSwipe = function () { 2496 var a = this, 2497 b = 0, 2498 c = 0, 2499 d = !1, 2500 e = 0; 2501 a.core.$outer.find(".lg-thumb").on("touchstart.lg", function (c) { 2502 a.thumbTotalWidth > a.thumbOuterWidth && 2503 (c.preventDefault(), 2504 (b = c.originalEvent.targetTouches[0].pageX), 2505 (a.thumbClickable = !1)); 2506 }), 2507 a.core.$outer.find(".lg-thumb").on("touchmove.lg", function (f) { 2508 a.thumbTotalWidth > a.thumbOuterWidth && 2509 (f.preventDefault(), 2510 (c = f.originalEvent.targetTouches[0].pageX), 2511 (d = !0), 2512 a.$thumbOuter.addClass("lg-dragging"), 2513 (e = a.left), 2514 (e -= c - b), 2515 e > a.thumbTotalWidth - a.thumbOuterWidth && 2516 (e = a.thumbTotalWidth - a.thumbOuterWidth), 2517 e < 0 && (e = 0), 2518 a.setTranslate(e)); 2519 }), 2520 a.core.$outer.find(".lg-thumb").on("touchend.lg", function () { 2521 a.thumbTotalWidth > a.thumbOuterWidth && d 2522 ? ((d = !1), 2523 a.$thumbOuter.removeClass("lg-dragging"), 2524 Math.abs(c - b) < a.core.s.swipeThreshold && 2525 (a.thumbClickable = !0), 2526 (a.left = e)) 2527 : (a.thumbClickable = !0); 2528 }); 2529 }), 2530 (c.prototype.toogle = function () { 2531 var a = this; 2532 a.core.s.toogleThumb && 2533 (a.core.$outer.addClass("lg-can-toggle"), 2534 a.$thumbOuter.append( 2535 '<button aria-label="Toggle thumbnails" class="lg-toogle-thumb lg-icon"></button>' 2536 ), 2537 a.core.$outer.find(".lg-toogle-thumb").on("click.lg", function () { 2538 a.core.$outer.toggleClass("lg-thumb-open"); 2539 })); 2540 }), 2541 (c.prototype.thumbkeyPress = function () { 2542 var b = this; 2543 a(window).on("keydown.lg.thumb", function (a) { 2544 38 === a.keyCode 2545 ? (a.preventDefault(), b.core.$outer.addClass("lg-thumb-open")) 2546 : 40 === a.keyCode && 2547 (a.preventDefault(), b.core.$outer.removeClass("lg-thumb-open")); 2548 }); 2549 }), 2550 (c.prototype.destroy = function () { 2551 this.core.s.thumbnail && 2552 this.core.$items.length > 1 && 2553 (a(window).off( 2554 "resize.lg.thumb orientationchange.lg.thumb keydown.lg.thumb" 2555 ), 2556 this.$thumbOuter.remove(), 2557 this.core.$outer.removeClass("lg-has-thumb")); 2558 }), 2559 (a.fn.lightGallery.modules.Thumbnail = c); 2560 })(); 2561}); 2562 2563/*! lg-zoom - v1.2.0 - 2020-05-03 2564 * http://sachinchoolur.github.io/lightGallery 2565 * Copyright (c) 2020 Sachin N; Licensed GPLv3 */ 2566!(function (a, b) { 2567 "function" == typeof define && define.amd 2568 ? define(["jquery"], function (a) { 2569 return b(a); 2570 }) 2571 : "object" == typeof module && module.exports 2572 ? (module.exports = b(require("jquery"))) 2573 : b(a.jQuery); 2574})(this, function (a) { 2575 !(function () { 2576 "use strict"; 2577 var b = function () { 2578 var a = !1, 2579 b = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./); 2580 return b && parseInt(b[2], 10) < 54 && (a = !0), a; 2581 }, 2582 c = { 2583 scale: 1, 2584 zoom: !0, 2585 actualSize: !0, 2586 enableZoomAfter: 300, 2587 useLeftForZoom: b(), 2588 }, 2589 d = function (b) { 2590 return ( 2591 (this.core = a(b).data("lightGallery")), 2592 (this.core.s = a.extend({}, c, this.core.s)), 2593 this.core.s.zoom && 2594 this.core.doCss() && 2595 (this.init(), 2596 (this.zoomabletimeout = !1), 2597 (this.pageX = a(window).width() / 2), 2598 (this.pageY = a(window).height() / 2 + a(window).scrollTop())), 2599 this 2600 ); 2601 }; 2602 (d.prototype.init = function () { 2603 var b = this, 2604 c = 2605 '<button aria-label="Zoom in" id="lg-zoom-in" class="lg-icon"></button><button aria-label="Zoom out" id="lg-zoom-out" class="lg-icon"></button>'; 2606 b.core.s.actualSize && 2607 (c += 2608 '<button aria-label="Actual size" id="lg-actual-size" class="lg-icon"></button>'), 2609 b.core.s.useLeftForZoom 2610 ? b.core.$outer.addClass("lg-use-left-for-zoom") 2611 : b.core.$outer.addClass("lg-use-transition-for-zoom"), 2612 this.core.$outer.find(".lg-toolbar").append(c), 2613 b.core.$el.on("onSlideItemLoad.lg.tm.zoom", function (c, d, e) { 2614 var f = b.core.s.enableZoomAfter + e; 2615 a("body").hasClass("lg-from-hash") && e 2616 ? (f = 0) 2617 : a("body").removeClass("lg-from-hash"), 2618 (b.zoomabletimeout = setTimeout(function () { 2619 b.core.$slide.eq(d).addClass("lg-zoomable"); 2620 }, f + 30)); 2621 }); 2622 var d = 1, 2623 e = function (c) { 2624 var d, 2625 e, 2626 f = b.core.$outer.find(".lg-current .lg-image"), 2627 g = (a(window).width() - f.prop("offsetWidth")) / 2, 2628 h = 2629 (a(window).height() - f.prop("offsetHeight")) / 2 + 2630 a(window).scrollTop(); 2631 (d = b.pageX - g), (e = b.pageY - h); 2632 var i = (c - 1) * d, 2633 j = (c - 1) * e; 2634 f 2635 .css("transform", "scale3d(" + c + ", " + c + ", 1)") 2636 .attr("data-scale", c), 2637 b.core.s.useLeftForZoom 2638 ? f 2639 .parent() 2640 .css({ left: -i + "px", top: -j + "px" }) 2641 .attr("data-x", i) 2642 .attr("data-y", j) 2643 : f 2644 .parent() 2645 .css( 2646 "transform", 2647 "translate3d(-" + i + "px, -" + j + "px, 0)" 2648 ) 2649 .attr("data-x", i) 2650 .attr("data-y", j); 2651 }, 2652 f = function () { 2653 d > 1 ? b.core.$outer.addClass("lg-zoomed") : b.resetZoom(), 2654 d < 1 && (d = 1), 2655 e(d); 2656 }, 2657 g = function (c, e, g, h) { 2658 var i, 2659 j = e.prop("offsetWidth"); 2660 i = b.core.s.dynamic
2661 ? b.core.s.dynamicEl[g].width || e[0].naturalWidth || j 2662 : b.core.$items.eq(g).attr("data-width") || e[0].naturalWidth || j; 2663 var k; 2664 b.core.$outer.hasClass("lg-zoomed") 2665 ? (d = 1) 2666 : i > j && ((k = i / j), (d = k || 2)), 2667 h 2668 ? ((b.pageX = a(window).width() / 2), 2669 (b.pageY = a(window).height() / 2 + a(window).scrollTop())) 2670 : ((b.pageX = c.pageX || c.originalEvent.targetTouches[0].pageX), 2671 (b.pageY = c.pageY || c.originalEvent.targetTouches[0].pageY)), 2672 f(), 2673 setTimeout(function () { 2674 b.core.$outer.removeClass("lg-grabbing").addClass("lg-grab"); 2675 }, 10); 2676 }, 2677 h = !1; 2678 b.core.$el.on("onAferAppendSlide.lg.tm.zoom", function (a, c) { 2679 var d = b.core.$slide.eq(c).find(".lg-image"); 2680 d.on("dblclick", function (a) { 2681 g(a, d, c); 2682 }), 2683 d.on("touchstart", function (a) { 2684 h 2685 ? (clearTimeout(h), (h = null), g(a, d, c)) 2686 : (h = setTimeout(function () { 2687 h = null; 2688 }, 300)), 2689 a.preventDefault(); 2690 }); 2691 }), 2692 a(window).on( 2693 "resize.lg.zoom scroll.lg.zoom orientationchange.lg.zoom", 2694 function () { 2695 (b.pageX = a(window).width() / 2), 2696 (b.pageY = a(window).height() / 2 + a(window).scrollTop()), 2697 e(d); 2698 } 2699 ), 2700 a("#lg-zoom-out").on("click.lg", function () { 2701 b.core.$outer.find(".lg-current .lg-image").length && 2702 ((d -= b.core.s.scale), f()); 2703 }), 2704 a("#lg-zoom-in").on("click.lg", function () { 2705 b.core.$outer.find(".lg-current .lg-image").length && 2706 ((d += b.core.s.scale), f()); 2707 }), 2708 a("#lg-actual-size").on("click.lg", function (a) { 2709 g( 2710 a, 2711 b.core.$slide.eq(b.core.index).find(".lg-image"), 2712 b.core.index, 2713 !0 2714 ); 2715 }), 2716 b.core.$el.on("onBeforeSlide.lg.tm", function () { 2717 (d = 1), b.resetZoom(); 2718 }), 2719 b.zoomDrag(), 2720 b.zoomSwipe(); 2721 }), 2722 (d.prototype.resetZoom = function () { 2723 this.core.$outer.removeClass("lg-zoomed"), 2724 this.core.$slide 2725 .find(".lg-img-wrap") 2726 .removeAttr("style data-x data-y"), 2727 this.core.$slide.find(".lg-image").removeAttr("style data-scale"), 2728 (this.pageX = a(window).width() / 2), 2729 (this.pageY = a(window).height() / 2 + a(window).scrollTop()); 2730 }), 2731 (d.prototype.zoomSwipe = function () { 2732 var a = this, 2733 b = {}, 2734 c = {}, 2735 d = !1, 2736 e = !1, 2737 f = !1; 2738 a.core.$slide.on("touchstart.lg", function (c) { 2739 if (a.core.$outer.hasClass("lg-zoomed")) { 2740 var d = a.core.$slide.eq(a.core.index).find(".lg-object"); 2741 (f = 2742 d.prop("offsetHeight") * d.attr("data-scale") > 2743 a.core.$outer.find(".lg").height()), 2744 (e = 2745 d.prop("offsetWidth") * d.attr("data-scale") > 2746 a.core.$outer.find(".lg").width()), 2747 (e || f) && 2748 (c.preventDefault(), 2749 (b = { 2750 x: c.originalEvent.targetTouches[0].pageX, 2751 y: c.originalEvent.targetTouches[0].pageY, 2752 })); 2753 } 2754 }), 2755 a.core.$slide.on("touchmove.lg", function (g) { 2756 if (a.core.$outer.hasClass("lg-zoomed")) { 2757 var h, 2758 i, 2759 j = a.core.$slide.eq(a.core.index).find(".lg-img-wrap"); 2760 g.preventDefault(), 2761 (d = !0), 2762 (c = { 2763 x: g.originalEvent.targetTouches[0].pageX, 2764 y: g.originalEvent.targetTouches[0].pageY, 2765 }), 2766 a.core.$outer.addClass("lg-zoom-dragging"), 2767 (i = f 2768 ? -Math.abs(j.attr("data-y")) + (c.y - b.y) 2769 : -Math.abs(j.attr("data-y"))), 2770 (h = e 2771 ? -Math.abs(j.attr("data-x")) + (c.x - b.x) 2772 : -Math.abs(j.attr("data-x"))), 2773 (Math.abs(c.x - b.x) > 15 || Math.abs(c.y - b.y) > 15) && 2774 (a.core.s.useLeftForZoom 2775 ? j.css({ left: h + "px", top: i + "px" }) 2776 : j.css( 2777 "transform", 2778 "translate3d(" + h + "px, " + i + "px, 0)" 2779 )); 2780 } 2781 }), 2782 a.core.$slide.on("touchend.lg", function () { 2783 a.core.$outer.hasClass("lg-zoomed") && 2784 d && 2785 ((d = !1), 2786 a.core.$outer.removeClass("lg-zoom-dragging"), 2787 a.touchendZoom(b, c, e, f)); 2788 }); 2789 }), 2790 (d.prototype.zoomDrag = function () { 2791 var b = this, 2792 c = {}, 2793 d = {}, 2794 e = !1, 2795 f = !1, 2796 g = !1, 2797 h = !1; 2798 b.core.$slide.on("mousedown.lg.zoom", function (d) { 2799 var f = b.core.$slide.eq(b.core.index).find(".lg-object"); 2800 (h = 2801 f.prop("offsetHeight") * f.attr("data-scale") > 2802 b.core.$outer.find(".lg").height()), 2803 (g = 2804 f.prop("offsetWidth") * f.attr("data-scale") > 2805 b.core.$outer.find(".lg").width()), 2806 b.core.$outer.hasClass("lg-zoomed") && 2807 a(d.target).hasClass("lg-object") && 2808 (g || h) && 2809 (d.preventDefault(), 2810 (c = { x: d.pageX, y: d.pageY }), 2811 (e = !0), 2812 (b.core.$outer.scrollLeft += 1), 2813 (b.core.$outer.scrollLeft -= 1), 2814 b.core.$outer.removeClass("lg-grab").addClass("lg-grabbing")); 2815 }), 2816 a(window).on("mousemove.lg.zoom", function (a) { 2817 if (e) { 2818 var i, 2819 j, 2820 k = b.core.$slide.eq(b.core.index).find(".lg-img-wrap"); 2821 (f = !0), 2822 (d = { x: a.pageX, y: a.pageY }), 2823 b.core.$outer.addClass("lg-zoom-dragging"), 2824 (j = h 2825 ? -Math.abs(k.attr("data-y")) + (d.y - c.y) 2826 : -Math.abs(k.attr("data-y"))), 2827 (i = g 2828 ? -Math.abs(k.attr("data-x")) + (d.x - c.x) 2829 : -Math.abs(k.attr("data-x"))), 2830 b.core.s.useLeftForZoom 2831 ? k.css({ left: i + "px", top: j + "px" }) 2832 : k.css( 2833 "transform", 2834 "translate3d(" + i + "px, " + j + "px, 0)" 2835 ); 2836 } 2837 }), 2838 a(window).on("mouseup.lg.zoom", function (a) { 2839 e && 2840 ((e = !1), 2841 b.core.$outer.removeClass("lg-zoom-dragging"), 2842 !f || 2843 (c.x === d.x && c.y === d.y) || 2844 ((d = { x: a.pageX, y: a.pageY }), b.touchendZoom(c, d, g, h)), 2845 (f = !1)), 2846 b.core.$outer.removeClass("lg-grabbing").addClass("lg-grab"); 2847 }); 2848 }), 2849 (d.prototype.touchendZoom = function (a, b, c, d) { 2850 var e = this, 2851 f = e.core.$slide.eq(e.core.index).find(".lg-img-wrap"), 2852 g = e.core.$slide.eq(e.core.index).find(".lg-object"), 2853 h = -Math.abs(f.attr("data-x")) + (b.x - a.x), 2854 i = -Math.abs(f.attr("data-y")) + (b.y - a.y), 2855 j = (e.core.$outer.find(".lg").height() - g.prop("offsetHeight")) / 2, 2856 k = Math.abs( 2857 g.prop("offsetHeight") * Math.abs(g.attr("data-scale")) - 2858 e.core.$outer.find(".lg").height() + 2859 j 2860 ), 2861 l = (e.core.$outer.find(".lg").width() - g.prop("offsetWidth")) / 2, 2862 m = Math.abs( 2863 g.prop("offsetWidth") * Math.abs(g.attr("data-scale")) - 2864 e.core.$outer.find(".lg").width() + 2865 l 2866 ); 2867 (Math.abs(b.x - a.x) > 15 || Math.abs(b.y - a.y) > 15) && 2868 (d && (i <= -k ? (i = -k) : i >= -j && (i = -j)), 2869 c && (h <= -m ? (h = -m) : h >= -l && (h = -l)), 2870 d ? f.attr("data-y", Math.abs(i)) : (i = -Math.abs(f.attr("data-y"))), 2871 c ? f.attr("data-x", Math.abs(h)) : (h = -Math.abs(f.attr("data-x"))), 2872 e.core.s.useLeftForZoom 2873 ? f.css({ left: h + "px", top: i + "px" }) 2874 : f.css("transform", "translate3d(" + h + "px, " + i + "px, 0)")); 2875 }), 2876 (d.prototype.destroy = function () { 2877 var b = this; 2878 b.core.$el.off(".lg.zoom"), 2879 a(window).off(".lg.zoom"), 2880 b.core.$slide.off(".lg.zoom"), 2881 b.core.$el.off(".lg.tm.zoom"), 2882 b.resetZoom(), 2883 clearTimeout(b.zoomabletimeout), 2884 (b.zoomabletimeout = !1); 2885 }), 2886 (a.fn.lightGallery.modules.zoom = d); 2887 })(); 2888});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.