vendor: 16,305 bytes, lines 1-521
1/* 2 _ _ _ _ 3 ___| (_) ___| | __ (_)___ 4/ __| | |/ __| |/ / | / __| 5\__ \ | | (__| < _ | \__ \ 6|___/_|_|\___|_|\_(_)/ |___/ 7 |__/ 8 9 Version: 1.6.0 10 Author: Ken Wheeler 11 Website: http://kenwheeler.github.io 12 Docs: http://kenwheeler.github.io/slick 13 Repo: http://github.com/kenwheeler/slick 14 Issues: http://github.com/kenwheeler/slick/issues 15 16 */ 17(function($) { 18 'use strict'; 19 var Slick = window.a4jSlick || {}; 20 21 Slick = (function() { 22 23 var instanceUid = 0; 24 25 function Slick(element, settings) { 26 27 var _ = this, dataSettings; 28 29 _.defaults = { 30 accessibility: true, 31 adaptiveHeight: false, 32 appendArrows: $(element), 33 appendDots: $(element), 34 arrows: true, 35 asNavFor: null, 36 prevArrow: '<span data-role="none" class="a4j-slick-prev" aria-label="Previous" tabindex="0" role="button"><i class="ing-icon-angle-left ing-fw"></i></span>', 37 nextArrow: '<span data-role="none" class="a4j-slick-next" aria-label="Next" tabindex="0" role="button"><i class="ing-icon-angle-right ing-fw"></i></span>', 38 autoplay: false, 39 autoplaySpeed: 3000, 40 centerMode: false, 41 centerPadding: '50px', 42 cssEase: 'ease', 43 customPaging: function(slider, i) { 44 return $('<i data-role="none" role="button" tabindex="0" />').text(i + 1); 45 }, 46 dots: false, 47 dotsClass: 'a4j-slick-dots', 48 draggable: true, 49 easing: 'linear', 50 edgeFriction: 0.35, 51 fade: false, 52 focusOnSelect: false, 53 infinite: false, 54 initialSlide: 0, 55 lazyLoad: 'ondemand', 56 mobileFirst: false, 57 pauseOnHover: true, 58 pauseOnFocus: true, 59 pauseOnDotsHover: false, 60 respondTo: 'window', 61 responsive: null, 62 rows: 1, 63 rtl: false, 64 slide: '', 65 slidesPerRow: 1, 66 slidesToShow: 1, 67 slidesToScroll: 1, 68 speed: 500, 69 swipe: true, 70 swipeToSlide: false, 71 touchMove: true, 72 touchThreshold: 5, 73 useCSS: true, 74 useTransform: true, 75 variableWidth: false, 76 vertical: false, 77 verticalSwiping: false, 78 waitForAnimate: true, 79 zIndex: 1000 80 }; 81 82 _.initials = { 83 animating: false, 84 dragging: false, 85 autoPlayTimer: null, 86 currentDirection: 0, 87 currentLeft: null, 88 currentSlide: 0, 89 direction: 1, 90 $dots: null, 91 listWidth: null, 92 listHeight: null, 93 loadIndex: 0, 94 $nextArrow: null, 95 $prevArrow: null, 96 slideCount: null, 97 slideWidth: null, 98 $slideTrack: null, 99 $slides: null, 100 sliding: false, 101 slideOffset: 0, 102 swipeLeft: null, 103 $list: null, 104 touchObject: {}, 105 transformsEnabled: false, 106 unslicked: false 107 }; 108 109 $.extend(_, _.initials); 110 111 _.activeBreakpoint = null; 112 _.animType = null; 113 _.animProp = null; 114 _.breakpoints = []; 115 _.breakpointSettings = []; 116 _.cssTransitions = false; 117 _.focussed = false; 118 _.interrupted = false; 119 _.hidden = 'hidden'; 120 _.paused = true; 121 _.positionProp = null; 122 _.respondTo = null; 123 _.rowCount = 1; 124 _.shouldClick = true; 125 _.$slider = $(element); 126 _.$slidesCache = null; 127 _.transformType = null; 128 _.transitionType = null; 129 _.visibilityChange = 'visibilitychange'; 130 _.windowWidth = 0; 131 _.windowTimer = null; 132 133 dataSettings = JSON.parse($(element).attr('data-slick') || '{}'); 134 135 _.options = $.extend({}, _.defaults, settings, dataSettings); 136 137 _.currentSlide = _.options.initialSlide; 138 139 _.originalSettings = _.options; 140 141 if (typeof document.mozHidden !== 'undefined') { 142 _.hidden = 'mozHidden'; 143 _.visibilityChange = 'mozvisibilitychange'; 144 } else if (typeof document.webkitHidden !== 'undefined') { 145 _.hidden = 'webkitHidden'; 146 _.visibilityChange = 'webkitvisibilitychange'; 147 } 148 149 _.autoPlay = $.proxy(_.autoPlay, _); 150 _.autoPlayClear = $.proxy(_.autoPlayClear, _); 151 _.autoPlayIterator = $.proxy(_.autoPlayIterator, _); 152 _.changeSlide = $.proxy(_.changeSlide, _); 153 _.clickHandler = $.proxy(_.clickHandler, _); 154 _.selectHandler = $.proxy(_.selectHandler, _); 155 _.setPosition = $.proxy(_.setPosition, _); 156 _.swipeHandler = $.proxy(_.swipeHandler, _); 157 _.dragHandler = $.proxy(_.dragHandler, _); 158 _.keyHandler = $.proxy(_.keyHandler, _); 159 160 _.instanceUid = instanceUid++; 161 162 // A simple way to check for HTML strings 163 // Strict HTML recognition (must start with <) 164 // Extracted from jQuery v1.11 source 165 _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/; 166 167 168 _.registerBreakpoints(); 169 _.init(true); 170 171 $(element).data('ingslick',_); 172 } 173 174 return Slick; 175 176 }()); 177 178 Slick.prototype.activateADA = function() { 179 var _ = this; 180 181 _.$slideTrack.find('.a4j-slick-active').attr({ 182 'aria-hidden': 'false' 183 }).find('a, input, button, select').attr({ 184 'tabindex': '0' 185 }); 186 187 }; 188 189 Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) { 190 var _ = this; 191 192 if (typeof(index) === 'boolean') { 193 addBefore = index; 194 index = null; 195 } else if (index < 0 || (index >= _.slideCount)) { 196 return false; 197 } 198 199 _.unload(); 200 201 if (typeof(index) === 'number') { 202 if (index === 0 && _.$slides.length === 0) { 203 _.getRowsItems($(markup)).appendTo(_.$slideTrack); 204 } else if (addBefore) { 205 _.getRowsItems($(markup)).insertBefore(_.$slides.eq(index)); 206 } else { 207 _.getRowsItems($(markup)).insertAfter(_.$slides.eq(index)); 208 } 209 } else { 210 if (addBefore === true) { 211 _.getRowsItems($(markup)).prependTo(_.$slideTrack); 212 } else { 213 _.getRowsItems($(markup)).appendTo(_.$slideTrack); 214 } 215 } 216 217 _.$slides = _.$slideTrack.children(this.options.slide); 218 219 _.$slideTrack.children(this.options.slide).detach(); 220 221 _.$slideTrack.append(_.$slides); 222 223 _.$slides.each(function(index, element) { 224 $(element).attr('data-slick-index', index); 225 }); 226 227 _.$slidesCache = _.$slides; 228 229 _.reinit(); 230 231 }; 232 233 234 235 Slick.prototype.animateHeight = function() { 236 var _ = this; 237 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 238 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 239 _.$list.animate({ 240 height: targetHeight 241 }, _.options.speed); 242 } 243 }; 244 245 Slick.prototype.animateSlide = function(targetLeft, callback) { 246 247 var animProps = {}, 248 _ = this; 249 250 _.animateHeight(); 251 252 if (_.options.rtl === true && _.options.vertical === false) { 253 targetLeft = -targetLeft; 254 } 255 if (_.transformsEnabled === false) { 256 if (_.options.vertical === false) { 257 _.$slideTrack.animate({ 258 left: targetLeft 259 }, _.options.speed, _.options.easing, callback); 260 } else { 261 _.$slideTrack.animate({ 262 top: targetLeft 263 }, _.options.speed, _.options.easing, callback); 264 } 265 266 } else { 267 268 if (_.cssTransitions === false) { 269 if (_.options.rtl === true) { 270 _.currentLeft = -(_.currentLeft); 271 } 272 $({ 273 animStart: _.currentLeft 274 }).animate({ 275 animStart: targetLeft 276 }, { 277 duration: _.options.speed, 278 easing: _.options.easing, 279 step: function(now) { 280 now = Math.ceil(now); 281 if (_.options.vertical === false) { 282 animProps[_.animType] = 'translate(' + 283 now + 'px, 0px)'; 284 _.$slideTrack.css(animProps); 285 } else { 286 animProps[_.animType] = 'translate(0px,' + 287 now + 'px)'; 288 _.$slideTrack.css(animProps); 289 } 290 }, 291 complete: function() { 292 if (callback) { 293 callback.call(); 294 } 295 } 296 }); 297 298 } else { 299 300 _.applyTransition(); 301 targetLeft = Math.ceil(targetLeft); 302 303 if (_.options.vertical === false) { 304 animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)'; 305 } else { 306 animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)'; 307 } 308 _.$slideTrack.css(animProps); 309 310 if (callback) { 311 setTimeout(function() { 312 313 _.disableTransition(); 314 315 callback.call(); 316 }, _.options.speed); 317 } 318 319 } 320 321 } 322 323 }; 324 325 Slick.prototype.getNavTarget = function() { 326 327 var _ = this, 328 asNavFor = _.options.asNavFor; 329 330 if ( asNavFor && asNavFor !== null ) { 331 asNavFor = $(asNavFor).not(_.$slider); 332 } 333 334 return asNavFor; 335 336 }; 337 338 Slick.prototype.asNavFor = function(index) { 339 340 var _ = this, 341 asNavFor = _.getNavTarget(); 342 343 if ( asNavFor !== null && typeof asNavFor === 'object' ) { 344 asNavFor.each(function() { 345 var target = $(this).a4jslick('getSlick'); 346 if(!target.unslicked) { 347 target.slideHandler(index, true); 348 } 349 }); 350 } 351 352 }; 353 354 Slick.prototype.applyTransition = function(slide) { 355 356 var _ = this, 357 transition = {}; 358 359 if (_.options.fade === false) { 360 transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase; 361 } else { 362 transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase; 363 } 364 365 if (_.options.fade === false) { 366 _.$slideTrack.css(transition); 367 } else { 368 _.$slides.eq(slide).css(transition); 369 } 370 371 }; 372 373 Slick.prototype.autoPlay = function() { 374 375 var _ = this; 376 377 _.autoPlayClear(); 378 379 if ( _.slideCount > _.options.slidesToShow ) { 380 _.autoPlayTimer = setInterval( _.autoPlayIterator, _.options.autoplaySpeed ); 381 } 382 383 }; 384 385 Slick.prototype.autoPlayClear = function() { 386 387 var _ = this; 388 389 if (_.autoPlayTimer) { 390 clearInterval(_.autoPlayTimer); 391 } 392 393 }; 394 395 Slick.prototype.autoPlayIterator = function() { 396 397 var _ = this, 398 slideTo = _.currentSlide + _.options.slidesToScroll; 399 400 if ( !_.paused && !_.interrupted && !_.focussed ) { 401 402 if ( _.options.infinite === false ) { 403 404 if ( _.direction === 1 && ( _.currentSlide + 1 ) === ( _.slideCount - 1 )) { 405 _.direction = 0; 406 } 407 408 else if ( _.direction === 0 ) { 409 410 slideTo = _.currentSlide - _.options.slidesToScroll; 411 412 if ( _.currentSlide - 1 === 0 ) { 413 _.direction = 1; 414 } 415 416 } 417 418 } 419 420 _.slideHandler( slideTo ); 421 422 } 423 424 }; 425 426 Slick.prototype.buildArrows = function() { 427 428 var _ = this; 429 430 if (_.options.arrows === true ) { 431 432 _.$prevArrow = $(_.options.prevArrow).addClass('a4j-slick-arrow'); 433 _.$nextArrow = $(_.options.nextArrow).addClass('a4j-slick-arrow'); 434 435 if( _.slideCount > _.options.slidesToShow ) { 436 437 _.$prevArrow.removeClass('a4j-slick-hidden').removeAttr('aria-hidden tabindex'); 438 _.$nextArrow.removeClass('a4j-slick-hidden').removeAttr('aria-hidden tabindex'); 439 440 if (_.htmlExpr.test(_.options.prevArrow)) { 441 _.$prevArrow.appendTo(_.options.appendArrows); 442 } 443 444 if (_.htmlExpr.test(_.options.nextArrow)) { 445 _.$nextArrow.appendTo(_.options.appendArrows); 446 } 447 448 if (_.options.infinite !== true) { 449 _.$prevArrow 450 .addClass('a4j-slick-disabled') 451 .attr('aria-disabled', 'true'); 452 } 453 454 } else { 455 456 _.$prevArrow.add( _.$nextArrow ) 457 458 .addClass('a4j-slick-hidden') 459 .attr({ 460 'aria-disabled': 'true', 461 'tabindex': '-1' 462 }); 463 464 } 465 466 } 467 468 }; 469 470 Slick.prototype.buildDots = function() { 471 472 var _ = this, 473 i, dot; 474 475 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 476 477 _.$slider.addClass('a4j-slick-dotted'); 478 479 dot = $('<div />').addClass(_.options.dotsClass); 480 481 for (i = 0; i <= _.getDotCount(); i += 1) { 482 dot.append(_.options.customPaging.call(this, _, i)); 483 } 484 485 _.$dots = dot.appendTo(_.options.appendDots); 486 487 _.$dots.find('i').first().addClass('a4j-slick-active').attr('aria-hidden', 'false'); 488 489 } 490 491 }; 492 493 Slick.prototype.buildOut = function() { 494 495 var _ = this; 496 497 _.$slides = 498 _.$slider 499 .children( _.options.slide + ':not(.a4j-slick-cloned)') 500 .addClass('a4j-slick-slide'); 501 502 _.slideCount = _.$slides.length; 503 504 _.$slides.each(function(index, element) { 505 $(element) 506 .attr('data-slick-index', index) 507 .data('originalStyling', $(element).attr('style') || ''); 508 }); 509 510 _.$slider.addClass('a4j-slick-slider'); 511 _.$slider.addClass('a4j-slick-slider'); 512 513 _.$slideTrack = (_.slideCount === 0) ? 514 $('<div class="a4j-slick-track"/>').appendTo(_.$slider) : 515 _.$slides.wrapAll('<div class="a4j-slick-track"/>').parent(); 516 517 _.$list = _.$slideTrack.wrap( 518 '<div aria-live="polite" class="a4j-slick-list"/>').parent(); 519 _.$slideTrack.css('opacity', 0); 520 521 if (_.options.centerMode === true || _.options.swipeToSlide === true) {
522 _.options.slidesToScroll = 1; 523 } 524 525 $('img[data-lazy]', _.$slider).not('[src]').addClass('a4j-slick-loading'); 526 527 _.setupInfinite(); 528 529 _.buildArrows(); 530 531 _.buildDots(); 532 533 _.updateDots(); 534 535 536 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 537 538 if (_.options.draggable === true) { 539 _.$list.addClass('draggable'); 540 } 541 542 }; 543 544 Slick.prototype.buildRows = function() { 545 546 var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection; 547 548 newSlides = document.createDocumentFragment(); 549 originalSlides = _.$slider.children(); 550 551 if(_.options.rows > 1) { 552 553 slidesPerSection = _.options.slidesPerRow * _.options.rows; 554 numOfSlides = Math.ceil( 555 originalSlides.length / slidesPerSection 556 ); 557 558 for(a = 0; a < numOfSlides; a++){ 559 var slide = document.createElement('div'); 560 for(b = 0; b < _.options.rows; b++) { 561 var row = document.createElement('div'); 562 row.className = "ingallery-row"; 563 for(c = 0; c < _.options.slidesPerRow; c++) { 564 var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c)); 565 if (originalSlides.get(target)) { 566 row.appendChild(originalSlides.get(target)); 567 } 568 } 569 slide.appendChild(row); 570 } 571 newSlides.appendChild(slide); 572 } 573 574 _.$slider.empty().append(newSlides); 575 _.$slider.children().children().children() 576 .css({ 577 'width':(100 / _.options.slidesPerRow) + '%', 578 }); 579 580 } 581 582 }; 583 584 Slick.prototype.getRowsItems = function(_jqItems){ 585 var _ = this; 586 if(_.options.rows <= 1){ 587 return _jqItems; 588 } 589 var slide = $('<div></div>'); 590 var index = 0; 591 for(var a=0;a<_.options.rows;a++) { 592 var row = $('<div class="ingallery-row"></div>'); 593 slide.append(row); 594 for(var b=0;b<_.options.slidesPerRow;b++){ 595 var _item = $(_jqItems.get(index)).css('width',(100 / _.options.slidesPerRow) + '%'); 596 row.append(_item); 597 index++; 598 } 599 } 600 return slide; 601 }; 602 603 Slick.prototype.checkResponsive = function(initial, forceUpdate) { 604 605 var _ = this, 606 breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false; 607 var sliderWidth = _.$slider.width(); 608 var windowWidth = window.innerWidth || $(window).width(); 609 610 if (_.respondTo === 'window') { 611 respondToWidth = windowWidth; 612 } else if (_.respondTo === 'slider') { 613 respondToWidth = sliderWidth; 614 } else if (_.respondTo === 'min') { 615 respondToWidth = Math.min(windowWidth, sliderWidth); 616 } 617 618 if ( _.options.responsive && 619 _.options.responsive.length && 620 _.options.responsive !== null) { 621 622 targetBreakpoint = null; 623 624 for (breakpoint in _.breakpoints) { 625 if (_.breakpoints.hasOwnProperty(breakpoint)) { 626 if (_.originalSettings.mobileFirst === false) { 627 if (respondToWidth < _.breakpoints[breakpoint]) { 628 targetBreakpoint = _.breakpoints[breakpoint]; 629 } 630 } else { 631 if (respondToWidth > _.breakpoints[breakpoint]) { 632 targetBreakpoint = _.breakpoints[breakpoint]; 633 } 634 } 635 } 636 } 637 638 if (targetBreakpoint !== null) { 639 if (_.activeBreakpoint !== null) { 640 if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) { 641 _.activeBreakpoint = 642 targetBreakpoint;
vendor: 15,717 bytes, lines 643-1132
643 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 644 _.unslick(targetBreakpoint); 645 } else { 646 _.options = $.extend({}, _.originalSettings, 647 _.breakpointSettings[ 648 targetBreakpoint]); 649 if (initial === true) { 650 _.currentSlide = _.options.initialSlide; 651 } 652 _.refresh(initial); 653 } 654 triggerBreakpoint = targetBreakpoint; 655 } 656 } else { 657 _.activeBreakpoint = targetBreakpoint; 658 if (_.breakpointSettings[targetBreakpoint] === 'unslick') { 659 _.unslick(targetBreakpoint); 660 } else { 661 _.options = $.extend({}, _.originalSettings, 662 _.breakpointSettings[ 663 targetBreakpoint]); 664 if (initial === true) { 665 _.currentSlide = _.options.initialSlide; 666 } 667 _.refresh(initial); 668 } 669 triggerBreakpoint = targetBreakpoint; 670 } 671 } else { 672 if (_.activeBreakpoint !== null) { 673 _.activeBreakpoint = null; 674 _.options = _.originalSettings; 675 if (initial === true) { 676 _.currentSlide = _.options.initialSlide; 677 } 678 _.refresh(initial); 679 triggerBreakpoint = targetBreakpoint; 680 } 681 } 682 683 // only trigger breakpoints during an actual break. not on initialize. 684 if( !initial && triggerBreakpoint !== false ) { 685 _.$slider.trigger('breakpoint', [_, triggerBreakpoint]); 686 } 687 } 688 689 }; 690 691 Slick.prototype.changeSlide = function(event, dontAnimate) { 692 693 var _ = this, 694 $target = $(event.currentTarget), 695 indexOffset, slideOffset, unevenOffset; 696 697 // If target is a link, prevent default action. 698 if($target.is('a')) { 699 event.preventDefault(); 700 } 701 702 // If target is not the <li> element (ie: a child), find the <li>. 703 if(!$target.is('i')) { 704 $target = $target.closest('i'); 705 } 706 707 unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0); 708 indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll; 709 710 switch (event.data.message) { 711 712 case 'previous': 713 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset; 714 if (_.slideCount > _.options.slidesToShow) { 715 _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate); 716 } 717 break; 718 719 case 'next': 720 slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset; 721 if (_.slideCount > _.options.slidesToShow) { 722 _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate); 723 } 724 break; 725 726 case 'index': 727 var index = event.data.index === 0 ? 0 : 728 event.data.index || $target.index() * _.options.slidesToScroll; 729 730 _.slideHandler(_.checkNavigable(index), false, dontAnimate); 731 $target.children().trigger('focus'); 732 break; 733 734 default: 735 return; 736 } 737 738 }; 739 740 Slick.prototype.checkNavigable = function(index) { 741 742 var _ = this, 743 navigables, prevNavigable; 744 745 navigables = _.getNavigableIndexes(); 746 prevNavigable = 0; 747 if (index > navigables[navigables.length - 1]) { 748 index = navigables[navigables.length - 1]; 749 } else { 750 for (var n in navigables) { 751 if (index < navigables[n]) { 752 index = prevNavigable; 753 break; 754 } 755 prevNavigable = navigables[n]; 756 } 757 } 758 759 return index; 760 }; 761 762 Slick.prototype.cleanUpEvents = function() { 763 764 var _ = this; 765 766 if (_.options.dots && _.$dots !== null) { 767 768 $('i', _.$dots) 769 .off('click.slick', _.changeSlide) 770 .off('mouseenter.slick', $.proxy(_.interrupt, _, true)) 771 .off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 772 773 } 774 775 _.$slider.off('focus.slick blur.slick'); 776 777 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 778 _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide); 779 _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide); 780 } 781 782 _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler); 783 _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler); 784 _.$list.off('touchend.slick mouseup.slick', _.swipeHandler); 785 _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler); 786 787 _.$list.off('click.slick', _.clickHandler); 788 789 $(document).off(_.visibilityChange, _.visibility); 790 791 _.cleanUpSlideEvents(); 792 793 if (_.options.accessibility === true) { 794 _.$list.off('keydown.slick', _.keyHandler); 795 } 796 797 if (_.options.focusOnSelect === true) { 798 $(_.$slideTrack).children().off('click.slick', _.selectHandler); 799 } 800 801 $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange); 802 803 $(window).off('resize.slick.slick-' + _.instanceUid, _.resize); 804 805 $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault); 806 807 $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition); 808 $(document).off('ready.slick.slick-' + _.instanceUid, _.setPosition); 809 810 }; 811 812 Slick.prototype.cleanUpSlideEvents = function() { 813 814 var _ = this; 815 816 _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true)); 817 _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false)); 818 819 }; 820 821 Slick.prototype.cleanUpRows = function() { 822 823 var _ = this, originalSlides; 824 825 if(_.options.rows > 1) { 826 originalSlides = _.$slides.children().children(); 827 originalSlides.removeAttr('style'); 828 _.$slider.empty().append(originalSlides); 829 } 830 831 }; 832 833 Slick.prototype.clickHandler = function(event) { 834 835 var _ = this; 836 837 if (_.shouldClick === false) { 838 event.stopImmediatePropagation(); 839 event.stopPropagation(); 840 event.preventDefault(); 841 } 842 843 }; 844 845 Slick.prototype.destroy = function(refresh) { 846 847 var _ = this; 848 849 _.autoPlayClear(); 850 851 _.touchObject = {}; 852 853 _.cleanUpEvents(); 854 855 $('.a4j-slick-cloned', _.$slider).detach(); 856 857 if (_.$dots) { 858 _.$dots.remove(); 859 } 860 861 862 if ( _.$prevArrow && _.$prevArrow.length ) { 863 864 _.$prevArrow 865 .removeClass('a4j-slick-disabled a4j-slick-arrow a4j-slick-hidden') 866 .removeAttr('aria-hidden aria-disabled tabindex') 867 .css('display',''); 868 869 if ( _.htmlExpr.test( _.options.prevArrow )) { 870 _.$prevArrow.remove(); 871 } 872 } 873 874 if ( _.$nextArrow && _.$nextArrow.length ) { 875 876 _.$nextArrow 877 .removeClass('a4j-slick-disabled a4j-slick-arrow a4j-slick-hidden') 878 .removeAttr('aria-hidden aria-disabled tabindex') 879 .css('display',''); 880 881 if ( _.htmlExpr.test( _.options.nextArrow )) { 882 _.$nextArrow.remove(); 883 } 884 885 } 886 887 888 if (_.$slides) { 889 890 _.$slides 891 .removeClass('a4j-slick-slide a4j-slick-active a4j-slick-center a4j-slick-visible a4j-slick-current') 892 .removeAttr('aria-hidden') 893 .removeAttr('data-slick-index') 894 .each(function(){ 895 $(this).attr('style', $(this).data('originalStyling')); 896 }); 897 898 _.$slideTrack.children(this.options.slide).detach(); 899 900 _.$slideTrack.detach(); 901 902 _.$list.detach(); 903 904 _.$slider.append(_.$slides); 905 } 906 907 _.cleanUpRows(); 908 909 _.$slider.removeClass('a4j-slick-slider'); 910 _.$slider.removeClass('a4j-slick-initialized'); 911 _.$slider.removeClass('a4j-slick-dotted'); 912 913 _.unslicked = true; 914 915 if(!refresh) { 916 _.$slider.trigger('destroy', [_]); 917 } 918 919 }; 920 921 Slick.prototype.disableTransition = function(slide) { 922 923 var _ = this, 924 transition = {}; 925 926 transition[_.transitionType] = ''; 927 928 if (_.options.fade === false) { 929 _.$slideTrack.css(transition); 930 } else { 931 _.$slides.eq(slide).css(transition); 932 } 933 934 }; 935 936 Slick.prototype.fadeSlide = function(slideIndex, callback) { 937 938 var _ = this; 939 940 if (_.cssTransitions === false) { 941 942 _.$slides.eq(slideIndex).css({ 943 zIndex: _.options.zIndex 944 }); 945 946 _.$slides.eq(slideIndex).animate({ 947 opacity: 1 948 }, _.options.speed, _.options.easing, callback); 949 950 } else { 951 952 _.applyTransition(slideIndex); 953 954 _.$slides.eq(slideIndex).css({ 955 opacity: 1, 956 zIndex: _.options.zIndex 957 }); 958 959 if (callback) { 960 setTimeout(function() { 961 962 _.disableTransition(slideIndex); 963 964 callback.call(); 965 }, _.options.speed); 966 } 967 968 } 969 970 }; 971 972 Slick.prototype.fadeSlideOut = function(slideIndex) { 973 974 var _ = this; 975 976 if (_.cssTransitions === false) { 977 978 _.$slides.eq(slideIndex).animate({ 979 opacity: 0, 980 zIndex: _.options.zIndex - 2 981 }, _.options.speed, _.options.easing); 982 983 } else { 984 985 _.applyTransition(slideIndex); 986 987 _.$slides.eq(slideIndex).css({ 988 opacity: 0, 989 zIndex: _.options.zIndex - 2 990 }); 991 992 } 993 994 }; 995 996 Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) { 997 998 var _ = this; 999 1000 if (filter !== null) { 1001 1002 _.$slidesCache = _.$slides; 1003 1004 _.unload(); 1005 1006 _.$slideTrack.children(this.options.slide).detach(); 1007 1008 _.$slidesCache.filter(filter).appendTo(_.$slideTrack); 1009 1010 _.reinit(); 1011 1012 } 1013 1014 }; 1015 1016 Slick.prototype.focusHandler = function() { 1017 1018 var _ = this; 1019 1020 _.$slider 1021 .off('focus.slick blur.slick') 1022 .on('focus.slick blur.slick', 1023 '*:not(.a4j-slick-arrow)', function(event) { 1024 1025 event.stopImmediatePropagation(); 1026 var $sf = $(this); 1027 1028 setTimeout(function() { 1029 1030 if( _.options.pauseOnFocus ) { 1031 _.focussed = $sf.is(':focus'); 1032 _.autoPlay(); 1033 } 1034 1035 }, 0); 1036 1037 }); 1038 }; 1039 1040 Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() { 1041 1042 var _ = this; 1043 return _.currentSlide; 1044 1045 }; 1046 1047 Slick.prototype.getDotCount = function() { 1048 1049 var _ = this; 1050 1051 var breakPoint = 0; 1052 var counter = 0; 1053 var pagerQty = 0; 1054 1055 if (_.options.infinite === true) { 1056 while (breakPoint < _.slideCount) { 1057 ++pagerQty; 1058 breakPoint = counter + _.options.slidesToScroll; 1059 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 1060 } 1061 } else if (_.options.centerMode === true) { 1062 pagerQty = _.slideCount; 1063 } else if(!_.options.asNavFor) { 1064 pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll); 1065 }else { 1066 while (breakPoint < _.slideCount) { 1067 ++pagerQty; 1068 breakPoint = counter + _.options.slidesToScroll; 1069 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 1070 } 1071 } 1072 1073 return pagerQty - 1; 1074 1075 }; 1076 1077 Slick.prototype.getLeft = function(slideIndex) { 1078 1079 var _ = this, 1080 targetLeft, 1081 verticalHeight, 1082 verticalOffset = 0, 1083 targetSlide; 1084 1085 _.slideOffset = 0; 1086 verticalHeight = _.$slides.first().outerHeight(true); 1087 1088 if (_.options.infinite === true) { 1089 if (_.slideCount > _.options.slidesToShow) { 1090 _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1; 1091 verticalOffset = (verticalHeight * _.options.slidesToShow) * -1; 1092 } 1093 if (_.slideCount % _.options.slidesToScroll !== 0) { 1094 if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) { 1095 if (slideIndex > _.slideCount) { 1096 _.slideOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * _.slideWidth) * -1; 1097 verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1; 1098 } else { 1099 _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1; 1100 verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1; 1101 } 1102 } 1103 } 1104 } else { 1105 if (slideIndex + _.options.slidesToShow > _.slideCount) { 1106 _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth; 1107 verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight; 1108 } 1109 } 1110 1111 if (_.slideCount <= _.options.slidesToShow) { 1112 _.slideOffset = 0; 1113 verticalOffset = 0; 1114 } 1115 1116 if (_.options.centerMode === true && _.slideCount <= _.options.slidesToShow) { 1117 _.slideOffset = ((_.slideWidth * Math.floor(_.options.slidesToShow)) / 2) - ((_.slideWidth * _.slideCount) / 2); 1118 } else if (_.options.centerMode === true && _.options.infinite === true) { 1119 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; 1120 } else if (_.options.centerMode === true) { 1121 _.slideOffset = 0; 1122 _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); 1123 } 1124 1125 if (_.options.vertical === false) { 1126 targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset; 1127 } else { 1128 targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset; 1129 } 1130 1131 if (_.options.variableWidth === true) { 1132
1133 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 1134 targetSlide = _.$slideTrack.children('.a4j-slick-slide').eq(slideIndex); 1135 } else { 1136 targetSlide = _.$slideTrack.children('.a4j-slick-slide').eq(slideIndex + _.options.slidesToShow); 1137 } 1138 1139 if (_.options.rtl === true) { 1140 if (targetSlide[0]) { 1141 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 1142 } else { 1143 targetLeft = 0; 1144 } 1145 } else { 1146 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 1147 } 1148 1149 if (_.options.centerMode === true) { 1150 if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) { 1151 targetSlide = _.$slideTrack.children('.a4j-slick-slide').eq(slideIndex); 1152 } else { 1153 targetSlide = _.$slideTrack.children('.a4j-slick-slide').eq(slideIndex + _.options.slidesToShow + 1); 1154 } 1155 1156 if (_.options.rtl === true) { 1157 if (targetSlide[0]) { 1158 targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1; 1159 } else { 1160 targetLeft = 0; 1161 } 1162 } else { 1163 targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; 1164 } 1165 1166 targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2; 1167 } 1168 } 1169 1170 return targetLeft; 1171 1172 }; 1173 1174 Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) { 1175 1176 var _ = this; 1177 1178 return _.options[option]; 1179 1180 }; 1181 1182 Slick.prototype.getNavigableIndexes = function() { 1183 1184 var _ = this, 1185 breakPoint = 0, 1186 counter = 0, 1187 indexes = [], 1188 max; 1189 1190 if (_.options.infinite === false) { 1191 max = _.slideCount; 1192 } else { 1193 breakPoint = _.options.slidesToScroll * -1; 1194 counter = _.options.slidesToScroll * -1; 1195 max = _.slideCount * 2; 1196 } 1197 1198 while (breakPoint < max) { 1199 indexes.push(breakPoint); 1200 breakPoint = counter + _.options.slidesToScroll; 1201 counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow; 1202 } 1203 1204 return indexes; 1205 1206 }; 1207 1208 Slick.prototype.getSlick = function() { 1209 1210 return this; 1211 1212 }; 1213 1214 Slick.prototype.getSlideCount = function() { 1215 1216 var _ = this, 1217 slidesTraversed, swipedSlide, centerOffset; 1218 1219 centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0; 1220 1221 if (_.options.swipeToSlide === true) { 1222 _.$slideTrack.find('.a4j-slick-slide').each(function(index, slide) { 1223 if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) { 1224 swipedSlide = slide; 1225 return false; 1226 } 1227 }); 1228 1229 slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1; 1230 1231 return slidesTraversed; 1232 1233 } else { 1234 return _.options.slidesToScroll; 1235 } 1236 1237 }; 1238 1239 Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) { 1240 1241 var _ = this; 1242 1243 _.changeSlide({ 1244 data: { 1245 message: 'index', 1246 index: parseInt(slide) 1247 } 1248 }, dontAnimate); 1249 1250 }; 1251 1252 Slick.prototype.init = function(creation) { 1253 1254 var _ = this; 1255 if (!_.$slider.hasClass('a4j-slick-initialized')) { 1256 1257 _.$slider.addClass('a4j-slick-initialized'); 1258 1259 _.buildRows(); 1260 _.buildOut(); 1261 _.setProps(); 1262 _.startLoad(); 1263 _.loadSlider(); 1264 _.initializeEvents(); 1265 _.updateArrows(); 1266 _.updateDots(); 1267 _.checkResponsive(true); 1268 _.focusHandler(); 1269 1270 } 1271 1272 if (creation) { 1273 _.$slider.trigger('init', [_]); 1274 } 1275 1276 if (_.options.accessibility === true) { 1277 _.initADA(); 1278 } 1279 1280 if ( _.options.autoplay ) { 1281 1282 _.paused = false; 1283 _.autoPlay(); 1284 1285 } 1286 1287 }; 1288 1289 Slick.prototype.initADA = function() { 1290 var _ = this; 1291 _.$slides.add(_.$slideTrack.find('.a4j-slick-cloned')).attr({ 1292 'aria-hidden': 'true', 1293 'tabindex': '-1' 1294 }).find('a, input, button, select').attr({ 1295 'tabindex': '-1' 1296 }); 1297 1298 _.$slideTrack.attr('role', 'listbox'); 1299 1300 _.$slides.not(_.$slideTrack.find('.a4j-slick-cloned')).each(function(i) { 1301 $(this).attr('role', 'option'); 1302 1303 //Evenly distribute aria-describedby tags through available dots. 1304 var describedBySlideId = _.options.centerMode ? i : Math.floor(i / _.options.slidesToShow); 1305 1306 if (_.options.dots === true) { 1307 $(this).attr('aria-describedby', 'slick-slide' + _.instanceUid + describedBySlideId + ''); 1308 } 1309 }); 1310 1311 if (_.$dots !== null) { 1312 _.$dots.attr('role', 'tablist').find('i').each(function(i) { 1313 $(this).attr({ 1314 'role': 'presentation', 1315 'aria-selected': 'false', 1316 'aria-controls': 'navigation' + _.instanceUid + i + '', 1317 'id': 'slick-slide' + _.instanceUid + i + '' 1318 }); 1319 }) 1320 .first().attr('aria-selected', 'true').end() 1321 .find('button').attr('role', 'button').end() 1322 .closest('div').attr('role', 'toolbar'); 1323 } 1324 _.activateADA(); 1325 1326 }; 1327 1328 Slick.prototype.initArrowEvents = function() { 1329 1330 var _ = this; 1331 1332 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 1333 _.$prevArrow 1334 .off('click.slick') 1335 .on('click.slick', { 1336 message: 'previous' 1337 }, _.changeSlide); 1338 _.$nextArrow 1339 .off('click.slick') 1340 .on('click.slick', { 1341 message: 'next' 1342 }, _.changeSlide); 1343 } 1344 1345 }; 1346 1347 Slick.prototype.initDotEvents = function() { 1348 1349 var _ = this; 1350 1351 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 1352 $('i', _.$dots).on('click.slick', { 1353 message: 'index' 1354 }, _.changeSlide); 1355 } 1356 1357 if ( _.options.dots === true && _.options.pauseOnDotsHover === true ) { 1358 1359 $('i', _.$dots) 1360 .on('mouseenter.slick', $.proxy(_.interrupt, _, true))
vendor: 22,267 bytes, lines 1361-2151
1361 .on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 1362 1363 } 1364 1365 }; 1366 1367 Slick.prototype.initSlideEvents = function() { 1368 1369 var _ = this; 1370 1371 if ( _.options.pauseOnHover ) { 1372 1373 _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true)); 1374 _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false)); 1375 1376 } 1377 1378 }; 1379 1380 Slick.prototype.initializeEvents = function() { 1381 1382 var _ = this; 1383 1384 _.initArrowEvents(); 1385 1386 _.initDotEvents(); 1387 _.initSlideEvents(); 1388 1389 _.$list.on('touchstart.slick mousedown.slick', { 1390 action: 'start' 1391 }, _.swipeHandler); 1392 _.$list.on('touchmove.slick mousemove.slick', { 1393 action: 'move' 1394 }, _.swipeHandler); 1395 _.$list.on('touchend.slick mouseup.slick', { 1396 action: 'end' 1397 }, _.swipeHandler); 1398 _.$list.on('touchcancel.slick mouseleave.slick', { 1399 action: 'end' 1400 }, _.swipeHandler); 1401 1402 _.$list.on('click.slick', _.clickHandler); 1403 1404 $(document).on(_.visibilityChange, $.proxy(_.visibility, _)); 1405 1406 if (_.options.accessibility === true) { 1407 _.$list.on('keydown.slick', _.keyHandler); 1408 } 1409 1410 if (_.options.focusOnSelect === true) { 1411 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 1412 } 1413 1414 $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _)); 1415 1416 $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _)); 1417 1418 $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault); 1419 1420 $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition); 1421 $(document).on('ready.slick.slick-' + _.instanceUid, _.setPosition); 1422 1423 }; 1424 1425 Slick.prototype.initUI = function() { 1426 1427 var _ = this; 1428 1429 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 1430 1431 _.$prevArrow.show(); 1432 _.$nextArrow.show(); 1433 1434 } 1435 1436 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 1437 1438 _.$dots.show(); 1439 1440 } 1441 1442 }; 1443 1444 Slick.prototype.keyHandler = function(event) { 1445 1446 var _ = this; 1447 //Dont slide if the cursor is inside the form fields and arrow keys are pressed 1448 if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) { 1449 if (event.keyCode === 37 && _.options.accessibility === true) { 1450 _.changeSlide({ 1451 data: { 1452 message: _.options.rtl === true ? 'next' : 'previous' 1453 } 1454 }); 1455 } else if (event.keyCode === 39 && _.options.accessibility === true) { 1456 _.changeSlide({ 1457 data: { 1458 message: _.options.rtl === true ? 'previous' : 'next' 1459 } 1460 }); 1461 } 1462 } 1463 1464 }; 1465 1466 Slick.prototype.lazyLoad = function() { 1467 1468 var _ = this, 1469 loadRange, cloneRange, rangeStart, rangeEnd; 1470 1471 function loadImages(imagesScope) { 1472 1473 $('img[data-lazy]', imagesScope).each(function() { 1474 1475 var image = $(this), 1476 imageSource = $(this).attr('data-lazy'), 1477 imageToLoad = document.createElement('img'); 1478 1479 imageToLoad.onload = function() { 1480 1481 image 1482 .animate({ opacity: 0 }, 100, function() { 1483 image 1484 .attr('src', imageSource) 1485 .animate({ opacity: 1 }, 200, function() { 1486 image 1487 .removeAttr('data-lazy') 1488 .removeClass('a4j-slick-loading'); 1489 }); 1490 _.$slider.trigger('lazyLoaded', [_, image, imageSource]); 1491 }); 1492 1493 }; 1494 1495 imageToLoad.onerror = function() { 1496 1497 image 1498 .removeAttr( 'data-lazy' ) 1499 .removeClass( 'a4j-slick-loading' ) 1500 .addClass( 'a4j-slick-lazyload-error' ); 1501 1502 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 1503 1504 }; 1505 1506 imageToLoad.src = imageSource; 1507 1508 }); 1509 1510 } 1511 1512 if (_.options.centerMode === true) { 1513 if (_.options.infinite === true) { 1514 rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1); 1515 rangeEnd = rangeStart + _.options.slidesToShow + 2; 1516 } else { 1517 rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1)); 1518 rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide; 1519 } 1520 } else { 1521 rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide; 1522 rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow); 1523 if (_.options.fade === true) { 1524 if (rangeStart > 0) rangeStart--; 1525 if (rangeEnd <= _.slideCount) rangeEnd++; 1526 } 1527 } 1528 1529 loadRange = _.$slider.find('.a4j-slick-slide').slice(rangeStart, rangeEnd); 1530 loadImages(loadRange); 1531 1532 if (_.slideCount <= _.options.slidesToShow) { 1533 cloneRange = _.$slider.find('.a4j-slick-slide'); 1534 loadImages(cloneRange); 1535 } else 1536 if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { 1537 cloneRange = _.$slider.find('.a4j-slick-cloned').slice(0, _.options.slidesToShow); 1538 loadImages(cloneRange); 1539 } else if (_.currentSlide === 0) { 1540 cloneRange = _.$slider.find('.a4j-slick-cloned').slice(_.options.slidesToShow * -1); 1541 loadImages(cloneRange); 1542 } 1543 1544 }; 1545 1546 Slick.prototype.loadSlider = function() { 1547 1548 var _ = this; 1549 1550 _.setPosition(); 1551 1552 _.$slideTrack.css({ 1553 opacity: 1 1554 }); 1555 1556 _.$slider.removeClass('a4j-slick-loading'); 1557 1558 _.initUI(); 1559 1560 if (_.options.lazyLoad === 'progressive') { 1561 _.progressiveLazyLoad(); 1562 } 1563 1564 }; 1565 1566 Slick.prototype.next = Slick.prototype.slickNext = function() { 1567 1568 var _ = this; 1569 1570 _.changeSlide({ 1571 data: { 1572 message: 'next' 1573 } 1574 }); 1575 1576 }; 1577 1578 Slick.prototype.orientationChange = function() { 1579 1580 var _ = this; 1581 1582 _.checkResponsive(); 1583 _.setPosition(); 1584 1585 }; 1586 1587 Slick.prototype.pause = Slick.prototype.slickPause = function() { 1588 1589 var _ = this; 1590 1591 _.autoPlayClear(); 1592 _.paused = true; 1593 1594 }; 1595 1596 Slick.prototype.play = Slick.prototype.slickPlay = function() { 1597 1598 var _ = this; 1599 1600 _.autoPlay(); 1601 _.options.autoplay = true; 1602 _.paused = false; 1603 _.focussed = false; 1604 _.interrupted = false; 1605 1606 }; 1607 1608 Slick.prototype.postSlide = function(index) { 1609 1610 var _ = this; 1611 1612 if( !_.unslicked ) { 1613 1614 _.$slider.trigger('afterChange', [_, index]); 1615 1616 _.animating = false; 1617 1618 _.setPosition(); 1619 1620 _.swipeLeft = null; 1621 1622 if ( _.options.autoplay ) { 1623 _.autoPlay(); 1624 } 1625 1626 if (_.options.accessibility === true) { 1627 _.initADA(); 1628 } 1629 1630 } 1631 1632 }; 1633 1634 Slick.prototype.prev = Slick.prototype.slickPrev = function() { 1635 1636 var _ = this; 1637 1638 _.changeSlide({ 1639 data: { 1640 message: 'previous' 1641 } 1642 }); 1643 1644 }; 1645 1646 Slick.prototype.preventDefault = function(event) { 1647 1648 event.preventDefault(); 1649 1650 }; 1651 1652 Slick.prototype.progressiveLazyLoad = function( tryCount ) { 1653 1654 tryCount = tryCount || 1; 1655 1656 var _ = this, 1657 $imgsToLoad = $( 'img[data-lazy]', _.$slider ), 1658 image, 1659 imageSource, 1660 imageToLoad; 1661 1662 if ( $imgsToLoad.length ) { 1663 1664 image = $imgsToLoad.first(); 1665 imageSource = image.attr('data-lazy'); 1666 imageToLoad = document.createElement('img'); 1667 1668 imageToLoad.onload = function() { 1669 1670 image 1671 .attr( 'src', imageSource ) 1672 .removeAttr('data-lazy') 1673 .removeClass('a4j-slick-loading'); 1674 1675 if ( _.options.adaptiveHeight === true ) { 1676 _.setPosition(); 1677 } 1678 1679 _.$slider.trigger('lazyLoaded', [ _, image, imageSource ]); 1680 _.progressiveLazyLoad(); 1681 1682 }; 1683 1684 imageToLoad.onerror = function() { 1685 1686 if ( tryCount < 3 ) { 1687 1688 /** 1689 * try to load the image 3 times, 1690 * leave a slight delay so we don't get 1691 * servers blocking the request. 1692 */ 1693 setTimeout( function() { 1694 _.progressiveLazyLoad( tryCount + 1 ); 1695 }, 500 ); 1696 1697 } else { 1698 1699 image 1700 .removeAttr( 'data-lazy' ) 1701 .removeClass( 'a4j-slick-loading' ) 1702 .addClass( 'a4j-slick-lazyload-error' ); 1703 1704 _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]); 1705 1706 _.progressiveLazyLoad(); 1707 1708 } 1709 1710 }; 1711 1712 imageToLoad.src = imageSource; 1713 1714 } else { 1715 1716 _.$slider.trigger('allImagesLoaded', [ _ ]); 1717 1718 } 1719 1720 }; 1721 1722 Slick.prototype.refresh = function( initializing ) { 1723 1724 var _ = this, currentSlide, lastVisibleIndex; 1725 1726 lastVisibleIndex = _.slideCount - _.options.slidesToShow; 1727 1728 // in non-infinite sliders, we don't want to go past the 1729 // last visible index. 1730 if( !_.options.infinite && ( _.currentSlide > lastVisibleIndex )) { 1731 _.currentSlide = lastVisibleIndex; 1732 } 1733 1734 // if less slides than to show, go to start. 1735 if ( _.slideCount <= _.options.slidesToShow ) { 1736 _.currentSlide = 0; 1737 1738 } 1739 1740 currentSlide = _.currentSlide; 1741 1742 _.destroy(true); 1743 1744 $.extend(_, _.initials, { currentSlide: currentSlide }); 1745 1746 _.init(); 1747 1748 if( !initializing ) { 1749 1750 _.changeSlide({ 1751 data: { 1752 message: 'index', 1753 index: currentSlide 1754 } 1755 }, false); 1756 1757 } 1758 1759 }; 1760 1761 Slick.prototype.registerBreakpoints = function() { 1762 1763 var _ = this, breakpoint, currentBreakpoint, l, 1764 responsiveSettings = _.options.responsive || null; 1765 1766 if ( $.type(responsiveSettings) === 'array' && responsiveSettings.length ) { 1767 1768 _.respondTo = _.options.respondTo || 'window'; 1769 1770 for ( breakpoint in responsiveSettings ) { 1771 1772 l = _.breakpoints.length-1; 1773 currentBreakpoint = responsiveSettings[breakpoint].breakpoint; 1774 1775 if (responsiveSettings.hasOwnProperty(breakpoint)) { 1776 1777 // loop through the breakpoints and cut out any existing 1778 // ones with the same breakpoint number, we don't want dupes. 1779 while( l >= 0 ) { 1780 if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) { 1781 _.breakpoints.splice(l,1); 1782 } 1783 l--; 1784 } 1785 1786 _.breakpoints.push(currentBreakpoint); 1787 _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings; 1788 1789 } 1790 1791 } 1792 1793 _.breakpoints.sort(function(a, b) { 1794 return ( _.options.mobileFirst ) ? a-b : b-a; 1795 }); 1796 1797 } 1798 1799 }; 1800 1801 Slick.prototype.reinit = function() { 1802 1803 var _ = this; 1804 1805 _.$slides = 1806 _.$slideTrack 1807 .children(_.options.slide) 1808 .addClass('a4j-slick-slide'); 1809 1810 _.slideCount = _.$slides.length; 1811 1812 if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) { 1813 _.currentSlide = _.currentSlide - _.options.slidesToScroll; 1814 } 1815 1816 if (_.slideCount <= _.options.slidesToShow) { 1817 _.currentSlide = 0; 1818 } 1819 1820 _.registerBreakpoints(); 1821 1822 _.setProps(); 1823 _.setupInfinite(); 1824 _.buildArrows(); 1825 _.updateArrows(); 1826 _.initArrowEvents(); 1827 _.buildDots(); 1828 _.updateDots(); 1829 _.initDotEvents(); 1830 _.cleanUpSlideEvents(); 1831 _.initSlideEvents(); 1832 1833 _.checkResponsive(false, true); 1834 1835 if (_.options.focusOnSelect === true) { 1836 $(_.$slideTrack).children().on('click.slick', _.selectHandler); 1837 } 1838 1839 _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0); 1840 1841 _.setPosition(); 1842 _.focusHandler(); 1843 1844 _.paused = !_.options.autoplay; 1845 _.autoPlay(); 1846 1847 _.$slider.trigger('reInit', [_]); 1848 1849 }; 1850 1851 Slick.prototype.resize = function() { 1852 1853 var _ = this; 1854 1855 if ($(window).width() !== _.windowWidth) { 1856 clearTimeout(_.windowDelay); 1857 _.windowDelay = window.setTimeout(function() { 1858 _.windowWidth = $(window).width(); 1859 _.checkResponsive(); 1860 if( !_.unslicked ) { _.setPosition(); } 1861 }, 50); 1862 } 1863 }; 1864 1865 Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) { 1866 1867 var _ = this; 1868 1869 if (typeof(index) === 'boolean') { 1870 removeBefore = index; 1871 index = removeBefore === true ? 0 : _.slideCount - 1; 1872 } else { 1873 index = removeBefore === true ? --index : index; 1874 } 1875 1876 if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) { 1877 return false; 1878 } 1879 1880 _.unload(); 1881 1882 if (removeAll === true) { 1883 _.$slideTrack.children().remove(); 1884 } else { 1885 _.$slideTrack.children(this.options.slide).eq(index).remove(); 1886 } 1887 1888 _.$slides = _.$slideTrack.children(this.options.slide); 1889 1890 _.$slideTrack.children(this.options.slide).detach(); 1891 1892 _.$slideTrack.append(_.$slides); 1893 1894 _.$slidesCache = _.$slides; 1895 1896 _.reinit(); 1897 1898 }; 1899 1900 Slick.prototype.setCSS = function(position) { 1901 1902 var _ = this, 1903 positionProps = {}, 1904 x, y; 1905 1906 if (_.options.rtl === true) { 1907 position = -position; 1908 } 1909 x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px'; 1910 y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px'; 1911 1912 positionProps[_.positionProp] = position; 1913 1914 if (_.transformsEnabled === false) { 1915 _.$slideTrack.css(positionProps); 1916 } else { 1917 positionProps = {}; 1918 if (_.cssTransitions === false) { 1919 positionProps[_.animType] = 'translate(' + x + ', ' + y + ')'; 1920 _.$slideTrack.css(positionProps); 1921 } else { 1922 positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)'; 1923 _.$slideTrack.css(positionProps); 1924 } 1925 } 1926 1927 }; 1928 1929 Slick.prototype.setDimensions = function() { 1930 1931 var _ = this; 1932 1933 if (_.options.vertical === false) { 1934 if (_.options.centerMode === true) { 1935 _.$list.css({ 1936 padding: ('0px ' + _.options.centerPadding) 1937 }); 1938 } 1939 } else { 1940 _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow); 1941 if (_.options.centerMode === true) { 1942 _.$list.css({ 1943 padding: (_.options.centerPadding + ' 0px') 1944 }); 1945 } 1946 } 1947 1948 _.listWidth = _.$list.width(); 1949 _.listHeight = _.$list.height(); 1950 1951 1952 if (_.options.vertical === false && _.options.variableWidth === false) { 1953 _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow); 1954 _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.a4j-slick-slide').length))); 1955 1956 } else if (_.options.variableWidth === true) { 1957 _.$slideTrack.width(5000 * _.slideCount); 1958 } else { 1959 _.slideWidth = Math.ceil(_.listWidth); 1960 _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.a4j-slick-slide').length))); 1961 } 1962 1963 var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width(); 1964 if (_.options.variableWidth === false) _.$slideTrack.children('.a4j-slick-slide').width(_.slideWidth - offset); 1965 1966 }; 1967 1968 Slick.prototype.setFade = function() { 1969 1970 var _ = this, 1971 targetLeft; 1972 1973 _.$slides.each(function(index, element) { 1974 targetLeft = (_.slideWidth * index) * -1; 1975 if (_.options.rtl === true) { 1976 $(element).css({ 1977 position: 'relative', 1978 right: targetLeft, 1979 top: 0, 1980 zIndex: _.options.zIndex - 2, 1981 opacity: 0 1982 }); 1983 } else { 1984 $(element).css({ 1985 position: 'relative', 1986 left: targetLeft, 1987 top: 0, 1988 zIndex: _.options.zIndex - 2, 1989 opacity: 0 1990 }); 1991 } 1992 }); 1993 1994 _.$slides.eq(_.currentSlide).css({ 1995 zIndex: _.options.zIndex - 1, 1996 opacity: 1 1997 }); 1998 1999 }; 2000 2001 Slick.prototype.setHeight = function() { 2002 2003 var _ = this; 2004 2005 if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) { 2006 var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); 2007 _.$list.css('height', targetHeight); 2008 } 2009 2010 }; 2011 2012 Slick.prototype.setOption = 2013 Slick.prototype.slickSetOption = function() { 2014 2015 /** 2016 * accepts arguments in format of: 2017 * 2018 * - for changing a single option's value: 2019 * .a4jslick("setOption", option, value, refresh ) 2020 * 2021 * - for changing a set of responsive options: 2022 * .a4jslick("setOption", 'responsive', [{}, ...], refresh ) 2023 * 2024 * - for updating multiple values at once (not responsive) 2025 * .a4jslick("setOption", { 'option': value, ... }, refresh ) 2026 */ 2027 2028 var _ = this, l, item, option, value, refresh = false, type; 2029 2030 if( $.type( arguments[0] ) === 'object' ) { 2031 2032 option = arguments[0]; 2033 refresh = arguments[1]; 2034 type = 'multiple'; 2035 2036 } else if ( $.type( arguments[0] ) === 'string' ) { 2037 2038 option = arguments[0]; 2039 value = arguments[1]; 2040 refresh = arguments[2]; 2041 2042 if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) { 2043 2044 type = 'responsive'; 2045 2046 } else if ( typeof arguments[1] !== 'undefined' ) { 2047 2048 type = 'single'; 2049 2050 } 2051 2052 } 2053 2054 if ( type === 'single' ) { 2055 2056 _.options[option] = value; 2057 2058 2059 } else if ( type === 'multiple' ) { 2060 2061 $.each( option , function( opt, val ) { 2062 2063 _.options[opt] = val; 2064 2065 }); 2066 2067 2068 } else if ( type === 'responsive' ) { 2069 2070 for ( item in value ) { 2071 2072 if( $.type( _.options.responsive ) !== 'array' ) { 2073 2074 _.options.responsive = [ value[item] ]; 2075 2076 } else { 2077 2078 l = _.options.responsive.length-1; 2079 2080 // loop through the responsive object and splice out duplicates. 2081 while( l >= 0 ) { 2082 2083 if( _.options.responsive[l].breakpoint === value[item].breakpoint ) { 2084 2085 _.options.responsive.splice(l,1); 2086 2087 } 2088 2089 l--; 2090 2091 } 2092 2093 _.options.responsive.push( value[item] ); 2094 2095 } 2096 2097 } 2098 2099 } 2100 2101 if ( refresh ) { 2102 2103 _.unload(); 2104 _.reinit(); 2105 2106 } 2107 2108 }; 2109 2110 Slick.prototype.setPosition = function() { 2111 2112 var _ = this; 2113 2114 _.setDimensions(); 2115 2116 _.setHeight(); 2117 2118 if (_.options.fade === false) { 2119 _.setCSS(_.getLeft(_.currentSlide)); 2120 } else { 2121 _.setFade(); 2122 } 2123 2124 _.$slider.trigger('setPosition', [_]); 2125 2126 }; 2127 2128 Slick.prototype.setProps = function() { 2129 2130 var _ = this, 2131 bodyStyle = document.body.style; 2132 2133 _.positionProp = _.options.vertical === true ? 'top' : 'left'; 2134 2135 if (_.positionProp === 'top') { 2136 _.$slider.addClass('a4j-slick-vertical'); 2137 } else { 2138 _.$slider.removeClass('a4j-slick-vertical'); 2139 } 2140 2141 if (bodyStyle.WebkitTransition !== undefined || 2142 bodyStyle.MozTransition !== undefined || 2143 bodyStyle.msTransition !== undefined) { 2144 if (_.options.useCSS === true) { 2145 _.cssTransitions = true; 2146 } 2147 } 2148 2149 if ( _.options.fade ) { 2150 if ( typeof _.options.zIndex === 'number' ) { 2151 if( _.options.zIndex < 3 ) {
2152 _.options.zIndex = 3; 2153 } 2154 } else { 2155 _.options.zIndex = _.defaults.zIndex; 2156 } 2157 } 2158 2159 if (bodyStyle.OTransform !== undefined) { 2160 _.animType = 'OTransform'; 2161 _.transformType = '-o-transform'; 2162 _.transitionType = 'OTransition'; 2163 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 2164 } 2165 if (bodyStyle.MozTransform !== undefined) { 2166 _.animType = 'MozTransform'; 2167 _.transformType = '-moz-transform'; 2168 _.transitionType = 'MozTransition'; 2169 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false; 2170 } 2171 if (bodyStyle.webkitTransform !== undefined) { 2172 _.animType = 'webkitTransform'; 2173 _.transformType = '-webkit-transform'; 2174 _.transitionType = 'webkitTransition'; 2175 if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false; 2176 } 2177 if (bodyStyle.msTransform !== undefined) { 2178 _.animType = 'msTransform'; 2179 _.transformType = '-ms-transform'; 2180 _.transitionType = 'msTransition'; 2181 if (bodyStyle.msTransform === undefined) _.animType = false; 2182 } 2183 if (bodyStyle.transform !== undefined && _.animType !== false) { 2184 _.animType = 'transform'; 2185 _.transformType = 'transform'; 2186 _.transitionType = 'transition'; 2187 } 2188 _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false); 2189 }; 2190 2191 2192 Slick.prototype.setSlideClasses = function(index) { 2193 2194 var _ = this, 2195 centerOffset, allSlides, indexOffset, remainder; 2196 2197 allSlides = _.$slider 2198 .find('.a4j-slick-slide') 2199 .removeClass('a4j-slick-active a4j-slick-center a4j-slick-current') 2200 .attr('aria-hidden', 'true'); 2201 2202 _.$slides 2203 .eq(index) 2204 .addClass('a4j-slick-current'); 2205 2206 if (_.options.centerMode === true) { 2207 2208 centerOffset = Math.floor(_.options.slidesToShow / 2); 2209 2210 if (_.options.infinite === true) { 2211 2212 if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) { 2213 2214 _.$slides 2215 .slice(index - centerOffset, index + centerOffset + 1) 2216 .addClass('a4j-slick-active') 2217 .attr('aria-hidden', 'false'); 2218 2219 } else { 2220 2221 indexOffset = _.options.slidesToShow + index; 2222 allSlides 2223 .slice(indexOffset - centerOffset + 1, indexOffset + centerOffset + 2) 2224 .addClass('a4j-slick-active') 2225 .attr('aria-hidden', 'false'); 2226 2227 } 2228 2229 if (index === 0) { 2230 2231 allSlides 2232 .eq(allSlides.length - 1 - _.options.slidesToShow) 2233 .addClass('a4j-slick-center'); 2234 2235 } else if (index === _.slideCount - 1) { 2236 2237 allSlides 2238 .eq(_.options.slidesToShow) 2239 .addClass('a4j-slick-center'); 2240 2241 } 2242 2243 } 2244 2245 _.$slides 2246 .eq(index) 2247 .addClass('a4j-slick-center'); 2248 2249 } else { 2250 2251 if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) { 2252 2253 _.$slides 2254 .slice(index, index + _.options.slidesToShow) 2255 .addClass('a4j-slick-active') 2256 .attr('aria-hidden', 'false'); 2257 2258 } else if (allSlides.length <= _.options.slidesToShow) { 2259 2260 allSlides 2261 .addClass('a4j-slick-active') 2262 .attr('aria-hidden', 'false'); 2263 2264 } else { 2265 2266 remainder = _.slideCount % _.options.slidesToShow;
vendor: 15,835 bytes, lines 2267-2807
2267 indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index; 2268 2269 if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) { 2270 2271 allSlides 2272 .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder) 2273 .addClass('a4j-slick-active') 2274 .attr('aria-hidden', 'false'); 2275 2276 } else { 2277 2278 allSlides 2279 .slice(indexOffset, indexOffset + _.options.slidesToShow) 2280 .addClass('a4j-slick-active') 2281 .attr('aria-hidden', 'false'); 2282 2283 } 2284 2285 } 2286 2287 } 2288 2289 if (_.options.lazyLoad === 'ondemand') { 2290 _.lazyLoad(); 2291 } 2292 2293 }; 2294 2295 Slick.prototype.setupInfinite = function() { 2296 2297 var _ = this, 2298 i, slideIndex, infiniteCount; 2299 2300 if (_.options.fade === true) { 2301 _.options.centerMode = false; 2302 } 2303 2304 if (_.options.infinite === true && _.options.fade === false) { 2305 2306 slideIndex = null; 2307 2308 if (_.slideCount > _.options.slidesToShow) { 2309 2310 if (_.options.centerMode === true) { 2311 infiniteCount = _.options.slidesToShow + 1; 2312 } else { 2313 infiniteCount = _.options.slidesToShow; 2314 } 2315 2316 for (i = _.slideCount; i > (_.slideCount - 2317 infiniteCount); i -= 1) { 2318 slideIndex = i - 1; 2319 $(_.$slides[slideIndex]).clone(true).attr('id', '') 2320 .attr('data-slick-index', slideIndex - _.slideCount) 2321 .prependTo(_.$slideTrack).addClass('a4j-slick-cloned'); 2322 } 2323 for (i = 0; i < infiniteCount; i += 1) { 2324 slideIndex = i; 2325 $(_.$slides[slideIndex]).clone(true).attr('id', '') 2326 .attr('data-slick-index', slideIndex + _.slideCount) 2327 .appendTo(_.$slideTrack).addClass('a4j-slick-cloned'); 2328 } 2329 _.$slideTrack.find('.a4j-slick-cloned').find('[id]').each(function() { 2330 $(this).attr('id', ''); 2331 }); 2332 2333 } 2334 2335 } 2336 2337 }; 2338 2339 Slick.prototype.interrupt = function( toggle ) { 2340 2341 var _ = this; 2342 2343 if( !toggle ) { 2344 _.autoPlay(); 2345 } 2346 _.interrupted = toggle; 2347 2348 }; 2349 2350 Slick.prototype.selectHandler = function(event) { 2351 2352 var _ = this; 2353 2354 var targetElement = 2355 $(event.target).is('.a4j-slick-slide') ? 2356 $(event.target) : 2357 $(event.target).parents('.a4j-slick-slide'); 2358 2359 var index = parseInt(targetElement.attr('data-slick-index')); 2360 2361 if (!index) index = 0; 2362 2363 if (_.slideCount <= _.options.slidesToShow) { 2364 2365 _.setSlideClasses(index); 2366 _.asNavFor(index); 2367 return; 2368 2369 } 2370 2371 _.slideHandler(index); 2372 2373 }; 2374 2375 Slick.prototype.slideHandler = function(index, sync, dontAnimate) { 2376 2377 var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null, 2378 _ = this, navTarget; 2379 2380 sync = sync || false; 2381 2382 if (_.animating === true && _.options.waitForAnimate === true) { 2383 return; 2384 } 2385 2386 if (_.options.fade === true && _.currentSlide === index) { 2387 return; 2388 } 2389 2390 if (_.slideCount <= _.options.slidesToShow) { 2391 return; 2392 } 2393 2394 if (sync === false) { 2395 _.asNavFor(index); 2396 } 2397 2398 targetSlide = index; 2399 targetLeft = _.getLeft(targetSlide); 2400 slideLeft = _.getLeft(_.currentSlide); 2401 2402 _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft; 2403 2404 if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) { 2405 if (_.options.fade === false) { 2406 targetSlide = _.currentSlide; 2407 if (dontAnimate !== true) { 2408 _.animateSlide(slideLeft, function() { 2409 _.postSlide(targetSlide); 2410 }); 2411 } else { 2412 _.postSlide(targetSlide); 2413 } 2414 } 2415 return; 2416 } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) { 2417 if (_.options.fade === false) { 2418 targetSlide = _.currentSlide; 2419 if (dontAnimate !== true) { 2420 _.animateSlide(slideLeft, function() { 2421 _.postSlide(targetSlide); 2422 }); 2423 } else { 2424 _.postSlide(targetSlide); 2425 } 2426 } 2427 return; 2428 } 2429 2430 if ( _.options.autoplay ) { 2431 clearInterval(_.autoPlayTimer); 2432 } 2433 2434 if (targetSlide < 0) { 2435 if (_.slideCount % _.options.slidesToScroll !== 0) { 2436 animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll); 2437 } else { 2438 animSlide = _.slideCount + targetSlide; 2439 } 2440 } else if (targetSlide >= _.slideCount) { 2441 if (_.slideCount % _.options.slidesToScroll !== 0) { 2442 animSlide = 0; 2443 } else { 2444 animSlide = targetSlide - _.slideCount; 2445 } 2446 } else { 2447 animSlide = targetSlide; 2448 } 2449 2450 _.animating = true; 2451 2452 _.$slider.closest('.ingallery').trigger('beforeCarouselChange', [_, _.currentSlide, animSlide]); 2453 _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]); 2454 2455 oldSlide = _.currentSlide; 2456 _.currentSlide = animSlide; 2457 2458 _.setSlideClasses(_.currentSlide); 2459 2460 if ( _.options.asNavFor ) { 2461 2462 navTarget = _.getNavTarget(); 2463 navTarget = navTarget.a4jslick('getSlick'); 2464 2465 if ( navTarget.slideCount <= navTarget.options.slidesToShow ) { 2466 navTarget.setSlideClasses(_.currentSlide); 2467 } 2468 2469 } 2470 2471 _.updateDots(); 2472 _.updateArrows(); 2473 2474 if (_.options.fade === true) { 2475 if (dontAnimate !== true) { 2476 2477 _.fadeSlideOut(oldSlide); 2478 2479 _.fadeSlide(animSlide, function() { 2480 _.postSlide(animSlide); 2481 }); 2482 2483 } else { 2484 _.postSlide(animSlide); 2485 } 2486 _.animateHeight(); 2487 return; 2488 } 2489 2490 if (dontAnimate !== true) { 2491 _.animateSlide(targetLeft, function() { 2492 _.postSlide(animSlide); 2493 }); 2494 } else { 2495 _.postSlide(animSlide); 2496 } 2497 2498 }; 2499 2500 Slick.prototype.startLoad = function() { 2501 2502 var _ = this; 2503 2504 if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { 2505 2506 _.$prevArrow.hide(); 2507 _.$nextArrow.hide(); 2508 2509 } 2510 2511 if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { 2512 2513 _.$dots.hide(); 2514 2515 } 2516 2517 _.$slider.addClass('a4j-slick-loading'); 2518 2519 }; 2520 2521 Slick.prototype.swipeDirection = function() { 2522 2523 var xDist, yDist, r, swipeAngle, _ = this; 2524 2525 xDist = _.touchObject.startX - _.touchObject.curX; 2526 yDist = _.touchObject.startY - _.touchObject.curY; 2527 r = Math.atan2(yDist, xDist); 2528 2529 swipeAngle = Math.round(r * 180 / Math.PI); 2530 if (swipeAngle < 0) { 2531 swipeAngle = 360 - Math.abs(swipeAngle); 2532 } 2533 2534 if ((swipeAngle <= 45) && (swipeAngle >= 0)) { 2535 return (_.options.rtl === false ? 'left' : 'right'); 2536 } 2537 if ((swipeAngle <= 360) && (swipeAngle >= 315)) { 2538 return (_.options.rtl === false ? 'left' : 'right'); 2539 } 2540 if ((swipeAngle >= 135) && (swipeAngle <= 225)) { 2541 return (_.options.rtl === false ? 'right' : 'left'); 2542 } 2543 if (_.options.verticalSwiping === true) { 2544 if ((swipeAngle >= 35) && (swipeAngle <= 135)) { 2545 return 'down'; 2546 } else { 2547 return 'up'; 2548 } 2549 } 2550 2551 return 'vertical'; 2552 2553 }; 2554 2555 Slick.prototype.swipeEnd = function(event) { 2556 2557 var _ = this, 2558 slideCount, 2559 direction; 2560 2561 _.dragging = false; 2562 _.interrupted = false; 2563 _.shouldClick = ( _.touchObject.swipeLength > 10 ) ? false : true; 2564 2565 if ( _.touchObject.curX === undefined ) { 2566 return false; 2567 } 2568 2569 if ( _.touchObject.edgeHit === true ) { 2570 _.$slider.trigger('edge', [_, _.swipeDirection() ]); 2571 } 2572 2573 if ( _.touchObject.swipeLength >= _.touchObject.minSwipe ) { 2574 2575 direction = _.swipeDirection(); 2576 2577 switch ( direction ) { 2578 2579 case 'left': 2580 case 'down': 2581 2582 slideCount = 2583 _.options.swipeToSlide ? 2584 _.checkNavigable( _.currentSlide + _.getSlideCount() ) : 2585 _.currentSlide + _.getSlideCount(); 2586 2587 _.currentDirection = 0; 2588 2589 break; 2590 2591 case 'right': 2592 case 'up': 2593 2594 slideCount = 2595 _.options.swipeToSlide ? 2596 _.checkNavigable( _.currentSlide - _.getSlideCount() ) : 2597 _.currentSlide - _.getSlideCount(); 2598 2599 _.currentDirection = 1; 2600 2601 break; 2602 2603 default: 2604 2605 2606 } 2607 2608 if( direction != 'vertical' ) { 2609 2610 _.slideHandler( slideCount ); 2611 _.touchObject = {}; 2612 _.$slider.trigger('swipe', [_, direction ]); 2613 2614 } 2615 2616 } else { 2617 2618 if ( _.touchObject.startX !== _.touchObject.curX ) { 2619 2620 _.slideHandler( _.currentSlide ); 2621 _.touchObject = {}; 2622 2623 } 2624 2625 } 2626 2627 }; 2628 2629 Slick.prototype.swipeHandler = function(event) { 2630 2631 var _ = this; 2632 2633 if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) { 2634 return; 2635 } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) { 2636 return; 2637 } 2638 2639 _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ? 2640 event.originalEvent.touches.length : 1; 2641 2642 _.touchObject.minSwipe = _.listWidth / _.options 2643 .touchThreshold; 2644 2645 if (_.options.verticalSwiping === true) { 2646 _.touchObject.minSwipe = _.listHeight / _.options 2647 .touchThreshold; 2648 } 2649 2650 switch (event.data.action) { 2651 2652 case 'start': 2653 _.swipeStart(event); 2654 break; 2655 2656 case 'move': 2657 _.swipeMove(event); 2658 break; 2659 2660 case 'end': 2661 _.swipeEnd(event); 2662 break; 2663 2664 } 2665 2666 }; 2667 2668 Slick.prototype.swipeMove = function(event) { 2669 2670 var _ = this, 2671 edgeWasHit = false, 2672 curLeft, swipeDirection, swipeLength, positionOffset, touches; 2673 2674 touches = event.originalEvent !== undefined ? event.originalEvent.touches : null; 2675 2676 if (!_.dragging || touches && touches.length !== 1) { 2677 return false; 2678 } 2679 2680 curLeft = _.getLeft(_.currentSlide); 2681 2682 _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX; 2683 _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY; 2684 2685 _.touchObject.swipeLength = Math.round(Math.sqrt( 2686 Math.pow(_.touchObject.curX - _.touchObject.startX, 2))); 2687 2688 if (_.options.verticalSwiping === true) { 2689 _.touchObject.swipeLength = Math.round(Math.sqrt( 2690 Math.pow(_.touchObject.curY - _.touchObject.startY, 2))); 2691 } 2692 2693 swipeDirection = _.swipeDirection(); 2694 2695 if (swipeDirection === 'vertical') { 2696 return; 2697 } 2698 2699 if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) { 2700 event.preventDefault(); 2701 } 2702 2703 positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1); 2704 if (_.options.verticalSwiping === true) { 2705 positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1; 2706 } 2707 2708 2709 swipeLength = _.touchObject.swipeLength; 2710 2711 _.touchObject.edgeHit = false; 2712 2713 if (_.options.infinite === false) { 2714 if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) { 2715 swipeLength = _.touchObject.swipeLength * _.options.edgeFriction; 2716 _.touchObject.edgeHit = true; 2717 } 2718 } 2719 2720 if (_.options.vertical === false) { 2721 _.swipeLeft = curLeft + swipeLength * positionOffset; 2722 } else { 2723 _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset; 2724 } 2725 if (_.options.verticalSwiping === true) { 2726 _.swipeLeft = curLeft + swipeLength * positionOffset; 2727 } 2728 2729 if (_.options.fade === true || _.options.touchMove === false) { 2730 return false; 2731 } 2732 2733 if (_.animating === true) { 2734 _.swipeLeft = null; 2735 return false; 2736 } 2737 2738 _.setCSS(_.swipeLeft); 2739 2740 }; 2741 2742 Slick.prototype.swipeStart = function(event) { 2743 2744 var _ = this, 2745 touches; 2746 2747 _.interrupted = true; 2748 2749 if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) { 2750 _.touchObject = {}; 2751 return false; 2752 } 2753 2754 if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) { 2755 touches = event.originalEvent.touches[0]; 2756 } 2757 2758 _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX; 2759 _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY; 2760 2761 _.dragging = true; 2762 2763 }; 2764 2765 Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() { 2766 2767 var _ = this; 2768 2769 if (_.$slidesCache !== null) { 2770 2771 _.unload(); 2772 2773 _.$slideTrack.children(this.options.slide).detach(); 2774 2775 _.$slidesCache.appendTo(_.$slideTrack); 2776 2777 _.reinit(); 2778 2779 } 2780 2781 }; 2782 2783 Slick.prototype.unload = function() { 2784 2785 var _ = this; 2786 2787 $('.a4j-slick-cloned', _.$slider).remove(); 2788 2789 if (_.$dots) { 2790 _.$dots.remove(); 2791 } 2792 2793 if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) { 2794 _.$prevArrow.remove(); 2795 } 2796 2797 if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) { 2798 _.$nextArrow.remove(); 2799 } 2800 2801 _.$slides 2802 .removeClass('a4j-slick-slide a4j-slick-active a4j-slick-visible a4j-slick-current') 2803 .attr('aria-hidden', 'true') 2804 .css('width', ''); 2805 2806 }; 2807
2808 Slick.prototype.unslick = function(fromBreakpoint) { 2809 2810 var _ = this; 2811 _.$slider.trigger('unslick', [_, fromBreakpoint]); 2812 _.destroy(); 2813 2814 }; 2815 2816 Slick.prototype.updateArrows = function() { 2817 2818 var _ = this, 2819 centerOffset; 2820 2821 centerOffset = Math.floor(_.options.slidesToShow / 2); 2822 2823 if ( _.options.arrows === true && 2824 _.slideCount > _.options.slidesToShow && 2825 !_.options.infinite ) { 2826 2827 _.$prevArrow.removeClass('a4j-slick-disabled').attr('aria-disabled', 'false'); 2828 _.$nextArrow.removeClass('a4j-slick-disabled').attr('aria-disabled', 'false'); 2829 2830 if (_.currentSlide === 0) { 2831 2832 _.$prevArrow.addClass('a4j-slick-disabled').attr('aria-disabled', 'true'); 2833 _.$nextArrow.removeClass('a4j-slick-disabled').attr('aria-disabled', 'false'); 2834 2835 } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) { 2836 2837 _.$nextArrow.addClass('a4j-slick-disabled').attr('aria-disabled', 'true'); 2838 _.$prevArrow.removeClass('a4j-slick-disabled').attr('aria-disabled', 'false'); 2839 2840 } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) { 2841 2842 _.$nextArrow.addClass('a4j-slick-disabled').attr('aria-disabled', 'true'); 2843 _.$prevArrow.removeClass('a4j-slick-disabled').attr('aria-disabled', 'false'); 2844 2845 } 2846 2847 } 2848 2849 }; 2850 2851 Slick.prototype.updateDots = function() { 2852 2853 var _ = this; 2854 2855 if (_.$dots !== null) { 2856 2857 _.$dots 2858 .find('i') 2859 .removeClass('a4j-slick-active') 2860 .attr('aria-hidden', 'true'); 2861 2862 _.$dots 2863 .find('i') 2864 .eq(Math.floor(_.currentSlide / _.options.slidesToScroll)) 2865 .addClass('a4j-slick-active') 2866 .attr('aria-hidden', 'false'); 2867 2868 } 2869 2870 }; 2871 2872 Slick.prototype.visibility = function() { 2873 2874 var _ = this; 2875 2876 if ( _.options.autoplay ) { 2877 2878 if ( document[_.hidden] ) { 2879 2880 _.interrupted = true; 2881 2882 } else { 2883 2884 _.interrupted = false; 2885 2886 } 2887 2888 } 2889 2890 }; 2891 2892 $.fn.a4jSlick = function() { 2893 var _ = this, 2894 opt = arguments[0], 2895 args = Array.prototype.slice.call(arguments, 1), 2896 l = _.length, 2897 i, 2898 ret; 2899 for (i = 0; i < l; i++) { 2900 if (typeof opt == 'object' || typeof opt == 'undefined') 2901 _[i].a4jslick = new Slick(_[i], opt); 2902 else 2903 ret = _[i].a4jslick[opt].apply(_[i].a4jslick, args); 2904 if (typeof ret != 'undefined') return ret; 2905 } 2906 return _; 2907 }; 2908 2909})(jQuery); 2910 2911(function ($) { 2912 'use strict'; 2913 2914 if (window.inGallery) { 2915 return; 2916 } 2917 2918 var popupShown = false; 2919 var fitPopupTimeout = 0; 2920 var popupShade = null; 2921 var popup = null; 2922 var loaderHTML = '<div class="ingLoaderWrap"><i class="ing-icon-spin2 animate-spin"></i></div>'; 2923 2924 var InGallery = function (htmlNode) { 2925 this.jqNode = $(htmlNode); 2926 this.id = this.jqNode.attr('data-id'); 2927 this.cfg = JSON.parse(this.jqNode.attr('data-cfg')); 2928 this.page = parseInt(this.jqNode.attr('data-page')); 2929 this.commentsCache = {}; 2930 this.layoutFitTimeout = 0; 2931 this.masonry = null; 2932 this.visible = false; 2933 2934 var self = this; 2935 2936 var loadMoreBtn = this.jqNode.find('.ingallery-loadmore-btn'); 2937 var infScroll = this.jqNode.find('.ingallery-loadmore.ingallery-inf-scroll'); 2938 2939 this.jqNode.find('.ingallery-album').off('click').on('click', function () { 2940 self.filterGallery($(this).attr('data-id')); 2941 }); 2942 if (this.cfg.layout_type == 'carousel') { 2943 this.jqNode.find('.ingallery-items').not('.a4j-slick-initialized').a4jSlick({ 2944 'prevArrow': '<span data-role="none" class="a4j-slick-prev" aria-label="Previous" tabindex="0" role="button"><i class="ing-icon-angle-left ing-fw"></i></span>', 2945 'nextArrow': '<span data-role="none" class="a4j-slick-next" aria-label="Next" tabindex="0" role="button"><i class="ing-icon-angle-right ing-fw"></i></span>' 2946 }); 2947 this.jqNode.off('beforeCarouselChange').on('beforeCarouselChange', function (e, _slick, _prevSlideID, _nextSlideID) { 2948 self.checkCarouselLoad(_nextSlideID); 2949 }); 2950 } else if (this.cfg.layout_type.indexOf('masonry') >= 0) { 2951 this.buildMasonryLayout(); 2952 this.activateMasonry(); 2953 } 2954 this.bindItemLinks(); 2955
2956 loadMoreBtn.off('click').on('click', function () { 2957 var $this = $(this); 2958 if ($this.hasClass('disabled')) { 2959 return false; 2960 } 2961 var btnContent = $this.html(); 2962 self.page++; 2963 self.jqNode.attr('data-page', self.page); 2964 var currentPage = self.page; 2965 var data = 'id=' + self.id + '&page=' + currentPage; 2966 var messageContainer = self.jqNode.find('.ingallery-loadmore'); 2967 var addData = window.inGallery.addRequestData(self.jqNode); 2968 if (addData) { 2969 data += '&' + addData; 2970 } 2971 $this.addClass('disabled').html('<i class="ing-icon-spin2 animate-spin"></i>'); 2972 $.ajax({ 2973 'url': window.inGallery.getParam('ajax_url'), 2974 'type': 'get', 2975 'dataType': 'json', 2976 'data': data, 2977 'success': function (response, statusText, xhr, $form) { 2978 if (!response) { 2979 messageContainer.html(getMessageHTML(window.inGallery.getLangString('system_error'), 'error')); 2980 return false; 2981 } 2982 if (response.status && response.status == 'success') { 2983 var gallery = self.jqNode; 2984 var newItems = $(response.html).find('.ingallery-cell'); 2985 var itemsContainer = gallery.find('.ingallery-items'); 2986 if (self.cfg.layout_type == 'carousel') { 2987 gallery.css('min-height', gallery.height()); 2988 itemsContainer.a4jSlick('slickAdd', newItems); 2989 gallery.css('min-height', 'auto'); 2990 } else if (self.cfg.layout_type.indexOf('masonry') >= 0) { 2991 itemsContainer.append(newItems) 2992 self.buildMasonryLayout(gallery); 2993 itemsContainer.masonry('appended', newItems); 2994 } else { 2995 itemsContainer.append(newItems); 2996 } 2997 self.lazyImages(); 2998 /*newItems.css('opacity',0).stop().animate({ 2999 'opacity': 1 3000 },300);*/ 3001 self.bindItemLinks(gallery); 3002 var galleryFiltered = gallery.attr('data-filtered'); 3003 if (galleryFiltered && galleryFiltered != '' && galleryFiltered != '0') { 3004 self.filterGallery(galleryFiltered, true); 3005 } else { 3006 self.fitLayout(); 3007 } 3008 if (response.has_more) { 3009 $this.removeClass('disabled').html(btnContent); 3010 if (gallery.hasClass('ingallery-layout-carousel')) { 3011 self.checkCarouselLoad(null); 3012 } else if (infScroll.length) { 3013 self.checkInfScroll(loadMoreBtn); 3014 } 3015 } else { 3016 var tmp = gallery.find('.ingallery-loadmore'); 3017 tmp.slideUp(200, 'swing', function () { 3018 tmp.remove(); 3019 }); 3020 } 3021 $(window).trigger('resize'); 3022 } else if (response.status && response.status == 'error') { 3023 messageContainer.html(getMessageHTML(response.message, 'error')); 3024 } else { 3025 messageContainer.html(getMessageHTML(window.inGallery.getLangString('system_error'), 'error')); 3026 } 3027 }, 3028 error: function (jqXHR, textStatus, errorThrown) { 3029 messageContainer.html(getMessageHTML(window.inGallery.getLangString('system_error') + '<br><i>' + textStatus + ' (' + errorThrown + ')</i>', 'error')); 3030 } 3031 }); 3032 3033 return false; 3034 }); 3035 if (this.cfg.layout_type == 'carousel') {
3036 loadMoreBtn.click(); 3037 } else if (infScroll.length) { 3038 $(window).on('scroll', function () { 3039 self.checkInfScroll(loadMoreBtn); 3040 }); 3041 self.checkInfScroll(loadMoreBtn); 3042 } 3043 3044 this.jqNode.off('updateLayout').on('updateLayout', function () { 3045 self.updateLayout(); 3046 }); 3047 3048 3049 $(window).on('resize', function () { 3050 self.updateLayout(); 3051 }).trigger('resize'); 3052 3053 window.setInterval(function () { 3054 self.checkIsVisible(); 3055 }, 100); 3056 } 3057 3058 InGallery.prototype = { 3059 checkIsVisible: function () { 3060 this.lazyImages(); 3061 var visible = this.jqNode.is(':visible'); 3062 if (!this.visible && visible) { 3063 this.updateLayout(); 3064 } 3065 this.visible = visible; 3066 }, 3067 lazyImages: function(){ 3068 var winY = parseInt($(window).scrollTop()+$(window).height()); 3069 var thisY = this.jqNode.offset().top; 3070 if((winY+200)>=thisY){ 3071 this.jqNode.find('img').each(function(){ 3072 var img = $(this); 3073 if(img.data('src')){ 3074 img.attr('src', img.data('src')); 3075 img.data('src', null); 3076 img.css('opacity', 0); 3077 img.on('load', function () { 3078 if(this.complete && this.naturalWidth) { 3079 img.animate({'opacity': 1}, 300); 3080 } 3081 }); 3082 } 3083 }); 3084 } 3085 }, 3086 updateLayout: function () { 3087 if (this.layoutFitTimeout > 0) { 3088 window.clearTimeout(this.layoutFitTimeout); 3089 this.layoutFitTimeout = 0; 3090 } 3091 this.layoutFitTimeout = window.setTimeout(this.fitLayout.bind(this), 150); 3092 }, 3093 fitLayout: function () { 3094 if (this.layoutFitTimeout > 0) { 3095 window.clearTimeout(this.layoutFitTimeout); 3096 this.layoutFitTimeout = 0; 3097 } 3098 var winWidth = $(window).width(); 3099 var respCfg = { 3100 "cols": parseInt(this.cfg.layout_cols), 3101 "rows": parseInt(this.cfg.layout_rows), 3102 "gutter": parseInt(this.cfg.layout_gutter) 3103 }; 3104 for (var w in this.cfg.layout_responsive) { 3105 if (parseInt(w) >= winWidth) { 3106 respCfg = this.cfg.layout_responsive[w]; 3107 break; 3108 } 3109 } 3110 var $margin = (respCfg.gutter > 0 ? Math.floor(respCfg.gutter / 2) : 0); 3111 var $widthPercent = (respCfg.cols > 1 ? precisionRound(100 / respCfg.cols, 3) : 100); 3112 if (this.cfg.layout_type == 'masonry') { 3113 $widthPercent = (respCfg.cols > 1 ? precisionRound(100 / (respCfg.cols + 1), 3) : 100); 3114 } 3115 3116 var css = ""; 3117 if (this.cfg.layout_type == 'carousel') { 3118 css += "#ingallery-" + this.id + " .ingallery-col, #ingallery-" + this.id + " .ingallery-cell{padding:" + $margin + "px;}"; 3119 } else { 3120 css += "#ingallery-" + this.id + " .ingallery-items{margin-left:-" + $margin + "px;margin-right:-" + $margin + "px;}"; 3121 css += "#ingallery-" + this.id + " .ingallery-col, #ingallery-" + this.id + " .ingallery-cell{padding-left:" + $margin + "px;padding-right:" + $margin + "px;padding-bottom:" + respCfg.gutter + "px;width:" + $widthPercent + "%;}"; 3122 css += "#ingallery-" + this.id + " .grid-sizer{width:" + $widthPercent + "%;}"; 3123 css += "#ingallery-" + this.id + " .ingallery-col-big, #ingallery-" + this.id + " .ingallery-cell-big{width:" + ($widthPercent * 2) + "%;}"; 3124 } 3125 3126 var customCSSNode = this.jqNode.find('.custom-css-node'); 3127 if (customCSSNode.length == 0) { 3128 customCSSNode = $('<style type="text/css" class="custom-css-node"></style>');
3129 this.jqNode.append(customCSSNode); 3130 } 3131 customCSSNode.text(css); 3132 3133 if (this.masonry) { 3134 var feed = this; 3135 this.masonry.masonry(); 3136 var images = this.masonry.find('img'); 3137 var imagesLoaded = 0; 3138 var imagesTotal = images.length; 3139 var imgLoaded = function (img) { 3140 imagesLoaded++; 3141 if (imagesLoaded >= imagesTotal) { 3142 feed.masonry.masonry('layout'); 3143 } 3144 }; 3145 images.each(function () { 3146 if (this.complete && this.naturalWidth) { 3147 imgLoaded(this); 3148 } 3149 }); 3150 if (imagesLoaded < imagesTotal) { 3151 images.on('load', function () { 3152 if (this.complete && this.naturalWidth) { 3153 imgLoaded(this); 3154 } 3155 }); 3156 } 3157 } 3158 var newImages = this.jqNode.find('.ingallery-item img').not('.ing-loading, .ing-loaded'); 3159 newImages.each(function () { 3160 if (this.complete && this.naturalWidth) { 3161 return 3162 } 3163 var $img = $(this); 3164 $img.addClass('ing-loading').css('opacity', 0); 3165 $img.on('load', function () { 3166 if (this.complete && this.naturalWidth) { 3167 $(this).removeClass('ing-loading').addClass('ing-loaded').stop().animate({'opacity': 1}, 300); 3168 } 3169 }); 3170 }); 3171 }, 3172 showInPopup: function (_item) { 3173 if (popupShown) { 3174 this.updatePopup(_item); 3175 } else { 3176 this.createPopup(_item); 3177 } 3178 }, 3179 3180 createPopup: function (_item) { 3181 if (popupShown) { 3182 return; 3183 } 3184 var gallery = this; 3185 var popupHTML; 3186 popupHTML = '<div id="ingallery-shade">'; 3187 popupHTML += '<div id="ingallery-popup" class="' + this.id + '">'; 3188 popupHTML += '<div id="ingallery-popup-close"><i class="ing-icon-cancel-1"></i></div>'; 3189 popupHTML += '<div id="ingallery-popup-wrap">'; 3190 popupHTML += '<div id="ingallery-popup-wrap-img">'; 3191 popupHTML += '<div id="ingallery-popup-left"><i class="ing-icon-angle-left"></i></div>'; 3192 popupHTML += '<div id="ingallery-popup-right"><i class="ing-icon-angle-right"></i></div>'; 3193 popupHTML += '<div id="ingallery-popup-wrap-img-cnt"></div>'; 3194 popupHTML += '</div>'; 3195 popupHTML += '<div id="ingallery-popup-wrap-content"></div>'; 3196 popupHTML += '</div>'; 3197 popupHTML += '</div>'; 3198 popupHTML += '</div>'; 3199 popupShade = $(popupHTML); 3200 var _body = $('body'); 3201 popup = popupShade.find('#ingallery-popup'); 3202 _body.append(popupShade); 3203 popupShown = true; 3204 popupShade.fadeIn(300); 3205 popup.css('opacity', 0).css('margin-top', '30px').stop().animate({ 3206 opacity: 1, 3207 'margin-top': 0 3208 }, 300); 3209 3210 popupShade.on('click', function (e) { 3211 var _target = $(e.target); 3212 var _close = _target.closest('#ingallery-popup-close'); 3213 if (_target.is(popupShade) || _close.length) { 3214 gallery.closePopup.call(this); 3215 } 3216 }); 3217 3218 $(document).on('keydown', this.processKeydown); 3219 3220 this.placeDataToPopup(_item); 3221 }, 3222 updatePopup: function (_item) { 3223 if (!popupShown) { 3224 return; 3225 } 3226 var gallery = this; 3227 var popupWraps = $('#ingallery-popup-wrap-img-cnt > img,#ingallery-popup-wrap-content'); 3228 popupWraps.stop().animate({ 3229 'opacity': 0 3230 }, 100, 'swing', function () { 3231 gallery.placeDataToPopup(_item); 3232 popupWraps.stop().animate({ 3233 'opacity': 1 3234 }, 100); 3235 }); 3236 }, 3237 closePopup: function () { 3238 if (!popupShown) { 3239 return; 3240 } 3241 var _body = $('body'); 3242 popupShade.fadeOut(300, 'swing', function () { 3243 popupShade.remove(); 3244 popupShown = false; 3245 }); 3246 popup.stop().animate({ 3247 opacity: 0, 3248 'margin-top': 30 3249 }, 300); 3250 $(document).off('keydown', this.processKeydown); 3251 }, 3252 3253 processKeydown: function (e) { 3254 if (!e.which) { 3255 return; 3256 } 3257 if (e.which == 37) { 3258 $('#ingallery-popup-left:visible').click(); 3259 } else if (e.which == 39) { 3260 $('#ingallery-popup-right:visible').click(); 3261 } 3262 }, 3263 3264 placeDataToPopup: function (_item) { 3265 var popupWrap = $('#ingallery-popup-wrap'); 3266 var popupImgWrap = $('#ingallery-popup-wrap-img'); 3267 var popupContentWrap = $('#ingallery-popup-wrap-content'); 3268 if (popupImgWrap.length == 0 || popupContentWrap.length == 0) { 3269 return false; 3270 } 3271 var gallery = this; 3272 popupImgWrap.attr('data-img-size', this.cfg.display_popup_img_size); 3273 popupImgWrap.attr('data-ratio', _item.ratio); 3274 popupImgWrap.attr('data-width', _item.full_width); 3275 popupImgWrap.attr('data-height', _item.full_height); 3276 var imgPlaceholder = popupImgWrap.find('#ingallery-popup-wrap-img-cnt'); 3277 imgPlaceholder.off('click').removeClass('ing-video').removeClass('ing-playing'); 3278 if (_item.is_video) { 3279 imgPlaceholder.addClass('ing-video'); 3280 var _video = $('<video poster="' + _item.display_src + '" src="' + _item.video_url + '" preload="false" ' + (this.cfg.display_popup_loop_video ? 'loop="loop"' : '') + ' playsinline type="video/mp4"><source src="' + _item.video_url + '" type="video/mp4"></video>'); 3281 imgPlaceholder.empty().append(_video); 3282 3283 _video.on('click', function () { 3284 var player = _video.get(0); 3285 if (player.paused) { 3286 imgPlaceholder.addClass('ing-playing'); 3287 player.play(); 3288 } else { 3289 imgPlaceholder.removeClass('ing-playing'); 3290 player.pause(); 3291 } 3292 }); 3293 } else if (_item.subgallery.length) { 3294 var _subgallery = $('<div id="ingallery-popup-wrap-img-subgallery"></div>'); 3295 var _subgalleryItems = $('<div id="ingallery-popup-wrap-img-subgallery-items"></div>');
3296 var _subgalleryNav = $('<div id="ingallery-popup-wrap-img-subgallery-nav"></div>'); 3297 var _subgalleryPrev = $('<div id="ingallery-popup-wrap-img-subgallery-prev"><i class="ing-icon-angle-left ing-fw"></i></div>'); 3298 var _subgalleryNext = $('<div id="ingallery-popup-wrap-img-subgallery-next"><i class="ing-icon-angle-right ing-fw"></i></div>'); 3299 var _subgalleryCurrentIdx = 0; 3300 for (var i = 0; i < _item.subgallery.length; i++) { 3301 var _subgalleryItemClass = ''; 3302 if (i == _subgalleryCurrentIdx) { 3303 _subgalleryItemClass = 'active'; 3304 } 3305 var _subgalleryItem = '<div class="ingallery-popup-subgallery-item ' + _subgalleryItemClass + '" data-ratio="' + _item.subgallery[i].ratio + '" data-width="' + _item.subgallery[i].width + '" data-height="' + _item.subgallery[i].height + '">'; 3306 if (_item.subgallery[i].is_video) { 3307 imgPlaceholder.addClass('ing-video'); 3308 _subgalleryItem += '<video poster="' + _item.subgallery[i].src + '" src="' + _item.subgallery[i].video_url + '" preload="false" ' + (this.cfg.display_popup_loop_video ? 'loop="loop"' : '') + ' playsinline type="video/mp4"><source src="' + _item.subgallery[i].video_url + '" type="video/mp4"></video>'; 3309 } else { 3310 _subgalleryItem += '<img src="' + _item.subgallery[i].src + '" />'; 3311 } 3312 _subgalleryItem += '</div>'; 3313 _subgalleryItems.append(_subgalleryItem); 3314 _subgalleryNav.append('<i class="' + _subgalleryItemClass + '"></i>'); 3315 } 3316 _subgallery.append(_subgalleryItems); 3317 _subgallery.append(_subgalleryNav); 3318 _subgallery.append(_subgalleryPrev); 3319 _subgallery.append(_subgalleryNext); 3320 imgPlaceholder.empty().append(_subgallery); 3321 3322 _subgallery.find('video').each(function () { 3323 var _video = $(this); 3324 _video.on('click', function () { 3325 var player = _video.get(0); 3326 if (player.paused) { 3327 imgPlaceholder.addClass('ing-playing'); 3328 player.play(); 3329 } else { 3330 imgPlaceholder.removeClass('ing-playing'); 3331 player.pause(); 3332 } 3333 }); 3334 }); 3335 3336 var checkNav = function () { 3337 if (_subgalleryCurrentIdx == 0) { 3338 _subgalleryPrev.hide(); 3339 } else { 3340 _subgalleryPrev.show(); 3341 } 3342 if (_subgalleryCurrentIdx == _item.subgallery.length - 1) { 3343 _subgalleryNext.hide(); 3344 } else { 3345 _subgalleryNext.show(); 3346 } 3347 } 3348 checkNav(); 3349 var switchItem = function (_index) { 3350 if (_index < 0 || _index > _item.subgallery.length - 1) { 3351 return false; 3352 } 3353 if (imgPlaceholder.hasClass('ing-playing')) { 3354 _subgalleryItems.children('.active').find('video').click(); 3355 } 3356 var _direction = (_subgalleryCurrentIdx > _index ? 'backward' : 'forward'); 3357 var _csgitemEx = $(_subgalleryItems.children().get(_subgalleryCurrentIdx)); 3358 var _csgitem = $(_subgalleryItems.children().get(_index)); 3359 3360 _subgalleryCurrentIdx = _index; 3361 popupImgWrap.attr('data-ratio', _csgitem.attr('data-ratio')); 3362 popupImgWrap.attr('data-width', _csgitem.attr('data-width')); 3363 popupImgWrap.attr('data-height', _csgitem.attr('data-height')); 3364 _subgalleryItems.children().removeClass('active prev next'); 3365 _csgitem.addClass('active'); 3366 _csgitem.prev().addClass('prev'); 3367 _csgitem.next().addClass('next'); 3368 _subgalleryNav.children().removeClass('active'); 3369 $(_subgalleryNav.children().get(_index)).addClass('active'); 3370 if (_csgitem.find('video').length) { 3371 imgPlaceholder.addClass('ing-video'); 3372 } else { 3373 imgPlaceholder.removeClass('ing-video'); 3374 } 3375 checkNav(); 3376 if (_direction == 'forward') { 3377 _csgitemEx.animate({ 3378 'left': '-100%' 3379 }, 100); 3380 _csgitem.css('left', '100%').animate({ 3381 'left': 0 3382 }, 100); 3383 } else { 3384 _csgitemEx.animate({ 3385 'left': '100%' 3386 }, 100); 3387 _csgitem.css('left', '-100%').animate({ 3388 'left': 0 3389 }, 100); 3390 } 3391 3392 fitPopup(); 3393 } 3394 _subgalleryNav.children().on('click', function () { 3395 switchItem($(this).index()); 3396 return false; 3397 }); 3398 _subgalleryPrev.on('click', function () { 3399 switchItem(_subgalleryCurrentIdx - 1); 3400 return false; 3401 }); 3402 _subgalleryNext.on('click', function () { 3403 switchItem(_subgalleryCurrentIdx + 1); 3404 return false; 3405 }); 3406 switchItem(0); 3407 } else { 3408 var _img = $('<img />').css('opacity', 0); 3409 _img.on('load', function () { 3410 _img.animate({ 3411 'opacity': 1 3412 }, 200); 3413 }); 3414 _img.attr('src', _item.display_src); 3415 imgPlaceholder.empty().append(_img); 3416 }
3417 var contentHTML = ''; 3418 if (this.cfg.display_popup_user) { 3419 contentHTML += '<div class="ingallery-popup-content-user">'; 3420 if (this.cfg.display_popup_instagram_link) { 3421 contentHTML += '<a href="https://www.instagram.com/' + _item.owner_username + '/" title="' + _item.owner_name + '" target="_blank">'; 3422 } 3423 contentHTML += '<img src="' + _item.owner_pic_url + '"> ' + _item.owner_username; 3424 if (this.cfg.display_popup_instagram_link) { 3425 contentHTML += '</a>'; 3426 } 3427 contentHTML += '</div>'; 3428 } 3429 if (this.cfg.display_popup_likes || this.cfg.display_popup_comments || this.cfg.display_popup_plays || this.cfg.display_popup_date) { 3430 contentHTML += '<div class="ingallery-popup-content-stats">'; 3431 if (this.cfg.display_popup_date) { 3432 contentHTML += '<time title="' + _item.full_date + '" datetime="' + _item.date_iso + '">' + _item.time_passed + '</time>'; 3433 } 3434 if (this.cfg.display_popup_likes) { 3435 contentHTML += '<span class="ingallery-popup-content-stats-likes"><i class="ing-icon-heart-1"></i> ' + _item.likes + '</span>'; 3436 } 3437 if (this.cfg.display_popup_comments) { 3438 contentHTML += '<span class="ingallery-popup-content-stats-comments"><i class="ing-icon-comment-1"></i> ' + _item.comments + '</span>'; 3439 } 3440 contentHTML += '</div>'; 3441 } 3442 if (this.cfg.display_popup_description || this.cfg.display_popup_comments_list) { 3443 contentHTML += '<div class="ingallery-popup-content-stretch">'; 3444 } 3445 if (this.cfg.display_popup_description) { 3446 contentHTML += '<div class="ingallery-popup-content-descr">' + _item.caption + '</div>'; 3447 } 3448 var needToLoadComments = false; 3449 if (this.cfg.display_popup_comments_list) { 3450 needToLoadComments = true; 3451 contentHTML += '<div class="ingallery-popup-content-comments ing-' + _item.code + ' ing-loading">'; 3452 if (this.commentsCache[_item.code]) { 3453 needToLoadComments = false; 3454 contentHTML += this.commentsCache[_item.code]; 3455 } 3456 contentHTML += '</div>'; 3457 } 3458 if (this.cfg.display_popup_description || this.cfg.display_popup_comments_list) { 3459 contentHTML += '</div>'; 3460 } 3461 3462 if (contentHTML != '') { 3463 popupWrap.removeClass('noRight'); 3464 popupContentWrap.html(contentHTML); 3465 } else { 3466 popupWrap.addClass('noRight'); 3467 } 3468 3469 3470 if (needToLoadComments) { 3471 $.ajax({
3472 url: window.inGallery.getParam('ajax_url'), 3473 type: 'get', 3474 dataType: 'json', 3475 cache: true, 3476 data: 'task=gallery.comments&media_code=' + _item.code, 3477 success: function (response, statusText, xhr, $form) { 3478 if (response && response.status && response.status == 'success') { 3479 gallery.commentsCache[response.media_code] = response.html; 3480 var comments = $(response.html); 3481 popupContentWrap.find('.ingallery-popup-content-comments.ing-' + response.media_code).removeClass('ing-loading').append(comments); 3482 comments.css('opacity', 0).stop().animate({ 3483 'opacity': 1 3484 }, 300); 3485 } 3486 }, 3487 }); 3488 } 3489 3490 var _items = this.jqNode.find('a.ingallery-item-link-popup:visible'); 3491 var goPrev = $('#ingallery-popup-left'); 3492 var goNext = $('#ingallery-popup-right'); 3493 var itemIndex = _items.index(_item.jqItem); 3494 if (itemIndex > 0) { 3495 goPrev.show(); 3496 goPrev.off('click').on('click', function () { 3497 _items.get(itemIndex - 1).click(); 3498 }); 3499 } else { 3500 goPrev.hide(); 3501 } 3502 if (itemIndex + 1 < _items.length) { 3503 goNext.show(); 3504 goNext.off('click').on('click', function () { 3505 _items.get(itemIndex + 1).click(); 3506 }); 3507 } else { 3508 goNext.hide(); 3509 } 3510 3511 if (itemIndex > _items.length - 4) { 3512 this.jqNode.find('.ingallery-loadmore-btn').click(); 3513 } 3514 3515 fitPopup(); 3516 3517 return true; 3518 }, 3519 3520 filterGallery: function (albumID, _force) { 3521 this.jqNode.css('height', this.jqNode.height()); 3522 var oldAlbum = this.jqNode.find('.ingallery-album.active'); 3523 if (oldAlbum.attr('data-id') == albumID && !_force) { 3524 return; 3525 } 3526 var newAlbum = this.jqNode.find('.ingallery-album[data-id="' + albumID + '"]'); 3527 var itemsToShow; 3528 var itemsToHide; 3529 3530 this.jqNode.attr('data-filtered', newAlbum.attr('data-id')); 3531 oldAlbum.removeClass('active'); 3532 newAlbum.addClass('active'); 3533 3534 itemsToHide = this.jqNode.find('.ingallery-cell'); 3535 3536 if (newAlbum.attr('data-id') == '0') { 3537 itemsToShow = this.jqNode.find('.ingallery-cell'); 3538 } else { 3539 itemsToShow = this.jqNode.find('.ingallery-cell[data-album="' + newAlbum.attr('data-id') + '"]'); 3540 } 3541 itemsToHide.stop().hide(); 3542 itemsToShow.stop().show().css('opacity', 0).animate({ 3543 'opacity': 1 3544 }, 300); 3545 3546 this.jqNode.css('height', 'auto'); 3547 this.fitLayout(); 3548 3549 if (this.masonry) { 3550 this.buildMasonryLayout(); 3551 this.masonry.masonry('layout'); 3552 } 3553 }, 3554 3555 checkCarouselLoad: function (_nextSlideID) { 3556 var carousel = this.jqNode.find('.ingallery-items').data('ingslick'); 3557 if (!carousel) { 3558 return; 3559 } 3560 var curSlide; 3561 var totalSlides; 3562 if (_nextSlideID) { 3563 carousel.currentSlide = _nextSlideID; 3564 } 3565 if (carousel.options.rows > 1) { 3566 curSlide = carousel.currentSlide; 3567 totalSlides = carousel.slideCount; 3568 //carousel.options.slidesPerRow 3569 } else { 3570 curSlide = Math.floor((parseInt(carousel.currentSlide) + 1) / parseInt(carousel.options.slidesToShow)); 3571 totalSlides = Math.ceil((parseInt(carousel.slideCount) - parseInt(carousel.options.slidesToShow)) / parseInt(carousel.options.slidesToShow)); 3572 } 3573 if (curSlide > totalSlides - 3) { 3574 this.jqNode.find('.ingallery-loadmore-btn').click(); 3575 } 3576 }, 3577 3578 checkInfScroll: function (loadMoreBtn) { 3579 if (loadMoreBtn.hasClass('disabled')) { 3580 return false; 3581 } 3582 var top = $(window).scrollTop() + ($(window).height() * 1.4); 3583 if (top > loadMoreBtn.offset().top) {
3584 loadMoreBtn.click(); 3585 } 3586 }, 3587 3588 buildMasonryLayout: function () { 3589 if (this.cfg.layout_type != 'masonry') { 3590 return this; 3591 } 3592 var cols = this.cfg.layout_cols; 3593 var maxColPos = cols - 1; 3594 var curColPos = -1; 3595 var colPosDir = 1; 3596 var lastRowNum = -1; 3597 3598 this.jqNode.find('.ingallery-cell:visible').each(function (index) { 3599 var itemRowNum = Math.floor(index / (cols * 2 - 1)); 3600 var itemColNum = index % (cols * 2 - 1); 3601 if (lastRowNum != itemRowNum) { 3602 if (curColPos + colPosDir > maxColPos) { 3603 colPosDir = -1; 3604 } else if (curColPos + colPosDir < 0) { 3605 colPosDir = 1; 3606 } 3607 curColPos += colPosDir; 3608 } 3609 if (curColPos == itemColNum) { 3610 $(this).addClass('ingallery-cell-big'); 3611 } else { 3612 $(this).removeClass('ingallery-cell-big'); 3613 } 3614 lastRowNum = itemRowNum; 3615 }); 3616 this.fitLayout(); 3617 }, 3618 3619 activateMasonry: function () { 3620 this.masonry = this.jqNode.find('.ingallery-items').masonry({ 3621 'itemSelector': '.ingallery-cell', 3622 'percentPosition': true, 3623 'columnWidth': '.grid-sizer', 3624 'masonry': { 3625 'columnWidth': '.grid-sizer' 3626 } 3627 }); 3628 }, 3629 3630 bindItemLinks: function () { 3631 var gallery = this; 3632 this.jqNode.find('a.ingallery-item-link-popup').off('click').on('click', function (e) { 3633 e.preventDefault(); 3634 var $this = $(this); 3635 var itemData = $this.attr('data-item'); 3636 if (!itemData) { 3637 return false; 3638 } 3639 var _item = JSON.parse(itemData); 3640 _item.jqItem = $this; 3641 gallery.showInPopup(_item); 3642 return false; 3643 }); 3644 }, 3645 3646 } 3647 3648 function getMessageHTML(msg, type) { 3649 var html = '<div class="ingallery-message ing-' + type + '">'; 3650 html += '<div class="ingallery-message-title">' + window.inGallery.getLangString('error_title') + '</div>'; 3651 html += '<div class="ingallery-message-text">' + msg + '</div>'; 3652 html += '</div>'; 3653 return html; 3654 } 3655 3656 function setFitPopup() { 3657 if (fitPopupTimeout > 0) { 3658 window.clearTimeout(fitPopupTimeout); 3659 fitPopupTimeout = 0; 3660 } 3661 fitPopupTimeout = window.setTimeout(fitPopup, 100); 3662 } 3663 3664 function fitPopup() { 3665 if (fitPopupTimeout > 0) { 3666 window.clearTimeout(fitPopupTimeout); 3667 fitPopupTimeout = 0; 3668 } 3669 if (!popupShown) { 3670 return; 3671 } 3672 var popupImgWrap = $('#ingallery-popup-wrap-img'); 3673 var popupWrap = $('#ingallery-popup-wrap'); 3674 var winH = $(window).height(); 3675 var winW = $(window).width(); 3676 var ratio = popupImgWrap.attr('data-ratio'); 3677 if (popupImgWrap.length == 0 || popupWrap.length == 0) { 3678 return false; 3679 } 3680 if (winW < 750) { 3681 winW = $('#ingallery-popup').width(); 3682 popup.addClass('ing-smallest'); 3683 popupWrap.height(winW / ratio); 3684 return false; 3685 } else { 3686 popup.removeClass('ing-smallest'); 3687 } 3688 var maxH = winH - 100; 3689 var minH = 550; 3690 var maxw = winW - 330 - 100; 3691 if (popupImgWrap.attr('data-img-size') == 'try_to_fit') { 3692 maxH = Math.min(maxH, popupImgWrap.attr('data-height')); 3693 maxw = Math.min(maxw, popupImgWrap.attr('data-width')); 3694 } 3695 var width = 750; 3696 var height = width / ratio; 3697 if (height > maxH) { 3698 height = maxH; 3699 width = height * ratio; 3700 } 3701 if (height < minH) { 3702 height = minH; 3703 width = height * ratio; 3704 } 3705 if (width > maxw) { 3706 width = maxw; 3707 height = width / ratio; 3708 } 3709 var top = Math.max((winH - height) / 2, 50); 3710 popup.css('top', top); 3711 popupWrap.height(height); 3712 popupImgWrap.width(width); 3713 3714 } 3715 3716 $(document).ready(function (e) { 3717 $('.ingallery-container').each(function () { 3718 var self = $(this); 3719 self.html(loaderHTML); 3720 var $aj = { 3721 url: window.inGallery.getParam('ajax_url'), 3722 type: 'get', 3723 dataType: 'json', 3724 cache: true, 3725 data: 'task=gallery.view&id=' + self.attr('data-id'), 3726 success: function (response, statusText, xhr, $form) { 3727 if (!response) { 3728 self.html(getMessageHTML(window.inGallery.getLangString('system_error'), 'error')); 3729 return false; 3730 } 3731 if (response && response.status && response.status == 'success') { 3732 var node = $(response.html); 3733 self.replaceWith(node); 3734 new InGallery(node.get(0)); 3735 } else if (response && response.status && response.status == 'error') { 3736 self.html(getMessageHTML(response.message, 'error')); 3737 } else { 3738 self.html(getMessageHTML(window.inGallery.getLangString('system_error'), 'error')); 3739 } 3740 }, 3741 error: function (jqXHR, textStatus, errorThrown) { 3742 self.html(getMessageHTML(window.inGallery.getLangString('system_error') + '<br><i>' + textStatus + ' (' + errorThrown + ')</i>', 'error')); 3743 }, 3744 } 3745 $.ajax($aj); 3746 }); 3747 });
3748 3749 function precisionRound(number, precision) { 3750 var factor = Math.pow(10, precision); 3751 return Math.round(number * factor) / factor; 3752 } 3753 3754 $(window).on('resize', function () { 3755 setFitPopup(); 3756 }); 3757 3758 window.inGallery = { 3759 config: null, 3760 reInit: function () { 3761 $('.ingallery').each(function () { 3762 new InGallery(this); 3763 }); 3764 }, 3765 addRequestData: function (gallery) { 3766 return ''; 3767 }, 3768 getParams: function () { 3769 if (this.config !== null) { 3770 return this.config; 3771 } else if ($('#ingallery-cfg').length) { 3772 this.config = JSON.parse($('#ingallery-cfg').html()); 3773 if (!this.config || !this.config['ajax_url']) { 3774 console.log('No InGallery config'); 3775 } 3776 return this.config; 3777 } else { 3778 console.log('No InGallery config'); 3779 } 3780 }, 3781 getLangString: function (key) { 3782 var params = this.getParams(); 3783 return params.lang[key]; 3784 }, 3785 getParam: function (paramName) { 3786 var params = this.getParams(); 3787 return params[paramName]; 3788 }, 3789 } 3790 3791})(jQuery);
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.