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