vendor: 7,064 bytes, lines 1-339
1var _____WB$wombat$assign$function_____=function(name){return (self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name))||self[name];};if(!self.__WB_pmw){self.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{ 2let window = _____WB$wombat$assign$function_____("window"); 3let self = _____WB$wombat$assign$function_____("self"); 4let document = _____WB$wombat$assign$function_____("document"); 5let location = _____WB$wombat$assign$function_____("location"); 6let top = _____WB$wombat$assign$function_____("top"); 7let parent = _____WB$wombat$assign$function_____("parent"); 8let frames = _____WB$wombat$assign$function_____("frames"); 9let opens = _____WB$wombat$assign$function_____("opens"); 10/** 11 * Owl Carousel v2.2.1 12 * Copyright 2013-2017 David Deutsch 13 * Licensed under () 14 */ 15/** 16 * Owl carousel 17 * @version 2.1.6 18 * @author Bartosz Wojciechowski 19 * @author David Deutsch 20 * @license The MIT License (MIT) 21 * @todo Lazy Load Icon 22 * @todo prevent animationend bubling 23 * @todo itemsScaleUp 24 * @todo Test Zepto 25 * @todo stagePadding calculate wrong active classes 26 */ 27;(function($, window, document, undefined) { 28 29 /** 30 * Creates a carousel. 31 * @class The Owl Carousel. 32 * @public 33 * @param {HTMLElement|jQuery} element - The element to create the carousel for. 34 * @param {Object} [options] - The options 35 */ 36 function Owl(element, options) { 37 38 /** 39 * Current settings for the carousel. 40 * @public 41 */ 42 this.settings = null; 43 44 /** 45 * Current options set by the caller including defaults. 46 * @public 47 */ 48 this.options = $.extend({}, Owl.Defaults, options); 49 50 /** 51 * Plugin element. 52 * @public 53 */ 54 this.$element = $(element); 55 56 /** 57 * Proxied event handlers. 58 * @protected 59 */ 60 this._handlers = {}; 61 62 /** 63 * References to the running plugins of this carousel. 64 * @protected 65 */ 66 this._plugins = {}; 67 68 /** 69 * Currently suppressed events to prevent them from beeing retriggered. 70 * @protected 71 */ 72 this._supress = {}; 73 74 /** 75 * Absolute current position. 76 * @protected 77 */ 78 this._current = null; 79 80 /** 81 * Animation speed in milliseconds. 82 * @protected 83 */ 84 this._speed = null; 85 86 /** 87 * Coordinates of all items in pixel. 88 * @todo The name of this member is missleading. 89 * @protected 90 */ 91 this._coordinates = []; 92 93 /** 94 * Current breakpoint. 95 * @todo Real media queries would be nice. 96 * @protected 97 */ 98 this._breakpoint = null; 99 100 /** 101 * Current width of the plugin element. 102 */ 103 this._width = null; 104 105 /** 106 * All real items. 107 * @protected 108 */ 109 this._items = []; 110 111 /** 112 * All cloned items. 113 * @protected 114 */ 115 this._clones = []; 116 117 /** 118 * Merge values of all items. 119 * @todo Maybe this could be part of a plugin. 120 * @protected 121 */ 122 this._mergers = []; 123 124 /** 125 * Widths of all items. 126 */ 127 this._widths = []; 128 129 /** 130 * Invalidated parts within the update process. 131 * @protected 132 */ 133 this._invalidated = {}; 134 135 /** 136 * Ordered list of workers for the update process. 137 * @protected 138 */ 139 this._pipe = []; 140 141 /** 142 * Current state information for the drag operation. 143 * @todo #261 144 * @protected 145 */ 146 this._drag = { 147 time: null, 148 target: null, 149 pointer: null, 150 stage: { 151 start: null, 152 current: null 153 }, 154 direction: null 155 }; 156 157 /** 158 * Current state information and their tags. 159 * @type {Object} 160 * @protected 161 */ 162 this._states = { 163 current: {}, 164 tags: { 165 'initializing': [ 'busy' ], 166 'animating': [ 'busy' ], 167 'dragging': [ 'interacting' ] 168 } 169 }; 170 171 $.each([ 'onResize', 'onThrottledResize' ], $.proxy(function(i, handler) { 172 this._handlers[handler] = $.proxy(this[handler], this); 173 }, this)); 174 175 $.each(Owl.Plugins, $.proxy(function(key, plugin) { 176 this._plugins[key.charAt(0).toLowerCase() + key.slice(1)] 177 = new plugin(this); 178 }, this)); 179 180 $.each(Owl.Workers, $.proxy(function(priority, worker) { 181 this._pipe.push({ 182 'filter': worker.filter, 183 'run': $.proxy(worker.run, this) 184 }); 185 }, this)); 186 187 this.setup(); 188 this.initialize(); 189 } 190 191 /** 192 * Default options for the carousel. 193 * @public 194 */ 195 Owl.Defaults = { 196 items: 3, 197 loop: false, 198 center: false, 199 rewind: false, 200 201 mouseDrag: true, 202 touchDrag: true, 203 pullDrag: true, 204 freeDrag: false, 205 206 margin: 0, 207 stagePadding: 0, 208 209 merge: false, 210 mergeFit: true, 211 autoWidth: false, 212 213 startPosition: 0, 214 rtl: false, 215 216 smartSpeed: 250, 217 fluidSpeed: false, 218 dragEndSpeed: false, 219 220 responsive: {}, 221 responsiveRefreshRate: 200, 222 responsiveBaseElement: window, 223 224 fallbackEasing: 'swing', 225 226 info: false, 227 228 nestedItemSelector: false, 229 itemElement: 'div', 230 stageElement: 'div', 231 232 refreshClass: 'owl-refresh', 233 loadedClass: 'owl-loaded', 234 loadingClass: 'owl-loading', 235 rtlClass: 'owl-rtl', 236 responsiveClass: 'owl-responsive', 237 dragClass: 'owl-drag', 238 itemClass: 'owl-item', 239 stageClass: 'owl-stage', 240 stageOuterClass: 'owl-stage-outer', 241 grabClass: 'owl-grab' 242 }; 243 244 /** 245 * Enumeration for width. 246 * @public 247 * @readonly 248 * @enum {String} 249 */ 250 Owl.Width = { 251 Default: 'default', 252 Inner: 'inner', 253 Outer: 'outer' 254 }; 255 256 /** 257 * Enumeration for types. 258 * @public 259 * @readonly 260 * @enum {String} 261 */ 262 Owl.Type = { 263 Event: 'event', 264 State: 'state' 265 }; 266 267 /** 268 * Contains all registered plugins. 269 * @public 270 */ 271 Owl.Plugins = {}; 272 273 /** 274 * List of workers involved in the update process. 275 */ 276 Owl.Workers = [ { 277 filter: [ 'width', 'settings' ], 278 run: function() { 279 this._width = this.$element.width(); 280 } 281 }, { 282 filter: [ 'width', 'items', 'settings' ], 283 run: function(cache) { 284 cache.current = this._items && this._items[this.relative(this._current)]; 285 } 286 }, { 287 filter: [ 'items', 'settings' ], 288 run: function() { 289 this.$stage.children('.cloned').remove(); 290 } 291 }, { 292 filter: [ 'width', 'items', 'settings' ], 293 run: function(cache) { 294 var margin = this.settings.margin || '', 295 grid = !this.settings.autoWidth, 296 rtl = this.settings.rtl, 297 css = { 298 'width': 'auto', 299 'margin-left': rtl ? margin : '', 300 'margin-right': rtl ? '' : margin 301 }; 302 303 !grid && this.$stage.children().css(css); 304 305 cache.css = css; 306 } 307 }, { 308 filter: [ 'width', 'items', 'settings' ], 309 run: function(cache) { 310 var width = (this.width() / this.settings.items).toFixed(3) - this.settings.margin, 311 merge = null, 312 iterator = this._items.length, 313 grid = !this.settings.autoWidth, 314 widths = []; 315 316 cache.items = { 317 merge: false, 318 width: width 319 }; 320 321 while (iterator--) { 322 merge = this._mergers[iterator]; 323 merge = this.settings.mergeFit && Math.min(merge, this.settings.items) || merge; 324 325 cache.items.merge = merge > 1 || cache.items.merge; 326 327 widths[iterator] = !grid ? this._items[iterator].width() : width * merge; 328 } 329 330 this._widths = widths; 331 } 332 }, { 333 filter: [ 'items', 'settings' ], 334 run: function() { 335 var clones = [], 336 items = this._items, 337 settings = this.settings, 338 // TODO: Should be computed from number of min width items in stage 339 view = Math.max(settings.items * 2, 4),
vendor: 684 bytes, lines 340-358
340 size = Math.ceil(items.length / 2) * 2, 341 repeat = settings.loop && items.length ? settings.rewind ? view : Math.max(view, size) : 0, 342 append = '', 343 prepend = ''; 344 345 repeat /= 2; 346 347 while (repeat--) { 348 // Switch to only using appended clones 349 clones.push(this.normalize(clones.length / 2, true)); 350 append = append + items[clones[clones.length - 1]][0].outerHTML; 351 clones.push(this.normalize(items.length - 1 - (clones.length - 1) / 2, true)); 352 prepend = items[clones[clones.length - 1]][0].outerHTML + prepend; 353 } 354 355 this._clones = clones; 356 357 $(append).addClass('cloned').appendTo(this.$stage); 358 $(prepend).addClass('cloned').prependTo(this.$stage);
vendor: 31,179 bytes, lines 358-1466
358 359 } 360 }, { 361 filter: [ 'width', 'items', 'settings' ], 362 run: function() { 363 var rtl = this.settings.rtl ? 1 : -1, 364 size = this._clones.length + this._items.length, 365 iterator = -1, 366 previous = 0, 367 current = 0, 368 coordinates = []; 369 370 while (++iterator < size) { 371 previous = coordinates[iterator - 1] || 0; 372 current = this._widths[this.relative(iterator)] + this.settings.margin; 373 coordinates.push(previous + current * rtl); 374 } 375 376 this._coordinates = coordinates; 377 } 378 }, { 379 filter: [ 'width', 'items', 'settings' ], 380 run: function() { 381 var padding = this.settings.stagePadding, 382 coordinates = this._coordinates, 383 css = { 384 'width': Math.ceil(Math.abs(coordinates[coordinates.length - 1])) + padding * 2, 385 'padding-left': padding || '', 386 'padding-right': padding || '' 387 }; 388 389 this.$stage.css(css); 390 } 391 }, { 392 filter: [ 'width', 'items', 'settings' ], 393 run: function(cache) { 394 var iterator = this._coordinates.length, 395 grid = !this.settings.autoWidth, 396 items = this.$stage.children(); 397 398 if (grid && cache.items.merge) { 399 while (iterator--) { 400 cache.css.width = this._widths[this.relative(iterator)]; 401 items.eq(iterator).css(cache.css); 402 } 403 } else if (grid) { 404 cache.css.width = cache.items.width; 405 items.css(cache.css); 406 } 407 } 408 }, { 409 filter: [ 'items' ], 410 run: function() { 411 this._coordinates.length < 1 && this.$stage.removeAttr('style'); 412 } 413 }, { 414 filter: [ 'width', 'items', 'settings' ], 415 run: function(cache) { 416 cache.current = cache.current ? this.$stage.children().index(cache.current) : 0; 417 cache.current = Math.max(this.minimum(), Math.min(this.maximum(), cache.current)); 418 this.reset(cache.current); 419 } 420 }, { 421 filter: [ 'position' ], 422 run: function() { 423 this.animate(this.coordinates(this._current)); 424 } 425 }, { 426 filter: [ 'width', 'position', 'items', 'settings' ], 427 run: function() { 428 var rtl = this.settings.rtl ? 1 : -1, 429 padding = this.settings.stagePadding * 2, 430 begin = this.coordinates(this.current()) + padding, 431 end = begin + this.width() * rtl, 432 inner, outer, matches = [], i, n; 433 434 for (i = 0, n = this._coordinates.length; i < n; i++) { 435 inner = this._coordinates[i - 1] || 0; 436 outer = Math.abs(this._coordinates[i]) + padding * rtl; 437 438 if ((this.op(inner, '<=', begin) && (this.op(inner, '>', end))) 439 || (this.op(outer, '<', begin) && this.op(outer, '>', end))) { 440 matches.push(i); 441 } 442 } 443 444 this.$stage.children('.active').removeClass('active'); 445 this.$stage.children(':eq(' + matches.join('), :eq(') + ')').addClass('active'); 446 447 if (this.settings.center) { 448 this.$stage.children('.center').removeClass('center'); 449 this.$stage.children().eq(this.current()).addClass('center'); 450 } 451 } 452 } ]; 453 454 /** 455 * Initializes the carousel. 456 * @protected 457 */ 458 Owl.prototype.initialize = function() { 459 this.enter('initializing'); 460 this.trigger('initialize'); 461 462 this.$element.toggleClass(this.settings.rtlClass, this.settings.rtl); 463 464 if (this.settings.autoWidth && !this.is('pre-loading')) { 465 var imgs, nestedSelector, width; 466 imgs = this.$element.find('img'); 467 nestedSelector = this.settings.nestedItemSelector ? '.' + this.settings.nestedItemSelector : undefined; 468 width = this.$element.children(nestedSelector).width(); 469 470 if (imgs.length && width <= 0) { 471 this.preloadAutoWidthImages(imgs); 472 } 473 } 474 475 this.$element.addClass(this.options.loadingClass); 476 477 // create stage 478 this.$stage = $('<' + this.settings.stageElement + ' class="' + this.settings.stageClass + '"/>') 479 .wrap('<div class="' + this.settings.stageOuterClass + '"/>'); 480 481 // append stage 482 this.$element.append(this.$stage.parent()); 483 484 // append content 485 this.replace(this.$element.children().not(this.$stage.parent())); 486 487 // check visibility 488 if (this.$element.is(':visible')) { 489 // update view 490 this.refresh(); 491 } else { 492 // invalidate width 493 this.invalidate('width'); 494 } 495 496 this.$element 497 .removeClass(this.options.loadingClass) 498 .addClass(this.options.loadedClass); 499 500 // register event handlers 501 this.registerEventHandlers(); 502 503 this.leave('initializing'); 504 this.trigger('initialized'); 505 }; 506 507 /** 508 * Setups the current settings. 509 * @todo Remove responsive classes. Why should adaptive designs be brought into IE8? 510 * @todo Support for media queries by using `matchMedia` would be nice. 511 * @public 512 */ 513 Owl.prototype.setup = function() { 514 var viewport = this.viewport(), 515 overwrites = this.options.responsive, 516 match = -1, 517 settings = null; 518 519 if (!overwrites) { 520 settings = $.extend({}, this.options); 521 } else { 522 $.each(overwrites, function(breakpoint) { 523 if (breakpoint <= viewport && breakpoint > match) { 524 match = Number(breakpoint); 525 } 526 }); 527 528 settings = $.extend({}, this.options, overwrites[match]); 529 if (typeof settings.stagePadding === 'function') { 530 settings.stagePadding = settings.stagePadding(); 531 } 532 delete settings.responsive; 533 534 // responsive class 535 if (settings.responsiveClass) { 536 this.$element.attr('class', 537 this.$element.attr('class').replace(new RegExp('(' + this.options.responsiveClass + '-)\\S+\\s', 'g'), '$1' + match) 538 ); 539 } 540 } 541 542 this.trigger('change', { property: { name: 'settings', value: settings } }); 543 this._breakpoint = match; 544 this.settings = settings; 545 this.invalidate('settings'); 546 this.trigger('changed', { property: { name: 'settings', value: this.settings } }); 547 }; 548 549 /** 550 * Updates option logic if necessery. 551 * @protected 552 */ 553 Owl.prototype.optionsLogic = function() { 554 if (this.settings.autoWidth) { 555 this.settings.stagePadding = false; 556 this.settings.merge = false; 557 } 558 }; 559 560 /** 561 * Prepares an item before add. 562 * @todo Rename event parameter `content` to `item`. 563 * @protected 564 * @returns {jQuery|HTMLElement} - The item container. 565 */ 566 Owl.prototype.prepare = function(item) { 567 var event = this.trigger('prepare', { content: item }); 568 569 if (!event.data) { 570 event.data = $('<' + this.settings.itemElement + '/>') 571 .addClass(this.options.itemClass).append(item) 572 } 573 574 this.trigger('prepared', { content: event.data }); 575 576 return event.data; 577 }; 578 579 /** 580 * Updates the view. 581 * @public 582 */ 583 Owl.prototype.update = function() { 584 var i = 0, 585 n = this._pipe.length, 586 filter = $.proxy(function(p) { return this[p] }, this._invalidated), 587 cache = {}; 588 589 while (i < n) { 590 if (this._invalidated.all || $.grep(this._pipe[i].filter, filter).length > 0) { 591 this._pipe[i].run(cache); 592 } 593 i++; 594 } 595 596 this._invalidated = {}; 597 598 !this.is('valid') && this.enter('valid'); 599 }; 600 601 /** 602 * Gets the width of the view. 603 * @public 604 * @param {Owl.Width} [dimension=Owl.Width.Default] - The dimension to return. 605 * @returns {Number} - The width of the view in pixel. 606 */ 607 Owl.prototype.width = function(dimension) { 608 dimension = dimension || Owl.Width.Default; 609 switch (dimension) { 610 case Owl.Width.Inner: 611 case Owl.Width.Outer: 612 return this._width; 613 default: 614 return this._width - this.settings.stagePadding * 2 + this.settings.margin; 615 } 616 }; 617 618 /** 619 * Refreshes the carousel primarily for adaptive purposes. 620 * @public 621 */ 622 Owl.prototype.refresh = function() { 623 this.enter('refreshing'); 624 this.trigger('refresh'); 625 626 this.setup(); 627 628 this.optionsLogic(); 629 630 this.$element.addClass(this.options.refreshClass); 631 632 this.update(); 633 634 this.$element.removeClass(this.options.refreshClass); 635 636 this.leave('refreshing'); 637 this.trigger('refreshed'); 638 }; 639 640 /** 641 * Checks window `resize` event. 642 * @protected 643 */ 644 Owl.prototype.onThrottledResize = function() { 645 window.clearTimeout(this.resizeTimer); 646 this.resizeTimer = window.setTimeout(this._handlers.onResize, this.settings.responsiveRefreshRate); 647 }; 648 649 /** 650 * Checks window `resize` event. 651 * @protected 652 */ 653 Owl.prototype.onResize = function() { 654 if (!this._items.length) { 655 return false; 656 } 657 658 if (this._width === this.$element.width()) { 659 return false; 660 } 661 662 if (!this.$element.is(':visible')) { 663 return false; 664 } 665 666 this.enter('resizing'); 667 668 if (this.trigger('resize').isDefaultPrevented()) { 669 this.leave('resizing'); 670 return false; 671 } 672 673 this.invalidate('width'); 674 675 this.refresh(); 676 677 this.leave('resizing'); 678 this.trigger('resized'); 679 }; 680 681 /** 682 * Registers event handlers. 683 * @todo Check `msPointerEnabled` 684 * @todo #261 685 * @protected 686 */ 687 Owl.prototype.registerEventHandlers = function() { 688 if ($.support.transition) { 689 this.$stage.on($.support.transition.end + '.owl.core', $.proxy(this.onTransitionEnd, this)); 690 } 691 692 if (this.settings.responsive !== false) { 693 this.on(window, 'resize', this._handlers.onThrottledResize); 694 } 695 696 if (this.settings.mouseDrag) { 697 this.$element.addClass(this.options.dragClass); 698 this.$stage.on('mousedown.owl.core', $.proxy(this.onDragStart, this)); 699 this.$stage.on('dragstart.owl.core selectstart.owl.core', function() { return false }); 700 } 701 702 if (this.settings.touchDrag){ 703 this.$stage.on('touchstart.owl.core', $.proxy(this.onDragStart, this)); 704 this.$stage.on('touchcancel.owl.core', $.proxy(this.onDragEnd, this)); 705 } 706 }; 707 708 /** 709 * Handles `touchstart` and `mousedown` events. 710 * @todo Horizontal swipe threshold as option 711 * @todo #261 712 * @protected 713 * @param {Event} event - The event arguments. 714 */ 715 Owl.prototype.onDragStart = function(event) { 716 var stage = null; 717 718 if (event.which === 3) { 719 return; 720 } 721 722 if ($.support.transform) { 723 stage = this.$stage.css('transform').replace(/.*\(|\)| /g, '').split(','); 724 stage = { 725 x: stage[stage.length === 16 ? 12 : 4], 726 y: stage[stage.length === 16 ? 13 : 5] 727 }; 728 } else { 729 stage = this.$stage.position(); 730 stage = { 731 x: this.settings.rtl ? 732 stage.left + this.$stage.width() - this.width() + this.settings.margin : 733 stage.left, 734 y: stage.top 735 }; 736 } 737 738 if (this.is('animating')) { 739 $.support.transform ? this.animate(stage.x) : this.$stage.stop() 740 this.invalidate('position'); 741 } 742 743 this.$element.toggleClass(this.options.grabClass, event.type === 'mousedown'); 744 745 this.speed(0); 746 747 this._drag.time = new Date().getTime(); 748 this._drag.target = $(event.target); 749 this._drag.stage.start = stage; 750 this._drag.stage.current = stage; 751 this._drag.pointer = this.pointer(event); 752 753 $(document).on('mouseup.owl.core touchend.owl.core', $.proxy(this.onDragEnd, this)); 754 755 $(document).one('mousemove.owl.core touchmove.owl.core', $.proxy(function(event) { 756 var delta = this.difference(this._drag.pointer, this.pointer(event)); 757 758 $(document).on('mousemove.owl.core touchmove.owl.core', $.proxy(this.onDragMove, this)); 759 760 if (Math.abs(delta.x) < Math.abs(delta.y) && this.is('valid')) { 761 return; 762 } 763 764 event.preventDefault(); 765 766 this.enter('dragging'); 767 this.trigger('drag'); 768 }, this)); 769 }; 770 771 /** 772 * Handles the `touchmove` and `mousemove` events. 773 * @todo #261 774 * @protected 775 * @param {Event} event - The event arguments. 776 */ 777 Owl.prototype.onDragMove = function(event) { 778 var minimum = null, 779 maximum = null, 780 pull = null, 781 delta = this.difference(this._drag.pointer, this.pointer(event)), 782 stage = this.difference(this._drag.stage.start, delta); 783 784 if (!this.is('dragging')) { 785 return; 786 } 787 788 event.preventDefault(); 789 790 if (this.settings.loop) { 791 minimum = this.coordinates(this.minimum()); 792 maximum = this.coordinates(this.maximum() + 1) - minimum; 793 stage.x = (((stage.x - minimum) % maximum + maximum) % maximum) + minimum; 794 } else { 795 minimum = this.settings.rtl ? this.coordinates(this.maximum()) : this.coordinates(this.minimum()); 796 maximum = this.settings.rtl ? this.coordinates(this.minimum()) : this.coordinates(this.maximum()); 797 pull = this.settings.pullDrag ? -1 * delta.x / 5 : 0; 798 stage.x = Math.max(Math.min(stage.x, minimum + pull), maximum + pull); 799 } 800 801 this._drag.stage.current = stage; 802 803 this.animate(stage.x); 804 }; 805 806 /** 807 * Handles the `touchend` and `mouseup` events. 808 * @todo #261 809 * @todo Threshold for click event 810 * @protected 811 * @param {Event} event - The event arguments. 812 */ 813 Owl.prototype.onDragEnd = function(event) { 814 var delta = this.difference(this._drag.pointer, this.pointer(event)), 815 stage = this._drag.stage.current, 816 direction = delta.x > 0 ^ this.settings.rtl ? 'left' : 'right'; 817 818 $(document).off('.owl.core'); 819 820 this.$element.removeClass(this.options.grabClass); 821 822 if (delta.x !== 0 && this.is('dragging') || !this.is('valid')) { 823 this.speed(this.settings.dragEndSpeed || this.settings.smartSpeed); 824 this.current(this.closest(stage.x, delta.x !== 0 ? direction : this._drag.direction)); 825 this.invalidate('position'); 826 this.update(); 827 828 this._drag.direction = direction; 829 830 if (Math.abs(delta.x) > 3 || new Date().getTime() - this._drag.time > 300) { 831 this._drag.target.one('click.owl.core', function() { return false; }); 832 } 833 } 834 835 if (!this.is('dragging')) { 836 return; 837 } 838 839 this.leave('dragging'); 840 this.trigger('dragged'); 841 }; 842 843 /** 844 * Gets absolute position of the closest item for a coordinate. 845 * @todo Setting `freeDrag` makes `closest` not reusable. See #165. 846 * @protected 847 * @param {Number} coordinate - The coordinate in pixel. 848 * @param {String} direction - The direction to check for the closest item. Ether `left` or `right`. 849 * @return {Number} - The absolute position of the closest item. 850 */ 851 Owl.prototype.closest = function(coordinate, direction) { 852 var position = -1, 853 pull = 30, 854 width = this.width(), 855 coordinates = this.coordinates(); 856 857 if (!this.settings.freeDrag) { 858 // check closest item 859 $.each(coordinates, $.proxy(function(index, value) { 860 // on a left pull, check on current index 861 if (direction === 'left' && coordinate > value - pull && coordinate < value + pull) { 862 position = index; 863 // on a right pull, check on previous index 864 // to do so, subtract width from value and set position = index + 1 865 } else if (direction === 'right' && coordinate > value - width - pull && coordinate < value - width + pull) { 866 position = index + 1; 867 } else if (this.op(coordinate, '<', value) 868 && this.op(coordinate, '>', coordinates[index + 1] || value - width)) { 869 position = direction === 'left' ? index + 1 : index; 870 } 871 return position === -1; 872 }, this)); 873 } 874 875 if (!this.settings.loop) { 876 // non loop boundries 877 if (this.op(coordinate, '>', coordinates[this.minimum()])) { 878 position = coordinate = this.minimum(); 879 } else if (this.op(coordinate, '<', coordinates[this.maximum()])) { 880 position = coordinate = this.maximum(); 881 } 882 } 883 884 return position; 885 }; 886 887 /** 888 * Animates the stage. 889 * @todo #270 890 * @public 891 * @param {Number} coordinate - The coordinate in pixels. 892 */ 893 Owl.prototype.animate = function(coordinate) { 894 var animate = this.speed() > 0; 895 896 this.is('animating') && this.onTransitionEnd(); 897 898 if (animate) { 899 this.enter('animating'); 900 this.trigger('translate'); 901 } 902 903 if ($.support.transform3d && $.support.transition) { 904 this.$stage.css({ 905 transform: 'translate3d(' + coordinate + 'px,0px,0px)', 906 transition: (this.speed() / 1000) + 's' 907 }); 908 } else if (animate) { 909 this.$stage.animate({ 910 left: coordinate + 'px' 911 }, this.speed(), this.settings.fallbackEasing, $.proxy(this.onTransitionEnd, this)); 912 } else { 913 this.$stage.css({ 914 left: coordinate + 'px' 915 }); 916 } 917 }; 918 919 /** 920 * Checks whether the carousel is in a specific state or not. 921 * @param {String} state - The state to check. 922 * @returns {Boolean} - The flag which indicates if the carousel is busy. 923 */ 924 Owl.prototype.is = function(state) { 925 return this._states.current[state] && this._states.current[state] > 0; 926 }; 927 928 /** 929 * Sets the absolute position of the current item. 930 * @public 931 * @param {Number} [position] - The new absolute position or nothing to leave it unchanged. 932 * @returns {Number} - The absolute position of the current item. 933 */ 934 Owl.prototype.current = function(position) { 935 if (position === undefined) { 936 return this._current; 937 } 938 939 if (this._items.length === 0) { 940 return undefined; 941 } 942 943 position = this.normalize(position); 944 945 if (this._current !== position) { 946 var event = this.trigger('change', { property: { name: 'position', value: position } }); 947 948 if (event.data !== undefined) { 949 position = this.normalize(event.data); 950 } 951 952 this._current = position; 953 954 this.invalidate('position'); 955 956 this.trigger('changed', { property: { name: 'position', value: this._current } }); 957 } 958 959 return this._current; 960 }; 961 962 /** 963 * Invalidates the given part of the update routine. 964 * @param {String} [part] - The part to invalidate. 965 * @returns {Array.<String>} - The invalidated parts. 966 */ 967 Owl.prototype.invalidate = function(part) { 968 if ($.type(part) === 'string') { 969 this._invalidated[part] = true; 970 this.is('valid') && this.leave('valid'); 971 } 972 return $.map(this._invalidated, function(v, i) { return i }); 973 }; 974 975 /** 976 * Resets the absolute position of the current item. 977 * @public 978 * @param {Number} position - The absolute position of the new item. 979 */ 980 Owl.prototype.reset = function(position) { 981 position = this.normalize(position); 982 983 if (position === undefined) { 984 return; 985 } 986 987 this._speed = 0; 988 this._current = position; 989 990 this.suppress([ 'translate', 'translated' ]); 991 992 this.animate(this.coordinates(position)); 993 994 this.release([ 'translate', 'translated' ]); 995 }; 996 997 /** 998 * Normalizes an absolute or a relative position of an item. 999 * @public 1000 * @param {Number} position - The absolute or relative position to normalize. 1001 * @param {Boolean} [relative=false] - Whether the given position is relative or not. 1002 * @returns {Number} - The normalized position. 1003 */ 1004 Owl.prototype.normalize = function(position, relative) { 1005 var n = this._items.length, 1006 m = relative ? 0 : this._clones.length; 1007 1008 if (!this.isNumeric(position) || n < 1) { 1009 position = undefined; 1010 } else if (position < 0 || position >= n + m) { 1011 position = ((position - m / 2) % n + n) % n + m / 2; 1012 } 1013 1014 return position; 1015 }; 1016 1017 /** 1018 * Converts an absolute position of an item into a relative one. 1019 * @public 1020 * @param {Number} position - The absolute position to convert. 1021 * @returns {Number} - The converted position. 1022 */ 1023 Owl.prototype.relative = function(position) { 1024 position -= this._clones.length / 2; 1025 return this.normalize(position, true); 1026 }; 1027 1028 /** 1029 * Gets the maximum position for the current item. 1030 * @public 1031 * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position. 1032 * @returns {Number} 1033 */ 1034 Owl.prototype.maximum = function(relative) { 1035 var settings = this.settings, 1036 maximum = this._coordinates.length, 1037 iterator, 1038 reciprocalItemsWidth, 1039 elementWidth; 1040 1041 if (settings.loop) { 1042 maximum = this._clones.length / 2 + this._items.length - 1; 1043 } else if (settings.autoWidth || settings.merge) { 1044 iterator = this._items.length; 1045 reciprocalItemsWidth = this._items[--iterator].width(); 1046 elementWidth = this.$element.width(); 1047 while (iterator--) { 1048 reciprocalItemsWidth += this._items[iterator].width() + this.settings.margin; 1049 if (reciprocalItemsWidth > elementWidth) { 1050 break; 1051 } 1052 } 1053 maximum = iterator + 1; 1054 } else if (settings.center) { 1055 maximum = this._items.length - 1; 1056 } else { 1057 maximum = this._items.length - settings.items; 1058 } 1059 1060 if (relative) { 1061 maximum -= this._clones.length / 2; 1062 } 1063 1064 return Math.max(maximum, 0); 1065 }; 1066 1067 /** 1068 * Gets the minimum position for the current item. 1069 * @public 1070 * @param {Boolean} [relative=false] - Whether to return an absolute position or a relative position. 1071 * @returns {Number} 1072 */ 1073 Owl.prototype.minimum = function(relative) { 1074 return relative ? 0 : this._clones.length / 2; 1075 }; 1076 1077 /** 1078 * Gets an item at the specified relative position. 1079 * @public 1080 * @param {Number} [position] - The relative position of the item. 1081 * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given. 1082 */ 1083 Owl.prototype.items = function(position) { 1084 if (position === undefined) { 1085 return this._items.slice(); 1086 } 1087 1088 position = this.normalize(position, true); 1089 return this._items[position]; 1090 }; 1091 1092 /** 1093 * Gets an item at the specified relative position. 1094 * @public 1095 * @param {Number} [position] - The relative position of the item. 1096 * @return {jQuery|Array.<jQuery>} - The item at the given position or all items if no position was given. 1097 */ 1098 Owl.prototype.mergers = function(position) { 1099 if (position === undefined) { 1100 return this._mergers.slice(); 1101 } 1102 1103 position = this.normalize(position, true); 1104 return this._mergers[position]; 1105 }; 1106 1107 /** 1108 * Gets the absolute positions of clones for an item. 1109 * @public 1110 * @param {Number} [position] - The relative position of the item. 1111 * @returns {Array.<Number>} - The absolute positions of clones for the item or all if no position was given. 1112 */ 1113 Owl.prototype.clones = function(position) { 1114 var odd = this._clones.length / 2, 1115 even = odd + this._items.length, 1116 map = function(index) { return index % 2 === 0 ? even + index / 2 : odd - (index + 1) / 2 }; 1117 1118 if (position === undefined) { 1119 return $.map(this._clones, function(v, i) { return map(i) }); 1120 } 1121 1122 return $.map(this._clones, function(v, i) { return v === position ? map(i) : null }); 1123 }; 1124 1125 /** 1126 * Sets the current animation speed. 1127 * @public 1128 * @param {Number} [speed] - The animation speed in milliseconds or nothing to leave it unchanged. 1129 * @returns {Number} - The current animation speed in milliseconds. 1130 */ 1131 Owl.prototype.speed = function(speed) { 1132 if (speed !== undefined) { 1133 this._speed = speed; 1134 } 1135 1136 return this._speed; 1137 }; 1138 1139 /** 1140 * Gets the coordinate of an item. 1141 * @todo The name of this method is missleanding. 1142 * @public 1143 * @param {Number} position - The absolute position of the item within `minimum()` and `maximum()`. 1144 * @returns {Number|Array.<Number>} - The coordinate of the item in pixel or all coordinates. 1145 */ 1146 Owl.prototype.coordinates = function(position) { 1147 var multiplier = 1, 1148 newPosition = position - 1, 1149 coordinate; 1150 1151 if (position === undefined) { 1152 return $.map(this._coordinates, $.proxy(function(coordinate, index) { 1153 return this.coordinates(index); 1154 }, this)); 1155 } 1156 1157 if (this.settings.center) { 1158 if (this.settings.rtl) { 1159 multiplier = -1; 1160 newPosition = position + 1; 1161 } 1162 1163 coordinate = this._coordinates[position]; 1164 coordinate += (this.width() - coordinate + (this._coordinates[newPosition] || 0)) / 2 * multiplier; 1165 } else { 1166 coordinate = this._coordinates[newPosition] || 0; 1167 } 1168 1169 coordinate = Math.ceil(coordinate); 1170 1171 return coordinate; 1172 }; 1173 1174 /** 1175 * Calculates the speed for a translation. 1176 * @protected 1177 * @param {Number} from - The absolute position of the start item. 1178 * @param {Number} to - The absolute position of the target item. 1179 * @param {Number} [factor=undefined] - The time factor in milliseconds. 1180 * @returns {Number} - The time in milliseconds for the translation. 1181 */ 1182 Owl.prototype.duration = function(from, to, factor) { 1183 if (factor === 0) { 1184 return 0; 1185 } 1186 1187 return Math.min(Math.max(Math.abs(to - from), 1), 6) * Math.abs((factor || this.settings.smartSpeed)); 1188 }; 1189 1190 /** 1191 * Slides to the specified item. 1192 * @public 1193 * @param {Number} position - The position of the item. 1194 * @param {Number} [speed] - The time in milliseconds for the transition. 1195 */ 1196 Owl.prototype.to = function(position, speed) { 1197 var current = this.current(), 1198 revert = null, 1199 distance = position - this.relative(current), 1200 direction = (distance > 0) - (distance < 0), 1201 items = this._items.length, 1202 minimum = this.minimum(), 1203 maximum = this.maximum(); 1204 1205 if (this.settings.loop) { 1206 if (!this.settings.rewind && Math.abs(distance) > items / 2) { 1207 distance += direction * -1 * items; 1208 } 1209 1210 position = current + distance; 1211 revert = ((position - minimum) % items + items) % items + minimum; 1212 1213 if (revert !== position && revert - distance <= maximum && revert - distance > 0) { 1214 current = revert - distance; 1215 position = revert; 1216 this.reset(current); 1217 } 1218 } else if (this.settings.rewind) { 1219 maximum += 1; 1220 position = (position % maximum + maximum) % maximum; 1221 } else { 1222 position = Math.max(minimum, Math.min(maximum, position)); 1223 } 1224 1225 this.speed(this.duration(current, position, speed)); 1226 this.current(position); 1227 1228 if (this.$element.is(':visible')) { 1229 this.update(); 1230 } 1231 }; 1232 1233 /** 1234 * Slides to the next item. 1235 * @public 1236 * @param {Number} [speed] - The time in milliseconds for the transition. 1237 */ 1238 Owl.prototype.next = function(speed) { 1239 speed = speed || false; 1240 this.to(this.relative(this.current()) + 1, speed); 1241 }; 1242 1243 /** 1244 * Slides to the previous item. 1245 * @public 1246 * @param {Number} [speed] - The time in milliseconds for the transition. 1247 */ 1248 Owl.prototype.prev = function(speed) { 1249 speed = speed || false; 1250 this.to(this.relative(this.current()) - 1, speed); 1251 }; 1252 1253 /** 1254 * Handles the end of an animation. 1255 * @protected 1256 * @param {Event} event - The event arguments. 1257 */ 1258 Owl.prototype.onTransitionEnd = function(event) { 1259 1260 // if css2 animation then event object is undefined 1261 if (event !== undefined) { 1262 event.stopPropagation(); 1263 1264 // Catch only owl-stage transitionEnd event 1265 if ((event.target || event.srcElement || event.originalTarget) !== this.$stage.get(0)) { 1266 return false; 1267 } 1268 } 1269 1270 this.leave('animating'); 1271 this.trigger('translated'); 1272 }; 1273 1274 /** 1275 * Gets viewport width. 1276 * @protected 1277 * @return {Number} - The width in pixel. 1278 */ 1279 Owl.prototype.viewport = function() { 1280 var width; 1281 if (this.options.responsiveBaseElement !== window) { 1282 width = $(this.options.responsiveBaseElement).width(); 1283 } else if (window.innerWidth) { 1284 width = window.innerWidth; 1285 } else if (document.documentElement && document.documentElement.clientWidth) { 1286 width = document.documentElement.clientWidth; 1287 } else { 1288 console.warn('Can not detect viewport width.'); 1289 } 1290 return width; 1291 }; 1292 1293 /** 1294 * Replaces the current content. 1295 * @public 1296 * @param {HTMLElement|jQuery|String} content - The new content. 1297 */ 1298 Owl.prototype.replace = function(content) { 1299 this.$stage.empty(); 1300 this._items = []; 1301 1302 if (content) { 1303 content = (content instanceof jQuery) ? content : $(content); 1304 } 1305 1306 if (this.settings.nestedItemSelector) { 1307 content = content.find('.' + this.settings.nestedItemSelector); 1308 } 1309 1310 content.filter(function() { 1311 return this.nodeType === 1; 1312 }).each($.proxy(function(index, item) { 1313 item = this.prepare(item); 1314 this.$stage.append(item); 1315 this._items.push(item); 1316 this._mergers.push(item.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1); 1317 }, this)); 1318 1319 this.reset(this.isNumeric(this.settings.startPosition) ? this.settings.startPosition : 0); 1320 1321 this.invalidate('items'); 1322 }; 1323 1324 /** 1325 * Adds an item. 1326 * @todo Use `item` instead of `content` for the event arguments. 1327 * @public 1328 * @param {HTMLElement|jQuery|String} content - The item content to add. 1329 * @param {Number} [position] - The relative position at which to insert the item otherwise the item will be added to the end. 1330 */ 1331 Owl.prototype.add = function(content, position) { 1332 var current = this.relative(this._current); 1333 1334 position = position === undefined ? this._items.length : this.normalize(position, true); 1335 content = content instanceof jQuery ? content : $(content); 1336 1337 this.trigger('add', { content: content, position: position }); 1338 1339 content = this.prepare(content); 1340 1341 if (this._items.length === 0 || position === this._items.length) { 1342 this._items.length === 0 && this.$stage.append(content); 1343 this._items.length !== 0 && this._items[position - 1].after(content); 1344 this._items.push(content); 1345 this._mergers.push(content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1); 1346 } else { 1347 this._items[position].before(content); 1348 this._items.splice(position, 0, content); 1349 this._mergers.splice(position, 0, content.find('[data-merge]').addBack('[data-merge]').attr('data-merge') * 1 || 1); 1350 } 1351 1352 this._items[current] && this.reset(this._items[current].index()); 1353 1354 this.invalidate('items'); 1355 1356 this.trigger('added', { content: content, position: position }); 1357 }; 1358 1359 /** 1360 * Removes an item by its position. 1361 * @todo Use `item` instead of `content` for the event arguments. 1362 * @public 1363 * @param {Number} position - The relative position of the item to remove. 1364 */ 1365 Owl.prototype.remove = function(position) { 1366 position = this.normalize(position, true); 1367 1368 if (position === undefined) { 1369 return; 1370 } 1371 1372 this.trigger('remove', { content: this._items[position], position: position }); 1373 1374 this._items[position].remove(); 1375 this._items.splice(position, 1); 1376 this._mergers.splice(position, 1); 1377 1378 this.invalidate('items'); 1379 1380 this.trigger('removed', { content: null, position: position }); 1381 }; 1382 1383 /** 1384 * Preloads images with auto width. 1385 * @todo Replace by a more generic approach 1386 * @protected 1387 */ 1388 Owl.prototype.preloadAutoWidthImages = function(images) { 1389 images.each($.proxy(function(i, element) { 1390 this.enter('pre-loading'); 1391 element = $(element); 1392 $(new Image()).one('load', $.proxy(function(e) { 1393 element.attr('src', e.target.src); 1394 element.css('opacity', 1); 1395 this.leave('pre-loading'); 1396 !this.is('pre-loading') && !this.is('initializing') && this.refresh(); 1397 }, this)).attr('src', element.attr('src') || element.attr('data-src') || element.attr('data-src-retina')); 1398 }, this)); 1399 }; 1400 1401 /** 1402 * Destroys the carousel. 1403 * @public 1404 */ 1405 Owl.prototype.destroy = function() { 1406 1407 this.$element.off('.owl.core'); 1408 this.$stage.off('.owl.core'); 1409 $(document).off('.owl.core'); 1410 1411 if (this.settings.responsive !== false) { 1412 window.clearTimeout(this.resizeTimer); 1413 this.off(window, 'resize', this._handlers.onThrottledResize); 1414 } 1415 1416 for (var i in this._plugins) { 1417 this._plugins[i].destroy(); 1418 } 1419 1420 this.$stage.children('.cloned').remove(); 1421 1422 this.$stage.unwrap(); 1423 this.$stage.children().contents().unwrap(); 1424 this.$stage.children().unwrap(); 1425 1426 this.$element 1427 .removeClass(this.options.refreshClass) 1428 .removeClass(this.options.loadingClass) 1429 .removeClass(this.options.loadedClass) 1430 .removeClass(this.options.rtlClass) 1431 .removeClass(this.options.dragClass) 1432 .removeClass(this.options.grabClass) 1433 .attr('class', this.$element.attr('class').replace(new RegExp(this.options.responsiveClass + '-\\S+\\s', 'g'), '')) 1434 .removeData('owl.carousel'); 1435 }; 1436 1437 /** 1438 * Operators to calculate right-to-left and left-to-right. 1439 * @protected 1440 * @param {Number} [a] - The left side operand. 1441 * @param {String} [o] - The operator. 1442 * @param {Number} [b] - The right side operand. 1443 */ 1444 Owl.prototype.op = function(a, o, b) { 1445 var rtl = this.settings.rtl; 1446 switch (o) { 1447 case '<': 1448 return rtl ? a > b : a < b; 1449 case '>': 1450 return rtl ? a < b : a > b; 1451 case '>=': 1452 return rtl ? a <= b : a >= b; 1453 case '<=': 1454 return rtl ? a >= b : a <= b; 1455 default: 1456 break; 1457 } 1458 }; 1459 1460 /** 1461 * Attaches to an internal event. 1462 * @protected 1463 * @param {HTMLElement} element - The event source. 1464 * @param {String} event - The event name. 1465 * @param {Function} listener - The event handler to attach. 1466 * @param {Boolean} capture - Wether the event should be handled at the capturing p
vendor: 7,017 bytes, lines 1466-1710
1466hase or not. 1467 */ 1468 Owl.prototype.on = function(element, event, listener, capture) { 1469 if (element.addEventListener) { 1470 element.addEventListener(event, listener, capture); 1471 } else if (element.attachEvent) { 1472 element.attachEvent('on' + event, listener); 1473 } 1474 }; 1475 1476 /** 1477 * Detaches from an internal event. 1478 * @protected 1479 * @param {HTMLElement} element - The event source. 1480 * @param {String} event - The event name. 1481 * @param {Function} listener - The attached event handler to detach. 1482 * @param {Boolean} capture - Wether the attached event handler was registered as a capturing listener or not. 1483 */ 1484 Owl.prototype.off = function(element, event, listener, capture) { 1485 if (element.removeEventListener) { 1486 element.removeEventListener(event, listener, capture); 1487 } else if (element.detachEvent) { 1488 element.detachEvent('on' + event, listener); 1489 } 1490 }; 1491 1492 /** 1493 * Triggers a public event. 1494 * @todo Remove `status`, `relatedTarget` should be used instead. 1495 * @protected 1496 * @param {String} name - The event name. 1497 * @param {*} [data=null] - The event data. 1498 * @param {String} [namespace=carousel] - The event namespace. 1499 * @param {String} [state] - The state which is associated with the event. 1500 * @param {Boolean} [enter=false] - Indicates if the call enters the specified state or not. 1501 * @returns {Event} - The event arguments. 1502 */ 1503 Owl.prototype.trigger = function(name, data, namespace, state, enter) { 1504 var status = { 1505 item: { count: this._items.length, index: this.current() } 1506 }, handler = $.camelCase( 1507 $.grep([ 'on', name, namespace ], function(v) { return v }) 1508 .join('-').toLowerCase() 1509 ), event = $.Event( 1510 [ name, 'owl', namespace || 'carousel' ].join('.').toLowerCase(), 1511 $.extend({ relatedTarget: this }, status, data) 1512 ); 1513 1514 if (!this._supress[name]) { 1515 $.each(this._plugins, function(name, plugin) { 1516 if (plugin.onTrigger) { 1517 plugin.onTrigger(event); 1518 } 1519 }); 1520 1521 this.register({ type: Owl.Type.Event, name: name }); 1522 this.$element.trigger(event); 1523 1524 if (this.settings && typeof this.settings[handler] === 'function') { 1525 this.settings[handler].call(this, event); 1526 } 1527 } 1528 1529 return event; 1530 }; 1531 1532 /** 1533 * Enters a state. 1534 * @param name - The state name. 1535 */ 1536 Owl.prototype.enter = function(name) { 1537 $.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) { 1538 if (this._states.current[name] === undefined) { 1539 this._states.current[name] = 0; 1540 } 1541 1542 this._states.current[name]++; 1543 }, this)); 1544 }; 1545 1546 /** 1547 * Leaves a state. 1548 * @param name - The state name. 1549 */ 1550 Owl.prototype.leave = function(name) { 1551 $.each([ name ].concat(this._states.tags[name] || []), $.proxy(function(i, name) { 1552 this._states.current[name]--; 1553 }, this)); 1554 }; 1555 1556 /** 1557 * Registers an event or state. 1558 * @public 1559 * @param {Object} object - The event or state to register. 1560 */ 1561 Owl.prototype.register = function(object) { 1562 if (object.type === Owl.Type.Event) { 1563 if (!$.event.special[object.name]) { 1564 $.event.special[object.name] = {}; 1565 } 1566 1567 if (!$.event.special[object.name].owl) { 1568 var _default = $.event.special[object.name]._default; 1569 $.event.special[object.name]._default = function(e) { 1570 if (_default && _default.apply && (!e.namespace || e.namespace.indexOf('owl') === -1)) { 1571 return _default.apply(this, arguments); 1572 } 1573 return e.namespace && e.namespace.indexOf('owl') > -1; 1574 }; 1575 $.event.special[object.name].owl = true; 1576 } 1577 } else if (object.type === Owl.Type.State) { 1578 if (!this._states.tags[object.name]) { 1579 this._states.tags[object.name] = object.tags; 1580 } else { 1581 this._states.tags[object.name] = this._states.tags[object.name].concat(object.tags); 1582 } 1583 1584 this._states.tags[object.name] = $.grep(this._states.tags[object.name], $.proxy(function(tag, i) { 1585 return $.inArray(tag, this._states.tags[object.name]) === i; 1586 }, this)); 1587 } 1588 }; 1589 1590 /** 1591 * Suppresses events. 1592 * @protected 1593 * @param {Array.<String>} events - The events to suppress. 1594 */ 1595 Owl.prototype.suppress = function(events) { 1596 $.each(events, $.proxy(function(index, event) { 1597 this._supress[event] = true; 1598 }, this)); 1599 }; 1600 1601 /** 1602 * Releases suppressed events. 1603 * @protected 1604 * @param {Array.<String>} events - The events to release. 1605 */ 1606 Owl.prototype.release = function(events) { 1607 $.each(events, $.proxy(function(index, event) { 1608 delete this._supress[event]; 1609 }, this)); 1610 }; 1611 1612 /** 1613 * Gets unified pointer coordinates from event. 1614 * @todo #261 1615 * @protected 1616 * @param {Event} - The `mousedown` or `touchstart` event. 1617 * @returns {Object} - Contains `x` and `y` coordinates of current pointer position. 1618 */ 1619 Owl.prototype.pointer = function(event) { 1620 var result = { x: null, y: null }; 1621 1622 event = event.originalEvent || event || window.event; 1623 1624 event = event.touches && event.touches.length ? 1625 event.touches[0] : event.changedTouches && event.changedTouches.length ? 1626 event.changedTouches[0] : event; 1627 1628 if (event.pageX) { 1629 result.x = event.pageX; 1630 result.y = event.pageY; 1631 } else { 1632 result.x = event.clientX; 1633 result.y = event.clientY; 1634 } 1635 1636 return result; 1637 }; 1638 1639 /** 1640 * Determines if the input is a Number or something that can be coerced to a Number 1641 * @protected 1642 * @param {Number|String|Object|Array|Boolean|RegExp|Function|Symbol} - The input to be tested 1643 * @returns {Boolean} - An indication if the input is a Number or can be coerced to a Number 1644 */ 1645 Owl.prototype.isNumeric = function(number) { 1646 return !isNaN(parseFloat(number)); 1647 }; 1648 1649 /** 1650 * Gets the difference of two vectors. 1651 * @todo #261 1652 * @protected 1653 * @param {Object} - The first vector. 1654 * @param {Object} - The second vector. 1655 * @returns {Object} - The difference. 1656 */ 1657 Owl.prototype.difference = function(first, second) { 1658 return { 1659 x: first.x - second.x, 1660 y: first.y - second.y 1661 }; 1662 }; 1663 1664 /** 1665 * The jQuery Plugin for the Owl Carousel 1666 * @todo Navigation plugin `next` and `prev` 1667 * @public 1668 */ 1669 $.fn.owlCarousel = function(option) { 1670 var args = Array.prototype.slice.call(arguments, 1); 1671 1672 return this.each(function() { 1673 var $this = $(this), 1674 data = $this.data('owl.carousel'); 1675 1676 if (!data) { 1677 data = new Owl(this, typeof option == 'object' && option); 1678 $this.data('owl.carousel', data); 1679 1680 $.each([ 1681 'next', 'prev', 'to', 'destroy', 'refresh', 'replace', 'add', 'remove' 1682 ], function(i, event) { 1683 data.register({ type: Owl.Type.Event, name: event }); 1684 data.$element.on(event + '.owl.carousel.core', $.proxy(function(e) { 1685 if (e.namespace && e.relatedTarget !== this) { 1686 this.suppress([ event ]); 1687 data[event].apply(this, [].slice.call(arguments, 1)); 1688 this.release([ event ]); 1689 } 1690 }, data)); 1691 }); 1692 } 1693 1694 if (typeof option == 'string' && option.charAt(0) !== '_') { 1695 data[option].apply(data, args); 1696 } 1697 }); 1698 }; 1699 1700 /** 1701 * The constructor for the jQuery Plugin 1702 * @public 1703 */ 1704 $.fn.owlCarousel.Constructor = Owl; 1705 1706})(window.Zepto || window.jQuery, window, document); 1707 1708/** 1709 * AutoRefresh Plugin 1710 * @version 2.
vendor: 8,226 bytes, lines 1710-2058
17101.0 1711 * @author Artus Kolanowski 1712 * @author David Deutsch 1713 * @license The MIT License (MIT) 1714 */ 1715;(function($, window, document, undefined) { 1716 1717 /** 1718 * Creates the auto refresh plugin. 1719 * @class The Auto Refresh Plugin 1720 * @param {Owl} carousel - The Owl Carousel 1721 */ 1722 var AutoRefresh = function(carousel) { 1723 /** 1724 * Reference to the core. 1725 * @protected 1726 * @type {Owl} 1727 */ 1728 this._core = carousel; 1729 1730 /** 1731 * Refresh interval. 1732 * @protected 1733 * @type {number} 1734 */ 1735 this._interval = null; 1736 1737 /** 1738 * Whether the element is currently visible or not. 1739 * @protected 1740 * @type {Boolean} 1741 */ 1742 this._visible = null; 1743 1744 /** 1745 * All event handlers. 1746 * @protected 1747 * @type {Object} 1748 */ 1749 this._handlers = { 1750 'initialized.owl.carousel': $.proxy(function(e) { 1751 if (e.namespace && this._core.settings.autoRefresh) { 1752 this.watch(); 1753 } 1754 }, this) 1755 }; 1756 1757 // set default options 1758 this._core.options = $.extend({}, AutoRefresh.Defaults, this._core.options); 1759 1760 // register event handlers 1761 this._core.$element.on(this._handlers); 1762 }; 1763 1764 /** 1765 * Default options. 1766 * @public 1767 */ 1768 AutoRefresh.Defaults = { 1769 autoRefresh: true, 1770 autoRefreshInterval: 500 1771 }; 1772 1773 /** 1774 * Watches the element. 1775 */ 1776 AutoRefresh.prototype.watch = function() { 1777 if (this._interval) { 1778 return; 1779 } 1780 1781 this._visible = this._core.$element.is(':visible'); 1782 this._interval = window.setInterval($.proxy(this.refresh, this), this._core.settings.autoRefreshInterval); 1783 }; 1784 1785 /** 1786 * Refreshes the element. 1787 */ 1788 AutoRefresh.prototype.refresh = function() { 1789 if (this._core.$element.is(':visible') === this._visible) { 1790 return; 1791 } 1792 1793 this._visible = !this._visible; 1794 1795 this._core.$element.toggleClass('owl-hidden', !this._visible); 1796 1797 this._visible && (this._core.invalidate('width') && this._core.refresh()); 1798 }; 1799 1800 /** 1801 * Destroys the plugin. 1802 */ 1803 AutoRefresh.prototype.destroy = function() { 1804 var handler, property; 1805 1806 window.clearInterval(this._interval); 1807 1808 for (handler in this._handlers) { 1809 this._core.$element.off(handler, this._handlers[handler]); 1810 } 1811 for (property in Object.getOwnPropertyNames(this)) { 1812 typeof this[property] != 'function' && (this[property] = null); 1813 } 1814 }; 1815 1816 $.fn.owlCarousel.Constructor.Plugins.AutoRefresh = AutoRefresh; 1817 1818})(window.Zepto || window.jQuery, window, document); 1819 1820/** 1821 * Lazy Plugin 1822 * @version 2.1.0 1823 * @author Bartosz Wojciechowski 1824 * @author David Deutsch 1825 * @license The MIT License (MIT) 1826 */ 1827;(function($, window, document, undefined) { 1828 1829 /** 1830 * Creates the lazy plugin. 1831 * @class The Lazy Plugin 1832 * @param {Owl} carousel - The Owl Carousel 1833 */ 1834 var Lazy = function(carousel) { 1835 1836 /** 1837 * Reference to the core. 1838 * @protected 1839 * @type {Owl} 1840 */ 1841 this._core = carousel; 1842 1843 /** 1844 * Already loaded items. 1845 * @protected 1846 * @type {Array.<jQuery>} 1847 */ 1848 this._loaded = []; 1849 1850 /** 1851 * Event handlers. 1852 * @protected 1853 * @type {Object} 1854 */ 1855 this._handlers = { 1856 'initialized.owl.carousel change.owl.carousel resized.owl.carousel': $.proxy(function(e) { 1857 if (!e.namespace) { 1858 return; 1859 } 1860 1861 if (!this._core.settings || !this._core.settings.lazyLoad) { 1862 return; 1863 } 1864 1865 if ((e.property && e.property.name == 'position') || e.type == 'initialized') { 1866 var settings = this._core.settings, 1867 n = (settings.center && Math.ceil(settings.items / 2) || settings.items), 1868 i = ((settings.center && n * -1) || 0), 1869 position = (e.property && e.property.value !== undefined ? e.property.value : this._core.current()) + i, 1870 clones = this._core.clones().length, 1871 load = $.proxy(function(i, v) { this.load(v) }, this); 1872 1873 while (i++ < n) { 1874 this.load(clones / 2 + this._core.relative(position)); 1875 clones && $.each(this._core.clones(this._core.relative(position)), load); 1876 position++; 1877 } 1878 } 1879 }, this) 1880 }; 1881 1882 // set the default options 1883 this._core.options = $.extend({}, Lazy.Defaults, this._core.options); 1884 1885 // register event handler 1886 this._core.$element.on(this._handlers); 1887 }; 1888 1889 /** 1890 * Default options. 1891 * @public 1892 */ 1893 Lazy.Defaults = { 1894 lazyLoad: false 1895 }; 1896 1897 /** 1898 * Loads all resources of an item at the specified position. 1899 * @param {Number} position - The absolute position of the item. 1900 * @protected 1901 */ 1902 Lazy.prototype.load = function(position) { 1903 var $item = this._core.$stage.children().eq(position), 1904 $elements = $item && $item.find('.owl-lazy'); 1905 1906 if (!$elements || $.inArray($item.get(0), this._loaded) > -1) { 1907 return; 1908 } 1909 1910 $elements.each($.proxy(function(index, element) { 1911 var $element = $(element), image, 1912 url = (window.devicePixelRatio > 1 && $element.attr('data-src-retina')) || $element.attr('data-src'); 1913 1914 this._core.trigger('load', { element: $element, url: url }, 'lazy'); 1915 1916 if ($element.is('img')) { 1917 $element.one('load.owl.lazy', $.proxy(function() { 1918 $element.css('opacity', 1); 1919 this._core.trigger('loaded', { element: $element, url: url }, 'lazy'); 1920 }, this)).attr('src', url); 1921 } else { 1922 image = new Image(); 1923 image.onload = $.proxy(function() { 1924 $element.css({ 1925 'background-image': 'url("' + url + '")', 1926 'opacity': '1' 1927 }); 1928 this._core.trigger('loaded', { element: $element, url: url }, 'lazy'); 1929 }, this); 1930 image.src = url; 1931 } 1932 }, this)); 1933 1934 this._loaded.push($item.get(0)); 1935 }; 1936 1937 /** 1938 * Destroys the plugin. 1939 * @public 1940 */ 1941 Lazy.prototype.destroy = function() { 1942 var handler, property; 1943 1944 for (handler in this.handlers) { 1945 this._core.$element.off(handler, this.handlers[handler]); 1946 } 1947 for (property in Object.getOwnPropertyNames(this)) { 1948 typeof this[property] != 'function' && (this[property] = null); 1949 } 1950 }; 1951 1952 $.fn.owlCarousel.Constructor.Plugins.Lazy = Lazy; 1953 1954})(window.Zepto || window.jQuery, window, document); 1955 1956/** 1957 * AutoHeight Plugin 1958 * @version 2.1.0 1959 * @author Bartosz Wojciechowski 1960 * @author David Deutsch 1961 * @license The MIT License (MIT) 1962 */ 1963;(function($, window, document, undefined) { 1964 1965 /** 1966 * Creates the auto height plugin. 1967 * @class The Auto Height Plugin 1968 * @param {Owl} carousel - The Owl Carousel 1969 */ 1970 var AutoHeight = function(carousel) { 1971 /** 1972 * Reference to the core. 1973 * @protected 1974 * @type {Owl} 1975 */ 1976 this._core = carousel; 1977 1978 /** 1979 * All event handlers. 1980 * @protected 1981 * @type {Object} 1982 */ 1983 this._handlers = { 1984 'initialized.owl.carousel refreshed.owl.carousel': $.proxy(function(e) { 1985 if (e.namespace && this._core.settings.autoHeight) { 1986 this.update(); 1987 } 1988 }, this), 1989 'changed.owl.carousel': $.proxy(function(e) { 1990 if (e.namespace && this._core.settings.autoHeight && e.property.name == 'position'){ 1991 this.update(); 1992 } 1993 }, this), 1994 'loaded.owl.lazy': $.proxy(function(e) { 1995 if (e.namespace && this._core.settings.autoHeight 1996 && e.element.closest('.' + this._core.settings.itemClass).index() === this._core.current()) { 1997 this.update(); 1998 } 1999 }, this) 2000 }; 2001 2002 // set default options 2003 this._core.options = $.extend({}, AutoHeight.Defaults, this._core.options); 2004 2005 // register event handlers 2006 this._core.$element.on(this._handlers); 2007 }; 2008 2009 /** 2010 * Default options. 2011 * @public 2012 */ 2013 AutoHeight.Defaults = { 2014 autoHeight: false, 2015 autoHeightClass: 'owl-height' 2016 }; 2017 2018 /** 2019 * Updates the view. 2020 */ 2021 AutoHeight.prototype.update = function() { 2022 var start = this._core._current, 2023 end = start + this._core.settings.items, 2024 visible = this._core.$stage.children().toArray().slice(start, end), 2025 heights = [], 2026 maxheight = 0; 2027 2028 $.each(visible, function(index, item) { 2029 heights.push($(item).height()); 2030 }); 2031 2032 maxheight = Math.max.apply(null, heights); 2033 2034 this._core.$stage.parent() 2035 .height(maxheight) 2036 .addClass(this._core.settings.autoHeightClass); 2037 }; 2038 2039 AutoHeight.prototype.destroy = function() { 2040 var handler, property; 2041 2042 for (handler in this._handlers) { 2043 this._core.$element.off(handler, this._handlers[handler]); 2044 } 2045 for (property in Object.getOwnPropertyNames(this)) { 2046 typeof this[property] != 'function' && (this[property] = null); 2047 } 2048 }; 2049 2050 $.fn.owlCarousel.Constructor.Plugins.AutoHeight = AutoHeight; 2051 2052})(window.Zepto || window.jQuery, window, document); 2053 2054/** 2055 * Video Plugin 2056 * @version 2.1.0 2057 * @author Bartosz Wojciechowski 2058 * @author David Deutsch
vendor: 5,530 bytes, lines 2058-2259
2058 2059 * @license The MIT License (MIT) 2060 */ 2061;(function($, window, document, undefined) { 2062 2063 /** 2064 * Creates the video plugin. 2065 * @class The Video Plugin 2066 * @param {Owl} carousel - The Owl Carousel 2067 */ 2068 var Video = function(carousel) { 2069 /** 2070 * Reference to the core. 2071 * @protected 2072 * @type {Owl} 2073 */ 2074 this._core = carousel; 2075 2076 /** 2077 * Cache all video URLs. 2078 * @protected 2079 * @type {Object} 2080 */ 2081 this._videos = {}; 2082 2083 /** 2084 * Current playing item. 2085 * @protected 2086 * @type {jQuery} 2087 */ 2088 this._playing = null; 2089 2090 /** 2091 * All event handlers. 2092 * @todo The cloned content removale is too late 2093 * @protected 2094 * @type {Object} 2095 */ 2096 this._handlers = { 2097 'initialized.owl.carousel': $.proxy(function(e) { 2098 if (e.namespace) { 2099 this._core.register({ type: 'state', name: 'playing', tags: [ 'interacting' ] }); 2100 } 2101 }, this), 2102 'resize.owl.carousel': $.proxy(function(e) { 2103 if (e.namespace && this._core.settings.video && this.isInFullScreen()) { 2104 e.preventDefault(); 2105 } 2106 }, this), 2107 'refreshed.owl.carousel': $.proxy(function(e) { 2108 if (e.namespace && this._core.is('resizing')) { 2109 this._core.$stage.find('.cloned .owl-video-frame').remove(); 2110 } 2111 }, this), 2112 'changed.owl.carousel': $.proxy(function(e) { 2113 if (e.namespace && e.property.name === 'position' && this._playing) { 2114 this.stop(); 2115 } 2116 }, this), 2117 'prepared.owl.carousel': $.proxy(function(e) { 2118 if (!e.namespace) { 2119 return; 2120 } 2121 2122 var $element = $(e.content).find('.owl-video'); 2123 2124 if ($element.length) { 2125 $element.css('display', 'none'); 2126 this.fetch($element, $(e.content)); 2127 } 2128 }, this) 2129 }; 2130 2131 // set default options 2132 this._core.options = $.extend({}, Video.Defaults, this._core.options); 2133 2134 // register event handlers 2135 this._core.$element.on(this._handlers); 2136 2137 this._core.$element.on('click.owl.video', '.owl-video-play-icon', $.proxy(function(e) { 2138 this.play(e); 2139 }, this)); 2140 }; 2141 2142 /** 2143 * Default options. 2144 * @public 2145 */ 2146 Video.Defaults = { 2147 video: false, 2148 videoHeight: false, 2149 videoWidth: false 2150 }; 2151 2152 /** 2153 * Gets the video ID and the type (YouTube/Vimeo/vzaar only). 2154 * @protected 2155 * @param {jQuery} target - The target containing the video data. 2156 * @param {jQuery} item - The item containing the video. 2157 */ 2158 Video.prototype.fetch = function(target, item) { 2159 var type = (function() { 2160 if (target.attr('data-vimeo-id')) { 2161 return 'vimeo'; 2162 } else if (target.attr('data-vzaar-id')) { 2163 return 'vzaar' 2164 } else { 2165 return 'youtube'; 2166 } 2167 })(), 2168 id = target.attr('data-vimeo-id') || target.attr('data-youtube-id') || target.attr('data-vzaar-id'), 2169 width = target.attr('data-width') || this._core.settings.videoWidth, 2170 height = target.attr('data-height') || this._core.settings.videoHeight, 2171 url = target.attr('href'); 2172 2173 if (url) { 2174 2175 /* 2176 Parses the id's out of the following urls (and probably more): 2177 https://www.youtube.com/watch?v=:id 2178 https://youtu.be/:id 2179 https://vimeo.com/:id 2180 https://vimeo.com/channels/:channel/:id 2181 https://vimeo.com/groups/:group/videos/:id 2182 https://app.vzaar.com/videos/:id 2183 2184 Visual example: https://regexper.com/#(http%3A%7Chttps%3A%7C)%5C%2F%5C%2F(player.%7Cwww.%7Capp.)%3F(vimeo%5C.com%7Cyoutu(be%5C.com%7C%5C.be%7Cbe%5C.googleapis%5C.com)%7Cvzaar%5C.com)%5C%2F(video%5C%2F%7Cvideos%5C%2F%7Cembed%5C%2F%7Cchannels%5C%2F.%2B%5C%2F%7Cgroups%5C%2F.%2B%5C%2F%7Cwatch%5C%3Fv%3D%7Cv%5C%2F)%3F(%5BA-Za-z0-9._%25-%5D*)(%5C%26%5CS%2B)%3F 2185 */ 2186 2187 id = url.match(/(http:|https:|)\/\/(player.|www.|app.)?(vimeo\.com|youtu(be\.com|\.be|be\.googleapis\.com)|vzaar\.com)\/(video\/|videos\/|embed\/|channels\/.+\/|groups\/.+\/|watch\?v=|v\/)?([A-Za-z0-9._%-]*)(\&\S+)?/); 2188 2189 if (id[3].indexOf('youtu') > -1) { 2190 type = 'youtube'; 2191 } else if (id[3].indexOf('vimeo') > -1) { 2192 type = 'vimeo'; 2193 } else if (id[3].indexOf('vzaar') > -1) { 2194 type = 'vzaar'; 2195 } else { 2196 throw new Error('Video URL not supported.'); 2197 } 2198 id = id[6]; 2199 } else { 2200 throw new Error('Missing video URL.'); 2201 } 2202 2203 this._videos[url] = { 2204 type: type, 2205 id: id, 2206 width: width, 2207 height: height 2208 }; 2209 2210 item.attr('data-video', url); 2211 2212 this.thumbnail(target, this._videos[url]); 2213 }; 2214 2215 /** 2216 * Creates video thumbnail. 2217 * @protected 2218 * @param {jQuery} target - The target containing the video data. 2219 * @param {Object} info - The video info object. 2220 * @see `fetch` 2221 */ 2222 Video.prototype.thumbnail = function(target, video) { 2223 var tnLink, 2224 icon, 2225 path, 2226 dimensions = video.width && video.height ? 'style="width:' + video.width + 'px;height:' + video.height + 'px;"' : '', 2227 customTn = target.find('img'), 2228 srcType = 'src', 2229 lazyClass = '', 2230 settings = this._core.settings, 2231 create = function(path) { 2232 icon = '<div class="owl-video-play-icon"></div>'; 2233 2234 if (settings.lazyLoad) { 2235 tnLink = '<div class="owl-video-tn ' + lazyClass + '" ' + srcType + '="' + path + '"></div>'; 2236 } else { 2237 tnLink = '<div class="owl-video-tn" style="opacity:1;background-image:url(' + path + ')"></div>'; 2238 } 2239 target.after(tnLink); 2240 target.after(icon); 2241 }; 2242 2243 // wrap video content into owl-video-wrapper div 2244 target.wrap('<div class="owl-video-wrapper"' + dimensions + '></div>'); 2245 2246 if (this._core.settings.lazyLoad) { 2247 srcType = 'data-src'; 2248 lazyClass = 'owl-lazy'; 2249 } 2250 2251 // custom thumbnail 2252 if (customTn.length) { 2253 create(customTn.attr(srcType)); 2254 customTn.remove(); 2255 return false; 2256 } 2257 2258 if (video.type === 'youtube') { 2259 path = "
vendor: 11,078 bytes, lines 2259-2700
2259https://img.youtube.com/vi/" + video.id + "/hqdefault.jpg"; 2260 create(path); 2261 } else if (video.type === 'vimeo') { 2262 $.ajax({ 2263 type: 'GET', 2264 url: 'https://vimeo.com/api/v2/video/' + video.id + '.json', 2265 jsonp: 'callback', 2266 dataType: 'jsonp', 2267 success: function(data) { 2268 path = data[0].thumbnail_large; 2269 create(path); 2270 } 2271 }); 2272 } else if (video.type === 'vzaar') { 2273 $.ajax({ 2274 type: 'GET', 2275 url: 'https://vzaar.com/api/videos/' + video.id + '.json', 2276 jsonp: 'callback', 2277 dataType: 'jsonp', 2278 success: function(data) { 2279 path = data.framegrab_url; 2280 create(path); 2281 } 2282 }); 2283 } 2284 }; 2285 2286 /** 2287 * Stops the current video. 2288 * @public 2289 */ 2290 Video.prototype.stop = function() { 2291 this._core.trigger('stop', null, 'video'); 2292 this._playing.find('.owl-video-frame').remove(); 2293 this._playing.removeClass('owl-video-playing'); 2294 this._playing = null; 2295 this._core.leave('playing'); 2296 this._core.trigger('stopped', null, 'video'); 2297 }; 2298 2299 /** 2300 * Starts the current video. 2301 * @public 2302 * @param {Event} event - The event arguments. 2303 */ 2304 Video.prototype.play = function(event) { 2305 var target = $(event.target), 2306 item = target.closest('.' + this._core.settings.itemClass), 2307 video = this._videos[item.attr('data-video')], 2308 width = video.width || '100%', 2309 height = video.height || this._core.$stage.height(), 2310 html; 2311 2312 if (this._playing) { 2313 return; 2314 } 2315 2316 this._core.enter('playing'); 2317 this._core.trigger('play', null, 'video'); 2318 2319 item = this._core.items(this._core.relative(item.index())); 2320 2321 this._core.reset(item.index()); 2322 2323 if (video.type === 'youtube') { 2324 html = '<iframe width="' + width + '" height="' + height + '" src="https://www.youtube.com/embed/' + 2325 video.id + '?autoplay=1&rel=0&v=' + video.id + '" frameborder="0" allowfullscreen></iframe>'; 2326 } else if (video.type === 'vimeo') { 2327 html = '<iframe src="https://player.vimeo.com/video/' + video.id + 2328 '?autoplay=1" width="' + width + '" height="' + height + 2329 '" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>'; 2330 } else if (video.type === 'vzaar') { 2331 html = '<iframe frameborder="0"' + 'height="' + height + '"' + 'width="' + width + 2332 '" allowfullscreen mozallowfullscreen webkitAllowFullScreen ' + 2333 'src="https://view.vzaar.com/' + video.id + '/player?autoplay=true"></iframe>'; 2334 } 2335 2336 $('<div class="owl-video-frame">' + html + '</div>').insertAfter(item.find('.owl-video')); 2337 2338 this._playing = item.addClass('owl-video-playing'); 2339 }; 2340 2341 /** 2342 * Checks whether an video is currently in full screen mode or not. 2343 * @todo Bad style because looks like a readonly method but changes members. 2344 * @protected 2345 * @returns {Boolean} 2346 */ 2347 Video.prototype.isInFullScreen = function() { 2348 var element = document.fullscreenElement || document.mozFullScreenElement || 2349 document.webkitFullscreenElement; 2350 2351 return element && $(element).parent().hasClass('owl-video-frame'); 2352 }; 2353 2354 /** 2355 * Destroys the plugin. 2356 */ 2357 Video.prototype.destroy = function() { 2358 var handler, property; 2359 2360 this._core.$element.off('click.owl.video'); 2361 2362 for (handler in this._handlers) { 2363 this._core.$element.off(handler, this._handlers[handler]); 2364 } 2365 for (property in Object.getOwnPropertyNames(this)) { 2366 typeof this[property] != 'function' && (this[property] = null); 2367 } 2368 }; 2369 2370 $.fn.owlCarousel.Constructor.Plugins.Video = Video; 2371 2372})(window.Zepto || window.jQuery, window, document); 2373 2374/** 2375 * Animate Plugin 2376 * @version 2.1.0 2377 * @author Bartosz Wojciechowski 2378 * @author David Deutsch 2379 * @license The MIT License (MIT) 2380 */ 2381;(function($, window, document, undefined) { 2382 2383 /** 2384 * Creates the animate plugin. 2385 * @class The Navigation Plugin 2386 * @param {Owl} scope - The Owl Carousel 2387 */ 2388 var Animate = function(scope) { 2389 this.core = scope; 2390 this.core.options = $.extend({}, Animate.Defaults, this.core.options); 2391 this.swapping = true; 2392 this.previous = undefined; 2393 this.next = undefined; 2394 2395 this.handlers = { 2396 'change.owl.carousel': $.proxy(function(e) { 2397 if (e.namespace && e.property.name == 'position') { 2398 this.previous = this.core.current(); 2399 this.next = e.property.value; 2400 } 2401 }, this), 2402 'drag.owl.carousel dragged.owl.carousel translated.owl.carousel': $.proxy(function(e) { 2403 if (e.namespace) { 2404 this.swapping = e.type == 'translated'; 2405 } 2406 }, this), 2407 'translate.owl.carousel': $.proxy(function(e) { 2408 if (e.namespace && this.swapping && (this.core.options.animateOut || this.core.options.animateIn)) { 2409 this.swap(); 2410 } 2411 }, this) 2412 }; 2413 2414 this.core.$element.on(this.handlers); 2415 }; 2416 2417 /** 2418 * Default options. 2419 * @public 2420 */ 2421 Animate.Defaults = { 2422 animateOut: false, 2423 animateIn: false 2424 }; 2425 2426 /** 2427 * Toggles the animation classes whenever an translations starts. 2428 * @protected 2429 * @returns {Boolean|undefined} 2430 */ 2431 Animate.prototype.swap = function() { 2432 2433 if (this.core.settings.items !== 1) { 2434 return; 2435 } 2436 2437 if (!$.support.animation || !$.support.transition) { 2438 return; 2439 } 2440 2441 this.core.speed(0); 2442 2443 var left, 2444 clear = $.proxy(this.clear, this), 2445 previous = this.core.$stage.children().eq(this.previous), 2446 next = this.core.$stage.children().eq(this.next), 2447 incoming = this.core.settings.animateIn, 2448 outgoing = this.core.settings.animateOut; 2449 2450 if (this.core.current() === this.previous) { 2451 return; 2452 } 2453 2454 if (outgoing) { 2455 left = this.core.coordinates(this.previous) - this.core.coordinates(this.next); 2456 previous.one($.support.animation.end, clear) 2457 .css( { 'left': left + 'px' } ) 2458 .addClass('animated owl-animated-out') 2459 .addClass(outgoing); 2460 } 2461 2462 if (incoming) { 2463 next.one($.support.animation.end, clear) 2464 .addClass('animated owl-animated-in') 2465 .addClass(incoming); 2466 } 2467 }; 2468 2469 Animate.prototype.clear = function(e) { 2470 $(e.target).css( { 'left': '' } ) 2471 .removeClass('animated owl-animated-out owl-animated-in') 2472 .removeClass(this.core.settings.animateIn) 2473 .removeClass(this.core.settings.animateOut); 2474 this.core.onTransitionEnd(); 2475 }; 2476 2477 /** 2478 * Destroys the plugin. 2479 * @public 2480 */ 2481 Animate.prototype.destroy = function() { 2482 var handler, property; 2483 2484 for (handler in this.handlers) { 2485 this.core.$element.off(handler, this.handlers[handler]); 2486 } 2487 for (property in Object.getOwnPropertyNames(this)) { 2488 typeof this[property] != 'function' && (this[property] = null); 2489 } 2490 }; 2491 2492 $.fn.owlCarousel.Constructor.Plugins.Animate = Animate; 2493 2494})(window.Zepto || window.jQuery, window, document); 2495 2496/** 2497 * Autoplay Plugin 2498 * @version 2.1.0 2499 * @author Bartosz Wojciechowski 2500 * @author Artus Kolanowski 2501 * @author David Deutsch 2502 * @license The MIT License (MIT) 2503 */ 2504;(function($, window, document, undefined) { 2505 2506 /** 2507 * Creates the autoplay plugin. 2508 * @class The Autoplay Plugin 2509 * @param {Owl} scope - The Owl Carousel 2510 */ 2511 var Autoplay = function(carousel) { 2512 /** 2513 * Reference to the core. 2514 * @protected 2515 * @type {Owl} 2516 */ 2517 this._core = carousel; 2518 2519 /** 2520 * The autoplay timeout. 2521 * @type {Timeout} 2522 */ 2523 this._timeout = null; 2524 2525 /** 2526 * Indicates whenever the autoplay is paused. 2527 * @type {Boolean} 2528 */ 2529 this._paused = false; 2530 2531 /** 2532 * All event handlers. 2533 * @protected 2534 * @type {Object} 2535 */ 2536 this._handlers = { 2537 'changed.owl.carousel': $.proxy(function(e) { 2538 if (e.namespace && e.property.name === 'settings') { 2539 if (this._core.settings.autoplay) { 2540 this.play(); 2541 } else { 2542 this.stop(); 2543 } 2544 } else if (e.namespace && e.property.name === 'position') { 2545 //console.log('play?', e); 2546 if (this._core.settings.autoplay) { 2547 this._setAutoPlayInterval(); 2548 } 2549 } 2550 }, this), 2551 'initialized.owl.carousel': $.proxy(function(e) { 2552 if (e.namespace && this._core.settings.autoplay) { 2553 this.play(); 2554 } 2555 }, this), 2556 'play.owl.autoplay': $.proxy(function(e, t, s) { 2557 if (e.namespace) { 2558 this.play(t, s); 2559 } 2560 }, this), 2561 'stop.owl.autoplay': $.proxy(function(e) { 2562 if (e.namespace) { 2563 this.stop(); 2564 } 2565 }, this), 2566 'mouseover.owl.autoplay': $.proxy(function() { 2567 if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) { 2568 this.pause(); 2569 } 2570 }, this), 2571 'mouseleave.owl.autoplay': $.proxy(function() { 2572 if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) { 2573 this.play(); 2574 } 2575 }, this), 2576 'touchstart.owl.core': $.proxy(function() { 2577 if (this._core.settings.autoplayHoverPause && this._core.is('rotating')) { 2578 this.pause(); 2579 } 2580 }, this), 2581 'touchend.owl.core': $.proxy(function() { 2582 if (this._core.settings.autoplayHoverPause) { 2583 this.play(); 2584 } 2585 }, this) 2586 }; 2587 2588 // register event handlers 2589 this._core.$element.on(this._handlers); 2590 2591 // set default options 2592 this._core.options = $.extend({}, Autoplay.Defaults, this._core.options); 2593 }; 2594 2595 /** 2596 * Default options. 2597 * @public 2598 */ 2599 Autoplay.Defaults = { 2600 autoplay: false, 2601 autoplayTimeout: 5000, 2602 autoplayHoverPause: false, 2603 autoplaySpeed: false 2604 }; 2605 2606 /** 2607 * Starts the autoplay. 2608 * @public 2609 * @param {Number} [timeout] - The interval before the next animation starts. 2610 * @param {Number} [speed] - The animation speed for the animations. 2611 */ 2612 Autoplay.prototype.play = function(timeout, speed) { 2613 this._paused = false; 2614 2615 if (this._core.is('rotating')) { 2616 return; 2617 } 2618 2619 this._core.enter('rotating'); 2620 2621 this._setAutoPlayInterval(); 2622 }; 2623 2624 /** 2625 * Gets a new timeout 2626 * @private 2627 * @param {Number} [timeout] - The interval before the next animation starts. 2628 * @param {Number} [speed] - The animation speed for the animations. 2629 * @return {Timeout} 2630 */ 2631 Autoplay.prototype._getNextTimeout = function(timeout, speed) { 2632 if ( this._timeout ) { 2633 window.clearTimeout(this._timeout); 2634 } 2635 return window.setTimeout($.proxy(function() { 2636 if (this._paused || this._core.is('busy') || this._core.is('interacting') || document.hidden) { 2637 return; 2638 } 2639 this._core.next(speed || this._core.settings.autoplaySpeed); 2640 }, this), timeout || this._core.settings.autoplayTimeout); 2641 }; 2642 2643 /** 2644 * Sets autoplay in motion. 2645 * @private 2646 */ 2647 Autoplay.prototype._setAutoPlayInterval = function() { 2648 this._timeout = this._getNextTimeout(); 2649 }; 2650 2651 /** 2652 * Stops the autoplay. 2653 * @public 2654 */ 2655 Autoplay.prototype.stop = function() { 2656 if (!this._core.is('rotating')) { 2657 return; 2658 } 2659 2660 window.clearTimeout(this._timeout); 2661 this._core.leave('rotating'); 2662 }; 2663 2664 /** 2665 * Stops the autoplay. 2666 * @public 2667 */ 2668 Autoplay.prototype.pause = function() { 2669 if (!this._core.is('rotating')) { 2670 return; 2671 } 2672 2673 this._paused = true; 2674 }; 2675 2676 /** 2677 * Destroys the plugin. 2678 */ 2679 Autoplay.prototype.destroy = function() { 2680 var handler, property; 2681 2682 this.stop(); 2683 2684 for (handler in this._handlers) { 2685 this._core.$element.off(handler, this._handlers[handler]); 2686 } 2687 for (property in Object.getOwnPropertyNames(this)) { 2688 typeof this[property] != 'function' && (this[property] = null); 2689 } 2690 }; 2691 2692 $.fn.owlCarousel.Constructor.Plugins.autoplay = Autoplay; 2693 2694})(window.Zepto || window.jQuery, window, document); 2695 2696/** 2697 * Navigation Plugin 2698 * @version 2.1.0 2699 * @author Artus Kolanowski 2700 * @author David Deutsch
vendor: 10,575 bytes, lines 2700-3083
2700 2701 * @license The MIT License (MIT) 2702 */ 2703;(function($, window, document, undefined) { 2704 'use strict'; 2705 2706 /** 2707 * Creates the navigation plugin. 2708 * @class The Navigation Plugin 2709 * @param {Owl} carousel - The Owl Carousel. 2710 */ 2711 var Navigation = function(carousel) { 2712 /** 2713 * Reference to the core. 2714 * @protected 2715 * @type {Owl} 2716 */ 2717 this._core = carousel; 2718 2719 /** 2720 * Indicates whether the plugin is initialized or not. 2721 * @protected 2722 * @type {Boolean} 2723 */ 2724 this._initialized = false; 2725 2726 /** 2727 * The current paging indexes. 2728 * @protected 2729 * @type {Array} 2730 */ 2731 this._pages = []; 2732 2733 /** 2734 * All DOM elements of the user interface. 2735 * @protected 2736 * @type {Object} 2737 */ 2738 this._controls = {}; 2739 2740 /** 2741 * Markup for an indicator. 2742 * @protected 2743 * @type {Array.<String>} 2744 */ 2745 this._templates = []; 2746 2747 /** 2748 * The carousel element. 2749 * @type {jQuery} 2750 */ 2751 this.$element = this._core.$element; 2752 2753 /** 2754 * Overridden methods of the carousel. 2755 * @protected 2756 * @type {Object} 2757 */ 2758 this._overrides = { 2759 next: this._core.next, 2760 prev: this._core.prev, 2761 to: this._core.to 2762 }; 2763 2764 /** 2765 * All event handlers. 2766 * @protected 2767 * @type {Object} 2768 */ 2769 this._handlers = { 2770 'prepared.owl.carousel': $.proxy(function(e) { 2771 if (e.namespace && this._core.settings.dotsData) { 2772 this._templates.push('<div class="' + this._core.settings.dotClass + '">' + 2773 $(e.content).find('[data-dot]').addBack('[data-dot]').attr('data-dot') + '</div>'); 2774 } 2775 }, this), 2776 'added.owl.carousel': $.proxy(function(e) { 2777 if (e.namespace && this._core.settings.dotsData) { 2778 this._templates.splice(e.position, 0, this._templates.pop()); 2779 } 2780 }, this), 2781 'remove.owl.carousel': $.proxy(function(e) { 2782 if (e.namespace && this._core.settings.dotsData) { 2783 this._templates.splice(e.position, 1); 2784 } 2785 }, this), 2786 'changed.owl.carousel': $.proxy(function(e) { 2787 if (e.namespace && e.property.name == 'position') { 2788 this.draw(); 2789 } 2790 }, this), 2791 'initialized.owl.carousel': $.proxy(function(e) { 2792 if (e.namespace && !this._initialized) { 2793 this._core.trigger('initialize', null, 'navigation'); 2794 this.initialize(); 2795 this.update(); 2796 this.draw(); 2797 this._initialized = true; 2798 this._core.trigger('initialized', null, 'navigation'); 2799 } 2800 }, this), 2801 'refreshed.owl.carousel': $.proxy(function(e) { 2802 if (e.namespace && this._initialized) { 2803 this._core.trigger('refresh', null, 'navigation'); 2804 this.update(); 2805 this.draw(); 2806 this._core.trigger('refreshed', null, 'navigation'); 2807 } 2808 }, this) 2809 }; 2810 2811 // set default options 2812 this._core.options = $.extend({}, Navigation.Defaults, this._core.options); 2813 2814 // register event handlers 2815 this.$element.on(this._handlers); 2816 }; 2817 2818 /** 2819 * Default options. 2820 * @public 2821 * @todo Rename `slideBy` to `navBy` 2822 */ 2823 Navigation.Defaults = { 2824 nav: false, 2825 navText: [ 'prev', 'next' ], 2826 navSpeed: false, 2827 navElement: 'div', 2828 navContainer: false, 2829 navContainerClass: 'owl-nav', 2830 navClass: [ 'owl-prev', 'owl-next' ], 2831 slideBy: 1, 2832 dotClass: 'owl-dot', 2833 dotsClass: 'owl-dots', 2834 dots: true, 2835 dotsEach: false, 2836 dotsData: false, 2837 dotsSpeed: false, 2838 dotsContainer: false 2839 }; 2840 2841 /** 2842 * Initializes the layout of the plugin and extends the carousel. 2843 * @protected 2844 */ 2845 Navigation.prototype.initialize = function() { 2846 var override, 2847 settings = this._core.settings; 2848 2849 // create DOM structure for relative navigation 2850 this._controls.$relative = (settings.navContainer ? $(settings.navContainer) 2851 : $('<div>').addClass(settings.navContainerClass).appendTo(this.$element)).addClass('disabled'); 2852 2853 this._controls.$previous = $('<' + settings.navElement + '>') 2854 .addClass(settings.navClass[0]) 2855 .html(settings.navText[0]) 2856 .prependTo(this._controls.$relative) 2857 .on('click', $.proxy(function(e) { 2858 this.prev(settings.navSpeed); 2859 }, this)); 2860 this._controls.$next = $('<' + settings.navElement + '>') 2861 .addClass(settings.navClass[1]) 2862 .html(settings.navText[1]) 2863 .appendTo(this._controls.$relative) 2864 .on('click', $.proxy(function(e) { 2865 this.next(settings.navSpeed); 2866 }, this)); 2867 2868 // create DOM structure for absolute navigation 2869 if (!settings.dotsData) { 2870 this._templates = [ $('<div>') 2871 .addClass(settings.dotClass) 2872 .append($('<span>')) 2873 .prop('outerHTML') ]; 2874 } 2875 2876 this._controls.$absolute = (settings.dotsContainer ? $(settings.dotsContainer) 2877 : $('<div>').addClass(settings.dotsClass).appendTo(this.$element)).addClass('disabled'); 2878 2879 this._controls.$absolute.on('click', 'div', $.proxy(function(e) { 2880 var index = $(e.target).parent().is(this._controls.$absolute) 2881 ? $(e.target).index() : $(e.target).parent().index(); 2882 2883 e.preventDefault(); 2884 2885 this.to(index, settings.dotsSpeed); 2886 }, this)); 2887 2888 // override public methods of the carousel 2889 for (override in this._overrides) { 2890 this._core[override] = $.proxy(this[override], this); 2891 } 2892 }; 2893 2894 /** 2895 * Destroys the plugin. 2896 * @protected 2897 */ 2898 Navigation.prototype.destroy = function() { 2899 var handler, control, property, override; 2900 2901 for (handler in this._handlers) { 2902 this.$element.off(handler, this._handlers[handler]); 2903 } 2904 for (control in this._controls) { 2905 this._controls[control].remove(); 2906 } 2907 for (override in this.overides) { 2908 this._core[override] = this._overrides[override]; 2909 } 2910 for (property in Object.getOwnPropertyNames(this)) { 2911 typeof this[property] != 'function' && (this[property] = null); 2912 } 2913 }; 2914 2915 /** 2916 * Updates the internal state. 2917 * @protected 2918 */ 2919 Navigation.prototype.update = function() { 2920 var i, j, k, 2921 lower = this._core.clones().length / 2, 2922 upper = lower + this._core.items().length, 2923 maximum = this._core.maximum(true), 2924 settings = this._core.settings, 2925 size = settings.center || settings.autoWidth || settings.dotsData 2926 ? 1 : settings.dotsEach || settings.items; 2927 2928 if (settings.slideBy !== 'page') { 2929 settings.slideBy = Math.min(settings.slideBy, settings.items); 2930 } 2931 2932 if (settings.dots || settings.slideBy == 'page') { 2933 this._pages = []; 2934 2935 for (i = lower, j = 0, k = 0; i < upper; i++) { 2936 if (j >= size || j === 0) { 2937 this._pages.push({ 2938 start: Math.min(maximum, i - lower), 2939 end: i - lower + size - 1 2940 }); 2941 if (Math.min(maximum, i - lower) === maximum) { 2942 break; 2943 } 2944 j = 0, ++k; 2945 } 2946 j += this._core.mergers(this._core.relative(i)); 2947 } 2948 } 2949 }; 2950 2951 /** 2952 * Draws the user interface. 2953 * @todo The option `dotsData` wont work. 2954 * @protected 2955 */ 2956 Navigation.prototype.draw = function() { 2957 var difference, 2958 settings = this._core.settings, 2959 disabled = this._core.items().length <= settings.items, 2960 index = this._core.relative(this._core.current()), 2961 loop = settings.loop || settings.rewind; 2962 2963 this._controls.$relative.toggleClass('disabled', !settings.nav || disabled); 2964 2965 if (settings.nav) { 2966 this._controls.$previous.toggleClass('disabled', !loop && index <= this._core.minimum(true)); 2967 this._controls.$next.toggleClass('disabled', !loop && index >= this._core.maximum(true)); 2968 } 2969 2970 this._controls.$absolute.toggleClass('disabled', !settings.dots || disabled); 2971 2972 if (settings.dots) { 2973 difference = this._pages.length - this._controls.$absolute.children().length; 2974 2975 if (settings.dotsData && difference !== 0) { 2976 this._controls.$absolute.html(this._templates.join('')); 2977 } else if (difference > 0) { 2978 this._controls.$absolute.append(new Array(difference + 1).join(this._templates[0])); 2979 } else if (difference < 0) { 2980 this._controls.$absolute.children().slice(difference).remove(); 2981 } 2982 2983 this._controls.$absolute.find('.active').removeClass('active'); 2984 this._controls.$absolute.children().eq($.inArray(this.current(), this._pages)).addClass('active'); 2985 } 2986 }; 2987 2988 /** 2989 * Extends event data. 2990 * @protected 2991 * @param {Event} event - The event object which gets thrown. 2992 */ 2993 Navigation.prototype.onTrigger = function(event) { 2994 var settings = this._core.settings; 2995 2996 event.page = { 2997 index: $.inArray(this.current(), this._pages), 2998 count: this._pages.length, 2999 size: settings && (settings.center || settings.autoWidth || settings.dotsData 3000 ? 1 : settings.dotsEach || settings.items) 3001 }; 3002 }; 3003 3004 /** 3005 * Gets the current page position of the carousel. 3006 * @protected 3007 * @returns {Number} 3008 */ 3009 Navigation.prototype.current = function() { 3010 var current = this._core.relative(this._core.current()); 3011 return $.grep(this._pages, $.proxy(function(page, index) { 3012 return page.start <= current && page.end >= current; 3013 }, this)).pop(); 3014 }; 3015 3016 /** 3017 * Gets the current succesor/predecessor position. 3018 * @protected 3019 * @returns {Number} 3020 */ 3021 Navigation.prototype.getPosition = function(successor) { 3022 var position, length, 3023 settings = this._core.settings; 3024 3025 if (settings.slideBy == 'page') { 3026 position = $.inArray(this.current(), this._pages); 3027 length = this._pages.length; 3028 successor ? ++position : --position; 3029 position = this._pages[((position % length) + length) % length].start; 3030 } else { 3031 position = this._core.relative(this._core.current()); 3032 length = this._core.items().length; 3033 successor ? position += settings.slideBy : position -= settings.slideBy; 3034 } 3035 3036 return position; 3037 }; 3038 3039 /** 3040 * Slides to the next item or page. 3041 * @public 3042 * @param {Number} [speed=false] - The time in milliseconds for the transition. 3043 */ 3044 Navigation.prototype.next = function(speed) { 3045 $.proxy(this._overrides.to, this._core)(this.getPosition(true), speed); 3046 }; 3047 3048 /** 3049 * Slides to the previous item or page. 3050 * @public 3051 * @param {Number} [speed=false] - The time in milliseconds for the transition. 3052 */ 3053 Navigation.prototype.prev = function(speed) { 3054 $.proxy(this._overrides.to, this._core)(this.getPosition(false), speed); 3055 }; 3056 3057 /** 3058 * Slides to the specified item or page. 3059 * @public 3060 * @param {Number} position - The position of the item or page. 3061 * @param {Number} [speed] - The time in milliseconds for the transition. 3062 * @param {Boolean} [standard=false] - Whether to use the standard behaviour or not. 3063 */ 3064 Navigation.prototype.to = function(position, speed, standard) { 3065 var length; 3066 3067 if (!standard && this._pages.length) { 3068 length = this._pages.length; 3069 $.proxy(this._overrides.to, this._core)(this._pages[((position % length) + length) % length].start, speed); 3070 } else { 3071 $.proxy(this._overrides.to, this._core)(position, speed); 3072 } 3073 }; 3074 3075 $.fn.owlCarousel.Constructor.Plugins.Navigation = Navigation; 3076 3077})(window.Zepto || window.jQuery, window, document); 3078 3079/** 3080 * Hash Plugin 3081 * @version 2.1.0 3082 * @author Artus Kolanowski 3083 * @author
vendor: 4,773 bytes, lines 3083-3286
3083David Deutsch 3084 * @license The MIT License (MIT) 3085 */ 3086;(function($, window, document, undefined) { 3087 'use strict'; 3088 3089 /** 3090 * Creates the hash plugin. 3091 * @class The Hash Plugin 3092 * @param {Owl} carousel - The Owl Carousel 3093 */ 3094 var Hash = function(carousel) { 3095 /** 3096 * Reference to the core. 3097 * @protected 3098 * @type {Owl} 3099 */ 3100 this._core = carousel; 3101 3102 /** 3103 * Hash index for the items. 3104 * @protected 3105 * @type {Object} 3106 */ 3107 this._hashes = {}; 3108 3109 /** 3110 * The carousel element. 3111 * @type {jQuery} 3112 */ 3113 this.$element = this._core.$element; 3114 3115 /** 3116 * All event handlers. 3117 * @protected 3118 * @type {Object} 3119 */ 3120 this._handlers = { 3121 'initialized.owl.carousel': $.proxy(function(e) { 3122 if (e.namespace && this._core.settings.startPosition === 'URLHash') { 3123 $(window).trigger('hashchange.owl.navigation'); 3124 } 3125 }, this), 3126 'prepared.owl.carousel': $.proxy(function(e) { 3127 if (e.namespace) { 3128 var hash = $(e.content).find('[data-hash]').addBack('[data-hash]').attr('data-hash'); 3129 3130 if (!hash) { 3131 return; 3132 } 3133 3134 this._hashes[hash] = e.content; 3135 } 3136 }, this), 3137 'changed.owl.carousel': $.proxy(function(e) { 3138 if (e.namespace && e.property.name === 'position') { 3139 var current = this._core.items(this._core.relative(this._core.current())), 3140 hash = $.map(this._hashes, function(item, hash) { 3141 return item === current ? hash : null; 3142 }).join(); 3143 3144 if (!hash || window.location.hash.slice(1) === hash) { 3145 return; 3146 } 3147 3148 window.location.hash = hash; 3149 } 3150 }, this) 3151 }; 3152 3153 // set default options 3154 this._core.options = $.extend({}, Hash.Defaults, this._core.options); 3155 3156 // register the event handlers 3157 this.$element.on(this._handlers); 3158 3159 // register event listener for hash navigation 3160 $(window).on('hashchange.owl.navigation', $.proxy(function(e) { 3161 var hash = window.location.hash.substring(1), 3162 items = this._core.$stage.children(), 3163 position = this._hashes[hash] && items.index(this._hashes[hash]); 3164 3165 if (position === undefined || position === this._core.current()) { 3166 return; 3167 } 3168 3169 this._core.to(this._core.relative(position), false, true); 3170 }, this)); 3171 }; 3172 3173 /** 3174 * Default options. 3175 * @public 3176 */ 3177 Hash.Defaults = { 3178 URLhashListener: false 3179 }; 3180 3181 /** 3182 * Destroys the plugin. 3183 * @public 3184 */ 3185 Hash.prototype.destroy = function() { 3186 var handler, property; 3187 3188 $(window).off('hashchange.owl.navigation'); 3189 3190 for (handler in this._handlers) { 3191 this._core.$element.off(handler, this._handlers[handler]); 3192 } 3193 for (property in Object.getOwnPropertyNames(this)) { 3194 typeof this[property] != 'function' && (this[property] = null); 3195 } 3196 }; 3197 3198 $.fn.owlCarousel.Constructor.Plugins.Hash = Hash; 3199 3200})(window.Zepto || window.jQuery, window, document); 3201 3202/** 3203 * Support Plugin 3204 * 3205 * @version 2.1.0 3206 * @author Vivid Planet Software GmbH 3207 * @author Artus Kolanowski 3208 * @author David Deutsch 3209 * @license The MIT License (MIT) 3210 */ 3211;(function($, window, document, undefined) { 3212 3213 var style = $('<support>').get(0).style, 3214 prefixes = 'Webkit Moz O ms'.split(' '), 3215 events = { 3216 transition: { 3217 end: { 3218 WebkitTransition: 'webkitTransitionEnd', 3219 MozTransition: 'transitionend', 3220 OTransition: 'oTransitionEnd', 3221 transition: 'transitionend' 3222 } 3223 }, 3224 animation: { 3225 end: { 3226 WebkitAnimation: 'webkitAnimationEnd', 3227 MozAnimation: 'animationend', 3228 OAnimation: 'oAnimationEnd', 3229 animation: 'animationend' 3230 } 3231 } 3232 }, 3233 tests = { 3234 csstransforms: function() { 3235 return !!test('transform'); 3236 }, 3237 csstransforms3d: function() { 3238 return !!test('perspective'); 3239 }, 3240 csstransitions: function() { 3241 return !!test('transition'); 3242 }, 3243 cssanimations: function() { 3244 return !!test('animation'); 3245 } 3246 }; 3247 3248 function test(property, prefixed) { 3249 var result = false, 3250 upper = property.charAt(0).toUpperCase() + property.slice(1); 3251 3252 $.each((property + ' ' + prefixes.join(upper + ' ') + upper).split(' '), function(i, property) { 3253 if (style[property] !== undefined) { 3254 result = prefixed ? property : true; 3255 return false; 3256 } 3257 }); 3258 3259 return result; 3260 } 3261 3262 function prefixed(property) { 3263 return test(property, true); 3264 } 3265 3266 if (tests.csstransitions()) { 3267 /* jshint -W053 */ 3268 $.support.transition = new String(prefixed('transition')) 3269 $.support.transition.end = events.transition.end[ $.support.transition ]; 3270 } 3271 3272 if (tests.cssanimations()) { 3273 /* jshint -W053 */ 3274 $.support.animation = new String(prefixed('animation')) 3275 $.support.animation.end = events.animation.end[ $.support.animation ]; 3276 } 3277 3278 if (tests.csstransforms()) { 3279 /* jshint -W053 */ 3280 $.support.transform = new String(prefixed('transform')); 3281 $.support.transform3d = tests.csstransforms3d(); 3282 } 3283 3284})(window.Zepto || window.jQuery, window, document); 3285 3286}
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.