bootstrap 4.0.0 → 4.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.travis.yml +1 -1
- data/CHANGELOG.md +8 -0
- data/README.md +2 -2
- data/Rakefile +4 -2
- data/assets/javascripts/bootstrap/alert.js +45 -22
- data/assets/javascripts/bootstrap/button.js +39 -19
- data/assets/javascripts/bootstrap/carousel.js +213 -51
- data/assets/javascripts/bootstrap/collapse.js +105 -52
- data/assets/javascripts/bootstrap/dropdown.js +169 -45
- data/assets/javascripts/bootstrap/modal.js +139 -71
- data/assets/javascripts/bootstrap/popover.js +77 -20
- data/assets/javascripts/bootstrap/scrollspy.js +87 -29
- data/assets/javascripts/bootstrap/tab.js +50 -32
- data/assets/javascripts/bootstrap/toast.js +282 -0
- data/assets/javascripts/bootstrap/tooltip.js +295 -59
- data/assets/javascripts/bootstrap/util.js +78 -45
- data/assets/javascripts/bootstrap-sprockets.js +7 -6
- data/assets/javascripts/bootstrap.js +1537 -996
- data/assets/javascripts/bootstrap.min.js +3 -3
- data/assets/stylesheets/_bootstrap-grid.scss +4 -7
- data/assets/stylesheets/_bootstrap-reboot.scss +3 -3
- data/assets/stylesheets/_bootstrap.scss +5 -3
- data/assets/stylesheets/bootstrap/_alert.scss +1 -1
- data/assets/stylesheets/bootstrap/_badge.scss +8 -1
- data/assets/stylesheets/bootstrap/_breadcrumb.scss +9 -6
- data/assets/stylesheets/bootstrap/_button-group.scss +16 -19
- data/assets/stylesheets/bootstrap/_buttons.scss +10 -16
- data/assets/stylesheets/bootstrap/_card.scss +53 -34
- data/assets/stylesheets/bootstrap/_carousel.scss +66 -60
- data/assets/stylesheets/bootstrap/_close.scss +15 -8
- data/assets/stylesheets/bootstrap/_code.scss +5 -13
- data/assets/stylesheets/bootstrap/_custom-forms.scss +250 -40
- data/assets/stylesheets/bootstrap/_dropdown.scss +65 -5
- data/assets/stylesheets/bootstrap/_forms.scss +32 -35
- data/assets/stylesheets/bootstrap/_functions.scss +9 -9
- data/assets/stylesheets/bootstrap/_images.scss +2 -2
- data/assets/stylesheets/bootstrap/_input-group.scss +45 -11
- data/assets/stylesheets/bootstrap/_jumbotron.scss +1 -0
- data/assets/stylesheets/bootstrap/_list-group.scss +39 -5
- data/assets/stylesheets/bootstrap/_mixins.scss +6 -1
- data/assets/stylesheets/bootstrap/_modal.scss +80 -19
- data/assets/stylesheets/bootstrap/_nav.scss +2 -0
- data/assets/stylesheets/bootstrap/_navbar.scss +9 -26
- data/assets/stylesheets/bootstrap/_pagination.scss +2 -6
- data/assets/stylesheets/bootstrap/_popover.scss +47 -59
- data/assets/stylesheets/bootstrap/_print.scss +23 -6
- data/assets/stylesheets/bootstrap/_progress.scss +16 -6
- data/assets/stylesheets/bootstrap/_reboot.scss +51 -50
- data/assets/stylesheets/bootstrap/_spinners.scss +55 -0
- data/assets/stylesheets/bootstrap/_tables.scss +16 -11
- data/assets/stylesheets/bootstrap/_toasts.scss +44 -0
- data/assets/stylesheets/bootstrap/_tooltip.scss +1 -1
- data/assets/stylesheets/bootstrap/_transitions.scss +4 -20
- data/assets/stylesheets/bootstrap/_type.scss +16 -16
- data/assets/stylesheets/bootstrap/_utilities.scss +3 -0
- data/assets/stylesheets/bootstrap/_variables.scss +430 -201
- data/assets/stylesheets/bootstrap/mixins/_badge.scss +7 -2
- data/assets/stylesheets/bootstrap/mixins/_border-radius.scss +29 -1
- data/assets/stylesheets/bootstrap/mixins/_box-shadow.scss +16 -1
- data/assets/stylesheets/bootstrap/mixins/_breakpoints.scss +3 -3
- data/assets/stylesheets/bootstrap/mixins/_buttons.scss +12 -14
- data/assets/stylesheets/bootstrap/mixins/_caret.scss +5 -8
- data/assets/stylesheets/bootstrap/mixins/_deprecate.scss +10 -0
- data/assets/stylesheets/bootstrap/mixins/_float.scss +3 -0
- data/assets/stylesheets/bootstrap/mixins/_forms.scss +68 -13
- data/assets/stylesheets/bootstrap/mixins/_gradients.scss +7 -7
- data/assets/stylesheets/bootstrap/mixins/_grid-framework.scss +3 -4
- data/assets/stylesheets/bootstrap/mixins/_grid.scss +9 -10
- data/assets/stylesheets/bootstrap/mixins/_hover.scss +3 -5
- data/assets/stylesheets/bootstrap/mixins/_image.scss +2 -2
- data/assets/stylesheets/bootstrap/mixins/_list-group.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_nav-divider.scss +2 -2
- data/assets/stylesheets/bootstrap/mixins/_pagination.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_reset-text.scss +1 -1
- data/assets/stylesheets/bootstrap/mixins/_screen-reader.scss +1 -3
- data/assets/stylesheets/bootstrap/mixins/_size.scss +1 -0
- data/assets/stylesheets/bootstrap/mixins/_table-row.scss +10 -1
- data/assets/stylesheets/bootstrap/mixins/_text-emphasis.scss +5 -3
- data/assets/stylesheets/bootstrap/mixins/_text-hide.scss +3 -1
- data/assets/stylesheets/bootstrap/mixins/_transition.scss +7 -0
- data/assets/stylesheets/bootstrap/mixins/_visibility.scss +1 -0
- data/assets/stylesheets/bootstrap/utilities/_borders.scss +17 -1
- data/assets/stylesheets/bootstrap/utilities/_display.scss +6 -18
- data/assets/stylesheets/bootstrap/utilities/_embed.scss +7 -20
- data/assets/stylesheets/bootstrap/utilities/_flex.scss +5 -0
- data/assets/stylesheets/bootstrap/utilities/_float.scss +5 -3
- data/assets/stylesheets/bootstrap/utilities/_overflow.scss +5 -0
- data/assets/stylesheets/bootstrap/utilities/_position.scss +0 -4
- data/assets/stylesheets/bootstrap/utilities/_shadows.scss +6 -0
- data/assets/stylesheets/bootstrap/utilities/_sizing.scss +8 -0
- data/assets/stylesheets/bootstrap/utilities/_spacing.scss +23 -1
- data/assets/stylesheets/bootstrap/utilities/_stretched-link.scss +19 -0
- data/assets/stylesheets/bootstrap/utilities/_text.scss +26 -6
- data/assets/stylesheets/bootstrap/utilities/_visibility.scss +4 -2
- data/assets/stylesheets/bootstrap/vendor/_rfs.scss +204 -0
- data/bootstrap.gemspec +6 -3
- data/lib/bootstrap/engine.rb +3 -0
- data/lib/bootstrap/version.rb +4 -2
- data/lib/bootstrap.rb +10 -7
- data/tasks/updater/js.rb +1 -1
- data/test/test_helper.rb +7 -6
- metadata +19 -12
- data/assets/stylesheets/bootstrap/mixins/_navbar-align.scss +0 -10
|
@@ -1,47 +1,101 @@
|
|
|
1
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* Bootstrap carousel.js v4.3.1 (https://getbootstrap.com/)
|
|
3
|
+
* Copyright 2011-2019 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
|
|
4
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
|
5
|
+
*/
|
|
6
|
+
(function (global, factory) {
|
|
7
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./util.js')) :
|
|
8
|
+
typeof define === 'function' && define.amd ? define(['jquery', './util.js'], factory) :
|
|
9
|
+
(global = global || self, global.Carousel = factory(global.jQuery, global.Util));
|
|
10
|
+
}(this, function ($, Util) { 'use strict';
|
|
11
|
+
|
|
12
|
+
$ = $ && $.hasOwnProperty('default') ? $['default'] : $;
|
|
13
|
+
Util = Util && Util.hasOwnProperty('default') ? Util['default'] : Util;
|
|
14
|
+
|
|
15
|
+
function _defineProperties(target, props) {
|
|
16
|
+
for (var i = 0; i < props.length; i++) {
|
|
17
|
+
var descriptor = props[i];
|
|
18
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
19
|
+
descriptor.configurable = true;
|
|
20
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
21
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
26
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
27
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
28
|
+
return Constructor;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function _defineProperty(obj, key, value) {
|
|
32
|
+
if (key in obj) {
|
|
33
|
+
Object.defineProperty(obj, key, {
|
|
34
|
+
value: value,
|
|
35
|
+
enumerable: true,
|
|
36
|
+
configurable: true,
|
|
37
|
+
writable: true
|
|
38
|
+
});
|
|
39
|
+
} else {
|
|
40
|
+
obj[key] = value;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return obj;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function _objectSpread(target) {
|
|
47
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
48
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
49
|
+
var ownKeys = Object.keys(source);
|
|
50
|
+
|
|
51
|
+
if (typeof Object.getOwnPropertySymbols === 'function') {
|
|
52
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
|
|
53
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
2
56
|
|
|
3
|
-
|
|
57
|
+
ownKeys.forEach(function (key) {
|
|
58
|
+
_defineProperty(target, key, source[key]);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
4
61
|
|
|
5
|
-
|
|
62
|
+
return target;
|
|
63
|
+
}
|
|
6
64
|
|
|
7
|
-
/**
|
|
8
|
-
* --------------------------------------------------------------------------
|
|
9
|
-
* Bootstrap (v4.0.0): carousel.js
|
|
10
|
-
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
|
11
|
-
* --------------------------------------------------------------------------
|
|
12
|
-
*/
|
|
13
|
-
var Carousel = function ($) {
|
|
14
65
|
/**
|
|
15
66
|
* ------------------------------------------------------------------------
|
|
16
67
|
* Constants
|
|
17
68
|
* ------------------------------------------------------------------------
|
|
18
69
|
*/
|
|
70
|
+
|
|
19
71
|
var NAME = 'carousel';
|
|
20
|
-
var VERSION = '4.
|
|
72
|
+
var VERSION = '4.3.1';
|
|
21
73
|
var DATA_KEY = 'bs.carousel';
|
|
22
74
|
var EVENT_KEY = "." + DATA_KEY;
|
|
23
75
|
var DATA_API_KEY = '.data-api';
|
|
24
76
|
var JQUERY_NO_CONFLICT = $.fn[NAME];
|
|
25
|
-
var TRANSITION_DURATION = 600;
|
|
26
77
|
var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
|
|
27
78
|
|
|
28
79
|
var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
|
|
29
80
|
|
|
30
81
|
var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
|
|
31
82
|
|
|
83
|
+
var SWIPE_THRESHOLD = 40;
|
|
32
84
|
var Default = {
|
|
33
85
|
interval: 5000,
|
|
34
86
|
keyboard: true,
|
|
35
87
|
slide: false,
|
|
36
88
|
pause: 'hover',
|
|
37
|
-
wrap: true
|
|
89
|
+
wrap: true,
|
|
90
|
+
touch: true
|
|
38
91
|
};
|
|
39
92
|
var DefaultType = {
|
|
40
93
|
interval: '(number|boolean)',
|
|
41
94
|
keyboard: 'boolean',
|
|
42
95
|
slide: '(boolean|string)',
|
|
43
96
|
pause: '(string|boolean)',
|
|
44
|
-
wrap: 'boolean'
|
|
97
|
+
wrap: 'boolean',
|
|
98
|
+
touch: 'boolean'
|
|
45
99
|
};
|
|
46
100
|
var Direction = {
|
|
47
101
|
NEXT: 'next',
|
|
@@ -55,7 +109,12 @@ var Carousel = function ($) {
|
|
|
55
109
|
KEYDOWN: "keydown" + EVENT_KEY,
|
|
56
110
|
MOUSEENTER: "mouseenter" + EVENT_KEY,
|
|
57
111
|
MOUSELEAVE: "mouseleave" + EVENT_KEY,
|
|
112
|
+
TOUCHSTART: "touchstart" + EVENT_KEY,
|
|
113
|
+
TOUCHMOVE: "touchmove" + EVENT_KEY,
|
|
58
114
|
TOUCHEND: "touchend" + EVENT_KEY,
|
|
115
|
+
POINTERDOWN: "pointerdown" + EVENT_KEY,
|
|
116
|
+
POINTERUP: "pointerup" + EVENT_KEY,
|
|
117
|
+
DRAG_START: "dragstart" + EVENT_KEY,
|
|
59
118
|
LOAD_DATA_API: "load" + EVENT_KEY + DATA_API_KEY,
|
|
60
119
|
CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
|
|
61
120
|
};
|
|
@@ -67,16 +126,22 @@ var Carousel = function ($) {
|
|
|
67
126
|
LEFT: 'carousel-item-left',
|
|
68
127
|
NEXT: 'carousel-item-next',
|
|
69
128
|
PREV: 'carousel-item-prev',
|
|
70
|
-
ITEM: 'carousel-item'
|
|
129
|
+
ITEM: 'carousel-item',
|
|
130
|
+
POINTER_EVENT: 'pointer-event'
|
|
71
131
|
};
|
|
72
132
|
var Selector = {
|
|
73
133
|
ACTIVE: '.active',
|
|
74
134
|
ACTIVE_ITEM: '.active.carousel-item',
|
|
75
135
|
ITEM: '.carousel-item',
|
|
136
|
+
ITEM_IMG: '.carousel-item img',
|
|
76
137
|
NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
|
|
77
138
|
INDICATORS: '.carousel-indicators',
|
|
78
139
|
DATA_SLIDE: '[data-slide], [data-slide-to]',
|
|
79
140
|
DATA_RIDE: '[data-ride="carousel"]'
|
|
141
|
+
};
|
|
142
|
+
var PointerType = {
|
|
143
|
+
TOUCH: 'touch',
|
|
144
|
+
PEN: 'pen'
|
|
80
145
|
/**
|
|
81
146
|
* ------------------------------------------------------------------------
|
|
82
147
|
* Class Definition
|
|
@@ -95,9 +160,13 @@ var Carousel = function ($) {
|
|
|
95
160
|
this._isPaused = false;
|
|
96
161
|
this._isSliding = false;
|
|
97
162
|
this.touchTimeout = null;
|
|
163
|
+
this.touchStartX = 0;
|
|
164
|
+
this.touchDeltaX = 0;
|
|
98
165
|
this._config = this._getConfig(config);
|
|
99
|
-
this._element =
|
|
100
|
-
this._indicatorsElement =
|
|
166
|
+
this._element = element;
|
|
167
|
+
this._indicatorsElement = this._element.querySelector(Selector.INDICATORS);
|
|
168
|
+
this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0;
|
|
169
|
+
this._pointerEvent = Boolean(window.PointerEvent || window.MSPointerEvent);
|
|
101
170
|
|
|
102
171
|
this._addEventListeners();
|
|
103
172
|
} // Getters
|
|
@@ -131,7 +200,7 @@ var Carousel = function ($) {
|
|
|
131
200
|
this._isPaused = true;
|
|
132
201
|
}
|
|
133
202
|
|
|
134
|
-
if (
|
|
203
|
+
if (this._element.querySelector(Selector.NEXT_PREV)) {
|
|
135
204
|
Util.triggerTransitionEnd(this._element);
|
|
136
205
|
this.cycle(true);
|
|
137
206
|
}
|
|
@@ -158,7 +227,7 @@ var Carousel = function ($) {
|
|
|
158
227
|
_proto.to = function to(index) {
|
|
159
228
|
var _this = this;
|
|
160
229
|
|
|
161
|
-
this._activeElement =
|
|
230
|
+
this._activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
|
|
162
231
|
|
|
163
232
|
var activeIndex = this._getItemIndex(this._activeElement);
|
|
164
233
|
|
|
@@ -195,15 +264,34 @@ var Carousel = function ($) {
|
|
|
195
264
|
this._isSliding = null;
|
|
196
265
|
this._activeElement = null;
|
|
197
266
|
this._indicatorsElement = null;
|
|
198
|
-
}
|
|
199
|
-
|
|
267
|
+
} // Private
|
|
268
|
+
;
|
|
200
269
|
|
|
201
270
|
_proto._getConfig = function _getConfig(config) {
|
|
202
|
-
config =
|
|
271
|
+
config = _objectSpread({}, Default, config);
|
|
203
272
|
Util.typeCheckConfig(NAME, config, DefaultType);
|
|
204
273
|
return config;
|
|
205
274
|
};
|
|
206
275
|
|
|
276
|
+
_proto._handleSwipe = function _handleSwipe() {
|
|
277
|
+
var absDeltax = Math.abs(this.touchDeltaX);
|
|
278
|
+
|
|
279
|
+
if (absDeltax <= SWIPE_THRESHOLD) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
var direction = absDeltax / this.touchDeltaX; // swipe left
|
|
284
|
+
|
|
285
|
+
if (direction > 0) {
|
|
286
|
+
this.prev();
|
|
287
|
+
} // swipe right
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
if (direction < 0) {
|
|
291
|
+
this.next();
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
|
|
207
295
|
_proto._addEventListeners = function _addEventListeners() {
|
|
208
296
|
var _this2 = this;
|
|
209
297
|
|
|
@@ -219,8 +307,45 @@ var Carousel = function ($) {
|
|
|
219
307
|
}).on(Event.MOUSELEAVE, function (event) {
|
|
220
308
|
return _this2.cycle(event);
|
|
221
309
|
});
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
if (this._config.touch) {
|
|
313
|
+
this._addTouchEventListeners();
|
|
314
|
+
}
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
_proto._addTouchEventListeners = function _addTouchEventListeners() {
|
|
318
|
+
var _this3 = this;
|
|
319
|
+
|
|
320
|
+
if (!this._touchSupported) {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
var start = function start(event) {
|
|
325
|
+
if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
|
|
326
|
+
_this3.touchStartX = event.originalEvent.clientX;
|
|
327
|
+
} else if (!_this3._pointerEvent) {
|
|
328
|
+
_this3.touchStartX = event.originalEvent.touches[0].clientX;
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
var move = function move(event) {
|
|
333
|
+
// ensure swiping with one touch and not pinching
|
|
334
|
+
if (event.originalEvent.touches && event.originalEvent.touches.length > 1) {
|
|
335
|
+
_this3.touchDeltaX = 0;
|
|
336
|
+
} else {
|
|
337
|
+
_this3.touchDeltaX = event.originalEvent.touches[0].clientX - _this3.touchStartX;
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
var end = function end(event) {
|
|
342
|
+
if (_this3._pointerEvent && PointerType[event.originalEvent.pointerType.toUpperCase()]) {
|
|
343
|
+
_this3.touchDeltaX = event.originalEvent.clientX - _this3.touchStartX;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
_this3._handleSwipe();
|
|
222
347
|
|
|
223
|
-
if ('
|
|
348
|
+
if (_this3._config.pause === 'hover') {
|
|
224
349
|
// If it's a touch-enabled device, mouseenter/leave are fired as
|
|
225
350
|
// part of the mouse compatibility events on first tap - the carousel
|
|
226
351
|
// would stop cycling until user tapped out of it;
|
|
@@ -228,18 +353,41 @@ var Carousel = function ($) {
|
|
|
228
353
|
// (as if it's the second time we tap on it, mouseenter compat event
|
|
229
354
|
// is NOT fired) and after a timeout (to allow for mouse compatibility
|
|
230
355
|
// events to fire) we explicitly restart cycling
|
|
231
|
-
|
|
232
|
-
_this2.pause();
|
|
356
|
+
_this3.pause();
|
|
233
357
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
358
|
+
if (_this3.touchTimeout) {
|
|
359
|
+
clearTimeout(_this3.touchTimeout);
|
|
360
|
+
}
|
|
237
361
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
});
|
|
362
|
+
_this3.touchTimeout = setTimeout(function (event) {
|
|
363
|
+
return _this3.cycle(event);
|
|
364
|
+
}, TOUCHEVENT_COMPAT_WAIT + _this3._config.interval);
|
|
242
365
|
}
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
$(this._element.querySelectorAll(Selector.ITEM_IMG)).on(Event.DRAG_START, function (e) {
|
|
369
|
+
return e.preventDefault();
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
if (this._pointerEvent) {
|
|
373
|
+
$(this._element).on(Event.POINTERDOWN, function (event) {
|
|
374
|
+
return start(event);
|
|
375
|
+
});
|
|
376
|
+
$(this._element).on(Event.POINTERUP, function (event) {
|
|
377
|
+
return end(event);
|
|
378
|
+
});
|
|
379
|
+
|
|
380
|
+
this._element.classList.add(ClassName.POINTER_EVENT);
|
|
381
|
+
} else {
|
|
382
|
+
$(this._element).on(Event.TOUCHSTART, function (event) {
|
|
383
|
+
return start(event);
|
|
384
|
+
});
|
|
385
|
+
$(this._element).on(Event.TOUCHMOVE, function (event) {
|
|
386
|
+
return move(event);
|
|
387
|
+
});
|
|
388
|
+
$(this._element).on(Event.TOUCHEND, function (event) {
|
|
389
|
+
return end(event);
|
|
390
|
+
});
|
|
243
391
|
}
|
|
244
392
|
};
|
|
245
393
|
|
|
@@ -264,7 +412,7 @@ var Carousel = function ($) {
|
|
|
264
412
|
};
|
|
265
413
|
|
|
266
414
|
_proto._getItemIndex = function _getItemIndex(element) {
|
|
267
|
-
this._items =
|
|
415
|
+
this._items = element && element.parentNode ? [].slice.call(element.parentNode.querySelectorAll(Selector.ITEM)) : [];
|
|
268
416
|
return this._items.indexOf(element);
|
|
269
417
|
};
|
|
270
418
|
|
|
@@ -289,7 +437,7 @@ var Carousel = function ($) {
|
|
|
289
437
|
_proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
|
|
290
438
|
var targetIndex = this._getItemIndex(relatedTarget);
|
|
291
439
|
|
|
292
|
-
var fromIndex = this._getItemIndex(
|
|
440
|
+
var fromIndex = this._getItemIndex(this._element.querySelector(Selector.ACTIVE_ITEM));
|
|
293
441
|
|
|
294
442
|
var slideEvent = $.Event(Event.SLIDE, {
|
|
295
443
|
relatedTarget: relatedTarget,
|
|
@@ -303,7 +451,8 @@ var Carousel = function ($) {
|
|
|
303
451
|
|
|
304
452
|
_proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
|
|
305
453
|
if (this._indicatorsElement) {
|
|
306
|
-
|
|
454
|
+
var indicators = [].slice.call(this._indicatorsElement.querySelectorAll(Selector.ACTIVE));
|
|
455
|
+
$(indicators).removeClass(ClassName.ACTIVE);
|
|
307
456
|
|
|
308
457
|
var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
|
|
309
458
|
|
|
@@ -314,9 +463,9 @@ var Carousel = function ($) {
|
|
|
314
463
|
};
|
|
315
464
|
|
|
316
465
|
_proto._slide = function _slide(direction, element) {
|
|
317
|
-
var
|
|
466
|
+
var _this4 = this;
|
|
318
467
|
|
|
319
|
-
var activeElement =
|
|
468
|
+
var activeElement = this._element.querySelector(Selector.ACTIVE_ITEM);
|
|
320
469
|
|
|
321
470
|
var activeElementIndex = this._getItemIndex(activeElement);
|
|
322
471
|
|
|
@@ -370,19 +519,29 @@ var Carousel = function ($) {
|
|
|
370
519
|
to: nextElementIndex
|
|
371
520
|
});
|
|
372
521
|
|
|
373
|
-
if (
|
|
522
|
+
if ($(this._element).hasClass(ClassName.SLIDE)) {
|
|
374
523
|
$(nextElement).addClass(orderClassName);
|
|
375
524
|
Util.reflow(nextElement);
|
|
376
525
|
$(activeElement).addClass(directionalClassName);
|
|
377
526
|
$(nextElement).addClass(directionalClassName);
|
|
527
|
+
var nextElementInterval = parseInt(nextElement.getAttribute('data-interval'), 10);
|
|
528
|
+
|
|
529
|
+
if (nextElementInterval) {
|
|
530
|
+
this._config.defaultInterval = this._config.defaultInterval || this._config.interval;
|
|
531
|
+
this._config.interval = nextElementInterval;
|
|
532
|
+
} else {
|
|
533
|
+
this._config.interval = this._config.defaultInterval || this._config.interval;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
var transitionDuration = Util.getTransitionDurationFromElement(activeElement);
|
|
378
537
|
$(activeElement).one(Util.TRANSITION_END, function () {
|
|
379
538
|
$(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName.ACTIVE);
|
|
380
539
|
$(activeElement).removeClass(ClassName.ACTIVE + " " + orderClassName + " " + directionalClassName);
|
|
381
|
-
|
|
540
|
+
_this4._isSliding = false;
|
|
382
541
|
setTimeout(function () {
|
|
383
|
-
return $(
|
|
542
|
+
return $(_this4._element).trigger(slidEvent);
|
|
384
543
|
}, 0);
|
|
385
|
-
}).emulateTransitionEnd(
|
|
544
|
+
}).emulateTransitionEnd(transitionDuration);
|
|
386
545
|
} else {
|
|
387
546
|
$(activeElement).removeClass(ClassName.ACTIVE);
|
|
388
547
|
$(nextElement).addClass(ClassName.ACTIVE);
|
|
@@ -393,17 +552,17 @@ var Carousel = function ($) {
|
|
|
393
552
|
if (isCycling) {
|
|
394
553
|
this.cycle();
|
|
395
554
|
}
|
|
396
|
-
}
|
|
397
|
-
|
|
555
|
+
} // Static
|
|
556
|
+
;
|
|
398
557
|
|
|
399
558
|
Carousel._jQueryInterface = function _jQueryInterface(config) {
|
|
400
559
|
return this.each(function () {
|
|
401
560
|
var data = $(this).data(DATA_KEY);
|
|
402
561
|
|
|
403
|
-
var _config =
|
|
562
|
+
var _config = _objectSpread({}, Default, $(this).data());
|
|
404
563
|
|
|
405
564
|
if (typeof config === 'object') {
|
|
406
|
-
_config =
|
|
565
|
+
_config = _objectSpread({}, _config, config);
|
|
407
566
|
}
|
|
408
567
|
|
|
409
568
|
var action = typeof config === 'string' ? config : _config.slide;
|
|
@@ -421,7 +580,7 @@ var Carousel = function ($) {
|
|
|
421
580
|
}
|
|
422
581
|
|
|
423
582
|
data[action]();
|
|
424
|
-
} else if (_config.interval) {
|
|
583
|
+
} else if (_config.interval && _config.ride) {
|
|
425
584
|
data.pause();
|
|
426
585
|
data.cycle();
|
|
427
586
|
}
|
|
@@ -441,7 +600,7 @@ var Carousel = function ($) {
|
|
|
441
600
|
return;
|
|
442
601
|
}
|
|
443
602
|
|
|
444
|
-
var config =
|
|
603
|
+
var config = _objectSpread({}, $(target).data(), $(this).data());
|
|
445
604
|
|
|
446
605
|
var slideIndex = this.getAttribute('data-slide-to');
|
|
447
606
|
|
|
@@ -481,11 +640,13 @@ var Carousel = function ($) {
|
|
|
481
640
|
|
|
482
641
|
$(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
|
|
483
642
|
$(window).on(Event.LOAD_DATA_API, function () {
|
|
484
|
-
|
|
485
|
-
|
|
643
|
+
var carousels = [].slice.call(document.querySelectorAll(Selector.DATA_RIDE));
|
|
644
|
+
|
|
645
|
+
for (var i = 0, len = carousels.length; i < len; i++) {
|
|
646
|
+
var $carousel = $(carousels[i]);
|
|
486
647
|
|
|
487
648
|
Carousel._jQueryInterface.call($carousel, $carousel.data());
|
|
488
|
-
}
|
|
649
|
+
}
|
|
489
650
|
});
|
|
490
651
|
/**
|
|
491
652
|
* ------------------------------------------------------------------------
|
|
@@ -502,4 +663,5 @@ var Carousel = function ($) {
|
|
|
502
663
|
};
|
|
503
664
|
|
|
504
665
|
return Carousel;
|
|
505
|
-
|
|
666
|
+
|
|
667
|
+
}));
|