1/** 2* @package Gridbox 3* @author Balbooa http://www.balbooa.com/ 4* @copyright Copyright @ Balbooa 5* @license http://www.gnu.org/licenses/gpl.html GNU/GPL 6*/ 7 8!function ($) { 9 10 var gridboxCarousel = function (element, options) { 11 this.parent = $(element); 12 this.modal = null; 13 this.modalImage = null; 14 this.options = options; 15 this.options.count *= 1; 16 if (this.parent.hasClass('slideshow-type')) { 17 this.options.count = 1; 18 } 19 this.currentIndex = 0; 20 this.content = this.parent.find('.slideshow-content'); 21 this.childrens = this.content.find('li.item:not(.ba-unpublished-html-item)'); 22 this.firstOrder = this.childrens.first(); 23 this.flag = true; 24 this.allowSlide = true; 25 this.outAnimation = {} 26 this.parent.find('[data-slide]').attr('tabindex', '0'); 27 this.content.before(this.parent.find('.ba-slideset-nav')); 28 this.isEdge = /Edge/.test(navigator.userAgent) || /Trident.*rv\:11\./.test(navigator.userAgent); 29 } 30 31 gridboxCarousel.prototype = { 32 setArrows: function(){ 33 let length = this.childrens.length, 34 count = this.options.count, 35 nav = this.parent.find('.ba-slideset-nav'), 36 navs = nav.find('a'); 37 if (count >= length && navs.length != 0) { 38 navs.remove(); 39 } else if (count < length && navs.length == 0) { 40 let str = '<a class="ba-btn-transition slideset-btn-prev ba-icons ba-icon-chevron-left"'+ 41 ' data-slide="prev"></a><a class="ba-btn-transition slideset-btn-next ba-icons'+ 42 ' ba-icon-chevron-right" data-slide="next"></a>'; 43 nav.append(str) 44 } 45 }, 46 init: function(){ 47 var $this = this, 48 count = this.options.count, 49 margin = this.options.gutter ? 30 : 0; 50 this.parent.find('.ba-slideset-dots').remove(); 51 if (themeData.page.view != 'gridbox') { 52 this.setArrows(); 53 } 54 if (this.options.pause) { 55 this.parent.on('mouseenter.slideset', $.proxy(this.pause, this)).on('mouseleave.slideset', $.proxy(this.cycle, this)); 56 } 57 this.childrens.css({ 58 transition: '', 59 visibility: '', 60 left: '' 61 }); 62 this.parent[0].style.setProperty('--carousel-caption-height', ''); 63 this.parent.find('li.active').removeClass('active').removeAttr('tabindex'); 64 for (var i = 0; i < count; i++) { 65 $(this.childrens[i]).addClass('active') 66 .attr('data-position', i).each(function (){ 67 if ($this.content.hasClass('lightbox-enabled')) { 68 this.querySelector('.ba-slideshow-img').setAttribute('tabindex', 0); 69 } 70 }); 71 } 72 this.content.css('left', ''); 73 this.content.removeClass('move-started'); 74 this.childrens.css('order', ''); 75 this.clearAnimation(); 76 this.setLeft(); 77 this.cycle(); 78 this.parent.addClass('slideset-loaded'); 79 this.setHeight(); 80 this.parent[this.childrens.length > count ? 'addClass' : 'removeClass']('enabled-carousel-sliding'); 81 if (this.childrens.length > count && !this.parent.hasClass('slideshow-type')) { 82 this.content.on('mousedown.carousel touchstart.carousel', function(event){ 83 var width = $(window).width(), 84 pwidth = $this.content.width(), 85 move = { 86 x: 0, 87 y: 0 88 }, 89 swipe = event.type == 'mousedown' ? event : event.originalEvent.targetTouches[0], 90 start = { 91 x: swipe.clientX, 92 y: swipe.clientY 93 }, 94 type = event.type == 'mousedown' ? 'mouse' : 'touch', 95 left; 96 97 $this.childrens.css({ 98 transition: 'none' 99 }); 100 $this.pause(); 101 $(document).on('mousemove.carousel touchmove.carousel', function(event){ 102 swipe = event.type == 'mousemove' ? event : event.originalEvent.targetTouches[0]; 103 var delta = start.x - swipe.clientX, 104 calc; 105 move.x = start.x - swipe.clientX; 106 move.y = start.y - swipe.clientY; 107 if (move.x != 0 && Math.abs(move.x) > Math.abs(move.y)) { 108 $this.content.addClass('move-started'); 109 var ind = 0; 110 $this.content.find('li.active').each(function(){ 111 ind = this.dataset.position * 1; 112 calc = '(((100% - '+(margin * (count - 1))+'px) / -'+count+') - '+margin+'px) * '+(delta / width)+ 113 ' + ((100% - '+(margin * (count - 1))+'px) / '+count+')*'+ind+' + '+margin+'px*'+ind; 114 left = 'calc('+calc+')'; 115 if ($this.isEdge) { 116 left = ((((pwidth - (margin * (count - 1))) / -count) - margin) * (delta / width) + 117 ((pwidth - (margin * (count - 1))) / count) * ind + margin * ind)+'px'; 118 } 119 this.style.left = left; 120 }); 121 var actionNext = start.x > swipe.clientX; 122 pos = 0; 123 if (actionNext) { 124 pos = $this.currentIndex == $this.childrens.length - 1 ? 0 : $this.currentIndex + 1; 125 } else { 126 pos = $this.currentIndex == 0 ? $this.childrens.length - 1 : $this.currentIndex - 1; 127 } 128 if ($this.childrens.length - pos < count) { 129 for (var i = pos; i < $this.childrens.length; i++) { 130 if (!$this.childrens[i].classList.contains('active')) { 131 $this.setMoveStartPosition(actionNext, delta, width, pwidth, $this.childrens[i]); 132 } 133 } 134 for (var i = 0; i < count - ($this.childrens.length - pos); i++) { 135 if (!$this.childrens[i].classList.contains('active')) { 136 $this.setMoveStartPosition(actionNext, delta, width, pwidth, $this.childrens[i]); 137 } 138 } 139 } else { 140 for (var i = pos; i < pos + count; i++) { 141 if (!$this.childrens[i].classList.contains('active')) { 142 $this.setMoveStartPosition(actionNext, delta, width, pwidth, $this.childrens[i]); 143 } 144 } 145 } 146 } 147 if (event.type == 'mousemove') { 148 return false; 149 } 150 }).on('mouseup.carousel touchend.carousel', function(event){ 151 $(document).off('mousemove.carousel mouseup.carousel touchmove.carousel touchend.carousel'); 152 $this.cycle(); 153 if (move.x != 0 && Math.abs(move.x) > Math.abs(move.y)) { 154 $this.content.removeClass('move-started'); 155 $this.childrens.css({ 156 'visibility': '', 157 'transition': '' 158 }); 159 if (swipe.clientX > start.x) { 160 $this.slideAction('prev'); 161 } else if (swipe.clientX < start.x) { 162 $this.slideAction('next'); 163 } 164 } 165 }); 166 }); 167 } else if (this.parent.hasClass('slideshow-type')) { 168 this.firstOrder.addClass('active').each(function (){ 169 if ($this.content.hasClass('lightbox-enabled')) { 170 this.querySelector('.ba-slideshow-img').setAttribute('tabindex', 0); 171 } 172 }); 173 this.parent.removeClass('first-load-slideshow'); 174 } 175 this.childrens.find('.ba-slideshow-img').on('mousedown.carousel', function(event){ 176 if ($this.content.hasClass('lightbox-enabled')) { 177 $g('body').trigger(event); 178 event.stopPropagation(); 179 } 180 }).on('click.carousel keyup', function(event){ 181 app.AccessibilityHelper.processAction(event, () => { 182 if ($this.content.hasClass('lightbox-enabled')) { 183 $this.modalImage = this; 184 const bgImage = $this.getImageURI(); 185 if (bgImage) { 186 $this.pause(); 187 $this.openModal(bgImage, this); 188 } 189 } 190 }); 191 });
192 this.parent.find('[data-slide]').on('click.slideset keyup', function(event){ 193 app.AccessibilityHelper.processAction(event, () => { 194 event.preventDefault(); 195 $this.slideAction(this.dataset.slide); 196 }) 197 }); 198 }, 199 setMoveStartPosition:function(actionNext, delta, width, pwidth, child){ 200 var calc, left, 201 count = this.options.count, 202 margin = this.options.gutter ? 30 : 0; 203 if (actionNext) { 204 calc = '(((100% - '+(margin * (count - 1))+'px) / -'+count+') - '+margin+'px) * '+(delta / width)+ 205 ' + ((100% - '+(margin * (count - 1))+'px) / '+count+')*'+count+' + '+margin+'px*'+count; 206 left = 'calc('+calc+')'; 207 if (this.isEdge) { 208 left = ((((pwidth - (margin * (count - 1))) / -count) - margin) * (delta / width) + 209 ((pwidth - (margin * (count - 1))) / count) * count + margin * count)+'px'; 210 } 211 } else { 212 calc = '((((100% - '+(margin * (count - 1))+'px)/-'+count+') - '+margin+ 213 'px) * (1 + '+(delta / width)+'))'; 214 left = 'calc('+calc+')'; 215 if (this.isEdge) { 216 left = ((((pwidth - (margin * (count - 1))) / -count) - margin) * (1 + delta / width))+'px'; 217 } 218 } 219 child.style.left = left; 220 child.style.visibility = 'visible' 221 }, 222 getImageURI: function(){ 223 var styles = getComputedStyle(this.modalImage), 224 match = styles.backgroundImage.match(/url\(([^\)]*)\)/), 225 bgImage = null; 226 if (match) { 227 bgImage = match[1]; 228 if (bgImage.indexOf('h') !== 0) { 229 bgImage = bgImage.substring(1, bgImage.length - 1) 230 } 231 } 232 233 return bgImage; 234 }, 235 setSimpleImage: function(image) { 236 var modal = this.modal, 237 imgHeight = image.naturalHeight, 238 imgWidth = image.naturalWidth, 239 comp = getComputedStyle(document.body), 240 wWidth = document.body.clientWidth, 241 wHeigth = window.innerHeight, 242 percent = imgWidth / imgHeight; 243 if (wWidth > 1024) { 244 if (imgWidth < wWidth && imgHeight < wHeigth) { 245 246 } else { 247 if (imgWidth > imgHeight) { 248 imgWidth = wWidth - 100; 249 imgHeight = imgWidth / percent; 250 } else { 251 imgHeight = wHeigth - 100; 252 imgWidth = percent * imgHeight; 253 } 254 if (imgHeight > wHeigth) { 255 imgHeight = wHeigth - 100; 256 imgWidth = percent * imgHeight; 257 } 258 if (imgWidth > wWidth) { 259 imgWidth = wWidth - 100; 260 imgHeight = imgWidth / percent; 261 } 262 } 263 } else { 264 percent = imgWidth / imgHeight; 265 if (percent >= 1) { 266 imgWidth = wWidth * 0.90; 267 imgHeight = imgWidth / percent; 268 if (wHeigth - imgHeight < wHeigth * 0.1) { 269 imgHeight = wHeigth * 0.90; 270 imgWidth = imgHeight * percent; 271 } 272 } else { 273 imgHeight = wHeigth * 0.90; 274 imgWidth = imgHeight * percent; 275 if (wWidth - imgWidth < wWidth * 0.1) { 276 imgWidth = wWidth * 0.90; 277 imgHeight = imgWidth / percent; 278 } 279 } 280 } 281 var modalTop = (wHeigth - imgHeight) / 2, 282 left = (wWidth - imgWidth) / 2+ comp.borderLeftWidth.replace('px', '') * 1; 283 setTimeout(function(){ 284 modal.find('> div').css({ 285 'background-image': 'url('+image.src+')', 286 'width' : Math.round(imgWidth), 287 'height' : Math.round(imgHeight), 288 'left' : Math.round(left),
289 'top' : Math.round(modalTop) 290 }).addClass('gridbox-gallery-fade-animation'); 291 }, 1); 292 }, 293 simpleGetPrev: function(){ 294 var el = $(this.modalImage).closest('li.item'), 295 $this = this; 296 if (el.prev().length > 0) { 297 el = el.prev(); 298 } else { 299 el = this.childrens.last(); 300 } 301 this.modalImage = el.find('.ba-slideshow-img')[0]; 302 var bgImage = this.getImageURI(); 303 if (bgImage) { 304 var image = document.createElement('img'); 305 image.onload = function(){ 306 $this.setSimpleImage(this); 307 } 308 image.src = bgImage; 309 } 310 }, 311 simpleGetNext: function(img, images, index){ 312 var el = $(this.modalImage).closest('li.item'), 313 $this = this; 314 if (el.next().length > 0) { 315 el = el.next(); 316 } else { 317 el = this.childrens.first(); 318 } 319 this.modalImage = el.find('.ba-slideshow-img')[0]; 320 var bgImage = this.getImageURI(); 321 if (bgImage) { 322 var image = document.createElement('img'); 323 image.onload = function(){ 324 $this.setSimpleImage(this); 325 } 326 image.src = bgImage; 327 } 328 }, 329 simpleModalClose: function(modal, images, index){ 330 var $this = this; 331 this.modal.addClass('image-lightbox-out'); 332 $g(window).off('keyup.slideshow'); 333 setTimeout(function(){ 334 app.AccessibilityHelper.releaseTrap($this.modal[0]); 335 $this.modal.remove(); 336 $this.cycle(); 337 }, 500); 338 }, 339 openModal: function(src, original){ 340 var image = document.createElement('img'), 341 $this = this, 342 div = document.createElement('div'), 343 origImage = $(original), 344 key = origImage.closest('.ba-item').attr('id'), 345 width = origImage.width(), 346 height = origImage.height(), 347 offset = origImage.offset(), 348 imgHeight = this.naturalHeight, 349 imgWidth = this.naturalWidth, 350 wWidth = $g(window).width(), 351 wHeigth = $g(window).height(), 352 percent = imgWidth / imgHeight, 353 img = document.createElement('div'); 354 $this.modal = $g(div); 355 img.style.top = (offset.top - $g(window).scrollTop())+'px'; 356 img.style.left = offset.left+'px'; 357 img.style.width = width+'px'; 358 img.style.height = height+'px'; 359 div.className = 'ba-image-modal gridbox-gallery-modal carousel-modal'; 360 div.style.backgroundColor = app.getCorrectColor(app.items[key].lightbox.color); 361 div.appendChild(img); 362 $this.modal.on('click', function(){ 363 $this.simpleModalClose(); 364 }); 365 $g('body').append(div); 366 image.onload = function(){ 367 $this.setSimpleImage(this); 368 setTimeout(function(){ 369 var str = '<i class="ba-icons ba-icon-chevron-left" tabindex="0"></i><i class="ba-icons ba-icon-chevron-right" tabindex="0"></i>'; 370 str += '<i class="ba-icons ba-icon-close" tabindex="0">'; 371 $this.modal.append(str); 372 app.AccessibilityHelper.trapFocus($this.modal[0], 350); 373 $this.modal.find('.ba-icon-chevron-left').on('click keyup', function(event){ 374 app.AccessibilityHelper.processAction(event, () => { 375 event.stopPropagation(); 376 $this.simpleGetPrev(); 377 }) 378 }); 379 $this.modal.find('.ba-icon-chevron-right').on('click keyup', function(event){ 380 app.AccessibilityHelper.processAction(event, () => { 381 event.stopPropagation(); 382 $this.simpleGetNext(); 383 }) 384 }); 385 $this.modal.find('.ba-icon-close').on('click keyup', function(event){ 386 app.AccessibilityHelper.processAction(event, () => { 387 event.stopPropagation(); 388 $this.simpleModalClose(); 389 }) 390 }); 391 $g(window).on('keyup.slideshow', function(event) { 392 event.preventDefault(); 393 event.stopPropagation(); 394 if (event.keyCode === 37) { 395 $this.simpleGetPrev(); 396 } else if (event.keyCode === 39) { 397 $this.simpleGetNext(); 398 } else if (event.keyCode === 27) { 399 $this.simpleModalClose(); 400 } 401 }); 402 }, 600); 403 } 404 image.src = src; 405 }, 406 cycle: function(){ 407 if (this.options.autoplay == 1) { 408 this.flag = true; 409 if (this.interval) { 410 clearInterval(this.interval); 411 }
412 let $this = this; 413 this.interval = setInterval(function(){ 414 $this.slideAction('next'); 415 }, this.options.delay); 416 417 return this; 418 } 419 }, 420 pause: function(){ 421 if (this.interval) { 422 clearInterval(this.interval); 423 } 424 this.interval = null; 425 this.flag = false; 426 }, 427 delete: function(){ 428 clearInterval(this.interval); 429 this.interval = null; 430 this.parent.off('mouseenter.slideset mouseleave.slideset'); 431 this.parent.find('[data-slide]').off('click.slideset'); 432 this.parent.find('.ba-next, .ba-prev, .ba-left, .ba-right').removeClass('ba-next ba-prev ba-left ba-right'); 433 this.content.off('mousedown.carousel touchstart.carousel'); 434 this.childrens.find('.ba-slideshow-img').off('mousedown.carousel click.carousel'); 435 }, 436 setOutAnimation: function(action){ 437 var count = this.options.count, 438 margin = this.options.gutter ? 30 : 0, 439 width = this.content.width(), 440 $this = this, 441 outItem = null, 442 parentRect = this.content[0].getBoundingClientRect(), 443 left = ''; 444 this.lastActive.each(function(i){ 445 if (!this.classList.contains('active')) { 446 outItem = this; 447 if (action == 'next') { 448 left = 'calc(((100% - '+(margin * (count - 1))+'px)/-'+count+') - '+margin+'px)'; 449 if ($this.isEdge) { 450 left = (((width - (margin * (count - 1))) / -count) - margin)+'px'; 451 } 452 } else { 453 left = 'calc(100% + '+margin+'px)'; 454 if ($this.isEdge) { 455 left = (width + margin)+'px'; 456 } 457 } 458 this.style.left = left; 459 this.classList.add('slideset-out-animation'); 460 } 461 }); 462 for (var ind in this.outAnimation) { 463 if (this.outAnimation[ind].classList.contains('active')) { 464 continue; 465 } 466 if (action == 'next') { 467 left = 'calc((((100% - '+(margin * (count - 1))+'px)/-'+count+') - '+margin+'px) * 2)'; 468 if ($this.isEdge) { 469 left = ((((width - (margin * (count - 1))) / -count) - margin) * 2)+'px'; 470 } 471 } else { 472 left = 'calc(100% + '+margin+'px + (((100% - '+(margin * (count - 1))+'px)/'+count+') + '+margin+'px))'; 473 if ($this.isEdge) { 474 left = (width + margin + (((width - (margin * (count - 1))) / count) + margin))+'px'; 475 } 476 } 477 this.outAnimation[ind].style.left = left; 478 } 479 this.outAnimation[+new Date()] = outItem; 480 }, 481 setStartPosition:function(child, action, nextPosition, prevPosition){ 482 if (child.classList.contains('slideset-out-animation')) { 483 child.style.transition = 'none'; 484 child.style.left = ''; 485 child.style.visibility = ''; 486 child.classList.remove('slideset-out-animation'); 487 } 488 if (!child.style.left) { 489 var count = this.options.count, 490 width = this.content.width(), 491 margin = this.options.gutter ? 30 : 0; 492 if (action == 'next') { 493 left = (nextPosition + (((width - (margin * (count - 1))) / count) + margin))+'px'; 494 } else { 495 left = (prevPosition - (((width - (margin * (count - 1))) / count) + margin))+'px'; 496 } 497 child.style.left = left; 498 } 499 }, 500 slide: function(action){ 501 var $this = this; 502 if (this.childrens.length > this.options.count && !this.parent.hasClass('slideshow-type')) { 503 if (this.interval) { 504 clearInterval(this.interval); 505 } 506 this.childrens.css({ 507 transition: '' 508 }); 509 if (action == 'next') { 510 this.currentIndex = this.currentIndex == this.childrens.length - 1 ? 0 : ++this.currentIndex; 511 } else { 512 this.currentIndex = this.currentIndex == 0 ? this.childrens.length - 1 : --this.currentIndex; 513 } 514 this.lastActive = this.parent.find('li.active') 515 .css('visibility', 'visible').removeClass('active') 516 .removeAttr('tabindex'); 517 var ind = 0, 518 count = this.options.count, 519 margin = this.options.gutter ? 30 : 0, 520 nextRect, prevRect, 521 nextPosition = prevPosition = 0, 522 parentRect = this.content[0].getBoundingClientRect(); 523 this.lastActive.each(function(){ 524 if (this.dataset.position == count - 1) { 525 nextRect = this.getBoundingClientRect(); 526 } 527 if (this.dataset.position == 0) { 528 prevRect = this.getBoundingClientRect(); 529 } 530 }); 531 nextPosition = nextRect.left - parentRect.left; 532 prevPosition = prevRect.left - parentRect.left; 533 if (this.childrens.length - this.currentIndex < this.options.count) { 534 for (var i = this.currentIndex; i < this.childrens.length; i++) { 535 this.setStartPosition(this.childrens[i], action, nextPosition, prevPosition); 536 $(this.childrens[i]).addClass('active').attr('data-position', ind++).each(function (){ 537 if ($this.content.hasClass('lightbox-enabled')) { 538 this.querySelector('.ba-slideshow-img').setAttribute('tabindex', 0); 539 } 540 }); 541 } 542 for (var i = 0; i < this.options.count - (this.childrens.length - this.currentIndex); i++) { 543 this.setStartPosition(this.childrens[i], action, nextPosition, prevPosition); 544 $(this.childrens[i]).addClass('active').attr('data-position', ind++).each(function (){ 545 if ($this.content.hasClass('lightbox-enabled')) { 546 this.querySelector('.ba-slideshow-img').setAttribute('tabindex', 0); 547 } 548 }); 549 } 550 } else { 551 for (var i = this.currentIndex; i < this.currentIndex + this.options.count; i++) { 552 this.setStartPosition(this.childrens[i], action, nextPosition, prevPosition); 553 $(this.childrens[i]).addClass('active').attr('data-position', ind++).each(function (){ 554 if ($this.content.hasClass('lightbox-enabled')) { 555 this.querySelector('.ba-slideshow-img').setAttribute('tabindex', 0); 556 } 557 }); 558 } 559 } 560 setTimeout(function(){ 561 $this.setLeft(); 562 $this.setOutAnimation(action); 563 setTimeout(function(){ 564 $this.clearAnimation(); 565 }, 850); 566 clearTimeout($this.slideDelay); 567 $this.slideDelay = setTimeout(function(){ 568 $this.allowSlide = true; 569 }, 250); 570 }, 1); 571 if (this.flag) { 572 this.cycle(); 573 } 574 } else if (this.parent.hasClass('slideshow-type')) { 575 var active = this.parent.find('.item.active'), 576 el = this[action](this.firstOrder), 577 fallback = action == 'next' ? 'first' : 'last'; 578 this.parent.find('.select-animation').removeClass('select-animation'); 579 if (el.hasClass('active')) { 580 return; 581 } 582 this.parent.find('.ba-next, .ba-prev, .ba-left, .ba-right').removeClass('ba-next ba-prev ba-left ba-right'); 583 if (fallback == 'first') { 584 active.addClass('ba-next').addClass('burns-out'); 585 el.addClass('ba-right'); 586 } else { 587 active.addClass('ba-prev').addClass('burns-out'); 588 el.addClass('ba-left'); 589 } 590 setTimeout(function(){ 591 active.removeClass('burns-out'); 592 }, 600); 593 active.removeClass('active').removeAttr('tabindex'); 594 this.firstOrder = el.addClass('active').each(function (){ 595 if ($this.content.hasClass('lightbox-enabled')) { 596 this.querySelector('.ba-slideshow-img').setAttribute('tabindex', 0); 597 } 598 }); 599 this.allowSlide = true; 600 } 601 }, 602 next: function(el){ 603 if (el.next().length > 0) { 604 return el.next(); 605 } else { 606 return this.childrens.first(); 607 } 608 }, 609 prev: function(el){ 610 if (el.prev().length > 0) { 611 return el.prev(); 612 } else { 613 return this.childrens.last(); 614 } 615 }, 616 clearAnimation: function(){ 617 let date = +new Date(), 618 ind = null; 619 for (ind in this.outAnimation) { 620 if (date - ind >= 850) { 621 if (this.outAnimation[ind].classList.contains('slideset-out-animation')) { 622 this.outAnimation[ind].style.left = ''; 623 this.outAnimation[ind].style.visibility = ''; 624 this.outAnimation[ind].classList.remove('slideset-out-animation'); 625 } 626 delete(this.outAnimation[ind]); 627 } 628 } 629 if (!ind) { 630 this.parent.find('.slideset-out-animation').css({ 631 'left': '', 632 'visibility': '' 633 }).removeClass('slideset-out-animation'); 634 } 635 }, 636 setHeight: function(){ 637 if (this.parent.hasClass('slideshow-type')) { 638 this.content.css({ 639 'height': '' 640 }); 641 } else { 642 var height = 0, 643 caption = 0; 644 this.parent.find('li.item').each(function(){ 645 if (this.offsetHeight > height) { 646 height = this.offsetHeight; 647 } 648 }); 649 this.parent.find('.ba-slideshow-caption').each(function(){ 650 if (this.offsetHeight > caption) { 651 caption = this.offsetHeight; 652 } 653 }); 654 this.parent[0].style.setProperty('--carousel-caption-height', caption+'px'); 655 this.content.height(height); 656 } 657 }, 658 setLeft: function(){ 659 var count = this.options.count, 660 margin = this.options.gutter ? 30 : 0, 661 width = this.content.width(), 662 $this = this, 663 left; 664 this.content.find('li.active').each(function(){ 665 ind = this.dataset.position * 1; 666 left = 'calc(((100% - '+(margin * (count - 1))+'px)/'+count+')*'+ind+' + '+margin+'px*'+ind+')'; 667 if ($this.isEdge) { 668 left = (((width - (margin * (count - 1))) / count) * ind + margin * ind)+'px'; 669 } 670 this.style.left = left; 671 this.style.transition = ''; 672 }); 673 }, 674 slideAction: function(action){ 675 if (this.allowSlide) { 676 this.allowSlide = false; 677 this.slide(action); 678 } 679 } 680 } 681 682 $.fn.gridboxCarousel = function(option){ 683 return this.each(function(){ 684 var $this = $(this), 685 data = $this.data('gridboxCarousel'), 686 options = $.extend({}, $.fn.gridboxCarousel.defaults, typeof option == 'object' && option); 687 if (data) { 688 data.delete(); 689 $this.removeData(); 690 } 691 $this.data('gridboxCarousel', (data = new gridboxCarousel(this, options))); 692 data.init(); 693 }); 694 } 695 696 $.fn.gridboxCarousel.defaults = { 697 delay: 3000, 698 autoplay: true, 699 pause: false,
700 mode: 'set', 701 gutter: true, 702 count: 3 703 } 704}(window.$g ? window.$g : window.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.