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