1/* 2 * jQuery OwlCarousel v1.3.3 3 * 4 * Copyright (c) 2013 Bartosz Wojciechowski 5 * http://www.owlgraphic.com/owlcarousel/ 6 * 7 * Licensed under MIT 8 * 9 */ 10 11/*JS Lint helpers: */ 12/*global dragMove: false, dragEnd: false, $, jQuery, alert, window, document */ 13/*jslint nomen: true, continue:true */ 14 15 16 17/* 18 MODIFIED! 19*/ 20 21 22if (typeof Object.create !== "function") { 23 Object.create = function (obj) { 24 function F() {} 25 F.prototype = obj; 26 return new F(); 27 }; 28} 29(function ($, window, document) { 30 31 var Carousel = { 32 init : function (options, el) { 33 var base = this; 34 35 base.$elem = $(el); 36 base.options = $.extend({}, $.fn.owlCarousel.options, base.$elem.data(), options); 37 38 base.userOptions = options; 39 base.loadContent(); 40 }, 41 42 loadContent : function () { 43 var base = this, url; 44 45 function getData(data) { 46 var i, content = ""; 47 if (typeof base.options.jsonSuccess === "function") { 48 base.options.jsonSuccess.apply(this, [data]); 49 } else { 50 for (i in data.owl) { 51 if (data.owl.hasOwnProperty(i)) { 52 content += data.owl[i].item; 53 } 54 } 55 base.$elem.html(content); 56 } 57 base.logIn(); 58 } 59 60 if (typeof base.options.beforeInit === "function") { 61 base.options.beforeInit.apply(this, [base.$elem]); 62 } 63 64 if (typeof base.options.jsonPath === "string") { 65 url = base.options.jsonPath; 66 $.getJSON(url, getData); 67 } else { 68 base.logIn(); 69 } 70 }, 71 72 logIn : function () { 73 var base = this; 74 75 base.$elem.data({ 76 "owl-originalStyles": base.$elem.attr("style"), 77 "owl-originalClasses": base.$elem.attr("class") 78 }); 79 80 base.$elem.css({opacity: 0}); 81 base.orignalItems = base.options.items; 82 base.checkBrowser(); 83 base.wrapperWidth = 0; 84 base.checkVisible = null; 85 base.setVars(); 86 }, 87 88 setVars : function () { 89 var base = this; 90 if (base.$elem.children().length === 0) {return false; } 91 base.baseClass(); 92 base.eventTypes(); 93 base.$userItems = base.$elem.children(); 94 base.itemsAmount = base.$userItems.length; 95 base.wrapItems(); 96 base.$owlItems = base.$elem.find(".owl-item"); 97 base.$owlWrapper = base.$elem.find(".owl-wrapper"); 98 base.playDirection = "next"; 99 base.prevItem = 0; 100 base.prevArr = [0]; 101 base.currentItem = 0; 102 base.customEvents(); 103 base.onStartup(); 104 }, 105 106 onStartup : function () { 107 var base = this; 108 base.updateItems(); 109 base.calculateAll(); 110 base.buildControls(); 111 base.updateControls(); 112 base.response(); 113 base.moveEvents(); 114 base.stopOnHover(); 115 base.owlStatus(); 116 117 if (base.options.transitionStyle !== false) { 118 base.transitionTypes(base.options.transitionStyle); 119 } 120 if (base.options.autoPlay === true) { 121 base.options.autoPlay = 5000; 122 } 123 base.play(); 124 125 base.$elem.find(".owl-wrapper").css("display", "block"); 126 127 if (!base.$elem.is(":visible")) { 128 base.watchVisibility(); 129 } else { 130 base.$elem.css("opacity", 1); 131 } 132 base.onstartup = false; 133 base.eachMoveUpdate(); 134 if (typeof base.options.afterInit === "function") { 135 base.options.afterInit.apply(this, [base.$elem]); 136 } 137 }, 138 139 eachMoveUpdate : function () { 140 var base = this; 141 142 if (base.options.lazyLoad === true) { 143 base.lazyLoad(); 144 } 145 if (base.options.autoHeight === true) { 146 base.autoHeight(); 147 } 148 base.onVisibleItems(); 149 150 if (typeof base.options.afterAction === "function") { 151 base.options.afterAction.apply(this, [base.$elem]); 152 } 153 }, 154
155 updateVars : function () { 156 var base = this; 157 if (typeof base.options.beforeUpdate === "function") { 158 base.options.beforeUpdate.apply(this, [base.$elem]); 159 } 160 base.watchVisibility(); 161 base.updateItems(); 162 base.calculateAll(); 163 base.updatePosition(); 164 base.updateControls(); 165 base.eachMoveUpdate(); 166 if (typeof base.options.afterUpdate === "function") { 167 base.options.afterUpdate.apply(this, [base.$elem]); 168 } 169 }, 170 171 reload : function () { 172 var base = this; 173 window.setTimeout(function () { 174 base.updateVars(); 175 }, 0); 176 }, 177 178 watchVisibility : function () { 179 var base = this; 180 181 if (base.$elem.is(":visible") === false) { 182 base.$elem.css({opacity: 0}); 183 window.clearInterval(base.autoPlayInterval); 184 window.clearInterval(base.checkVisible); 185 } else { 186 return false; 187 } 188 base.checkVisible = window.setInterval(function () { 189 if (base.$elem.is(":visible")) { 190 base.reload(); 191 base.$elem.animate({opacity: 1}, 200); 192 window.clearInterval(base.checkVisible); 193 } 194 }, 500); 195 }, 196 197 wrapItems : function () { 198 var base = this; 199 base.$userItems.wrapAll("<div class=\"owl-wrapper\">").wrap("<div class=\"owl-item\"></div>"); 200 base.$elem.find(".owl-wrapper").wrap("<div class=\"owl-wrapper-outer\">"); 201 base.wrapperOuter = base.$elem.find(".owl-wrapper-outer"); 202 base.$elem.css("display", "block"); 203 }, 204 205 baseClass : function () { 206 var base = this, 207 hasBaseClass = base.$elem.hasClass(base.options.baseClass), 208 hasThemeClass = base.$elem.hasClass(base.options.theme); 209 210 if (!hasBaseClass) { 211 base.$elem.addClass(base.options.baseClass); 212 } 213 214 if (!hasThemeClass) { 215 base.$elem.addClass(base.options.theme); 216 } 217 }, 218 219 updateItems : function () { 220 var base = this, width, i; 221 222 if (base.options.responsive === false) { 223 return false; 224 } 225 if (base.options.singleItem === true) { 226 base.options.items = base.orignalItems = 1; 227 base.options.itemsCustom = false; 228 base.options.itemsDesktop = false; 229 base.options.itemsDesktopSmall = false; 230 base.options.itemsTablet = false; 231 base.options.itemsTabletSmall = false; 232 base.options.itemsMobile = false; 233 return false; 234 } 235 236 width = $(base.options.responsiveBaseWidth).width(); 237 238 if (width > (base.options.itemsDesktop[0] || base.orignalItems)) { 239 base.options.items = base.orignalItems; 240 } 241 if (base.options.itemsCustom !== false) { 242 //Reorder array by screen size 243 base.options.itemsCustom.sort(function (a, b) {return a[0] - b[0]; }); 244 245 for (i = 0; i < base.options.itemsCustom.length; i += 1) { 246 if (base.options.itemsCustom[i][0] <= width) { 247 base.options.items = base.options.itemsCustom[i][1]; 248 } 249 } 250 251 } else { 252 253 if (width <= base.options.itemsDesktop[0] && base.options.itemsDesktop !== false) { 254 base.options.items = base.options.itemsDesktop[1]; 255 } 256 257 if (width <= base.options.itemsDesktopSmall[0] && base.options.itemsDesktopSmall !== false) { 258 base.options.items = base.options.itemsDesktopSmall[1]; 259 } 260 261 if (width <= base.options.itemsTablet[0] && base.options.itemsTablet !== false) { 262 base.options.items = base.options.itemsTablet[1]; 263 } 264 265 if (width <= base.options.itemsTabletSmall[0] && base.options.itemsTabletSmall !== false) { 266 base.options.items = base.options.itemsTabletSmall[1]; 267 } 268 269 if (width <= base.options.itemsMobile[0] && base.options.itemsMobile !== false) { 270 base.options.items = base.options.itemsMobile[1]; 271 } 272 } 273 274 //if number of items is less than declared 275 if (base.options.items > base.itemsAmount && base.options.itemsScaleUp === true) { 276 base.options.items = base.itemsAmount; 277 } 278 }, 279 280 response : function () { 281 var base = this, 282 smallDelay, 283 lastWindowWidth; 284 285 if (base.options.responsive !== true) { 286 return false;
287 } 288 lastWindowWidth = $(window).width(); 289 290 base.resizer = function () { 291 if ($(window).width() !== lastWindowWidth) { 292 if (base.options.autoPlay !== false) { 293 window.clearInterval(base.autoPlayInterval); 294 } 295 window.clearTimeout(smallDelay); 296 smallDelay = window.setTimeout(function () { 297 lastWindowWidth = $(window).width(); 298 base.updateVars(); 299 }, base.options.responsiveRefreshRate); 300 } 301 }; 302 $(window).resize(base.resizer); 303 }, 304 305 updatePosition : function () { 306 var base = this; 307 base.jumpTo(base.currentItem); 308 if (base.options.autoPlay !== false) { 309 base.checkAp(); 310 } 311 }, 312 313 appendItemsSizes : function () { 314 var base = this, 315 roundPages = 0, 316 lastItem = base.itemsAmount - base.options.items; 317 318 base.$owlItems.each(function (index) { 319 var $this = $(this); 320 var updatedWidth = base.itemWidth - 1; 321 $this 322 .css({"width": updatedWidth}) 323 .data("owl-item", Number(index)); 324 325 if (index % base.options.items === 0 || index === lastItem) { 326 if (!(index > lastItem)) { 327 roundPages += 1; 328 } 329 } 330 $this.data("owl-roundPages", roundPages); 331 }); 332 }, 333 334 appendWrapperSizes : function () { 335 var base = this, 336 width = base.$owlItems.length * base.itemWidth; 337 338 base.$owlWrapper.css({ 339 "width": width * 2, 340 "left": 0 341 }); 342 base.appendItemsSizes(); 343 }, 344 345 calculateAll : function () { 346 var base = this; 347 base.calculateWidth(); 348 base.appendWrapperSizes(); 349 base.loops(); 350 base.max(); 351 }, 352 353 calculateWidth : function () { 354 var base = this; 355 base.itemWidth = Math.round(base.$elem.width() / base.options.items); 356 }, 357 358 max : function () { 359 var base = this, 360 maximum = ((base.itemsAmount * base.itemWidth) - base.options.items * base.itemWidth) * -1; 361 if (base.options.items > base.itemsAmount) { 362 base.maximumItem = 0; 363 maximum = 0; 364 base.maximumPixels = 0; 365 } else { 366 base.maximumItem = base.itemsAmount - base.options.items; 367 base.maximumPixels = maximum; 368 } 369 return maximum; 370 }, 371 372 min : function () { 373 return 0; 374 }, 375 376 loops : function () { 377 var base = this, 378 prev = 0, 379 elWidth = 0, 380 i, 381 item, 382 roundPageNum; 383 384 base.positionsInArray = [0]; 385 base.pagesInArray = []; 386 387 for (i = 0; i < base.itemsAmount; i += 1) { 388 elWidth += base.itemWidth; 389 base.positionsInArray.push(-elWidth); 390 391 if (base.options.scrollPerPage === true) { 392 item = $(base.$owlItems[i]); 393 roundPageNum = item.data("owl-roundPages"); 394 if (roundPageNum !== prev) { 395 base.pagesInArray[prev] = base.positionsInArray[i]; 396 prev = roundPageNum; 397 } 398 } 399 } 400 }, 401 402 buildControls : function () { 403 var base = this; 404 if (base.options.navigation === true || base.options.pagination === true) { 405 base.owlControls = $("<div class=\"owl-controls\"/>").toggleClass("clickable", !base.browser.isTouch).appendTo(base.$elem); 406 } 407 if (base.options.pagination === true) { 408 base.buildPagination(); 409 } 410 if (base.options.navigation === true) { 411 base.buildButtons(); 412 } 413 }, 414 415 buildButtons : function () { 416 var base = this, 417 buttonsWrapper = $("<div class=\"owl-buttons\"/>"); 418 base.owlControls.append(buttonsWrapper); 419 420 base.buttonPrev = $("<div/>", { 421 "class" : "owl-prev", 422 "html" : base.options.navigationText[0] || "" 423 }); 424 425 base.buttonNext = $("<div/>", { 426 "class" : "owl-next", 427 "html" : base.options.navigationText[1] || "" 428 }); 429 430 buttonsWrapper 431 .append(base.buttonPrev) 432 .append(base.buttonNext); 433 434 buttonsWrapper.on("touchstart.owlControls mousedown.owlControls", "div[class^=\"owl\"]", function (event) { 435 event.preventDefault(); 436 }); 437 438 buttonsWrapper.on("touchend.owlControls mouseup.owlControls", "div[class^=\"owl\"]", function (event) { 439 event.preventDefault(); 440 if ($(this).hasClass("owl-next")) { 441 base.next(); 442 } else { 443 base.prev(); 444 } 445 }); 446 }, 447 448 buildPagination : function () { 449 var base = this; 450 451 base.paginationWrapper = $("<div class=\"owl-pagination\"/>"); 452 base.owlControls.append(base.paginationWrapper); 453 454 base.paginationWrapper.on("touchend.owlControls mouseup.owlControls", ".owl-page", function (event) { 455 event.preventDefault(); 456 if (Number($(this).data("owl-page")) !== base.currentItem) { 457 base.goTo(Number($(this).data("owl-page")), true); 458 } 459 }); 460 }, 461 462 updatePagination : function () { 463 var base = this, 464 counter, 465 lastPage, 466 lastItem, 467 i, 468 paginationButton, 469 paginationButtonInner; 470 471 if (base.options.pagination === false) { 472 return false;
473 } 474 475 base.paginationWrapper.html(""); 476 477 counter = 0; 478 lastPage = base.itemsAmount - base.itemsAmount % base.options.items; 479 480 for (i = 0; i < base.itemsAmount; i += 1) { 481 if (i % base.options.items === 0) { 482 counter += 1; 483 if (lastPage === i) { 484 lastItem = base.itemsAmount - base.options.items; 485 } 486 paginationButton = $("<div/>", { 487 "class" : "owl-page" 488 }); 489 paginationButtonInner = $("<span></span>", { 490 "text": base.options.paginationNumbers === true ? counter : "", 491 "class": base.options.paginationNumbers === true ? "owl-numbers" : "" 492 }); 493 paginationButton.append(paginationButtonInner); 494 495 paginationButton.data("owl-page", lastPage === i ? lastItem : i); 496 paginationButton.data("owl-roundPages", counter); 497 498 base.paginationWrapper.append(paginationButton); 499 } 500 } 501 base.checkPagination(); 502 }, 503 checkPagination : function () { 504 var base = this; 505 if (base.options.pagination === false) { 506 return false; 507 } 508 base.paginationWrapper.find(".owl-page").each(function () { 509 if ($(this).data("owl-roundPages") === $(base.$owlItems[base.currentItem]).data("owl-roundPages")) { 510 base.paginationWrapper 511 .find(".owl-page") 512 .removeClass("active"); 513 $(this).addClass("active"); 514 } 515 }); 516 }, 517 518 checkNavigation : function () { 519 var base = this; 520 521 if (base.options.navigation === false) { 522 return false; 523 } 524 if (base.options.rewindNav === false) { 525 if (base.currentItem === 0 && base.maximumItem === 0) { 526 base.buttonPrev.addClass("disabled"); 527 base.buttonNext.addClass("disabled"); 528 } else if (base.currentItem === 0 && base.maximumItem !== 0) { 529 base.buttonPrev.addClass("disabled"); 530 base.buttonNext.removeClass("disabled"); 531 } else if (base.currentItem === base.maximumItem) { 532 base.buttonPrev.removeClass("disabled"); 533 base.buttonNext.addClass("disabled"); 534 } else if (base.currentItem !== 0 && base.currentItem !== base.maximumItem) { 535 base.buttonPrev.removeClass("disabled"); 536 base.buttonNext.removeClass("disabled"); 537 } 538 } 539 }, 540 541 updateControls : function () { 542 var base = this; 543 const $carousel = base.$elem; 544 if ($carousel.find(".owl-item").length < 6) { 545 $carousel.addClass("js-owl-default-generic"); 546 } 547 base.updatePagination(); 548 base.checkNavigation(); 549 if (base.owlControls) { 550 if (base.options.items >= base.itemsAmount) { 551 base.owlControls.hide(); 552 $carousel.find(".owl-wrapper").css("float", "left"); 553 $(".js-owl-lazy-reference .owl-wrapper").css("float", "left"); 554 enquire.register("screen and (min-width:0px )", { 555 match : function() { 556 $carousel 557 .find(".owl-wrapper") 558 .css({ width: "auto", float: "none" }); 559 } 560 }); 561 } else { 562 base.owlControls.show(); 563 } 564 } 565 }, 566 567 destroyControls : function () { 568 var base = this; 569 if (base.owlControls) { 570 base.owlControls.remove(); 571 } 572 }, 573 574 next : function (speed) { 575 var base = this; 576 577 if (base.isTransition) { 578 return false;
579 } 580 581 base.currentItem += base.options.scrollPerPage === true ? base.options.items : 1; 582 if (base.currentItem > base.maximumItem + (base.options.scrollPerPage === true ? (base.options.items - 1) : 0)) { 583 if (base.options.rewindNav === true) { 584 base.currentItem = 0; 585 speed = "rewind"; 586 } else { 587 base.currentItem = base.maximumItem; 588 return false; 589 } 590 } 591 base.goTo(base.currentItem, speed); 592 }, 593 594 prev : function (speed) { 595 var base = this; 596 597 if (base.isTransition) { 598 return false; 599 } 600 601 if (base.options.scrollPerPage === true && base.currentItem > 0 && base.currentItem < base.options.items) { 602 base.currentItem = 0; 603 } else { 604 base.currentItem -= base.options.scrollPerPage === true ? base.options.items : 1; 605 } 606 if (base.currentItem < 0) { 607 if (base.options.rewindNav === true) { 608 base.currentItem = base.maximumItem; 609 speed = "rewind"; 610 } else { 611 base.currentItem = 0; 612 return false; 613 } 614 } 615 base.goTo(base.currentItem, speed); 616 }, 617 618 goTo : function (position, speed, drag) { 619 var base = this, 620 goToPixel; 621 622 if (base.isTransition) { 623 return false; 624 } 625 if (typeof base.options.beforeMove === "function") { 626 base.options.beforeMove.apply(this, [base.$elem]); 627 } 628 if (position >= base.maximumItem) { 629 position = base.maximumItem; 630 } else if (position <= 0) { 631 position = 0; 632 } 633 634 base.currentItem = base.owl.currentItem = position; 635 if (base.options.transitionStyle !== false && drag !== "drag" && base.options.items === 1 && base.browser.support3d === true) { 636 base.swapSpeed(0); 637 if (base.browser.support3d === true) { 638 base.transition3d(base.positionsInArray[position]); 639 } else { 640 base.css2slide(base.positionsInArray[position], 1); 641 } 642 base.afterGo(); 643 base.singleItemTransition(); 644 return false; 645 } 646 goToPixel = base.positionsInArray[position]; 647 648 if (base.browser.support3d === true) { 649 base.isCss3Finish = false; 650 651 if (speed === true) { 652 base.swapSpeed("paginationSpeed"); 653 window.setTimeout(function () { 654 base.isCss3Finish = true; 655 }, base.options.paginationSpeed); 656 657 } else if (speed === "rewind") { 658 base.swapSpeed(base.options.rewindSpeed); 659 window.setTimeout(function () { 660 base.isCss3Finish = true; 661 }, base.options.rewindSpeed); 662 663 } else { 664 base.swapSpeed("slideSpeed"); 665 window.setTimeout(function () { 666 base.isCss3Finish = true; 667 }, base.options.slideSpeed); 668 } 669 base.transition3d(goToPixel); 670 } else { 671 if (speed === true) { 672 base.css2slide(goToPixel, base.options.paginationSpeed); 673 } else if (speed === "rewind") { 674 base.css2slide(goToPixel, base.options.rewindSpeed); 675 } else { 676 base.css2slide(goToPixel, base.options.slideSpeed); 677 } 678 } 679 base.afterGo(); 680 }, 681 682 jumpTo : function (position) { 683 var base = this; 684 if (typeof base.options.beforeMove === "function") { 685 base.options.beforeMove.apply(this, [base.$elem]); 686 } 687 if (position >= base.maximumItem || position === -1) { 688 position = base.maximumItem; 689 } else if (position <= 0) { 690 position = 0; 691 } 692 base.swapSpeed(0); 693 if (base.browser.support3d === true) { 694 base.transition3d(base.positionsInArray[position]); 695 } else { 696 base.css2slide(base.positionsInArray[position], 1); 697 } 698 base.currentItem = base.owl.currentItem = position; 699 base.afterGo(); 700 }, 701 702 afterGo : function () { 703 var base = this; 704 705 base.prevArr.push(base.currentItem); 706 base.prevItem = base.owl.prevItem = base.prevArr[base.prevArr.length - 2]; 707 base.prevArr.shift(0); 708 709 if (base.prevItem !== base.currentItem) { 710 base.checkPagination(); 711 base.checkNavigation(); 712 base.eachMoveUpdate(); 713 714 if (base.options.autoPlay !== false) { 715 base.checkAp(); 716 } 717 } 718 if (typeof base.options.afterMove === "function" && base.prevItem !== base.currentItem) { 719 base.options.afterMove.apply(this, [base.$elem]); 720 } 721 }, 722 723 stop : function () { 724 var base = this; 725 base.apStatus = "stop"; 726 window.clearInterval(base.autoPlayInterval); 727 }, 728 729 730 dragging : function (bool) { 731 var base = this; 732 base.options.dragging = bool; 733 734 }, 735 736 737 checkAp : function () { 738 var base = this; 739 if (base.apStatus !== "stop") { 740 base.play(); 741 } 742 }, 743 744 play : function () { 745 var base = this; 746 base.apStatus = "play"; 747 if (base.options.autoPlay === false) { 748 return false;
749 } 750 window.clearInterval(base.autoPlayInterval); 751 base.autoPlayInterval = window.setInterval(function () { 752 base.next(true); 753 }, base.options.autoPlay); 754 }, 755 756 swapSpeed : function (action) { 757 var base = this; 758 if (action === "slideSpeed") { 759 base.$owlWrapper.css(base.addCssSpeed(base.options.slideSpeed)); 760 } else if (action === "paginationSpeed") { 761 base.$owlWrapper.css(base.addCssSpeed(base.options.paginationSpeed)); 762 } else if (typeof action !== "string") { 763 base.$owlWrapper.css(base.addCssSpeed(action)); 764 } 765 }, 766 767 addCssSpeed : function (speed) { 768 return { 769 "-webkit-transition": "all " + speed + "ms ease", 770 "-moz-transition": "all " + speed + "ms ease", 771 "-o-transition": "all " + speed + "ms ease", 772 "transition": "all " + speed + "ms ease" 773 }; 774 }, 775 776 removeTransition : function () { 777 return { 778 "-webkit-transition": "", 779 "-moz-transition": "", 780 "-o-transition": "", 781 "transition": "" 782 }; 783 }, 784 785 doTranslate : function (pixels) { 786 return { 787 "-webkit-transform": "translate3d(" + pixels + "px, 0px, 0px)", 788 "-moz-transform": "translate3d(" + pixels + "px, 0px, 0px)", 789 "-o-transform": "translate3d(" + pixels + "px, 0px, 0px)", 790 "-ms-transform": "translate3d(" + pixels + "px, 0px, 0px)", 791 "transform": "translate3d(" + pixels + "px, 0px,0px)" 792 }; 793 }, 794 795 transition3d : function (value) { 796 var base = this; 797 base.$owlWrapper.css(base.doTranslate(value)); 798 }, 799 800 css2move : function (value) { 801 var base = this; 802 base.$owlWrapper.css({"left" : value}); 803 }, 804 805 css2slide : function (value, speed) { 806 var base = this; 807 808 base.isCssFinish = false; 809 base.$owlWrapper.stop(true, true).animate({ 810 "left" : value 811 }, { 812 duration : speed || base.options.slideSpeed, 813 complete : function () { 814 base.isCssFinish = true; 815 } 816 }); 817 }, 818 819 checkBrowser : function () { 820 var base = this, 821 translate3D = "translate3d(0px, 0px, 0px)", 822 tempElem = document.createElement("div"), 823 regex, 824 asSupport, 825 support3d, 826 isTouch; 827 828 tempElem.style.cssText = " -moz-transform:" + translate3D + 829 "; -ms-transform:" + translate3D + 830 "; -o-transform:" + translate3D + 831 "; -webkit-transform:" + translate3D + 832 "; transform:" + translate3D; 833 regex = /translate3d\(0px, 0px, 0px\)/g; 834 asSupport = tempElem.style.cssText.match(regex); 835 support3d = (asSupport !== null && asSupport.length === 1); 836 837 isTouch = "ontouchstart" in window || window.navigator.msMaxTouchPoints; 838 839 base.browser = { 840 "support3d" : support3d, 841 "isTouch" : isTouch 842 }; 843 }, 844 845 moveEvents : function () { 846 var base = this; 847 if (base.options.mouseDrag !== false || base.options.touchDrag !== false) { 848 base.gestures(); 849 base.disabledEvents(); 850 } 851 }, 852 853 eventTypes : function () { 854 var base = this, 855 types = ["s", "e", "x"]; 856 857 base.ev_types = {}; 858 859 if (base.options.mouseDrag === true && base.options.touchDrag === true) { 860 types = [ 861 "touchstart.owl mousedown.owl", 862 "touchmove.owl mousemove.owl", 863 "touchend.owl touchcancel.owl mouseup.owl" 864 ]; 865 } else if (base.options.mouseDrag === false && base.options.touchDrag === true) { 866 types = [ 867 "touchstart.owl", 868 "touchmove.owl", 869 "touchend.owl touchcancel.owl" 870 ]; 871 } else if (base.options.mouseDrag === true && base.options.touchDrag === false) { 872 types = [ 873 "mousedown.owl", 874 "mousemove.owl", 875 "mouseup.owl" 876 ]; 877 } 878 879 base.ev_types.start = types[0]; 880 base.ev_types.move = types[1]; 881 base.ev_types.end = types[2]; 882 }, 883 884 disabledEvents : function () { 885 var base = this; 886 base.$elem.on("dragstart.owl", function (event) { event.preventDefault(); }); 887 base.$elem.on("mousedown.disableTextSelect", function (e) { 888 return $(e.target).is('input, textarea, select, option'); 889 }); 890 }, 891 892 gestures : function () { 893 /*jslint unparam: true*/ 894 var base = this, 895 locals = { 896 offsetX : 0, 897 offsetY : 0, 898 baseElWidth : 0, 899 relativePos : 0, 900 position: null, 901 minSwipe : null, 902 maxSwipe: null, 903 sliding : null, 904 dargging: null, 905 targetElement : null 906 }; 907 908 base.isCssFinish = true; 909 910 function getTouches(event) { 911 if (event.touches !== undefined) { 912 return { 913 x : event.touches[0].pageX, 914 y : event.touches[0].pageY 915 }; 916 } 917 918 if (event.touches === undefined) { 919 if (event.pageX !== undefined) { 920 return { 921 x : event.pageX, 922 y : event.pageY 923 }; 924 } 925 if (event.pageX === undefined) { 926 return { 927 x : event.clientX, 928 y : event.clientY 929 }; 930 } 931 } 932 } 933 934 function swapEvents(type) { 935 if (type === "on") { 936 $(document).on(base.ev_types.move, dragMove); 937 $(document).on(base.ev_types.end, dragEnd); 938 } else if (type === "off") { 939 $(document).off(base.ev_types.move); 940 $(document).off(base.ev_types.end); 941 } 942 } 943 944 function dragStart(event) { 945 var ev = event.originalEvent || event || window.event, 946 position; 947 948 949 950 if(!base.options.dragging){ 951 return; 952 } 953 954 if (ev.which === 3) { 955 return false;
956 } 957 if (base.itemsAmount <= base.options.items) { 958 return; 959 } 960 if (base.isCssFinish === false && !base.options.dragBeforeAnimFinish) { 961 return false; 962 } 963 if (base.isCss3Finish === false && !base.options.dragBeforeAnimFinish) { 964 return false; 965 } 966 967 if (base.options.autoPlay !== false) { 968 window.clearInterval(base.autoPlayInterval); 969 } 970 971 if (base.browser.isTouch !== true && !base.$owlWrapper.hasClass("grabbing")) { 972 base.$owlWrapper.addClass("grabbing"); 973 } 974 975 base.newPosX = 0; 976 base.newRelativeX = 0; 977 978 $(this).css(base.removeTransition()); 979 980 position = $(this).position(); 981 locals.relativePos = position.left; 982 983 locals.offsetX = getTouches(ev).x - position.left; 984 locals.offsetY = getTouches(ev).y - position.top; 985 986 swapEvents("on"); 987 988 locals.sliding = false; 989 locals.targetElement = ev.target || ev.srcElement; 990 } 991 992 function dragMove(event) { 993 994 if(!base.options.dragging){ 995 return; 996 } 997 998 var ev = event.originalEvent || event || window.event, 999 minSwipe, 1000 maxSwipe; 1001 1002 base.newPosX = getTouches(ev).x - locals.offsetX; 1003 base.newPosY = getTouches(ev).y - locals.offsetY; 1004 base.newRelativeX = base.newPosX - locals.relativePos; 1005 1006 1007 1008 if (typeof base.options.startDragging === "function" && locals.dragging !== true && base.newRelativeX !== 0) { 1009 locals.dragging = true; 1010 base.options.startDragging.apply(base, [base.$elem]); 1011 1012 } 1013 1014 1015 if ((base.newRelativeX > 8 || base.newRelativeX < -8) && (base.browser.isTouch === true)) { 1016 if (ev.preventDefault !== undefined) { 1017 ev.preventDefault(); 1018 } else { 1019 ev.returnValue = false; 1020 } 1021 locals.sliding = true; 1022 } 1023 1024 if ((base.newPosY > 10 || base.newPosY < -10) && locals.sliding === false) { 1025 $(document).off("touchmove.owl"); 1026 } 1027 1028 minSwipe = function () { 1029 return base.newRelativeX / 5; 1030 }; 1031 1032 maxSwipe = function () { 1033 return base.maximumPixels + base.newRelativeX / 5; 1034 }; 1035 1036 base.newPosX = Math.max(Math.min(base.newPosX, minSwipe()), maxSwipe()); 1037 if (base.browser.support3d === true) { 1038 base.transition3d(base.newPosX); 1039 } else { 1040 base.css2move(base.newPosX); 1041 } 1042 } 1043 1044 function dragEnd(event) { 1045 var ev = event.originalEvent || event || window.event, 1046 newPosition, 1047 handlers, 1048 owlStopEvent; 1049 1050 ev.target = ev.target || ev.srcElement; 1051 1052 locals.dragging = false; 1053 1054 if (base.browser.isTouch !== true) { 1055 base.$owlWrapper.removeClass("grabbing"); 1056 } 1057 1058 if (base.newRelativeX < 50) { 1059 base.dragDirection = base.owl.dragDirection = "left"; 1060 } else { 1061 base.dragDirection = base.owl.dragDirection = "right"; 1062 } 1063 1064 if (base.newRelativeX !== 0) { 1065 newPosition = base.getNewPosition(); 1066 base.goTo(newPosition, false, "drag"); 1067 if (locals.targetElement === ev.target && base.browser.isTouch !== true) { 1068 $(ev.target).on("click.disable", function (ev) { 1069 ev.stopImmediatePropagation(); 1070 ev.stopPropagation(); 1071 ev.preventDefault(); 1072 $(ev.target).off("click.disable"); 1073 }); 1074 handlers = $._data(ev.target, "events").click; 1075 owlStopEvent = handlers.pop(); 1076 handlers.splice(0, 0, owlStopEvent); 1077 } 1078 } 1079 swapEvents("off"); 1080 } 1081 base.$elem.on(base.ev_types.start, ".owl-wrapper", dragStart); 1082 }, 1083 1084 getNewPosition : function () { 1085 var base = this, 1086 newPosition = base.closestItem(); 1087 1088 if (newPosition > base.maximumItem) { 1089 base.currentItem = base.maximumItem; 1090 newPosition = base.maximumItem; 1091 } else if (base.newPosX >= 0) { 1092 newPosition = 0; 1093 base.currentItem = 0; 1094 } 1095 return newPosition; 1096 }, 1097 closestItem : function () { 1098 var base = this, 1099 array = base.options.scrollPerPage === true ? base.pagesInArray : base.positionsInArray, 1100 goal = base.newPosX, 1101 closest = null; 1102 1103 $.each(array, function (i, v) { 1104 if (goal - (base.itemWidth / 20) > array[i + 1] && goal - (base.itemWidth / 20) < v && base.moveDirection() === "left") { 1105 closest = v; 1106 if (base.options.scrollPerPage === true) { 1107 base.currentItem = $.inArray(closest, base.positionsInArray); 1108 } else { 1109 base.currentItem = i; 1110 } 1111 } else if (goal + (base.itemWidth / 20) < v && goal + (base.itemWidth / 20) > (array[i + 1] || array[i] - base.itemWidth) && base.moveDirection() === "right") { 1112 if (base.options.scrollPerPage === true) { 1113 closest = array[i + 1] || array[array.length - 1]; 1114 base.currentItem = $.inArray(closest, base.positionsInArray); 1115 } else { 1116 closest = array[i + 1]; 1117 base.currentItem = i + 1; 1118 } 1119 } 1120 }); 1121 return base.currentItem; 1122 }, 1123 1124 moveDirection : function () { 1125 var base = this, 1126 direction; 1127 if (base.newRelativeX < 0) { 1128 direction = "right"; 1129 base.playDirection = "next"; 1130 } else { 1131 direction = "left"; 1132 base.playDirection = "prev"; 1133 } 1134 return direction; 1135 }, 1136 1137 customEvents : function () { 1138 /*jslint unparam: true*/ 1139 var base = this; 1140 base.$elem.on("owl.next", function () { 1141 base.next(); 1142 }); 1143 base.$elem.on("owl.prev", function () { 1144 base.prev(); 1145 }); 1146 base.$elem.on("owl.play", function (event, speed) { 1147 base.options.autoPlay = speed; 1148 base.play(); 1149 base.hoverStatus = "play"; 1150 }); 1151 base.$elem.on("owl.stop", function () { 1152 base.stop(); 1153 base.hoverStatus = "stop"; 1154 }); 1155 base.$elem.on("owl.goTo", function (event, item) { 1156 base.goTo(item); 1157 }); 1158 base.$elem.on("owl.jumpTo", function (event, item) { 1159 base.jumpTo(item); 1160 }); 1161 1162 base.$elem.on("owl.dragging", function (event, item) { 1163 base.dragging(item); 1164 }); 1165 }, 1166 1167 stopOnHover : function () { 1168 var base = this; 1169 if (base.options.stopOnHover === true && base.browser.isTouch !== true && base.options.autoPlay !== false) { 1170 base.$elem.on("mouseover", function () { 1171 base.stop(); 1172 }); 1173 base.$elem.on("mouseout", function () { 1174 if (base.hoverStatus !== "stop") { 1175 base.play(); 1176 } 1177 }); 1178 } 1179 }, 1180 1181 lazyLoad : function () { 1182 var base = this, 1183 i, 1184 $item, 1185 itemNumber, 1186 $lazyImg, 1187 follow; 1188 1189 if (base.options.lazyLoad === false) { 1190 return false;
1191 } 1192 for (i = 0; i < base.itemsAmount; i += 1) { 1193 $item = $(base.$owlItems[i]); 1194 1195 if ($item.data("owl-loaded") === "loaded") { 1196 continue; 1197 } 1198 1199 itemNumber = $item.data("owl-item"); 1200 $lazyImg = $item.find(".lazyOwl"); 1201 1202 if (typeof $lazyImg.data("src") !== "string") { 1203 $item.data("owl-loaded", "loaded"); 1204 continue; 1205 } 1206 if ($item.data("owl-loaded") === undefined) { 1207 $lazyImg.hide(); 1208 $item.addClass("loading").data("owl-loaded", "checked"); 1209 } 1210 if (base.options.lazyFollow === true) { 1211 follow = itemNumber >= base.currentItem; 1212 } else { 1213 follow = true; 1214 } 1215 if (follow && itemNumber < base.currentItem + base.options.items && $lazyImg.length) { 1216 $lazyImg.each(function() { 1217 base.lazyPreload($item, $(this)); 1218 }); 1219 } 1220 } 1221 }, 1222 1223 lazyPreload : function ($item, $lazyImg) { 1224 var base = this, 1225 iterations = 0, 1226 isBackgroundImg; 1227 1228 if ($lazyImg.prop("tagName") === "DIV") { 1229 $lazyImg.css("background-image", "url(" + $lazyImg.data("src") + ")"); 1230 isBackgroundImg = true; 1231 } else { 1232 $lazyImg[0].src = $lazyImg.data("src"); 1233 } 1234 1235 function showImage() { 1236 $item.data("owl-loaded", "loaded").removeClass("loading"); 1237 $lazyImg.removeAttr("data-src"); 1238 if (base.options.lazyEffect === "fade") { 1239 $lazyImg.fadeIn(400); 1240 } else { 1241 $lazyImg.show(); 1242 } 1243 if (typeof base.options.afterLazyLoad === "function") { 1244 base.options.afterLazyLoad.apply(this, [base.$elem]); 1245 } 1246 } 1247 1248 function checkLazyImage() { 1249 iterations += 1; 1250 if (base.completeImg($lazyImg.get(0)) || isBackgroundImg === true) { 1251 showImage(); 1252 } else if (iterations <= 100) {//if image loads in less than 10 seconds 1253 window.setTimeout(checkLazyImage, 100); 1254 } else { 1255 showImage(); 1256 } 1257 } 1258 1259 checkLazyImage(); 1260 }, 1261 1262 autoHeight : function () { 1263 var base = this, 1264 $currentimg = $(base.$owlItems[base.currentItem]).find("img"), 1265 iterations; 1266 1267 function addHeight() { 1268 var $currentItem = $(base.$owlItems[base.currentItem]).height(); 1269 base.wrapperOuter.css("height", $currentItem + "px"); 1270 if (!base.wrapperOuter.hasClass("autoHeight")) { 1271 window.setTimeout(function () { 1272 base.wrapperOuter.addClass("autoHeight"); 1273 }, 0); 1274 } 1275 } 1276 1277 function checkImage() { 1278 iterations += 1; 1279 if (base.completeImg($currentimg.get(0))) { 1280 addHeight(); 1281 } else if (iterations <= 100) { //if image loads in less than 10 seconds 1282 window.setTimeout(checkImage, 100); 1283 } else { 1284 base.wrapperOuter.css("height", ""); //Else remove height attribute 1285 } 1286 } 1287 1288 if ($currentimg.get(0) !== undefined) { 1289 iterations = 0; 1290 checkImage(); 1291 } else { 1292 addHeight(); 1293 } 1294 }, 1295 1296 completeImg : function (img) { 1297 var naturalWidthType; 1298 1299 if (!img.complete) { 1300 return false; 1301 } 1302 naturalWidthType = typeof img.naturalWidth;
1303 if (naturalWidthType !== "undefined" && img.naturalWidth === 0) { 1304 return false; 1305 } 1306 return true; 1307 }, 1308 1309 onVisibleItems : function () { 1310 var base = this, 1311 i; 1312 1313 if (base.options.addClassActive === true) { 1314 base.$owlItems.removeClass("active"); 1315 } 1316 base.visibleItems = []; 1317 for (i = base.currentItem; i < base.currentItem + base.options.items; i += 1) { 1318 base.visibleItems.push(i); 1319 1320 if (base.options.addClassActive === true) { 1321 $(base.$owlItems[i]).addClass("active"); 1322 } 1323 } 1324 base.owl.visibleItems = base.visibleItems; 1325 }, 1326 1327 transitionTypes : function (className) { 1328 var base = this; 1329 //Currently available: "fade", "backSlide", "goDown", "fadeUp" 1330 base.outClass = "owl-" + className + "-out"; 1331 base.inClass = "owl-" + className + "-in"; 1332 }, 1333 1334 singleItemTransition : function () { 1335 var base = this, 1336 outClass = base.outClass, 1337 inClass = base.inClass, 1338 $currentItem = base.$owlItems.eq(base.currentItem), 1339 $prevItem = base.$owlItems.eq(base.prevItem), 1340 prevPos = Math.abs(base.positionsInArray[base.currentItem]) + base.positionsInArray[base.prevItem], 1341 origin = Math.abs(base.positionsInArray[base.currentItem]) + base.itemWidth / 2, 1342 animEnd = 'webkitAnimationEnd oAnimationEnd MSAnimationEnd animationend'; 1343 1344 base.isTransition = true; 1345 1346 base.$owlWrapper 1347 .addClass('owl-origin') 1348 .css({ 1349 "-webkit-transform-origin" : origin + "px", 1350 "-moz-perspective-origin" : origin + "px", 1351 "perspective-origin" : origin + "px" 1352 }); 1353 function transStyles(prevPos) { 1354 return { 1355 "position" : "relative", 1356 "left" : prevPos + "px" 1357 }; 1358 } 1359 1360 $prevItem 1361 .css(transStyles(prevPos, 10)) 1362 .addClass(outClass) 1363 .on(animEnd, function () { 1364 base.endPrev = true; 1365 $prevItem.off(animEnd); 1366 base.clearTransStyle($prevItem, outClass); 1367 }); 1368 1369 $currentItem 1370 .addClass(inClass) 1371 .on(animEnd, function () { 1372 base.endCurrent = true; 1373 $currentItem.off(animEnd); 1374 base.clearTransStyle($currentItem, inClass); 1375 }); 1376 }, 1377 1378 clearTransStyle : function (item, classToRemove) { 1379 var base = this; 1380 item.css({ 1381 "position" : "", 1382 "left" : "" 1383 }).removeClass(classToRemove); 1384 1385 if (base.endPrev && base.endCurrent) { 1386 base.$owlWrapper.removeClass('owl-origin'); 1387 base.endPrev = false; 1388 base.endCurrent = false; 1389 base.isTransition = false; 1390 } 1391 }, 1392 1393 owlStatus : function () { 1394 var base = this; 1395 base.owl = { 1396 "userOptions" : base.userOptions, 1397 "baseElement" : base.$elem, 1398 "userItems" : base.$userItems, 1399 "owlItems" : base.$owlItems, 1400 "currentItem" : base.currentItem, 1401 "prevItem" : base.prevItem, 1402 "visibleItems" : base.visibleItems, 1403 "isTouch" : base.browser.isTouch, 1404 "browser" : base.browser, 1405 "dragDirection" : base.dragDirection 1406 }; 1407 }, 1408 1409 clearEvents : function () { 1410 var base = this; 1411 base.$elem.off(".owl owl mousedown.disableTextSelect"); 1412 $(document).off(".owl owl"); 1413 $(window).off("resize", base.resizer); 1414 }, 1415 1416 unWrap : function () { 1417 var base = this; 1418 if (base.$elem.children().length !== 0) { 1419 base.$owlWrapper.unwrap(); 1420 base.$userItems.unwrap().unwrap(); 1421 if (base.owlControls) { 1422 base.owlControls.remove(); 1423 } 1424 } 1425 base.clearEvents(); 1426 base.$elem.attr({ 1427 style: base.$elem.data("owl-originalStyles") || "", 1428 class: base.$elem.data("owl-originalClasses") 1429 }); 1430 }, 1431 1432 destroy : function () { 1433 var base = this; 1434 base.stop(); 1435 window.clearInterval(base.checkVisible); 1436 base.unWrap(); 1437 base.$elem.removeData(); 1438 }, 1439 1440 reinit : function (newOptions) { 1441 var base = this, 1442 options = $.extend({}, base.userOptions, newOptions); 1443 base.unWrap(); 1444 base.init(options, base.$elem); 1445 }, 1446 1447 addItem : function (htmlString, targetPosition) { 1448 var base = this, 1449 position; 1450 1451 if (!htmlString) {return false; } 1452 1453 if (base.$elem.children().length === 0) { 1454 base.$elem.append(htmlString); 1455 base.setVars(); 1456 return false;
1457 } 1458 base.unWrap(); 1459 if (targetPosition === undefined || targetPosition === -1) { 1460 position = -1; 1461 } else { 1462 position = targetPosition; 1463 } 1464 if (position >= base.$userItems.length || position === -1) { 1465 base.$userItems.eq(-1).after(htmlString); 1466 } else { 1467 base.$userItems.eq(position).before(htmlString); 1468 } 1469 1470 base.setVars(); 1471 }, 1472 1473 removeItem : function (targetPosition) { 1474 var base = this, 1475 position; 1476 1477 if (base.$elem.children().length === 0) { 1478 return false; 1479 } 1480 if (targetPosition === undefined || targetPosition === -1) { 1481 position = -1; 1482 } else { 1483 position = targetPosition; 1484 } 1485 1486 base.unWrap(); 1487 base.$userItems.eq(position).remove(); 1488 base.setVars(); 1489 } 1490 1491 }; 1492 1493 $.fn.owlCarousel = function (options) { 1494 return this.each(function () { 1495 if ($(this).data("owl-init") === true) { 1496 return false; 1497 } 1498 $(this).data("owl-init", true); 1499 var carousel = Object.create(Carousel); 1500 carousel.init(options, this); 1501 $.data(this, "owlCarousel", carousel); 1502 }); 1503 }; 1504 1505 $.fn.owlCarousel.options = { 1506 1507 items : 5, 1508 itemsCustom : false, 1509 itemsDesktop : [1199, 4], 1510 itemsDesktopSmall : [979, 3], 1511 itemsTablet : [768, 2], 1512 itemsTabletSmall : false, 1513 itemsMobile : [479, 1], 1514 singleItem : false, 1515 itemsScaleUp : false, 1516 1517 slideSpeed : 200, 1518 paginationSpeed : 800, 1519 rewindSpeed : 1000, 1520 1521 autoPlay : false, 1522 stopOnHover : false, 1523 1524 navigation : false, 1525 navigationText : ["prev", "next"], 1526 rewindNav : true, 1527 scrollPerPage : false, 1528 1529 pagination : true, 1530 paginationNumbers : false, 1531 1532 responsive : true, 1533 responsiveRefreshRate : 200, 1534 responsiveBaseWidth : window, 1535 1536 baseClass : "owl-carousel", 1537 theme : "owl-theme", 1538 1539 lazyLoad : false, 1540 lazyFollow : true, 1541 lazyEffect : "fade", 1542 1543 autoHeight : false, 1544 1545 jsonPath : false, 1546 jsonSuccess : false, 1547 1548 dragBeforeAnimFinish : true, 1549 mouseDrag : true, 1550 touchDrag : true, 1551 dragging: true, 1552 1553 addClassActive : false, 1554 transitionStyle : false, 1555 1556 beforeUpdate : false, 1557 afterUpdate : false, 1558 beforeInit : false, 1559 afterInit : false, 1560 beforeMove : false, 1561 afterMove : false, 1562 afterAction : false, 1563 startDragging : false, 1564 afterLazyLoad: false 1565 }; 1566}(jQuery, window, document));
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.