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