1/*! lightgallery - v1.6.6 - 2017-12-20 2* http://sachinchoolur.github.io/lightGallery/ 3* Copyright (c) 2017 Sachin N; Licensed GPLv3 */ 4 5/** 6 * WARNING: 7 * Contains Hive modifications to improve accessibility and to use Font Awesome instead of proprietary icons. 8 * If you want to see the updates, please compare with the original library code. 9 */ 10 11(function (root, factory) { 12 if (typeof define === 'function' && define.amd) { 13 // AMD. Register as an anonymous module unless amdModuleId is set 14 define(['jquery'], function (a0) { 15 return (factory(a0)); 16 }); 17 } else if (typeof exports === 'object') { 18 // Node. Does not work with strict CommonJS, but 19 // only CommonJS-like environments that support module.exports, 20 // like Node. 21 module.exports = factory(require('jquery')); 22 } else { 23 factory(root["jQuery"]); 24 } 25}(this, function ($) { 26 27 (function() { 28 'use strict'; 29 30 var defaults = { 31 32 mode: 'lg-slide', 33 34 // Ex : 'ease' 35 cssEasing: 'ease', 36 37 //'for jquery animation' 38 easing: 'linear', 39 speed: 600, 40 height: '100%', 41 width: '100%', 42 addClass: '', 43 startClass: 'lg-start-zoom', 44 backdropDuration: 150, 45 hideBarsDelay: 6000, 46 47 useLeft: false, 48 49 closable: true, 50 loop: true, 51 escKey: true, 52 keyPress: true, 53 controls: true, 54 slideEndAnimatoin: true, 55 hideControlOnEnd: false, 56 mousewheel: true, 57 58 getCaptionFromTitleOrAlt: false, 59 60 // .lg-item || '.lg-sub-html' 61 appendSubHtmlTo: '.lg-sub-html', 62 63 subHtmlSelectorRelative: false, 64 65 /** 66 * @desc number of preload slides 67 * will exicute only after the current slide is fully loaded. 68 * 69 * @ex you clicked on 4th image and if preload = 1 then 3rd slide and 5th 70 * slide will be loaded in the background after the 4th slide is fully loaded.. 71 * if preload is 2 then 2nd 3rd 5th 6th slides will be preloaded.. ... ... 72 * 73 */ 74 preload: 1, 75 showAfterLoad: true, 76 selector: '', 77 selectWithin: '', 78 nextHtml: '', 79 prevHtml: '', 80 81 // 0, 1 82 index: false, 83 84 iframeMaxWidth: '100%', 85 86 download: true, 87 counter: true, 88 appendCounterTo: '.lg-toolbar', 89 90 swipeThreshold: 50, 91 enableSwipe: true, 92 enableDrag: true, 93 94 dynamic: false, 95 dynamicEl: [], 96 galleryId: 1 97 }; 98 99 function Plugin(element, options) { 100 101 // Current lightGallery element 102 this.el = element; 103 104 // Current jquery element 105 this.$el = $(element); 106 107 // lightGallery settings 108 this.s = $.extend({}, defaults, options); 109 110 // When using dynamic mode, ensure dynamicEl is an array 111 if (this.s.dynamic && this.s.dynamicEl !== 'undefined' && this.s.dynamicEl.constructor === Array && !this.s.dynamicEl.length) { 112 throw ('When using dynamic mode, you must also define dynamicEl as an Array.'); 113 } 114 115 // lightGallery modules 116 this.modules = {}; 117 118 // false when lightgallery complete first slide; 119 this.lGalleryOn = false; 120 121 this.lgBusy = false; 122 123 // Timeout function for hiding controls; 124 this.hideBartimeout = false; 125 126 // To determine browser supports for touch events; 127 this.isTouch = ('ontouchstart' in document.documentElement); 128 129 // Disable hideControlOnEnd if sildeEndAnimation is true 130 if (this.s.slideEndAnimatoin) { 131 this.s.hideControlOnEnd = false; 132 } 133 134 // Gallery items 135 if (this.s.dynamic) { 136 this.$items = this.s.dynamicEl; 137 } else { 138 if (this.s.selector === 'this') { 139 this.$items = this.$el; 140 } else if (this.s.selector !== '') { 141 if (this.s.selectWithin) { 142 this.$items = $(this.s.selectWithin).find(this.s.selector); 143 } else { 144 this.$items = this.$el.find($(this.s.selector)); 145 } 146 } else { 147 this.$items = this.$el.children(); 148 } 149 } 150 151 // .lg-item 152 this.$slide = ''; 153 154 // .lg-outer 155 this.$outer = ''; 156 157 this.$focusedElementBeforeOpen = null; 158 159 this.focusableElementsString = "a[href], area[href], input
159:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, *[tabindex], *[contenteditable]"; 160 161 this.init(); 162 163 return this; 164 } 165 166 Plugin.prototype.init = function() { 167 168 var _this = this; 169 170 // s.preload should not be more than $item.length 171 if (_this.s.preload > _this.$items.length) { 172 _this.s.preload = _this.$items.length; 173 } 174 175 // if dynamic option is enabled execute immediately 176 var _hash = window.location.hash; 177 if (_hash.indexOf('lg=' + this.s.galleryId) > 0) { 178 179 _this.index = parseInt(_hash.split('&slide=')[1], 10); 180 181 $('body').addClass('lg-from-hash'); 182 if (!$('body').hasClass('lg-on')) { 183 setTimeout(function() { 184 _this.build(_this.index); 185 }); 186 187 $('body').addClass('lg-on'); 188 } 189 } 190 191 if (_this.s.dynamic) { 192 193 _this.$el.trigger('onBeforeOpen.lg'); 194 195 _this.index = _this.s.index || 0; 196 197 // prevent accidental double execution 198 if (!$('body').hasClass('lg-on')) { 199 setTimeout(function() { 200 _this.build(_this.index); 201 $('body').addClass('lg-on'); 202 }); 203 } 204 } else { 205 206 // Using different namespace for click because click event should not unbind if selector is same object('this') 207 _this.$items.on('click.lgcustom', function(event) { 208 209 // For IE8 210 try { 211 event.preventDefault(); 212 event.preventDefault(); 213 } catch (er) { 214 event.returnValue = false; 215 } 216 217 _this.$el.trigger('onBeforeOpen.lg'); 218 219 _this.index = _this.s.index || _this.$items.index(this); 220 221 // prevent accidental double execution 222 if (!$('body').hasClass('lg-on')) { 223 _this.build(_this.index); 224 $('body').addClass('lg-on'); 225 } 226 227 _this.$focusedElementBeforeOpen = $(this); 228 $('#page').attr('aria-hidden', true); 229 _this.$items.attr('aria-hidden', true); 230 }); 231 } 232 233 }; 234 235 Plugin.prototype.build = function(index) { 236 237 var _this = this; 238 239 _this.structure(); 240 241 // module constructor 242 $.each($.fn.lightGallery.modules, function(key) { 243 _this.modules[key] = new $.fn.lightGallery.modules[key](_this.el); 244 }); 245 246 // initiate slide function 247 _this.slide(index, false, false, false); 248 249 if (_this.s.keyPress) { 250 _this.keyPress(); 251 } 252 253 if (_this.$items.length > 1) { 254 255 _this.arrow(); 256 257 setTimeout(function() { 258 _this.enableDrag(); 259 _this.enableSwipe(); 260 }, 50); 261 262 if (_this.s.mousewheel) { 263 _this.mousewheel(); 264 } 265 } else { 266 _this.$slide.on('click.lg', function() { 267 _this.$el.trigger('onSlideClick.lg'); 268 }); 269 } 270 271 _this.counter(); 272 273 _this.closeGallery(); 274 275 _this.$el.trigger('onAfterOpen.lg'); 276 277 // Hide controllers if mouse doesn't move for some period 278 _this.$outer.on('mousemove.lg click.lg touchstart.lg keyup.lg', function() { 279 280 _this.$outer.removeClass('lg-hide-items'); 281 282 clearTimeout(_this.hideBartimeout); 283 284 // Timeout will be cleared on each slide movement also 285 _this.hideBartimeout = setTimeout(function() { 286 _this.$outer.addClass('lg-hide-items'); 287 }, _this.s.hideBarsDelay); 288 289 }); 290 291 _this.$outer.trigger('mousemove.lg'); 292 const defaultFocus = ($('.lg-next').length === 0) ? '.lg-close':'.lg-next'; 293 $(defaultFocus).focus(); 294 295 }; 296 297 Plugin.prototype.structure = function() { 298 var list = ''; 299 var controls = ''; 300 var i = 0; 301 var subHtmlCont = ''; 302 var template; 303 var _this = this; 304 305 $('body').append('<div class="lg-backdrop"></div>'); 306 $('.lg-backdrop').css('transition-duration', this.s.backdropDuration + 'ms'); 307 308 // Create gallery items 309 for (i = 0; i < this.$items.length; i++) { 310 list += '<div class="lg-item" aria-hidden="true"></div>'; 311 } 312 313 // Create controlls 314 if (this.s.controls && this.$items.length > 1) { 315 controls = '<div class="lg-actions">' + 316 '<button aria-label="Previous Slide" title="Previous Slide" class="lg-prev lg-icon fa fa-chevron-left">' + this.s.prevHtml + '</button>' + 317 '<button aria-label="Next Slide" title="Next Slide" class="lg-next lg-icon fa fa-chevron-right">' + this.s.nextHtml + '</button>' + 318 '</div>'; 319 } 320 321 if (this.s.appendSubHtmlTo === '.lg-sub-html') { 322 subHtmlCont = '<div class="lg-sub-html"></div>'; 323 } 324 325 template = '<div role="dialog" tabindex="1" class="lg-outer ' + this.s.addClass + ' ' + this.s.startClass + '">' + 326 '<div class="lg" style="width:' + this.s.width + '; height:' + this.s.height + '">' + 327 '<div class="lg-inner">
327' + list + '</div>' + 328 '<div class="lg-toolbar lg-group">' + 329 '<button aria-label="Close" title="Close" class="lg-close lg-icon fa fa-times"></button>' + 330 '</div>' + 331 controls + 332 subHtmlCont + 333 '</div>' + 334 '</div>'; 335 336 $('body').append(template); 337 this.$outer = $('.lg-outer'); 338 this.$slide = this.$outer.find('.lg-item'); 339 340 if (this.s.useLeft) { 341 this.$outer.addClass('lg-use-left'); 342 343 // Set mode lg-slide if use left is true; 344 this.s.mode = 'lg-slide'; 345 } else { 346 this.$outer.addClass('lg-use-css3'); 347 } 348 349 // For fixed height gallery 350 _this.setTop(); 351 $(window).on('resize.lg orientationchange.lg', function() { 352 setTimeout(function() { 353 _this.setTop(); 354 }, 100); 355 }); 356 357 // add class lg-current to remove initial transition 358 this.$slide.eq(this.index).addClass('lg-current'); 359 360 // add Class for css support and transition mode 361 if (this.doCss()) { 362 this.$outer.addClass('lg-css3'); 363 } else { 364 this.$outer.addClass('lg-css'); 365 366 // Set speed 0 because no animation will happen if browser doesn't support css3 367 this.s.speed = 0; 368 } 369 370 this.$outer.addClass(this.s.mode); 371 372 if (this.s.enableDrag && this.$items.length > 1) { 373 this.$outer.addClass('lg-grab'); 374 } 375 376 if (this.s.showAfterLoad) { 377 this.$outer.addClass('lg-show-after-load'); 378 } 379 380 if (this.doCss()) { 381 var $inner = this.$outer.find('.lg-inner'); 382 $inner.css('transition-timing-function', this.s.cssEasing); 383 $inner.css('transition-duration', this.s.speed + 'ms'); 384 } 385 386 setTimeout(function() { 387 $('.lg-backdrop').addClass('in'); 388 }); 389 390 setTimeout(function() { 391 _this.$outer.addClass('lg-visible'); 392 }, this.s.backdropDuration); 393 394 if (this.s.download) { 395 this.$outer.find('.lg-toolbar').append('<a id="lg-download" aria-label="Download" title="Download" target="_blank" download class="button lg-download lg-icon fa fa-download"><span class=""></span></a>'); 396 } 397 398 // Store the current scroll top value to scroll back after closing the gallery.. 399 this.prevScrollTop = $(window).scrollTop(); 400 401 }; 402 403 // For fixed height gallery 404 Plugin.prototype.setTop = function() { 405 if (this.s.height !== '100%') { 406 var wH = $(window).height(); 407 var top = (wH - parseInt(this.s.height, 10)) / 2; 408 var $lGallery = this.$outer.find('.lg'); 409 if (wH >= parseInt(this.s.height, 10)) { 410 $lGallery.css('top', top + 'px'); 411 } else { 412 $lGallery.css('top', '0px'); 413 } 414 } 415 }; 416 417 // Find css3 support 418 Plugin.prototype.doCss = function() { 419 // check for css animation support 420 var support = function() { 421 var transition = ['transition', 'MozTransition', 'WebkitTransition', 'OTransition', 'msTransition', 'KhtmlTransition']; 422 var root = document.documentElement; 423 var i = 0; 424 for (i = 0; i < transition.length; i++) { 425 if (transition[i] in root.style) { 426 return true; 427 } 428 } 429 }; 430 431 if (support()) { 432 return true; 433 } 434 435 return false; 436 }; 437 438 /** 439 * @desc Check the given src is video 440 * @param {String} src 441 * @return {Object} video type 442 * Ex:{ youtube : ["//www.youtube.com/watch?v=c0asJgSyxcY", "c0asJgSyxcY"] } 443 */ 444 Plugin.prototype.isVideo = function(src, index) { 445 446 var html; 447 if (this.s.dynamic) { 448 html = this.s.dynamicEl[index].html; 449 } else { 450 html = this.$items.eq(index).attr('data-html'); 451 } 452 453 if (!src) { 454 if(html) { 455 return { 456 html5: true 457 }; 458 } else { 459 console.error('lightGallery :- data-src is not pvovided 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'); 460 return false;
461 } 462 } 463 464 var youtube = src.match(/(?:youtube\.com\/\S*(?:(?:\/e(?:mbed))?\/|watch\?(?:\S*?&?v\=)|shorts\/)|youtu\.be\/)(?<id>[a-zA-Z0-9_-]{6,11})/i); 465 var vimeo = src.match(/\/\/(?:www\.)?vimeo.com\/([0-9a-z\-_]+)/i); 466 var dailymotion = src.match(/\/\/(?:www\.)?dai.ly\/([0-9a-z\-_]+)/i); 467 var vk = src.match(/\/\/(?:www\.)?(?:vk\.com|vkontakte\.ru)\/(?:video_ext\.php\?)(.*)/i); 468 469 if (youtube) { 470 return { 471 youtube: youtube 472 }; 473 } else if (vimeo) { 474 return { 475 vimeo: vimeo 476 }; 477 } else if (dailymotion) { 478 return { 479 dailymotion: dailymotion 480 }; 481 } else if (vk) { 482 return { 483 vk: vk 484 }; 485 } 486 }; 487 488 /** 489 * @desc Create image counter 490 * Ex: 1/10 491 */ 492 Plugin.prototype.counter = function() { 493 if (this.s.counter) { 494 $(this.s.appendCounterTo).append('<div id="lg-counter"><span id="lg-counter-current">' + (parseInt(this.index, 10) + 1) + '</span> / <span id="lg-counter-all">' + this.$items.length + '</span></div>'); 495 } 496 }; 497 498 /** 499 * @desc add sub-html into the slide 500 * @param {Number} index - index of the slide 501 */ 502 Plugin.prototype.addHtml = function(index) { 503 var subHtml = null; 504 var subHtmlUrl; 505 var $currentEle; 506 if (this.s.dynamic) { 507 if (this.s.dynamicEl[index].subHtmlUrl) { 508 subHtmlUrl = this.s.dynamicEl[index].subHtmlUrl; 509 } else { 510 subHtml = this.s.dynamicEl[index].subHtml; 511 } 512 } else { 513 $currentEle = this.$items.eq(index); 514 if ($currentEle.attr('data-sub-html-url')) { 515 subHtmlUrl = $currentEle.attr('data-sub-html-url'); 516 } else { 517 subHtml = $currentEle.attr('data-sub-html'); 518 if (this.s.getCaptionFromTitleOrAlt && !subHtml) { 519 subHtml = $currentEle.attr('title') || $currentEle.find('img').first().attr('alt'); 520 } 521 } 522 } 523 524 if (!subHtmlUrl) { 525 if (typeof subHtml !== 'undefined' && subHtml !== null) { 526 527 // get first letter of subhtml 528 // if first letter starts with . or # get the html form the jQuery object 529 var fL = subHtml.substring(0, 1); 530 if (fL === '.' || fL === '#') { 531 if (this.s.subHtmlSelectorRelative && !this.s.dynamic) { 532 subHtml = $currentEle.find(subHtml).html(); 533 } else { 534 subHtml = $(subHtml).html(); 535 } 536 } 537 } else { 538 subHtml = ''; 539 } 540 } 541 542 if (this.s.appendSubHtmlTo === '.lg-sub-html') { 543 544 if (subHtmlUrl) { 545 this.$outer.find(this.s.appendSubHtmlTo).load(subHtmlUrl); 546 } else { 547 this.$outer.find(this.s.appendSubHtmlTo).html(subHtml); 548 } 549 550 } else { 551 552 if (subHtmlUrl) { 553 this.$slide.eq(index).load(subHtmlUrl); 554 } else { 555 this.$slide.eq(index).append(subHtml); 556 } 557 } 558 559 // Add lg-empty-html class if title doesn't exist 560 if (typeof subHtml !== 'undefined' && subHtml !== null) { 561 if (subHtml === '') { 562 this.$outer.find(this.s.appendSubHtmlTo).addClass('lg-empty-html'); 563 } else { 564 this.$outer.find(this.s.appendSubHtmlTo).removeClass('lg-empty-html'); 565 } 566 } 567 568 this.$el.trigger('onAfterAppendSubHtml.lg', [index]); 569 }; 570 571 /** 572 * @desc Preload slides 573 * @param {Number} index - index of the slide 574 */ 575 Plugin.prototype.preload = function(index) { 576 var i = 1; 577 var j = 1; 578 for (i = 1; i <= this.s.preload; i++) { 579 if (i >= this.$items.length - index) { 580 break; 581 } 582 583 this.loadContent(index + i, false, 0); 584 } 585 586 for (j = 1; j <= this.s.preload; j++) { 587 if (index - j < 0) { 588 break; 589 } 590 591 this.loadContent(index - j, false, 0); 592 } 593 }; 594 595 /**
596 * @desc Load slide content into slide. 597 * @param {Number} index - index of the slide. 598 * @param {Boolean} rec - if true call loadcontent() function again. 599 * @param {Boolean} delay - delay for adding complete class. it is 0 except first time. 600 */ 601 Plugin.prototype.loadContent = function(index, rec, delay) { 602 603 var _this = this; 604 var _hasPoster = false; 605 var _$img; 606 var _src; 607 var _poster; 608 var _srcset; 609 var _sizes; 610 var _html; 611 var getResponsiveSrc = function(srcItms) { 612 var rsWidth = []; 613 var rsSrc = []; 614 for (var i = 0; i < srcItms.length; i++) { 615 var __src = srcItms[i].split(' '); 616 617 // Manage empty space 618 if (__src[0] === '') { 619 __src.splice(0, 1); 620 } 621 622 rsSrc.push(__src[0]); 623 rsWidth.push(__src[1]); 624 } 625 626 var wWidth = $(window).width(); 627 for (var j = 0; j < rsWidth.length; j++) { 628 if (parseInt(rsWidth[j], 10) > wWidth) { 629 _src = rsSrc[j]; 630 break; 631 } 632 } 633 }; 634 var alt = _this.$items.eq(index).find('img').first().attr('alt'); 635 636 if (_this.s.dynamic) { 637 638 if (_this.s.dynamicEl[index].poster) { 639 _hasPoster = true; 640 _poster = _this.s.dynamicEl[index].poster; 641 } 642 643 _html = _this.s.dynamicEl[index].html; 644 _src = _this.s.dynamicEl[index].src; 645 646 if (_this.s.dynamicEl[index].responsive) { 647 var srcDyItms = _this.s.dynamicEl[index].responsive.split(','); 648 getResponsiveSrc(srcDyItms); 649 } 650 651 _srcset = _this.s.dynamicEl[index].srcset; 652 _sizes = _this.s.dynamicEl[index].sizes; 653 654 } else { 655 656 if (_this.$items.eq(index).attr('data-poster')) { 657 _hasPoster = true; 658 _poster = _this.$items.eq(index).attr('data-poster'); 659 } 660 661 _html = _this.$items.eq(index).attr('data-html'); 662 _src = _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src'); 663 664 if (_this.$items.eq(index).attr('data-responsive')) { 665 var srcItms = _this.$items.eq(index).attr('data-responsive').split(','); 666 getResponsiveSrc(srcItms); 667 } 668 669 _srcset = _this.$items.eq(index).attr('data-srcset'); 670 _sizes = _this.$items.eq(index).attr('data-sizes'); 671 672 } 673 674 //if (_src || _srcset || _sizes || _poster) { 675 676 var iframe = false; 677 if (_this.s.dynamic) { 678 if (_this.s.dynamicEl[index].iframe) { 679 iframe = true; 680 } 681 } else { 682 if (_this.$items.eq(index).attr('data-iframe') === 'true') { 683 iframe = true; 684 } 685 } 686 687 var _isVideo = _this.isVideo(_src, index); 688 if (!_this.$slide.eq(index).hasClass('lg-loaded')) { 689 if (iframe) { 690 _this.$slide.eq(index).prepend('<div class="lg-video-cont lg-has-iframe" style="max-width:' + _this.s.iframeMaxWidth + '"><div class="lg-video"><iframe class="lg-object" frameborder="0" src="' + _src + '" allowfullscreen="true"></iframe></div></div>'); 691 } else if (_hasPoster) { 692 var videoClass = ''; 693 if (_isVideo && _isVideo.youtube) { 694 videoClass = 'lg-has-youtube'; 695 } else if (_isVideo && _isVideo.vimeo) { 696 videoClass = 'lg-has-vimeo'; 697 } else { 698 videoClass = 'lg-has-html5'; 699 } 700 701 _this.$slide.eq(index).prepend('<div class="lg-video-cont ' + videoClass + ' "><div class="lg-video"><span class="lg-video-play"></span><img class="lg-object lg-has-poster" src="' + _poster + '" alt="' + alt + '" /></div></div>'); 702 703 } else if (_isVideo) { 704 _this.$slide.eq(index).prepend('<div class="lg-video-cont "><div class="lg-video"></div></div>'); 705 _this.$el.trigger('hasVideo.lg', [index, _src, _html]); 706 } else { 707 _this.$slide.eq(index).prepend('<div class="lg-img-wrap"><img class="lg-object lg-image" src="' + _src + '" alt="' + alt + '" /></div>'); 708 } 709 710 _this.$el.trigger('onAferAppendSlide.lg', [index]); 711 712 _$img = _this.$slide.eq(index).find('.lg-object'); 713 if (_sizes) { 714 _$img.attr('sizes', _sizes); 715 } 716 717 if (_srcset) { 718 _$img.attr('srcset', _srcset); 719 try { 720 picturefill({ 721 elements: [_$img[0]] 722 }); 723 } catch (e) { 724 console.warn('lightGallery :- If you want srcset to be supported for older browser please include picturefil version 2 javascript library in your document.'); 725 } 726 } 727 728 if (this.s.appendSubHtmlTo !== '.lg-sub-html') { 729 _this.addHtml(index); 730 } 731 732 _this.$slide.eq(index).addClass('lg-loaded'); 733 } 734 735 _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() { 736 737 // For first time add some delay for displaying the start animation. 738 var _speed = 0; 739
740 // Do not change the delay value because it is required for zoom plugin. 741 // If gallery opened from direct url (hash) speed value should be 0 742 if (delay && !$('body').hasClass('lg-from-hash')) { 743 _speed = delay; 744 } 745 746 setTimeout(function() { 747 _this.$slide.eq(index).addClass('lg-complete'); 748 _this.$el.trigger('onSlideItemLoad.lg', [index, delay || 0]); 749 }, _speed); 750 751 }); 752 753 // @todo check load state for html5 videos 754 if (_isVideo && _isVideo.html5 && !_hasPoster) { 755 _this.$slide.eq(index).addClass('lg-complete'); 756 } 757 758 if (rec === true) { 759 if (!_this.$slide.eq(index).hasClass('lg-complete')) { 760 _this.$slide.eq(index).find('.lg-object').on('load.lg error.lg', function() { 761 _this.preload(index); 762 }); 763 } else { 764 _this.preload(index); 765 } 766 } 767 768 //} 769 }; 770 771 /** 772 * @desc slide function for lightgallery 773 ** Slide() gets call on start 774 ** ** Set lg.on true once slide() function gets called. 775 ** Call loadContent() on slide() function inside setTimeout 776 ** ** On first slide we do not want any animation like slide of fade 777 ** ** So on first slide( if lg.on if false that is first slide) loadContent() should start loading immediately 778 ** ** Else loadContent() should wait for the transition to complete. 779 ** ** So set timeout s.speed + 50 780 <=> ** loadContent() will load slide content in to the particular slide 781 ** ** It has recursion (rec) parameter. if rec === true loadContent() will call preload() function. 782 ** ** preload will execute only when the previous slide is fully loaded (images iframe) 783 ** ** avoid simultaneous image load 784 <=> ** Preload() will check for s.preload value and call loadContent() again accoring to preload value 785 ** loadContent() <====> Preload(); 786 787 * @param {Number} index - index of the slide 788 * @param {Boolean} fromTouch - true if slide function called via touch event or mouse drag 789 * @param {Boolean} fromThumb - true if slide function called via thumbnail click 790 * @param {String} direction - Direction of the slide(next/prev) 791 */ 792 Plugin.prototype.slide = function(index, fromTouch, fromThumb, direction) { 793 794 var _prevIndex = this.$outer.find('.lg-current').index(); 795 var _this = this; 796 797 // Prevent if multiple call 798 // Required for hsh plugin 799 if (_this.lGalleryOn && (_prevIndex === index)) { 800 return; 801 } 802 803 var _length = this.$slide.length; 804 var _time = _this.lGalleryOn ? this.s.speed : 0; 805 806 if (!_this.lgBusy) { 807 808 if (this.s.download) { 809 var _src; 810 if (_this.s.dynamic) { 811 _src = _this.s.dynamicEl[index].downloadUrl !== false && (_this.s.dynamicEl[index].downloadUrl || _this.s.dynamicEl[index].src); 812 } else { 813 _src = _this.$items.eq(index).attr('data-download-url') !== 'false' && (_this.$items.eq(index).attr('data-download-url') || _this.$items.eq(index).attr('href') || _this.$items.eq(index).attr('data-src')); 814 815 } 816 817 if (_src) { 818 $('#lg-download').attr('href', _src); 819 _this.$outer.removeClass('lg-hide-download'); 820 } else { 821 _this.$outer.addClass('lg-hide-download'); 822 } 823 } 824 825 this.$el.trigger('onBeforeSlide.lg', [_prevIndex, index, fromTouch, fromThumb]); 826 827 _this.lgBusy = true; 828 829 clearTimeout(_this.hideBartimeout); 830 831 // Add title if this.s.appendSubHtmlTo === lg-sub-html 832 if (this.s.appendSubHtmlTo === '.lg-sub-html') { 833 834 // wait for slide animation to complete 835 setTimeout(function() { 836 _this.addHtml(index); 837 }, _time); 838 } 839 840 this.arrowDisable(index); 841 842 if (!direction) { 843 if (index < _prevIndex) { 844 direction = 'prev'; 845 } else if (index > _prevIndex) {
846 direction = 'next'; 847 } 848 } 849 850 if (!fromTouch) { 851 852 // remove all transitions 853 _this.$outer.addClass('lg-no-trans'); 854 855 this.$slide.removeClass('lg-prev-slide lg-next-slide'); 856 this.$slide.attr('aria-hidden', 'true'); 857 858 if (direction === 'prev') { 859 860 //prevslide 861 this.$slide.eq(index).addClass('lg-prev-slide'); 862 this.$slide.eq(_prevIndex).addClass('lg-next-slide'); 863 } else { 864 865 // next slide 866 this.$slide.eq(index).addClass('lg-next-slide'); 867 this.$slide.eq(_prevIndex).addClass('lg-prev-slide'); 868 } 869 870 // give 50 ms for browser to add/remove class 871 setTimeout(function() { 872 _this.$slide.removeClass('lg-current'); 873 874 //_this.$slide.eq(_prevIndex).removeClass('lg-current'); 875 _this.$slide.eq(index).addClass('lg-current'); 876 _this.$slide.eq(index).removeAttr('aria-hidden'); 877 878 // reset all transitions 879 _this.$outer.removeClass('lg-no-trans'); 880 }, 50); 881 } else { 882 883 this.$slide.removeClass('lg-prev-slide lg-current lg-next-slide'); 884 var touchPrev; 885 var touchNext; 886 if (_length > 2) { 887 touchPrev = index - 1; 888 touchNext = index + 1; 889 890 if ((index === 0) && (_prevIndex === _length - 1)) { 891 892 // next slide 893 touchNext = 0; 894 touchPrev = _length - 1; 895 } else if ((index === _length - 1) && (_prevIndex === 0)) { 896 897 // prev slide 898 touchNext = 0; 899 touchPrev = _length - 1; 900 } 901 902 } else { 903 touchPrev = 0; 904 touchNext = 1; 905 } 906 907 if (direction === 'prev') { 908 _this.$slide.eq(touchNext).addClass('lg-next-slide'); 909 } else { 910 _this.$slide.eq(touchPrev).addClass('lg-prev-slide'); 911 } 912 913 _this.$slide.eq(index).addClass('lg-current'); 914 _this.$slide.eq(index).removeAttr('aria-hidden'); 915 } 916 917 if (_this.lGalleryOn) { 918 setTimeout(function() { 919 _this.loadContent(index, true, 0); 920 }, this.s.speed + 50); 921 922 setTimeout(function() { 923 _this.lgBusy = false; 924 _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]); 925 }, this.s.speed); 926 927 } else { 928 _this.loadContent(index, true, _this.s.backdropDuration); 929 930 _this.lgBusy = false; 931 _this.$el.trigger('onAfterSlide.lg', [_prevIndex, index, fromTouch, fromThumb]); 932 } 933 934 _this.lGalleryOn = true; 935 936 if (this.s.counter) { 937 $('#lg-counter-current').text(index + 1); 938 } 939 940 } 941 _this.index = index; 942 943 }; 944 945 /** 946 * @desc Go to next slide 947 * @param {Boolean} fromTouch - true if slide function called via touch event 948 */ 949 Plugin.prototype.goToNextSlide = function(fromTouch) { 950 var _this = this; 951 var _loop = _this.s.loop; 952 if (fromTouch && _this.$slide.length < 3) { 953 _loop = false; 954 } 955 956 if (!_this.lgBusy) { 957 if ((_this.index + 1) < _this.$slide.length) { 958 _this.index++; 959 _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]); 960 _this.slide(_this.index, fromTouch, false, 'next'); 961 } else { 962 if (_loop) { 963 _this.index = 0; 964 _this.$el.trigger('onBeforeNextSlide.lg', [_this.index]); 965 _this.slide(_this.index, fromTouch, false, 'next'); 966 } else if (_this.s.slideEndAnimatoin && !fromTouch) { 967 _this.$outer.addClass('lg-right-end'); 968 setTimeout(function() { 969 _this.$outer.removeClass('lg-right-end'); 970 }, 400); 971 } 972 } 973 } 974 }; 975 976 /** 977 * @desc Go to last slide 978 * @param {Boolean} fromTouch - true if slide function called via touch event 979 */ 980 Plugin.prototype.goToLastSlide = function(fromTouch) { 981 var _this = this; 982 _this.index = (_this.$slide.length - 1); 983 984 if (!_this.lgBusy) { 985 _this.$el.trigger('onBeforeNextSlide.lg', [_this.index, fromTouch]); 986 _this.slide(_this.index, fromTouch, false, 'next'); 987 } 988 }; 989 990 /** 991 * @desc Go to previous slide 992 * @param {Boolean} fromTouch - true if slide function called via touch event 993 */ 994 Plugin.prototype.goToPrevSlide = function(fromTouch) { 995 var _this = this; 996 var _loop = _this.s.loop; 997 if (fromTouch && _this.$slide.length < 3) { 998 _loop = false;
999 } 1000 1001 if (!_this.lgBusy) { 1002 if (_this.index > 0) { 1003 _this.index--; 1004 _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]); 1005 _this.slide(_this.index, fromTouch, false, 'prev'); 1006 } else { 1007 if (_loop) { 1008 _this.index = _this.$items.length - 1; 1009 _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]); 1010 _this.slide(_this.index, fromTouch, false, 'prev'); 1011 } else if (_this.s.slideEndAnimatoin && !fromTouch) { 1012 _this.$outer.addClass('lg-left-end'); 1013 setTimeout(function() { 1014 _this.$outer.removeClass('lg-left-end'); 1015 }, 400); 1016 } 1017 } 1018 } 1019 }; 1020 1021 /** 1022 * @desc Go to first slide 1023 * @param {Boolean} fromTouch - tru if slide function called via touch event 1024 */ 1025 Plugin.prototype.goToFirstSlide = function(fromTouch) { 1026 var _this = this; 1027 _this.index = 0; 1028 1029 if (!_this.lgBusy) { 1030 _this.$el.trigger('onBeforePrevSlide.lg', [_this.index, fromTouch]); 1031 _this.slide(_this.index, fromTouch, false, 'prev'); 1032 } 1033 }; 1034 1035 Plugin.prototype.keyPress = function() { 1036 var _this = this; 1037 var shiftDown = false; 1038 1039 $(window).on('keyup.lg', function(e) { 1040 if (e.keyCode == 16) { 1041 shiftDown = false; 1042 } 1043 }); 1044 1045 if (this.$items.length > 1) { 1046 $(window).on('keyup.lg', function(e) { 1047 if (_this.$items.length > 1) { 1048 if (e.keyCode === 37) { 1049 e.preventDefault(); 1050 _this.goToPrevSlide(); 1051 } 1052 1053 if (e.keyCode === 39) { 1054 e.preventDefault(); 1055 _this.goToNextSlide(); 1056 } 1057 1058 if (e.keyCode === 36) { 1059 e.preventDefault(); 1060 _this.goToFirstSlide(); 1061 } 1062 1063 if (e.keyCode === 35) { 1064 e.preventDefault(); 1065 _this.goToLastSlide(); 1066 } 1067 } 1068 }); 1069 } 1070 1071 $(window).on('keydown.lg', function(e) { 1072 if (e.keyCode == 16) { 1073 shiftDown = true; 1074 } 1075 1076 if ($('.lg-toogle-thumb').is(':focus') && !shiftDown && e.keyCode == 9) { 1077 e.preventDefault(); 1078 $('button.lg-close').focus() 1079 } 1080 if ($('.lg-close').is(':focus') && shiftDown && e.keyCode == 9) { 1081 e.preventDefault(); 1082 $('button.lg-toogle-thumb').focus() 1083 } 1084 if ($(':focus', '.lg').length === 0) { 1085 var $focusElement = $('button.lg-close'); 1086 $focusElement.focus() 1087 } 1088 1089 1090 1091 1092 1093 if (_this.s.escKey === true && e.keyCode === 27) { 1094 e.preventDefault(); 1095 if (!_this.$outer.hasClass('lg-thumb-open')) { 1096 _this.destroy(); 1097 } else { 1098 _this.$outer.removeClass('lg-thumb-open'); 1099 if(Object.prototype.hasOwnProperty(_this.core, "$outer")) { 1100 _this.core.$outer.find('.lg-toogle-thumb').attr('aria-expanded', 'false'); 1101 } 1102 } 1103 } 1104 }); 1105 }; 1106 1107 Plugin.prototype.arrow = function() { 1108 var _this = this; 1109 this.$outer.find('.lg-prev').on('click.lg', function() { 1110 _this.goToPrevSlide(); 1111 }); 1112 1113 this.$outer.find('.lg-next').on('click.lg', function() { 1114 _this.goToNextSlide(); 1115 }); 1116 }; 1117 1118 Plugin.prototype.arrowDisable = function(index) { 1119 1120 // Disable arrows if s.hideControlOnEnd is true 1121 if (!this.s.loop && this.s.hideControlOnEnd) { 1122 if ((index + 1) < this.$slide.length) { 1123 this.$outer.find('.lg-next').removeAttr('disabled').removeClass('disabled'); 1124 } else { 1125 this.$outer.find('.lg-next').attr('disabled', 'disabled').addClass('disabled'); 1126 } 1127 1128 if (index > 0) { 1129 this.$outer.find('.lg-prev').removeAttr('disabled').removeClass('disabled'); 1130 } else { 1131 this.$outer.find('.lg-prev').attr('disabled', 'disabled').addClass('disabled'); 1132 } 1133 } 1134 }; 1135 1136 Plugin.prototype.setTranslate = function($el, xValue, yValue) { 1137 // jQuery supports Automatic CSS prefixing since jQuery 1.8.0 1138 if (this.s.useLeft) { 1139 $el.css('left', xValue); 1140 } else { 1141 $el.css({ 1142 transform: 'translate3d(' + (xValue) + 'px, ' + yValue + 'px, 0px)' 1143 }); 1144 } 1145 }; 1146 1147 Plugin.prototype.touchMove = function(startCoords, endCoords) { 1148 1149 var distance = endCoords - startCoords; 1150 1151 if (Math.abs(distance) > 15) { 1152 // reset opacity and transition duration 1153 this.$outer.addClass('lg-dragging'); 1154 1155 // move current slide 1156 this.setTranslate(this.$slide.eq(this.index), distance, 0); 1157 1158 // move next and prev slide with current slide 1159 this.setTranslate($('.lg-prev-slide'), -this.$slide.eq(this.index).width() + distance, 0); 1160 this.setTranslate($('.lg-next-slide'), this.$slide.eq(this.index).width() + distance, 0); 1161 } 1162 }; 1163 1164 Plugin.prototype.touchEnd = function(distance) { 1165 var _this = this; 1166 1167 // keep slide animation for any mode while dragg/swipe 1168 if (_this.s.mode !== 'lg-slide') { 1169 _this.$outer.addClass('lg-slide'); 1170 } 1171 1172 this.$slide.not('.lg-current, .lg-prev-slide, .lg-next-slide').css('opacity', '0'); 1173 1174 // set transition duration 1175 setTimeout(function() { 1176 _this.$outer.removeClass('lg-dragging'); 1177 if ((distance < 0) && (Math.abs(distance) > _this.s.swipeThreshold)) { 1178 _this.goToNextSlide(true); 1179 } else if ((distance > 0) && (Math.abs(distance) > _this.s.swipeThreshold)) { 1180 _this.goToPrevSlide(true); 1181 } else if (Math.abs(distance) < 5) { 1182 1183 // Trigger click if distance is less than 5 pix 1184 _this.$el.trigger('onSlideClick.lg'); 1185 } 1186 1187 _this.$slide.removeAttr('style'); 1188 }); 1189 1190 // remove slide class once drag/swipe is completed if mode is not slide 1191 setTimeout(function() { 1192 if (!_this.$outer.hasClass('lg-dragging') && _this.s.mode !== 'lg-slide') { 1193 _this.$outer.removeClass('lg-slide'); 1194 } 1195 }, _this.s.speed + 100); 1196 1197 }; 1198 1199 Plugin.prototype.enableSwipe = function() { 1200 var _this = this; 1201 var startCoords = 0; 1202 var endCoords = 0; 1203 var isMoved = false;
1204 1205 if (_this.s.enableSwipe && _this.doCss()) { 1206 1207 _this.$slide.on('touchstart.lg', function(e) { 1208 if (!_this.$outer.hasClass('lg-zoomed') && !_this.lgBusy) { 1209 e.preventDefault(); 1210 _this.manageSwipeClass(); 1211 startCoords = e.originalEvent.targetTouches[0].pageX; 1212 } 1213 }); 1214 1215 _this.$slide.on('touchmove.lg', function(e) { 1216 if (!_this.$outer.hasClass('lg-zoomed')) { 1217 e.preventDefault(); 1218 endCoords = e.originalEvent.targetTouches[0].pageX; 1219 _this.touchMove(startCoords, endCoords); 1220 isMoved = true; 1221 } 1222 }); 1223 1224 _this.$slide.on('touchend.lg', function() { 1225 if (!_this.$outer.hasClass('lg-zoomed')) { 1226 if (isMoved) { 1227 isMoved = false; 1228 _this.touchEnd(endCoords - startCoords); 1229 } else { 1230 _this.$el.trigger('onSlideClick.lg'); 1231 } 1232 } 1233 }); 1234 } 1235 1236 }; 1237 1238 Plugin.prototype.enableDrag = function() { 1239 var _this = this; 1240 var startCoords = 0; 1241 var endCoords = 0; 1242 var isDraging = false; 1243 var isMoved = false; 1244 if (_this.s.enableDrag && _this.doCss()) { 1245 _this.$slide.on('mousedown.lg', function(e) { 1246 // execute only on .lg-object 1247 if (!_this.$outer.hasClass('lg-zoomed')) { 1248 if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) { 1249 e.preventDefault(); 1250 1251 if (!_this.lgBusy) { 1252 _this.manageSwipeClass(); 1253 startCoords = e.pageX; 1254 isDraging = true; 1255 1256 // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723 1257 _this.$outer.scrollLeft += 1; 1258 _this.$outer.scrollLeft -= 1; 1259 1260 // * 1261 1262 _this.$outer.removeClass('lg-grab').addClass('lg-grabbing'); 1263 1264 _this.$el.trigger('onDragstart.lg'); 1265 } 1266 1267 } 1268 } 1269 }); 1270 1271 $(window).on('mousemove.lg', function(e) { 1272 if (isDraging) { 1273 isMoved = true; 1274 endCoords = e.pageX; 1275 _this.touchMove(startCoords, endCoords); 1276 _this.$el.trigger('onDragmove.lg'); 1277 } 1278 }); 1279 1280 $(window).on('mouseup.lg', function(e) { 1281 if (isMoved) { 1282 isMoved = false; 1283 _this.touchEnd(endCoords - startCoords); 1284 _this.$el.trigger('onDragend.lg'); 1285 } else if ($(e.target).hasClass('lg-object') || $(e.target).hasClass('lg-video-play')) { 1286 _this.$el.trigger('onSlideClick.lg'); 1287 } 1288 1289 // Prevent execution on click 1290 if (isDraging) { 1291 isDraging = false; 1292 _this.$outer.removeClass('lg-grabbing').addClass('lg-grab'); 1293 } 1294 }); 1295 1296 } 1297 }; 1298 1299 Plugin.prototype.manageSwipeClass = function() { 1300 var _touchNext = this.index + 1; 1301 var _touchPrev = this.index - 1; 1302 if (this.s.loop && this.$slide.length > 2) { 1303 if (this.index === 0) { 1304 _touchPrev = this.$slide.length - 1; 1305 } else if (this.index === this.$slide.length - 1) { 1306 _touchNext = 0; 1307 } 1308 } 1309 1310 this.$slide.removeClass('lg-next-slide lg-prev-slide'); 1311 if (_touchPrev > -1) { 1312 this.$slide.eq(_touchPrev).addClass('lg-prev-slide'); 1313 } 1314 1315 this.$slide.eq(_touchNext).addClass('lg-next-slide'); 1316 }; 1317 1318 Plugin.prototype.mousewheel = function() { 1319 var _this = this; 1320 _this.$outer.on('mousewheel.lg', function(e) { 1321 1322 if (!e.deltaY) { 1323 return; 1324 } 1325 1326 if (e.deltaY > 0) { 1327 _this.goToPrevSlide(); 1328 } else { 1329 _this.goToNextSlide(); 1330 } 1331 1332 e.preventDefault(); 1333 }); 1334 1335 }; 1336 1337 Plugin.prototype.closeGallery = function() { 1338 1339 var _this = this; 1340 var mousedown = false;
1341 this.$outer.find('.lg-close').on('click.lg keyup.lg', function(e) { 1342 if (e.type == 'click') { 1343 _this.destroy(); 1344 } 1345 }); 1346 1347 if (_this.s.closable) { 1348 1349 // If you drag the slide and release outside gallery gets close on chrome 1350 // for preventing this check mousedown and mouseup happened on .lg-item or lg-outer 1351 _this.$outer.on('mousedown.lg', function(e) { 1352 1353 if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap')) { 1354 mousedown = true; 1355 } else { 1356 mousedown = false; 1357 } 1358 1359 }); 1360 1361 _this.$outer.on('mouseup.lg', function(e) { 1362 1363 if ($(e.target).is('.lg-outer') || $(e.target).is('.lg-item ') || $(e.target).is('.lg-img-wrap') && mousedown) { 1364 if (!_this.$outer.hasClass('lg-dragging')) { 1365 _this.destroy(); 1366 } 1367 } 1368 1369 }); 1370 1371 } 1372 1373 }; 1374 1375 Plugin.prototype.destroy = function(d) { 1376 1377 var _this = this; 1378 1379 $('#page').removeAttr('aria-hidden'); 1380 _this.$items.removeAttr('aria-hidden'); 1381 1382 1383 if (_this.$focusedElementBeforeOpen != 'undefined' && _this.$focusedElementBeforeOpen != null) { 1384 _this.$focusedElementBeforeOpen.find('a').focus(); 1385 } else { 1386 var imageSrc = $(".lg-current").find("img").attr("src"); 1387 if (imageSrc) { 1388 $('a[href="' + imageSrc + '"]')[0].focus() 1389 } 1390 } 1391 1392 if (!d) { 1393 _this.$el.trigger('onBeforeClose.lg'); 1394 $(window).scrollTop(_this.prevScrollTop); 1395 } 1396 1397 1398 /** 1399 * if d is false or undefined destroy will only close the gallery 1400 * plugins instance remains with the element 1401 * 1402 * if d is true destroy will completely remove the plugin 1403 */ 1404 1405 if (d) { 1406 if (!_this.s.dynamic) { 1407 // only when not using dynamic mode is $items a jquery collection 1408 this.$items.off('click.lg click.lgcustom'); 1409 } 1410 1411 $.removeData(_this.el, 'lightGallery'); 1412 } 1413 1414 // Unbind all events added by lightGallery 1415 this.$el.off('.lg.tm'); 1416 1417 // Distroy all lightGallery modules 1418 $.each($.fn.lightGallery.modules, function(key) { 1419 if (_this.modules[key]) { 1420 _this.modules[key].destroy(); 1421 } 1422 }); 1423 1424 this.lGalleryOn = false; 1425 1426 clearTimeout(_this.hideBartimeout); 1427 this.hideBartimeout = false; 1428 $(window).off('.lg'); 1429 $('body').removeClass('lg-on lg-from-hash'); 1430 1431 if (_this.$outer) { 1432 _this.$outer.removeClass('lg-visible'); 1433 } 1434 1435 $('.lg-backdrop').removeClass('in'); 1436 1437 setTimeout(function() { 1438 if (_this.$outer) { 1439 _this.$outer.remove(); 1440 } 1441 1442 $('.lg-backdrop').remove(); 1443 1444 if (!d) { 1445 _this.$el.trigger('onCloseAfter.lg'); 1446 } 1447 1448 }, _this.s.backdropDuration + 50); 1449 }; 1450 1451 $.fn.lightGallery = function(options) { 1452 return this.each(function() { 1453 if (!$.data(this, 'lightGallery')) { 1454 $.data(this, 'lightGallery', new Plugin(this, options)); 1455 } else { 1456 try { 1457 $(this).data('lightGallery').init(); 1458 } catch (err) { 1459 console.error('lightGallery has not initiated properly'); 1460 } 1461 } 1462 }); 1463 }; 1464 1465 $.fn.lightGallery.modules = {}; 1466 1467 })(); 1468 1469 1470})); 1471 1472/*! lg-autoplay - v1.0.4 - 2017-03-28 1473* http://sachinchoolur.github.io/lightGallery 1474* Copyright (c) 2017 Sachin N; Licensed GPLv3 */ 1475 1476(function (root, factory) { 1477 if (typeof define === 'function' && define.amd) { 1478 // AMD. Register as an anonymous module unless amdModuleId is set 1479 define(['jquery'], function (a0) { 1480 return (factory(a0)); 1481 }); 1482 } else if (typeof exports === 'object') { 1483 // Node. Does not work with strict CommonJS, but 1484 // only CommonJS-like environments that support module.exports, 1485 // like Node. 1486 module.exports = factory(require('jquery')); 1487 } else { 1488 factory(jQuery); 1489 } 1490}(this, function ($) { 1491 1492 1493 (function() { 1494 1495 'use strict'; 1496 1497 var defaults = { 1498 autoplay: false, 1499 pause: 5000, 1500 progressBar: true, 1501 fourceAutoplay: false, 1502 autoplayControls: true, 1503 appendAutoplayControlsTo: '.lg-toolbar' 1504 }; 1505 1506 /** 1507 * Creates the autoplay plugin. 1508 * @param {object} element - lightGallery element 1509 */ 1510 var Autoplay = function(element) { 1511 1512 this.core = $(element).data('lightGallery'); 1513 1514 this.$el = $(element); 1515 1516 // Execute only if items are above 1 1517 if (this.core.$items.length < 2) { 1518 return false;
vendor: 5,444 bytes, lines 1519-1663
1519 } 1520 1521 this.core.s = $.extend({}, defaults, this.core.s); 1522 this.interval = false; 1523 1524 // Identify if slide happened from autoplay 1525 this.fromAuto = true; 1526 1527 // Identify if autoplay canceled from touch/drag 1528 this.canceledOnTouch = false; 1529 1530 // save fourceautoplay value 1531 this.fourceAutoplayTemp = this.core.s.fourceAutoplay; 1532 1533 // do not allow progress bar if browser does not support css3 transitions 1534 if (!this.core.doCss()) { 1535 this.core.s.progressBar = false; 1536 } 1537 1538 this.init(); 1539 1540 return this; 1541 }; 1542 1543 Autoplay.prototype.init = function() { 1544 var _this = this; 1545 1546 // append autoplay controls 1547 if (_this.core.s.autoplayControls) { 1548 _this.controls(); 1549 } 1550 1551 // Create progress bar 1552 if (_this.core.s.progressBar) { 1553 _this.core.$outer.find('.lg').append('<div class="lg-progress-bar"><div class="lg-progress"></div></div>'); 1554 } 1555 1556 // set progress 1557 _this.progress(); 1558 1559 // Start autoplay 1560 if (_this.core.s.autoplay) { 1561 _this.$el.one('onSlideItemLoad.lg.tm', function() { 1562 _this.startlAuto(); 1563 }); 1564 } 1565 1566 // cancel interval on touchstart and dragstart 1567 _this.$el.on('onDragstart.lg.tm touchstart.lg.tm', function() { 1568 if (_this.interval) { 1569 _this.cancelAuto(); 1570 _this.canceledOnTouch = true; 1571 } 1572 }); 1573 1574 // restore autoplay if autoplay canceled from touchstart / dragstart 1575 _this.$el.on('onDragend.lg.tm touchend.lg.tm onSlideClick.lg.tm', function() { 1576 if (!_this.interval && _this.canceledOnTouch) { 1577 _this.startlAuto(); 1578 _this.canceledOnTouch = false; 1579 } 1580 }); 1581 1582 }; 1583 1584 Autoplay.prototype.progress = function() { 1585 1586 var _this = this; 1587 var _$progressBar; 1588 var _$progress; 1589 1590 _this.$el.on('onBeforeSlide.lg.tm', function() { 1591 1592 // start progress bar animation 1593 if (_this.core.s.progressBar && _this.fromAuto) { 1594 _$progressBar = _this.core.$outer.find('.lg-progress-bar'); 1595 _$progress = _this.core.$outer.find('.lg-progress'); 1596 if (_this.interval) { 1597 _$progress.removeAttr('style'); 1598 _$progressBar.removeClass('lg-start'); 1599 setTimeout(function() { 1600 _$progress.css('transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s'); 1601 _$progressBar.addClass('lg-start'); 1602 }, 20); 1603 } 1604 } 1605 1606 // Remove setinterval if slide is triggered manually and fourceautoplay is false 1607 if (!_this.fromAuto && !_this.core.s.fourceAutoplay) { 1608 _this.cancelAuto(); 1609 } 1610 1611 _this.fromAuto = false; 1612 1613 }); 1614 }; 1615 1616 // Manage autoplay via play/stop buttons 1617 Autoplay.prototype.controls = function() { 1618 var _this = this; 1619 var _html = '<button aria-pressed="false" aria-label="Autoplay" title="Autoplay" class="lg-autoplay-button lg-icon fa fa-play-circle"></button>'; 1620 1621 // Append autoplay controls 1622 $(this.core.s.appendAutoplayControlsTo).append(_html); 1623 1624 _this.core.$outer.find('.lg-autoplay-button').on('click.lg keyup.lg', function(e) { 1625 if (e.type == 'click') { 1626 if ($(_this.core.$outer).hasClass('lg-show-autoplay')) { 1627 _this.cancelAuto(); 1628 _this.core.s.fourceAutoplay = false; 1629 } else { 1630 if (!_this.interval) { 1631 _this.startlAuto(); 1632 _this.core.s.fourceAutoplay = _this.fourceAutoplayTemp; 1633 } 1634 } 1635 } 1636 }); 1637 }; 1638 1639 // Autostart gallery 1640 Autoplay.prototype.startlAuto = function() { 1641 var _this = this; 1642 1643 _this.core.$outer.find('.lg-progress').css('transition', 'width ' + (_this.core.s.speed + _this.core.s.pause) + 'ms ease 0s'); 1644 _this.core.$outer.addClass('lg-show-autoplay'); 1645 _this.core.$outer.find('.lg-progress-bar').addClass('lg-start'); 1646 1647 _this.interval = setInterval(function() { 1648 if (_this.core.index + 1 < _this.core.$items.length) { 1649 _this.core.index++; 1650 } else { 1651 _this.core.index = 0; 1652 } 1653 1654 _this.fromAuto = true; 1655 _this.core.slide(_this.core.index, false, false, 'next'); 1656 }, _this.core.s.speed + _this.core.s.pause); 1657 _this.core.$outer.find('.lg-toolbar .lg-autoplay-button').removeClass('fa-play-circle').addClass('fa-pause-circle').attr('aria-pressed', 'true'); 1658 }; 1659 1660 // cancel Autostart 1661 Autoplay.prototype.cancelAuto = function() { 1662 clearInterval(this.interval); 1663 this.interval = false;
1664 this.core.$outer.find('.lg-progress').removeAttr('style'); 1665 this.core.$outer.removeClass('lg-show-autoplay'); 1666 this.core.$outer.find('.lg-progress-bar').removeClass('lg-start'); 1667 this.core.$outer.find('.lg-toolbar .lg-autoplay-button').removeClass('fa-pause-circle').addClass('fa-play-circle').attr('aria-pressed', 'false'); 1668 }; 1669 1670 Autoplay.prototype.destroy = function() { 1671 1672 this.cancelAuto(); 1673 this.core.$outer.find('.lg-progress-bar').remove(); 1674 }; 1675 1676 $.fn.lightGallery.modules.autoplay = Autoplay; 1677 1678 })(); 1679 1680 1681})); 1682 1683/*! lg-fullscreen - v1.0.1 - 2016-09-30 1684* http://sachinchoolur.github.io/lightGallery 1685* Copyright (c) 2016 Sachin N; Licensed GPLv3 */ 1686 1687(function (root, factory) { 1688 if (typeof define === 'function' && define.amd) { 1689 // AMD. Register as an anonymous module unless amdModuleId is set 1690 define(['jquery'], function (a0) { 1691 return (factory(a0)); 1692 }); 1693 } else if (typeof exports === 'object') { 1694 // Node. Does not work with strict CommonJS, but 1695 // only CommonJS-like environments that support module.exports, 1696 // like Node. 1697 module.exports = factory(require('jquery')); 1698 } else { 1699 factory(jQuery); 1700 } 1701}(this, function ($) { 1702 1703 (function() { 1704 1705 'use strict'; 1706 1707 var defaults = { 1708 fullScreen: true 1709 }; 1710 1711 var Fullscreen = function(element) { 1712 1713 // get lightGallery core plugin data 1714 this.core = $(element).data('lightGallery'); 1715 1716 this.$el = $(element); 1717 1718 // extend module defalut settings with lightGallery core settings 1719 this.core.s = $.extend({}, defaults, this.core.s); 1720 1721 this.init(); 1722 1723 return this; 1724 }; 1725 1726 Fullscreen.prototype.init = function() { 1727 var fullScreen = ''; 1728 if (this.core.s.fullScreen) { 1729 1730 // check for fullscreen browser support 1731 if (!document.fullscreenEnabled && !document.webkitFullscreenEnabled && 1732 !document.mozFullScreenEnabled && !document.msFullscreenEnabled) { 1733 return; 1734 } else { 1735 fullScreen = '<button aria-pressed="false" aria-label="Fullscreen" title="Fullscreen" class="lg-fullscreen lg-icon fa fa-expand"></button>'; 1736 this.core.$outer.find('.lg-toolbar').append(fullScreen); 1737 this.fullScreen(); 1738 } 1739 } 1740 }; 1741 1742 Fullscreen.prototype.requestFullscreen = function() { 1743 this.core.$outer.find('.lg-fullscreen').attr('aria-pressed', 'true') 1744 var el = document.documentElement; 1745 if (el.requestFullscreen) { 1746 el.requestFullscreen(); 1747 } else if (el.msRequestFullscreen) { 1748 el.msRequestFullscreen(); 1749 } else if (el.mozRequestFullScreen) { 1750 el.mozRequestFullScreen(); 1751 } else if (el.webkitRequestFullscreen) { 1752 el.webkitRequestFullscreen(); 1753 } 1754 }; 1755 1756 Fullscreen.prototype.exitFullscreen = function() { 1757 this.core.$outer.find('.lg-fullscreen').removeClass('fa-compress').addClass('fa-expand').attr('aria-pressed', 'false'); 1758 if (document.fullscreenElement) { 1759 document.exitFullscreen(); 1760 } else if (document.msExitFullscreen) { 1761 document.msExitFullscreen(); 1762 } else if (document.mozFullScreenElement) { 1763 document.mozCancelFullScreen(); 1764 } else if (document.webkitFullscreenElement) { 1765 document.webkitExitFullscreen(); 1766 } 1767 }; 1768 1769 // https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode 1770 Fullscreen.prototype.fullScreen = function() { 1771 var _this = this; 1772 1773 $(document).on('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg', function() { 1774 if (!_this.core.$outer.hasClass('lg-fullscreen-on')) { 1775 _this.core.$outer.find('.lg-fullscreen').removeClass('fa-expand').addClass('fa-compress').attr('aria-pressed', 'true'); 1776 } else { 1777 _this.core.$outer.find('.lg-fullscreen').removeClass('fa-compress').addClass('fa-expand').attr('aria-pressed', 'false'); 1778 } 1779 _this.core.$outer.toggleClass('lg-fullscreen-on'); 1780 }); 1781 1782 this.core.$outer.find('.lg-fullscreen').on('click.lg keyup.lg', function(e) { 1783 if (e.type == 'click') { 1784 if (!document.fullscreenElement && 1785 !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement) { 1786 _this.requestFullscreen(); 1787 } else { 1788 _this.exitFullscreen(); 1789 } 1790 } 1791 }); 1792 1793 }; 1794 1795 Fullscreen.prototype.destroy = function() { 1796 1797 // exit from fullscreen if activated 1798 this.exitFullscreen(); 1799 1800 $(document).off('fullscreenchange.lg webkitfullscreenchange.lg mozfullscreenchange.lg MSFullscreenChange.lg'); 1801 }; 1802 1803 $.fn.lightGallery.modules.fullscreen = Fullscreen; 1804 1805 })(); 1806 1807})); 1808 1809/*! lg-pager - v1.0.2 - 2017-01-22 1810* http://sachinchoolur.github.io/lightGallery 1811* Copyright (c) 2017 Sachin N; Licensed GPLv3 */ 1812 1813(function (root, factory) { 1814 if (typeof define === 'function' && define.amd) { 1815 // AMD. Register as an anonymous module unless amdModuleId is set 1816 define(['jquery'], function (a0) { 1817 return (factory(a0)); 1818 }); 1819 } else if (typeof exports === 'object') { 1820 // Node. Does not work with strict CommonJS, but 1821 // only CommonJS-like environments that support module.exports, 1822 // like Node. 1823 module.exports = factory(require('jquery')); 1824 } else { 1825 factory(jQuery); 1826 } 1827}(this, function ($) { 1828 1829 (function() { 1830 1831 'use strict'; 1832 1833 var defaults = { 1834 pager: false 1835 }; 1836 1837 var Pager = function(element) { 1838 1839 this.core = $(element).data('lightGallery'); 1840 1841 this.$el = $(element); 1842 this.core.s = $.extend({}, defaults, this.core.s); 1843 if (this.core.s.pager && this.core.$items.length > 1) { 1844 this.init(); 1845 } 1846 1847 return this; 1848 }; 1849 1850 Pager.prototype.init = function() { 1851 var _this = this; 1852 var pagerList = ''; 1853 var $pagerCont; 1854 var $pagerOuter; 1855 var timeout; 1856 1857 _this.core.$outer.find('.lg').append('<div class="lg-pager-outer"></div>'); 1858 1859 if (_this.core.s.dynamic) { 1860 for (var i = 0; i < _this.core.s.dynamicEl.length; i++) { 1861 pagerList += '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + _this.core.s.dynamicEl[i].thumb + '" /></div></span>'; 1862 } 1863 } else { 1864 _this.core.$items.each(function() { 1865 1866 if (!_this.core.s.exThumbImage) { 1867 pagerList += '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + $(this).find('img').attr('src') + '" /></div></span>'; 1868 } else { 1869 pagerList += '<span class="lg-pager-cont"> <span class="lg-pager"></span><div class="lg-pager-thumb-cont"><span class="lg-caret"></span> <img src="' + $(this).attr(_this.core.s.exThumbImage) + '" /></div></span>'; 1870 } 1871 1872 }); 1873 } 1874 1875 $pagerOuter = _this.core.$outer.find('.lg-pager-outer'); 1876
1877 $pagerOuter.html(pagerList); 1878 1879 $pagerCont = _this.core.$outer.find('.lg-pager-cont'); 1880 $pagerCont.on('click.lg touchend.lg', function() { 1881 var _$this = $(this); 1882 _this.core.index = _$this.index(); 1883 _this.core.slide(_this.core.index, false, true, false); 1884 }); 1885 1886 $pagerOuter.on('mouseover.lg', function() { 1887 clearTimeout(timeout); 1888 $pagerOuter.addClass('lg-pager-hover'); 1889 }); 1890 1891 $pagerOuter.on('mouseout.lg', function() { 1892 timeout = setTimeout(function() { 1893 $pagerOuter.removeClass('lg-pager-hover'); 1894 }); 1895 }); 1896 1897 _this.core.$el.on('onBeforeSlide.lg.tm', function(e, prevIndex, index) { 1898 $pagerCont.removeClass('lg-pager-active'); 1899 $pagerCont.eq(index).addClass('lg-pager-active'); 1900 }); 1901 1902 }; 1903 1904 Pager.prototype.destroy = function() { 1905 1906 }; 1907 1908 $.fn.lightGallery.modules.pager = Pager; 1909 1910 })(); 1911 1912 1913})); 1914 1915/*! lg-thumbnail - v1.1.0 - 2017-08-08 1916* http://sachinchoolur.github.io/lightGallery 1917* Copyright (c) 2017 Sachin N; Licensed GPLv3 */ 1918 1919(function (root, factory) { 1920 if (typeof define === 'function' && define.amd) { 1921 // AMD. Register as an anonymous module unless amdModuleId is set 1922 define(['jquery'], function (a0) { 1923 return (factory(a0)); 1924 }); 1925 } else if (typeof exports === 'object') { 1926 // Node. Does not work with strict CommonJS, but 1927 // only CommonJS-like environments that support module.exports, 1928 // like Node. 1929 module.exports = factory(require('jquery')); 1930 } else { 1931 factory(jQuery); 1932 } 1933}(this, function ($) { 1934 1935 (function() { 1936 1937 'use strict'; 1938 1939 var defaults = { 1940 thumbnail: true, 1941 1942 animateThumb: true, 1943 currentPagerPosition: 'middle', 1944 1945 thumbWidth: 100, 1946 thumbHeight: '80px', 1947 thumbContHeight: 100, 1948 thumbMargin: 5, 1949 1950 exThumbImage: false, 1951 showThumbByDefault: true, 1952 toogleThumb: true, 1953 pullCaptionUp: true, 1954 1955 enableThumbDrag: true, 1956 enableThumbSwipe: true, 1957 swipeThreshold: 50, 1958 1959 loadYoutubeThumbnail: true, 1960 youtubeThumbSize: 1, 1961 1962 loadVimeoThumbnail: true, 1963 vimeoThumbSize: 'thumbnail_small', 1964 1965 loadDailymotionThumbnail: true 1966 }; 1967 1968 var Thumbnail = function(element) { 1969 1970 // get lightGallery core plugin data 1971 this.core = $(element).data('lightGallery'); 1972 1973 // extend module default settings with lightGallery core settings 1974 this.core.s = $.extend({}, defaults, this.core.s); 1975 1976 this.$el = $(element); 1977 this.$thumbOuter = null; 1978 this.thumbOuterWidth = 0; 1979 this.thumbTotalWidth = (this.core.$items.length * (this.core.s.thumbWidth + this.core.s.thumbMargin)); 1980 this.thumbIndex = this.core.index; 1981 1982 if (this.core.s.animateThumb) { 1983 this.core.s.thumbHeight = '100%'; 1984 } 1985 1986 // Thumbnail animation value 1987 this.left = 0; 1988 1989 this.init(); 1990 1991 return this; 1992 }; 1993 1994 Thumbnail.prototype.init = function() { 1995 var _this = this; 1996 if (this.core.s.thumbnail && this.core.$items.length > 1) { 1997 if (this.core.s.showThumbByDefault) { 1998 setTimeout(function(){ 1999 _this.core.$outer.addClass('lg-thumb-open'); 2000 _this.core.$outer.find('.lg-toogle-thumb').attr('aria-expanded', 'true'); 2001 }, 700); 2002 } 2003 2004 if (this.core.s.pullCaptionUp) { 2005 this.core.$outer.addClass('lg-pull-caption-up'); 2006 } 2007 2008 this.build(); 2009 if (this.core.s.animateThumb && this.core.doCss()) { 2010 if (this.core.s.enableThumbDrag) { 2011 this.enableThumbDrag(); 2012 } 2013 2014 if (this.core.s.enableThumbSwipe) { 2015 this.enableThumbSwipe(); 2016 } 2017 2018 this.thumbClickable = false;
vendor: 15,932 bytes, lines 2019-2437
2019 } else { 2020 this.thumbClickable = true; 2021 } 2022 2023 this.toogle(); 2024 this.thumbkeyPress(); 2025 } 2026 }; 2027 2028 Thumbnail.prototype.build = function() { 2029 var _this = this; 2030 var thumbList = ''; 2031 var vimeoErrorThumbSize = ''; 2032 var $thumb; 2033 var html = '<div class="lg-thumb-outer">' + 2034 '<div class="lg-thumb lg-group">' + 2035 '</div>' + 2036 '</div>'; 2037 2038 switch (this.core.s.vimeoThumbSize) { 2039 case 'thumbnail_large': 2040 vimeoErrorThumbSize = '640'; 2041 break; 2042 case 'thumbnail_medium': 2043 vimeoErrorThumbSize = '200x150'; 2044 break; 2045 case 'thumbnail_small': 2046 vimeoErrorThumbSize = '100x75'; 2047 } 2048 2049 _this.core.$outer.addClass('lg-has-thumb'); 2050 2051 _this.core.$outer.find('.lg').append(html); 2052 2053 _this.$thumbOuter = _this.core.$outer.find('.lg-thumb-outer'); 2054 _this.thumbOuterWidth = _this.$thumbOuter.width(); 2055 2056 if (_this.core.s.animateThumb) { 2057 _this.core.$outer.find('.lg-thumb').css({ 2058 width: _this.thumbTotalWidth + 'px', 2059 position: 'relative' 2060 }); 2061 } 2062 2063 if (this.core.s.animateThumb) { 2064 _this.$thumbOuter.css('height', _this.core.s.thumbContHeight + 'px'); 2065 } 2066 2067 function getThumb(src, thumb, index) { 2068 var isVideo = _this.core.isVideo(src, index) || {}; 2069 var thumbImg; 2070 var vimeoId = ''; 2071 var alt = _this.core.$items.eq(index).find("img").first().attr("alt"); 2072 2073 if (isVideo.youtube || isVideo.vimeo || isVideo.dailymotion) { 2074 if (isVideo.youtube) { 2075 if (_this.core.s.loadYoutubeThumbnail) { 2076 thumbImg = '//img.youtube.com/vi/' + isVideo.youtube[1] + '/' + _this.core.s.youtubeThumbSize + '.jpg'; 2077 } else { 2078 thumbImg = thumb; 2079 } 2080 } else if (isVideo.vimeo) { 2081 if (_this.core.s.loadVimeoThumbnail) { 2082 thumbImg = '//i.vimeocdn.com/video/error_' + vimeoErrorThumbSize + '.jpg'; 2083 vimeoId = isVideo.vimeo[1]; 2084 } else { 2085 thumbImg = thumb; 2086 } 2087 } else if (isVideo.dailymotion) { 2088 if (_this.core.s.loadDailymotionThumbnail) { 2089 thumbImg = '//www.dailymotion.com/thumbnail/video/' + isVideo.dailymotion[1]; 2090 } else { 2091 thumbImg = thumb; 2092 } 2093 } 2094 } else { 2095 thumbImg = thumb; 2096 } 2097 2098 thumbList += '<div data-vimeo-id="' + vimeoId + '" class="lg-thumb-item" style="width:' + _this.core.s.thumbWidth + 'px; height: ' + _this.core.s.thumbHeight + '; margin-right: ' + _this.core.s.thumbMargin + 'px"><img src="' + thumbImg + '" alt="'+ alt + '" /></div>'; 2099 vimeoId = ''; 2100 } 2101 2102 if (_this.core.s.dynamic) { 2103 for (var i = 0; i < _this.core.s.dynamicEl.length; i++) { 2104 getThumb(_this.core.s.dynamicEl[i].src, _this.core.s.dynamicEl[i].thumb, i); 2105 } 2106 } else { 2107 _this.core.$items.each(function(i) { 2108 2109 if (!_this.core.s.exThumbImage) { 2110 getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).find('img').attr('src'), i); 2111 } else { 2112 getThumb($(this).attr('href') || $(this).attr('data-src'), $(this).attr(_this.core.s.exThumbImage), i); 2113 } 2114 2115 }); 2116 } 2117 2118 _this.core.$outer.find('.lg-thumb').html(thumbList); 2119 2120 $thumb = _this.core.$outer.find('.lg-thumb-item'); 2121 2122 // Load vimeo thumbnails 2123 $thumb.each(function() { 2124 var $this = $(this); 2125 var vimeoVideoId = $this.attr('data-vimeo-id'); 2126 2127 if (vimeoVideoId) { 2128 var vimeoUrl = 'https://vimeo.com/api/oembed.json?url=https://vimeo.com/' + vimeoVideoId; 2129 $.getJSON(vimeoUrl, { 2130 format: 'json' 2131 }, function(data) { 2132 $this.find('img').attr('src', data['thumbnail_url']); 2133 }); 2134 } 2135 }); 2136 2137 // manage active class for thumbnail 2138 $thumb.eq(_this.core.index).addClass('active'); 2139 _this.core.$el.on('onBeforeSlide.lg.tm', function() { 2140 $thumb.removeClass('active'); 2141 $thumb.eq(_this.core.index).addClass('active'); 2142 }); 2143 2144 $thumb.on('click.lg touchend.lg keyup.lg', function(e) { 2145 if (e.type == 'click' || e.type == 'touchend') { 2146 var _$this = $(this); 2147 setTimeout(function() { 2148 2149 // In IE9 and bellow touch does not support 2150 // Go to slide if browser does not support css transitions 2151 if ((_this.thumbClickable && !_this.core.lgBusy) || !_this.core.doCss()) { 2152 _this.core.index = _$this.index(); 2153 _this.core.slide(_this.core.index, false, true, false); 2154 } 2155 }, 50); 2156 } 2157 }); 2158 2159 _this.core.$el.on('onBeforeSlide.lg.tm', function() { 2160 _this.animateThumb(_this.core.index); 2161 }); 2162 2163 $(window).on('resize.lg.thumb orientationchange.lg.thumb', function() { 2164 setTimeout(function() { 2165 _this.animateThumb(_this.core.index); 2166 _this.thumbOuterWidth = _this.$thumbOuter.width(); 2167 }, 200); 2168 }); 2169 2170 }; 2171 2172 Thumbnail.prototype.setTranslate = function(value) { 2173 // jQuery supports Automatic CSS prefixing since jQuery 1.8.0 2174 this.core.$outer.find('.lg-thumb').css({ 2175 transform: 'translate3d(-' + (value) + 'px, 0px, 0px)' 2176 }); 2177 }; 2178 2179 Thumbnail.prototype.animateThumb = function(index) { 2180 var $thumb = this.core.$outer.find('.lg-thumb'); 2181 if (this.core.s.animateThumb) { 2182 var position; 2183 switch (this.core.s.currentPagerPosition) { 2184 case 'left': 2185 position = 0; 2186 break; 2187 case 'middle': 2188 position = (this.thumbOuterWidth / 2) - (this.core.s.thumbWidth / 2); 2189 break; 2190 case 'right': 2191 position = this.thumbOuterWidth - this.core.s.thumbWidth; 2192 } 2193 this.left = ((this.core.s.thumbWidth + this.core.s.thumbMargin) * index - 1) - position; 2194 if (this.left > (this.thumbTotalWidth - this.thumbOuterWidth)) { 2195 this.left = this.thumbTotalWidth - this.thumbOuterWidth; 2196 } 2197 2198 if (this.left < 0) { 2199 this.left = 0; 2200 } 2201 2202 if (this.core.lGalleryOn) { 2203 if (!$thumb.hasClass('on')) { 2204 this.core.$outer.find('.lg-thumb').css('transition-duration', this.core.s.speed + 'ms'); 2205 } 2206 2207 if (!this.core.doCss()) { 2208 $thumb.animate({ 2209 left: -this.left + 'px' 2210 }, this.core.s.speed); 2211 } 2212 } else { 2213 if (!this.core.doCss()) { 2214 $thumb.css('left', -this.left + 'px'); 2215 } 2216 } 2217 2218 this.setTranslate(this.left); 2219 2220 } 2221 }; 2222 2223 // Enable thumbnail dragging and swiping 2224 Thumbnail.prototype.enableThumbDrag = function() { 2225 2226 var _this = this; 2227 var startCoords = 0; 2228 var endCoords = 0; 2229 var isDraging = false; 2230 var isMoved = false; 2231 var tempLeft = 0; 2232 2233 _this.$thumbOuter.addClass('lg-grab'); 2234 2235 _this.core.$outer.find('.lg-thumb').on('mousedown.lg.thumb', function(e) { 2236 if (_this.thumbTotalWidth > _this.thumbOuterWidth) { 2237 // execute only on .lg-object 2238 e.preventDefault(); 2239 startCoords = e.pageX; 2240 isDraging = true; 2241 2242 // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723 2243 _this.core.$outer.scrollLeft += 1; 2244 _this.core.$outer.scrollLeft -= 1; 2245 2246 // * 2247 _this.thumbClickable = false; 2248 _this.$thumbOuter.removeClass('lg-grab').addClass('lg-grabbing'); 2249 } 2250 }); 2251 2252 $(window).on('mousemove.lg.thumb', function(e) { 2253 if (isDraging) { 2254 tempLeft = _this.left; 2255 isMoved = true; 2256 endCoords = e.pageX; 2257 2258 _this.$thumbOuter.addClass('lg-dragging'); 2259 2260 tempLeft = tempLeft - (endCoords - startCoords); 2261 2262 if (tempLeft > (_this.thumbTotalWidth - _this.thumbOuterWidth)) { 2263 tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth; 2264 } 2265 2266 if (tempLeft < 0) { 2267 tempLeft = 0; 2268 } 2269 2270 // move current slide 2271 _this.setTranslate(tempLeft); 2272 2273 } 2274 }); 2275 2276 $(window).on('mouseup.lg.thumb', function() { 2277 if (isMoved) { 2278 isMoved = false; 2279 _this.$thumbOuter.removeClass('lg-dragging'); 2280 2281 _this.left = tempLeft; 2282 2283 if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) { 2284 _this.thumbClickable = true; 2285 } 2286 2287 } else { 2288 _this.thumbClickable = true; 2289 } 2290 2291 if (isDraging) { 2292 isDraging = false; 2293 _this.$thumbOuter.removeClass('lg-grabbing').addClass('lg-grab'); 2294 } 2295 }); 2296 2297 }; 2298 2299 Thumbnail.prototype.enableThumbSwipe = function() { 2300 var _this = this; 2301 var startCoords = 0; 2302 var endCoords = 0; 2303 var isMoved = false; 2304 var tempLeft = 0; 2305 2306 _this.core.$outer.find('.lg-thumb').on('touchstart.lg', function(e) { 2307 if (_this.thumbTotalWidth > _this.thumbOuterWidth) { 2308 e.preventDefault(); 2309 startCoords = e.originalEvent.targetTouches[0].pageX; 2310 _this.thumbClickable = false; 2311 } 2312 }); 2313 2314 _this.core.$outer.find('.lg-thumb').on('touchmove.lg', function(e) { 2315 if (_this.thumbTotalWidth > _this.thumbOuterWidth) { 2316 e.preventDefault(); 2317 endCoords = e.originalEvent.targetTouches[0].pageX; 2318 isMoved = true; 2319 2320 _this.$thumbOuter.addClass('lg-dragging'); 2321 2322 tempLeft = _this.left; 2323 2324 tempLeft = tempLeft - (endCoords - startCoords); 2325 2326 if (tempLeft > (_this.thumbTotalWidth - _this.thumbOuterWidth)) { 2327 tempLeft = _this.thumbTotalWidth - _this.thumbOuterWidth; 2328 } 2329 2330 if (tempLeft < 0) { 2331 tempLeft = 0; 2332 } 2333 2334 // move current slide 2335 _this.setTranslate(tempLeft); 2336 2337 } 2338 }); 2339 2340 _this.core.$outer.find('.lg-thumb').on('touchend.lg', function() { 2341 if (_this.thumbTotalWidth > _this.thumbOuterWidth) { 2342 2343 if (isMoved) { 2344 isMoved = false; 2345 _this.$thumbOuter.removeClass('lg-dragging'); 2346 if (Math.abs(endCoords - startCoords) < _this.core.s.swipeThreshold) { 2347 _this.thumbClickable = true; 2348 } 2349 2350 _this.left = tempLeft; 2351 } else { 2352 _this.thumbClickable = true; 2353 } 2354 } else { 2355 _this.thumbClickable = true; 2356 } 2357 }); 2358 2359 }; 2360 2361 Thumbnail.prototype.toogle = function() { 2362 var _this = this; 2363 if (_this.core.s.toogleThumb) { 2364 _this.core.$outer.addClass('lg-can-toggle'); 2365 _this.$thumbOuter.append('<button aria-label="Toggle thumbnails - this button has visual effect only" aria-expanded="false" title="Toggle Thumbnails" class="lg-toogle-thumb lg-icon fa fa-th"></button>'); 2366 _this.core.$outer.find('.lg-toogle-thumb').on('click.lg keyup.lg', function(e) { 2367 if (e.type == 'click') { 2368 _this.core.$outer.toggleClass('lg-thumb-open'); 2369 $(this).attr('aria-expanded', ($(this).attr('aria-expanded') == 'true') ? 'false' : 'true'); 2370 } 2371 }); 2372 } 2373 }; 2374 2375 Thumbnail.prototype.thumbkeyPress = function() { 2376 var _this = this; 2377 $(window).on('keydown.lg.thumb', function(e) { 2378 if (e.keyCode === 38) { 2379 e.preventDefault(); 2380 _this.core.$outer.addClass('lg-thumb-open'); 2381 _this.core.$outer.find('.lg-toogle-thumb').attr('aria-expanded', 'true'); 2382 } else if (e.keyCode === 40) { 2383 e.preventDefault(); 2384 _this.core.$outer.removeClass('lg-thumb-open'); 2385 _this.core.$outer.find('.lg-toogle-thumb').attr('aria-expanded', 'false'); 2386 } 2387 }); 2388 }; 2389 2390 Thumbnail.prototype.destroy = function() { 2391 if (this.core.s.thumbnail && this.core.$items.length > 1) { 2392 $(window).off('resize.lg.thumb orientationchange.lg.thumb keydown.lg.thumb'); 2393 this.$thumbOuter.remove(); 2394 this.core.$outer.removeClass('lg-has-thumb'); 2395 } 2396 }; 2397 2398 $.fn.lightGallery.modules.Thumbnail = Thumbnail; 2399 2400 })(); 2401 2402})); 2403 2404/*! lg-video - v1.2.0 - 2017-11-16 2405* http://sachinchoolur.github.io/lightGallery 2406* Copyright (c) 2017 Sachin N; Licensed GPLv3 */ 2407 2408(function (root, factory) { 2409 if (typeof define === 'function' && define.amd) { 2410 // AMD. Register as an anonymous module unless amdModuleId is set 2411 define(['jquery'], function (a0) { 2412 return (factory(a0)); 2413 }); 2414 } else if (typeof exports === 'object') { 2415 // Node. Does not work with strict CommonJS, but 2416 // only CommonJS-like environments that support module.exports, 2417 // like Node. 2418 module.exports = factory(require('jquery')); 2419 } else { 2420 factory(jQuery); 2421 } 2422}(this, function ($) { 2423 2424 (function() { 2425 2426 'use strict'; 2427 2428 var defaults = { 2429 videoMaxWidth: '855px', 2430 2431 autoplayFirstVideo: true, 2432 2433 youtubePlayerParams: false, 2434 vimeoPlayerParams: false, 2435 dailymotionPlayerParams: false, 2436 vkPlayerParams: false, 2437
vendor: 12,844 bytes, lines 2438-2761
2438 videojs: false, 2439 videojsOptions: {} 2440 }; 2441 2442 var Video = function(element) { 2443 2444 this.core = $(element).data('lightGallery'); 2445 2446 this.$el = $(element); 2447 this.core.s = $.extend({}, defaults, this.core.s); 2448 this.videoLoaded = false; 2449 2450 this.init(); 2451 2452 return this; 2453 }; 2454 2455 Video.prototype.init = function() { 2456 var _this = this; 2457 2458 // Event triggered when video url found without poster 2459 _this.core.$el.on('hasVideo.lg.tm', onHasVideo.bind(this)); 2460 2461 // Set max width for video 2462 _this.core.$el.on('onAferAppendSlide.lg.tm', onAferAppendSlide.bind(this)); 2463 2464 if (_this.core.doCss() && (_this.core.$items.length > 1) && (_this.core.s.enableSwipe || _this.core.s.enableDrag)) { 2465 _this.core.$el.on('onSlideClick.lg.tm', function() { 2466 var $el = _this.core.$slide.eq(_this.core.index); 2467 _this.loadVideoOnclick($el); 2468 }); 2469 } else { 2470 2471 // For IE 9 and bellow 2472 _this.core.$slide.on('click.lg', function() { 2473 _this.loadVideoOnclick($(this)); 2474 }); 2475 } 2476 2477 _this.core.$el.on('onBeforeSlide.lg.tm', onBeforeSlide.bind(this)); 2478 2479 _this.core.$el.on('onAfterSlide.lg.tm', function(event, prevIndex) { 2480 _this.core.$slide.eq(prevIndex).removeClass('lg-video-playing'); 2481 }); 2482 }; 2483 2484 Video.prototype.loadVideo = function(src, addClass, noPoster, index, html) { 2485 var video = ''; 2486 var autoplay = 1; 2487 var a = ''; 2488 var isVideo = this.core.isVideo(src, index) || {}; 2489 2490 // Enable autoplay based on setting for first video if poster doesn't exist 2491 if (noPoster) { 2492 if (this.videoLoaded) { 2493 autoplay = 0; 2494 } else { 2495 autoplay = this.core.s.autoplayFirstVideo ? 1 : 0; 2496 } 2497 } 2498 2499 if (isVideo.youtube) { 2500 2501 a = '?wmode=opaque&autoplay=' + autoplay + '&enablejsapi=1'; 2502 if (this.core.s.youtubePlayerParams) { 2503 a = a + '&' + $.param(this.core.s.youtubePlayerParams); 2504 } 2505 2506 video = '<iframe class="lg-video-object lg-youtube ' + addClass + '" width="560" height="315" src="//www.youtube.com/embed/' + isVideo.youtube[1] + a + '" frameborder="0" allowfullscreen></iframe>'; 2507 2508 } else if (isVideo.vimeo) { 2509 2510 a = '?autoplay=' + autoplay + '&api=1'; 2511 if (this.core.s.vimeoPlayerParams) { 2512 a = a + '&' + $.param(this.core.s.vimeoPlayerParams); 2513 } 2514 2515 video = '<iframe class="lg-video-object lg-vimeo ' + addClass + '" width="560" height="315" src="//player.vimeo.com/video/' + isVideo.vimeo[1] + a + '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'; 2516 2517 } else if (isVideo.dailymotion) { 2518 2519 a = '?wmode=opaque&autoplay=' + autoplay + '&api=postMessage'; 2520 if (this.core.s.dailymotionPlayerParams) { 2521 a = a + '&' + $.param(this.core.s.dailymotionPlayerParams); 2522 } 2523 2524 video = '<iframe class="lg-video-object lg-dailymotion ' + addClass + '" width="560" height="315" src="//www.dailymotion.com/embed/video/' + isVideo.dailymotion[1] + a + '" frameborder="0" allowfullscreen></iframe>'; 2525 2526 } else if (isVideo.html5) { 2527 var fL = html.substring(0, 1); 2528 if (fL === '.' || fL === '#') { 2529 html = $(html).html(); 2530 } 2531 2532 video = html; 2533 2534 } else if (isVideo.vk) { 2535 2536 a = '&autoplay=' + autoplay; 2537 if (this.core.s.vkPlayerParams) { 2538 a = a + '&' + $.param(this.core.s.vkPlayerParams); 2539 } 2540 2541 video = '<iframe class="lg-video-object lg-vk ' + addClass + '" width="560" height="315" src="http://vk.com/video_ext.php?' + isVideo.vk[1] + a + '" frameborder="0" allowfullscreen></iframe>'; 2542 2543 } 2544 2545 return video; 2546 }; 2547 2548 Video.prototype.loadVideoOnclick = function($el){ 2549 2550 var _this = this; 2551 // check slide has poster 2552 if ($el.find('.lg-object').hasClass('lg-has-poster') && $el.find('.lg-object').is(':visible')) { 2553 2554 // check already video element present 2555 if (!$el.hasClass('lg-has-video')) { 2556 2557 $el.addClass('lg-video-playing lg-has-video'); 2558 2559 var _src; 2560 var _html; 2561 var _loadVideo = function(_src, _html) { 2562 2563 $el.find('.lg-video').append(_this.loadVideo(_src, '', false, _this.core.index, _html)); 2564 2565 if (_html) { 2566 if (_this.core.s.videojs) { 2567 try { 2568 videojs(_this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function() { 2569 this.play(); 2570 }); 2571 } catch (e) { 2572 console.error('Make sure you have included videojs'); 2573 } 2574 } else { 2575 _this.core.$slide.eq(_this.core.index).find('.lg-html5').get(0).play(); 2576 } 2577 } 2578 2579 }; 2580 2581 if (_this.core.s.dynamic) { 2582 2583 _src = _this.core.s.dynamicEl[_this.core.index].src; 2584 _html = _this.core.s.dynamicEl[_this.core.index].html; 2585 2586 _loadVideo(_src, _html); 2587 2588 } else { 2589 2590 _src = _this.core.$items.eq(_this.core.index).attr('href') || _this.core.$items.eq(_this.core.index).attr('data-src'); 2591 _html = _this.core.$items.eq(_this.core.index).attr('data-html'); 2592 2593 _loadVideo(_src, _html); 2594 2595 } 2596 2597 var $tempImg = $el.find('.lg-object'); 2598 $el.find('.lg-video').append($tempImg); 2599 2600 // @todo loading icon for html5 videos also 2601 // for showing the loading indicator while loading video 2602 if (!$el.find('.lg-video-object').hasClass('lg-html5')) { 2603 $el.removeClass('lg-complete'); 2604 $el.find('.lg-video-object').on('load.lg error.lg', function() { 2605 $el.addClass('lg-complete'); 2606 }); 2607 } 2608 2609 } else { 2610 2611 var youtubePlayer = $el.find('.lg-youtube').get(0); 2612 var vimeoPlayer = $el.find('.lg-vimeo').get(0); 2613 var dailymotionPlayer = $el.find('.lg-dailymotion').get(0); 2614 var html5Player = $el.find('.lg-html5').get(0); 2615 if (youtubePlayer) { 2616 youtubePlayer.contentWindow.postMessage('{"event":"command","func":"playVideo","args":""}', '*'); 2617 } else if (vimeoPlayer) { 2618 try { 2619 $f(vimeoPlayer).api('play'); 2620 } catch (e) { 2621 console.error('Make sure you have included froogaloop2 js'); 2622 } 2623 } else if (dailymotionPlayer) { 2624 dailymotionPlayer.contentWindow.postMessage('play', '*'); 2625 2626 } else if (html5Player) { 2627 if (_this.core.s.videojs) { 2628 try { 2629 videojs(html5Player).play(); 2630 } catch (e) { 2631 console.error('Make sure you have included videojs'); 2632 } 2633 } else { 2634 html5Player.play(); 2635 } 2636 } 2637 2638 $el.addClass('lg-video-playing'); 2639 2640 } 2641 } 2642 }; 2643 2644 Video.prototype.destroy = function() { 2645 this.videoLoaded = false; 2646 }; 2647 2648 function onHasVideo(event, index, src, html) { 2649 /*jshint validthis:true */ 2650 var _this = this; 2651 _this.core.$slide.eq(index).find('.lg-video').append(_this.loadVideo(src, 'lg-object', true, index, html)); 2652 if (html) { 2653 if (_this.core.s.videojs) { 2654 try { 2655 videojs(_this.core.$slide.eq(index).find('.lg-html5').get(0), _this.core.s.videojsOptions, function() { 2656 if (!_this.videoLoaded && _this.core.s.autoplayFirstVideo) { 2657 this.play(); 2658 } 2659 }); 2660 } catch (e) { 2661 console.error('Make sure you have included videojs'); 2662 } 2663 } else { 2664 if(!_this.videoLoaded && _this.core.s.autoplayFirstVideo) { 2665 _this.core.$slide.eq(index).find('.lg-html5').get(0).play(); 2666 } 2667 } 2668 } 2669 } 2670 2671 function onAferAppendSlide(event, index) { 2672 /*jshint validthis:true */ 2673 var $videoCont = this.core.$slide.eq(index).find('.lg-video-cont'); 2674 if (!$videoCont.hasClass('lg-has-iframe')) { 2675 $videoCont.css('max-width', this.core.s.videoMaxWidth); 2676 this.videoLoaded = true; 2677 } 2678 } 2679 2680 function onBeforeSlide(event, prevIndex, index) { 2681 /*jshint validthis:true */ 2682 var _this = this; 2683 2684 var $videoSlide = _this.core.$slide.eq(prevIndex); 2685 var youtubePlayer = $videoSlide.find('.lg-youtube').get(0); 2686 var vimeoPlayer = $videoSlide.find('.lg-vimeo').get(0); 2687 var dailymotionPlayer = $videoSlide.find('.lg-dailymotion').get(0); 2688 var vkPlayer = $videoSlide.find('.lg-vk').get(0); 2689 var html5Player = $videoSlide.find('.lg-html5').get(0); 2690 if (youtubePlayer) { 2691 youtubePlayer.contentWindow.postMessage('{"event":"command","func":"pauseVideo","args":""}', '*'); 2692 } else if (vimeoPlayer) { 2693 try { 2694 $f(vimeoPlayer).api('pause'); 2695 } catch (e) { 2696 console.error('Make sure you have included froogaloop2 js'); 2697 } 2698 } else if (dailymotionPlayer) { 2699 dailymotionPlayer.contentWindow.postMessage('pause', '*'); 2700 2701 } else if (html5Player) { 2702 if (_this.core.s.videojs) { 2703 try { 2704 videojs(html5Player).pause(); 2705 } catch (e) { 2706 console.error('Make sure you have included videojs'); 2707 } 2708 } else { 2709 html5Player.pause(); 2710 } 2711 } if (vkPlayer) { 2712 $(vkPlayer).attr('src', $(vkPlayer).attr('src').replace('&autoplay', '&noplay')); 2713 } 2714 2715 var _src; 2716 if (_this.core.s.dynamic) { 2717 _src = _this.core.s.dynamicEl[index].src; 2718 } else { 2719 _src = _this.core.$items.eq(index).attr('href') || _this.core.$items.eq(index).attr('data-src'); 2720 2721 } 2722 2723 var _isVideo = _this.core.isVideo(_src, index) || {}; 2724 if (_isVideo.youtube || _isVideo.vimeo || _isVideo.dailymotion || _isVideo.vk) { 2725 _this.core.$outer.addClass('lg-hide-download'); 2726 } 2727 2728 } 2729 2730 $.fn.lightGallery.modules.video = Video; 2731 2732 })(); 2733 2734})); 2735 2736/*! lg-zoom - v1.1.0 - 2017-08-08 2737* http://sachinchoolur.github.io/lightGallery 2738* Copyright (c) 2017 Sachin N; Licensed GPLv3 */ 2739 2740(function (root, factory) { 2741 if (typeof define === 'function' && define.amd) { 2742 // AMD. Register as an anonymous module unless amdModuleId is set 2743 define(['jquery'], function (a0) { 2744 return (factory(a0)); 2745 }); 2746 } else if (typeof exports === 'object') { 2747 // Node. Does not work with strict CommonJS, but 2748 // only CommonJS-like environments that support module.exports, 2749 // like Node. 2750 module.exports = factory(require('jquery')); 2751 } else { 2752 factory(jQuery); 2753 } 2754}(this, function ($) { 2755 2756 (function() { 2757 2758 'use strict'; 2759 2760 var getUseLeft = function() { 2761 var useLeft = false;
vendor: 5,000 bytes, lines 2762-2892
2762 var isChrome = navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./); 2763 if (isChrome && parseInt(isChrome[2], 10) < 54) { 2764 useLeft = true; 2765 } 2766 2767 return useLeft; 2768 }; 2769 2770 var defaults = { 2771 scale: 1, 2772 zoom: true, 2773 actualSize: true, 2774 enableZoomAfter: 300, 2775 useLeftForZoom: getUseLeft() 2776 }; 2777 2778 var Zoom = function(element) { 2779 2780 this.core = $(element).data('lightGallery'); 2781 2782 this.core.s = $.extend({}, defaults, this.core.s); 2783 2784 if (this.core.s.zoom && this.core.doCss()) { 2785 this.init(); 2786 2787 // Store the zoomable timeout value just to clear it while closing 2788 this.zoomabletimeout = false; 2789 2790 // Set the initial value center 2791 this.pageX = $(window).width() / 2; 2792 this.pageY = ($(window).height() / 2) + $(window).scrollTop(); 2793 } 2794 2795 return this; 2796 }; 2797 2798 Zoom.prototype.init = function() { 2799 2800 var _this = this; 2801 var zoomIcons = '<button aria-label="Zoom In" title="Zoom In" id="lg-zoom-in" class="lg-icon fa fa-search-plus"></button><button aria-disabled="true" aria-label="Zoom Out" title="Zoom Out" id="lg-zoom-out" class="lg-icon fa fa-search-minus"></button>'; 2802 2803 if (_this.core.s.actualSize) { 2804 zoomIcons += '<button aria-pressed="false" aria-label="Actual Size" title="Actual Size" id="lg-actual-size" class="lg-icon fa fa-clone"></button>'; 2805 } 2806 2807 if (_this.core.s.useLeftForZoom) { 2808 _this.core.$outer.addClass('lg-use-left-for-zoom'); 2809 } else { 2810 _this.core.$outer.addClass('lg-use-transition-for-zoom'); 2811 } 2812 2813 this.core.$outer.find('.lg-toolbar').append(zoomIcons); 2814 2815 // Add zoomable class 2816 _this.core.$el.on('onSlideItemLoad.lg.tm.zoom', function(event, index, delay) { 2817 2818 // delay will be 0 except first time 2819 var _speed = _this.core.s.enableZoomAfter + delay; 2820 2821 // set _speed value 0 if gallery opened from direct url and if it is first slide 2822 if ($('body').hasClass('lg-from-hash') && delay) { 2823 2824 // will execute only once 2825 _speed = 0; 2826 } else { 2827 2828 // Remove lg-from-hash to enable starting animation. 2829 $('body').removeClass('lg-from-hash'); 2830 } 2831 2832 _this.zoomabletimeout = setTimeout(function() { 2833 _this.core.$slide.eq(index).addClass('lg-zoomable'); 2834 }, _speed + 30); 2835 }); 2836 2837 var scale = 1; 2838 /** 2839 * @desc Image zoom 2840 * Translate the wrap and scale the image to get better user experience 2841 * 2842 * @param {String} scaleVal - Zoom decrement/increment value 2843 */ 2844 var zoom = function(scaleVal) { 2845 2846 var $image = _this.core.$outer.find('.lg-current .lg-image'); 2847 var _x; 2848 var _y; 2849 2850 // Find offset manually to avoid issue after zoom 2851 var offsetX = ($(window).width() - $image.prop('offsetWidth')) / 2; 2852 var offsetY = (($(window).height() - $image.prop('offsetHeight')) / 2) + $(window).scrollTop(); 2853 2854 _x = _this.pageX - offsetX; 2855 _y = _this.pageY - offsetY; 2856 2857 var x = (scaleVal - 1) * (_x); 2858 var y = (scaleVal - 1) * (_y); 2859 2860 $image.css('transform', 'scale3d(' + scaleVal + ', ' + scaleVal + ', 1)').attr('data-scale', scaleVal); 2861 2862 if (_this.core.s.useLeftForZoom) { 2863 $image.parent().css({ 2864 left: -x + 'px', 2865 top: -y + 'px' 2866 }).attr('data-x', x).attr('data-y', y); 2867 } else { 2868 $image.parent().css('transform', 'translate3d(-' + x + 'px, -' + y + 'px, 0)').attr('data-x', x).attr('data-y', y); 2869 } 2870 }; 2871 2872 var callScale = function() { 2873 if (scale > 1) { 2874 _this.core.$outer.addClass('lg-zoomed'); 2875 _this.core.$outer.find('.lg-toolbar #lg-actual-size').attr('aria-pressed', 'false'); 2876 _this.core.$outer.find('.lg-toolbar #lg-zoom-out').attr('aria-disabled', 'false'); 2877 } else { 2878 _this.resetZoom(); 2879 } 2880 2881 if (scale < 1) { 2882 scale = 1; 2883 } 2884 2885 zoom(scale); 2886 }; 2887 2888 var actualSize = function(event, $image, index, fromIcon) { 2889 var w = $image.prop('offsetWidth'); 2890 var nw; 2891 if (_this.core.s.dynamic) { 2892 nw = _this.core.s.dynamicEl[index].width || $image[0].naturalWi
2892dth || w; 2893 } else { 2894 nw = _this.core.$items.eq(index).attr('data-width') || $image[0].naturalWidth || w; 2895 } 2896 2897 var _scale; 2898 2899 if (_this.core.$outer.hasClass('lg-zoomed')) { 2900 scale = 1; 2901 } else { 2902 if (nw > w) { 2903 _scale = nw / w; 2904 scale = _scale || 2; 2905 } 2906 } 2907 2908 if (fromIcon) { 2909 _this.pageX = $(window).width() / 2; 2910 _this.pageY = ($(window).height() / 2) + $(window).scrollTop(); 2911 } else { 2912 _this.pageX = event.pageX || event.originalEvent.targetTouches[0].pageX; 2913 _this.pageY = event.pageY || event.originalEvent.targetTouches[0].pageY; 2914 } 2915 2916 callScale(); 2917 setTimeout(function() { 2918 _this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab'); 2919 _this.core.$outer.find('.lg-toolbar #lg-actual-size').attr('aria-pressed', (scale == 1) ? 'false' : 'true'); 2920 }, 10); 2921 }; 2922 2923 var tapped = false; 2924 2925 // event triggered after appending slide content 2926 _this.core.$el.on('onAferAppendSlide.lg.tm.zoom', function(event, index) { 2927 2928 // Get the current element 2929 var $image = _this.core.$slide.eq(index).find('.lg-image'); 2930 2931 $image.on('dblclick', function(event) { 2932 actualSize(event, $image, index); 2933 }); 2934 2935 $image.on('touchstart', function(event) { 2936 if (!tapped) { 2937 tapped = setTimeout(function() { 2938 tapped = null; 2939 }, 300); 2940 } else { 2941 clearTimeout(tapped); 2942 tapped = null; 2943 actualSize(event, $image, index); 2944 } 2945 2946 event.preventDefault(); 2947 }); 2948 2949 }); 2950 2951 // Update zoom on resize and orientationchange 2952 $(window).on('resize.lg.zoom scroll.lg.zoom orientationchange.lg.zoom', function() { 2953 _this.pageX = $(window).width() / 2; 2954 _this.pageY = ($(window).height() / 2) + $(window).scrollTop(); 2955 zoom(scale); 2956 }); 2957 2958 $('#lg-zoom-out').on('click.lg keyup.lg', function(e) { 2959 if (e.type == 'click') { 2960 if (_this.core.$outer.find('.lg-current .lg-image').length) { 2961 scale -= _this.core.s.scale; 2962 callScale(); 2963 } 2964 } 2965 }); 2966 2967 $('#lg-zoom-in').on('click.lg keyup.lg', function(e) { 2968 if (e.type == 'click') { 2969 if (_this.core.$outer.find('.lg-current .lg-image').length) { 2970 scale += _this.core.s.scale; 2971 callScale(); 2972 } 2973 } 2974 }); 2975 2976 $('#lg-actual-size').on('click.lg keyup.lg', function(event) { 2977 if (event.type == 'click' || (event.type == 'keyup' && (event.which == 13 || event.which == 32))) { 2978 actualSize(event, _this.core.$slide.eq(_this.core.index).find('.lg-image'), _this.core.index, true); 2979 } 2980 }); 2981 2982 // Reset zoom on slide change 2983 _this.core.$el.on('onBeforeSlide.lg.tm', function() { 2984 scale = 1; 2985 _this.resetZoom(); 2986 }); 2987 2988 // Drag option after zoom 2989 _this.zoomDrag(); 2990 2991 _this.zoomSwipe(); 2992 2993 }; 2994 2995 // Reset zoom effect 2996 Zoom.prototype.resetZoom = function() { 2997 this.core.$outer.removeClass('lg-zoomed'); 2998 this.core.$slide.find('.lg-img-wrap').removeAttr('style data-x data-y'); 2999 this.core.$slide.find('.lg-image').removeAttr('style data-scale'); 3000 this.core.$outer.find('.lg-toolbar #lg-zoom-out').attr('aria-disabled', 'true'); 3001 3002 // Reset pagx pagy values to center 3003 this.pageX = $(window).width() / 2; 3004 this.pageY = ($(window).height() / 2) + $(window).scrollTop(); 3005 }; 3006 3007 Zoom.prototype.zoomSwipe = function() { 3008 var _this = this; 3009 var startCoords = {}; 3010 var endCoords = {}; 3011 var isMoved = false;
3012 3013 // Allow x direction drag 3014 var allowX = false; 3015 3016 // Allow Y direction drag 3017 var allowY = false; 3018 3019 _this.core.$slide.on('touchstart.lg', function(e) { 3020 3021 if (_this.core.$outer.hasClass('lg-zoomed')) { 3022 var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object'); 3023 3024 allowY = $image.prop('offsetHeight') * $image.attr('data-scale') > _this.core.$outer.find('.lg').height(); 3025 allowX = $image.prop('offsetWidth') * $image.attr('data-scale') > _this.core.$outer.find('.lg').width(); 3026 if ((allowX || allowY)) { 3027 e.preventDefault(); 3028 startCoords = { 3029 x: e.originalEvent.targetTouches[0].pageX, 3030 y: e.originalEvent.targetTouches[0].pageY 3031 }; 3032 } 3033 } 3034 3035 }); 3036 3037 _this.core.$slide.on('touchmove.lg', function(e) { 3038 3039 if (_this.core.$outer.hasClass('lg-zoomed')) { 3040 3041 var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap'); 3042 var distanceX; 3043 var distanceY; 3044 3045 e.preventDefault(); 3046 isMoved = true; 3047 3048 endCoords = { 3049 x: e.originalEvent.targetTouches[0].pageX, 3050 y: e.originalEvent.targetTouches[0].pageY 3051 }; 3052 3053 // reset opacity and transition duration 3054 _this.core.$outer.addClass('lg-zoom-dragging'); 3055 3056 if (allowY) { 3057 distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y); 3058 } else { 3059 distanceY = -Math.abs(_$el.attr('data-y')); 3060 } 3061 3062 if (allowX) { 3063 distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x); 3064 } else { 3065 distanceX = -Math.abs(_$el.attr('data-x')); 3066 } 3067 3068 if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) { 3069 3070 if (_this.core.s.useLeftForZoom) { 3071 _$el.css({ 3072 left: distanceX + 'px', 3073 top: distanceY + 'px' 3074 }); 3075 } else { 3076 _$el.css('transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)'); 3077 } 3078 } 3079 3080 } 3081 3082 }); 3083 3084 _this.core.$slide.on('touchend.lg', function() { 3085 if (_this.core.$outer.hasClass('lg-zoomed')) { 3086 if (isMoved) { 3087 isMoved = false; 3088 _this.core.$outer.removeClass('lg-zoom-dragging'); 3089 _this.touchendZoom(startCoords, endCoords, allowX, allowY); 3090 3091 } 3092 } 3093 }); 3094 3095 }; 3096 3097 Zoom.prototype.zoomDrag = function() { 3098 3099 var _this = this; 3100 var startCoords = {}; 3101 var endCoords = {}; 3102 var isDraging = false; 3103 var isMoved = false; 3104 3105 // Allow x direction drag 3106 var allowX = false; 3107 3108 // Allow Y direction drag 3109 var allowY = false; 3110 3111 _this.core.$slide.on('mousedown.lg.zoom', function(e) { 3112 3113 // execute only on .lg-object 3114 var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object'); 3115 3116 allowY = $image.prop('offsetHeight') * $image.attr('data-scale') > _this.core.$outer.find('.lg').height(); 3117 allowX = $image.prop('offsetWidth') * $image.attr('data-scale') > _this.core.$outer.find('.lg').width(); 3118 3119 if (_this.core.$outer.hasClass('lg-zoomed')) { 3120 if ($(e.target).hasClass('lg-object') && (allowX || allowY)) { 3121 e.preventDefault(); 3122 startCoords = { 3123 x: e.pageX, 3124 y: e.pageY 3125 }; 3126 3127 isDraging = true; 3128 3129 // ** Fix for webkit cursor issue https://code.google.com/p/chromium/issues/detail?id=26723 3130 _this.core.$outer.scrollLeft += 1; 3131 _this.core.$outer.scrollLeft -= 1; 3132 3133 _this.core.$outer.removeClass('lg-grab').addClass('lg-grabbing'); 3134 } 3135 } 3136 }); 3137 3138 $(window).on('mousemove.lg.zoom', function(e) { 3139 if (isDraging) { 3140 var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap'); 3141 var distanceX; 3142 var distanceY; 3143 3144 isMoved = true; 3145 endCoords = { 3146 x: e.pageX, 3147 y: e.pageY 3148 }; 3149 3150 // reset opacity and transition duration 3151 _this.core.$outer.addClass('lg-zoom-dragging'); 3152 3153 if (allowY) { 3154 distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y); 3155 } else { 3156 distanceY = -Math.abs(_$el.attr('data-y')); 3157 } 3158 3159 if (allowX) { 3160 distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x); 3161 } else { 3162 distanceX = -Math.abs(_$el.attr('data-x')); 3163 } 3164 3165 if (_this.core.s.useLeftForZoom) { 3166 _$el.css({ 3167 left: distanceX + 'px', 3168 top: distanceY + 'px' 3169 }); 3170 } else { 3171 _$el.css('transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)'); 3172 } 3173 } 3174 }); 3175 3176 $(window).on('mouseup.lg.zoom', function(e) { 3177 3178 if (isDraging) { 3179 isDraging = false;
3180 _this.core.$outer.removeClass('lg-zoom-dragging'); 3181 3182 // Fix for chrome mouse move on click 3183 if (isMoved && ((startCoords.x !== endCoords.x) || (startCoords.y !== endCoords.y))) { 3184 endCoords = { 3185 x: e.pageX, 3186 y: e.pageY 3187 }; 3188 _this.touchendZoom(startCoords, endCoords, allowX, allowY); 3189 3190 } 3191 3192 isMoved = false; 3193 } 3194 3195 _this.core.$outer.removeClass('lg-grabbing').addClass('lg-grab'); 3196 3197 }); 3198 }; 3199 3200 Zoom.prototype.touchendZoom = function(startCoords, endCoords, allowX, allowY) { 3201 3202 var _this = this; 3203 var _$el = _this.core.$slide.eq(_this.core.index).find('.lg-img-wrap'); 3204 var $image = _this.core.$slide.eq(_this.core.index).find('.lg-object'); 3205 var distanceX = (-Math.abs(_$el.attr('data-x'))) + (endCoords.x - startCoords.x); 3206 var distanceY = (-Math.abs(_$el.attr('data-y'))) + (endCoords.y - startCoords.y); 3207 var minY = (_this.core.$outer.find('.lg').height() - $image.prop('offsetHeight')) / 2; 3208 var maxY = Math.abs(($image.prop('offsetHeight') * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').height() + minY); 3209 var minX = (_this.core.$outer.find('.lg').width() - $image.prop('offsetWidth')) / 2; 3210 var maxX = Math.abs(($image.prop('offsetWidth') * Math.abs($image.attr('data-scale'))) - _this.core.$outer.find('.lg').width() + minX); 3211 3212 if ((Math.abs(endCoords.x - startCoords.x) > 15) || (Math.abs(endCoords.y - startCoords.y) > 15)) { 3213 if (allowY) { 3214 if (distanceY <= -maxY) { 3215 distanceY = -maxY; 3216 } else if (distanceY >= -minY) { 3217 distanceY = -minY; 3218 } 3219 } 3220 3221 if (allowX) { 3222 if (distanceX <= -maxX) { 3223 distanceX = -maxX; 3224 } else if (distanceX >= -minX) { 3225 distanceX = -minX; 3226 } 3227 } 3228 3229 if (allowY) { 3230 _$el.attr('data-y', Math.abs(distanceY)); 3231 } else { 3232 distanceY = -Math.abs(_$el.attr('data-y')); 3233 } 3234 3235 if (allowX) { 3236 _$el.attr('data-x', Math.abs(distanceX)); 3237 } else { 3238 distanceX = -Math.abs(_$el.attr('data-x')); 3239 } 3240 3241 if (_this.core.s.useLeftForZoom) { 3242 _$el.css({ 3243 left: distanceX + 'px', 3244 top: distanceY + 'px' 3245 }); 3246 } else { 3247 _$el.css('transform', 'translate3d(' + distanceX + 'px, ' + distanceY + 'px, 0)'); 3248 } 3249 3250 } 3251 }; 3252 3253 Zoom.prototype.destroy = function() { 3254 3255 var _this = this; 3256 3257 // Unbind all events added by lightGallery zoom plugin 3258 _this.core.$el.off('.lg.zoom'); 3259 $(window).off('.lg.zoom'); 3260 _this.core.$slide.off('.lg.zoom'); 3261 _this.core.$el.off('.lg.tm.zoom'); 3262 _this.resetZoom(); 3263 clearTimeout(_this.zoomabletimeout); 3264 _this.zoomabletimeout = false; 3265 }; 3266 3267 $.fn.lightGallery.modules.zoom = Zoom; 3268 3269 })(); 3270 3271 3272})); 3273 3274/*! lg-hash - v1.0.4 - 2017-12-20 3275* http://sachinchoolur.github.io/lightGallery 3276* Copyright (c) 2017 Sachin N; Licensed GPLv3 */ 3277 3278(function (root, factory) { 3279 if (typeof define === 'function' && define.amd) { 3280 // AMD. Register as an anonymous module unless amdModuleId is set 3281 define(['jquery'], function (a0) { 3282 return (factory(a0)); 3283 }); 3284 } else if (typeof exports === 'object') { 3285 // Node. Does not work with strict CommonJS, but 3286 // only CommonJS-like environments that support module.exports, 3287 // like Node. 3288 module.exports = factory(require('jquery')); 3289 } else { 3290 factory(jQuery); 3291 } 3292}(this, function ($) { 3293 3294 (function() { 3295 3296 'use strict'; 3297 3298 var defaults = { 3299 hash: true 3300 }; 3301 3302 var Hash = function(element) { 3303 3304 this.core = $(element).data('lightGallery'); 3305 3306 this.core.s = $.extend({}, defaults, this.core.s); 3307 3308 if (this.core.s.hash) { 3309 this.oldHash = window.location.hash; 3310 this.init(); 3311 } 3312 3313 return this; 3314 }; 3315 3316 Hash.prototype.init = function() { 3317 var _this = this; 3318 var _hash; 3319 3320 // Change hash value on after each slide transition 3321 _this.core.$el.on('onAfterSlide.lg.tm', function(event, prevIndex, index) { 3322 if (history.replaceState) { 3323 history.replaceState(null, null, window.location.pathname + window.location.search + '#lg=' + _this.core.s.galleryId + '&slide=' + index); 3324 } else { 3325 window.location.hash = 'lg=' + _this.core.s.galleryId + '&slide=' + index; 3326 } 3327 }); 3328 3329 // Listen hash change and change the slide according to slide value 3330 $(window).on('hashchange.lg.hash', function() { 3331 _hash = window.location.hash; 3332 var _idx = parseInt(_hash.split('&slide=')[1], 10); 3333 3334 // it galleryId doesn't exist in the url close the gallery 3335 if ((_hash.indexOf('lg=' + _this.core.s.galleryId) > -1)) { 3336 _this.core.slide(_idx, false, false); 3337 } else if (_this.core.lGalleryOn) { 3338 _this.core.destroy(); 3339 } 3340 3341 }); 3342 }; 3343 3344 Hash.prototype.destroy = function() { 3345 3346 if (!this.core.s.hash) { 3347 return; 3348 } 3349 3350 // Reset to old hash value 3351 if (this.oldHash && this.oldHash.indexOf('lg=' + this.core.s.galleryId) < 0) { 3352 if (history.replaceState) { 3353 history.replaceState(null, null, this.oldHash); 3354 } else { 3355 window.location.hash = this.oldHash; 3356 } 3357 } else { 3358 if (history.replaceState) { 3359 history.replaceState(null, document.title, window.location.pathname + window.location.search); 3360 } else { 3361 window.location.hash = ''; 3362 } 3363 } 3364 3365 this.core.$el.off('.lg.hash'); 3366 3367 }; 3368 3369 $.fn.lightGallery.modules.hash = Hash; 3370 3371 })(); 3372 3373 3374})); 3375 3376/*! lg-share - v1.1.0 - 2017-10-03 3377* http://sachinchoolur.github.io/lightGallery 3378* Copyright (c) 2017 Sachin N; Licensed GPLv3 */ 3379 3380(function (root, factory) { 3381 if (typeof define === 'function' && define.amd) { 3382 // AMD. Register as an anonymous module unless amdModuleId is set 3383 define(['jquery'], function (a0) { 3384 return (factory(a0)); 3385 }); 3386 } else if (typeof exports === 'object') { 3387 // Node. Does not work with strict CommonJS, but 3388 // only CommonJS-like environments that support module.exports, 3389 // like Node. 3390 module.exports = factory(require('jquery')); 3391 } else { 3392 factory(jQuery); 3393 } 3394}(this, function ($) { 3395 3396 (function() { 3397 3398 'use strict'; 3399 3400 var defaults = { 3401 share: true, 3402 facebook: true, 3403 facebookDropdownText: 'Facebook', 3404 twitter: true, 3405 twitterDropdownText: 'X', 3406 googlePlus: false, 3407 googlePlusDropdownText: 'GooglePlus', 3408 pinterest: true, 3409 pinterestDropdownText: 'Pinterest' 3410 }; 3411 3412 var Share = function(element) { 3413 3414 this.core = $(element).data('lightGallery'); 3415 3416 this.core.s = $.extend({}, defaults, this.core.s); 3417 if (this.core.s.share) { 3418 this.init(); 3419 } 3420 3421 return this; 3422 }; 3423 3424 Share.prototype.init = function() { 3425 var _this = this; 3426 var shareHtml = '<div class="share-wrapper" style="float: right; position: relative;"><button aria-expanded="false" aria-label="Share" title="Share" id="lg-share" class="lg-icon fa fa-share-alt"></button>' + 3427 '<ul class="lg-dropdown" style="position: absolute;">'; 3428 shareHtml += _this.core.s.facebook ? '<li><a id="lg-share-facebook" target="_blank"><span class="lg-icon fab fa-facebook" aria-label="Facebook" title="Facebook"></span><span class="lg-dropdown-text">' + this.core.s.facebookDropdownText + '</span></a></li>' : ''; 3429 shareHtml += _this.core.s.twitter ? '<li><a id="lg-share-twitter" target="_blank"><span class="lg-icon fab fa-x-twitter" aria-label="X" title="X"></span><span class="lg-dropdown-text">' + this.core.s.twitterDropdownText + '</span></a></li>' : ''; 3430 shareHtml += _this.core.s.googlePlus ? '<li><a id="lg-share-googleplus" target="_blank"><span class="lg-icon fab fa-google-plus" aria-label="Google Plus" title="Google Plus"></span><span class="lg-dropdown-text">' + this.core.s.googlePlusDropdownText + '</span></a></li>' : ''; 3431 shareHtml += _this.core.s.pinterest ? '<li><a id="lg-share-pinterest" target="_blank"><span class="lg-icon fa fa-pinterest" aria-label="Pinterest" title="Pinterest"></span><span class="lg-dropdown-text">' + this.core.s.pinterestDropdownText + '</span></a></li>' : ''; 3432 shareHtml += '</ul></div>'; 3433 3434 this.core.$outer.find('.lg-toolbar').append(shareHtml); 3435 this.core.$outer.find('.lg').append('<div id="lg-dropdown-overlay"></div>'); 3436 $('#lg-share').on('click.lg keyup.lg', function(e){ 3437 if (e.type == 'click') { 3438 _this.core.$outer.toggleClass('lg-dropdown-active'); 3439 3440 if (_this.core.$outer.hasClass('lg-dropdown-active')) { 3441 $(this).attr('aria-expanded', 'true'); 3442 } else { 3443 $(this).attr('aria-expanded', 'false'); 3444 } 3445 } 3446 }); 3447 3448 $('#lg-dropdown-overlay').on('click.lg keyup.lg', function(e){ 3449 if (e.type == 'click') { 3450 _this.core.$outer.removeClass('lg-dropdown-active'); 3451 _this.core.$outer.find('#lg-share').attr('aria-expanded', 'false'); 3452 } 3453 }); 3454 3455 _this.core.$el.on('onAfterSlide.lg.tm', function(event, prevIndex, index) { 3456 3457 setTimeout(function() { 3458 3459 $('#lg-share-facebook').attr('href', 'https://www.facebook.com/sharer/sharer.php?u=' + (encodeURIComponent(_this.get
vendor: 1,509 bytes, lines 3459-3493
3459SahreProps(index, 'facebookShareUrl') || window.location.href))); 3460 3461 $('#lg-share-twitter').attr('href', 'https://twitter.com/intent/tweet?text=' + _this.getSahreProps(index, 'tweetText') + '&url=' + (encodeURIComponent(_this.getSahreProps(index, 'twitterShareUrl') || window.location.href))); 3462 3463 $('#lg-share-googleplus').attr('href', 'https://plus.google.com/share?url=' + (encodeURIComponent(_this.getSahreProps(index, 'googleplusShareUrl') || window.location.href))); 3464 3465 $('#lg-share-pinterest').attr('href', 'http://www.pinterest.com/pin/create/button/?url=' + (encodeURIComponent(_this.getSahreProps(index, 'pinterestShareUrl') || window.location.href)) + '&media=' + encodeURIComponent(_this.getSahreProps(index, 'src')) + '&description=' + _this.getSahreProps(index, 'pinterestText')); 3466 3467 }, 100); 3468 }); 3469 }; 3470 3471 Share.prototype.getSahreProps = function(index, prop){ 3472 var shareProp = ''; 3473 if(this.core.s.dynamic) { 3474 shareProp = this.core.s.dynamicEl[index][prop]; 3475 } else { 3476 var _href = this.core.$items.eq(index).attr('href'); 3477 var _prop = this.core.$items.eq(index).data(prop); 3478 shareProp = prop === 'src' ? _href || _prop : _prop; 3479 } 3480 return shareProp; 3481 }; 3482 3483 Share.prototype.destroy = function() { 3484 3485 }; 3486 3487 $.fn.lightGallery.modules.share = Share; 3488 3489 })(); 3490 3491 3492 3493}));
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.