@@ -9,9 +9,7 @@ import $ from 'jquery'
99import Util from './util'
1010
1111/**
12- * ------------------------------------------------------------------------
1312 * Constants
14- * ------------------------------------------------------------------------
1513 */
1614
1715const NAME = 'carousel'
@@ -25,23 +23,14 @@ const ARROW_RIGHT_KEYCODE = 39 // KeyboardEvent.which value for right arrow key
2523const TOUCHEVENT_COMPAT_WAIT = 500 // Time for mouse compat events to fire after touch
2624const SWIPE_THRESHOLD = 40
2725
28- const Default = {
29- interval : 5000 ,
30- keyboard : true ,
31- slide : false ,
32- pause : 'hover' ,
33- wrap : true ,
34- touch : true
35- }
36-
37- const DefaultType = {
38- interval : '(number|boolean)' ,
39- keyboard : 'boolean' ,
40- slide : '(boolean|string)' ,
41- pause : '(string|boolean)' ,
42- wrap : 'boolean' ,
43- touch : 'boolean'
44- }
26+ const CLASS_NAME_CAROUSEL = 'carousel'
27+ const CLASS_NAME_ACTIVE = 'active'
28+ const CLASS_NAME_SLIDE = 'slide'
29+ const CLASS_NAME_RIGHT = 'carousel-item-right'
30+ const CLASS_NAME_LEFT = 'carousel-item-left'
31+ const CLASS_NAME_NEXT = 'carousel-item-next'
32+ const CLASS_NAME_PREV = 'carousel-item-prev'
33+ const CLASS_NAME_POINTER_EVENT = 'pointer-event'
4534
4635const DIRECTION_NEXT = 'next'
4736const DIRECTION_PREV = 'prev'
@@ -62,15 +51,6 @@ const EVENT_DRAG_START = `dragstart${EVENT_KEY}`
6251const EVENT_LOAD_DATA_API = `load${ EVENT_KEY } ${ DATA_API_KEY } `
6352const EVENT_CLICK_DATA_API = `click${ EVENT_KEY } ${ DATA_API_KEY } `
6453
65- const CLASS_NAME_CAROUSEL = 'carousel'
66- const CLASS_NAME_ACTIVE = 'active'
67- const CLASS_NAME_SLIDE = 'slide'
68- const CLASS_NAME_RIGHT = 'carousel-item-right'
69- const CLASS_NAME_LEFT = 'carousel-item-left'
70- const CLASS_NAME_NEXT = 'carousel-item-next'
71- const CLASS_NAME_PREV = 'carousel-item-prev'
72- const CLASS_NAME_POINTER_EVENT = 'pointer-event'
73-
7454const SELECTOR_ACTIVE = '.active'
7555const SELECTOR_ACTIVE_ITEM = '.active.carousel-item'
7656const SELECTOR_ITEM = '.carousel-item'
@@ -80,16 +60,33 @@ const SELECTOR_INDICATORS = '.carousel-indicators'
8060const SELECTOR_DATA_SLIDE = '[data-slide], [data-slide-to]'
8161const SELECTOR_DATA_RIDE = '[data-ride="carousel"]'
8262
63+ const Default = {
64+ interval : 5000 ,
65+ keyboard : true ,
66+ slide : false ,
67+ pause : 'hover' ,
68+ wrap : true ,
69+ touch : true
70+ }
71+
72+ const DefaultType = {
73+ interval : '(number|boolean)' ,
74+ keyboard : 'boolean' ,
75+ slide : '(boolean|string)' ,
76+ pause : '(string|boolean)' ,
77+ wrap : 'boolean' ,
78+ touch : 'boolean'
79+ }
80+
8381const PointerType = {
8482 TOUCH : 'touch' ,
8583 PEN : 'pen'
8684}
8785
8886/**
89- * ------------------------------------------------------------------------
90- * Class Definition
91- * ------------------------------------------------------------------------
87+ * Class definition
9288 */
89+
9390class Carousel {
9491 constructor ( element , config ) {
9592 this . _items = null
@@ -111,7 +108,6 @@ class Carousel {
111108 }
112109
113110 // Getters
114-
115111 static get VERSION ( ) {
116112 return VERSION
117113 }
@@ -121,7 +117,6 @@ class Carousel {
121117 }
122118
123119 // Public
124-
125120 next ( ) {
126121 if ( ! this . _isSliding ) {
127122 this . _slide ( DIRECTION_NEXT )
@@ -220,7 +215,6 @@ class Carousel {
220215 }
221216
222217 // Private
223-
224218 _getConfig ( config ) {
225219 config = {
226220 ...Default ,
@@ -508,7 +502,6 @@ class Carousel {
508502 }
509503
510504 // Static
511-
512505 static _jQueryInterface ( config ) {
513506 return this . each ( function ( ) {
514507 let data = $ ( this ) . data ( DATA_KEY )
@@ -580,9 +573,7 @@ class Carousel {
580573}
581574
582575/**
583- * ------------------------------------------------------------------------
584- * Data Api implementation
585- * ------------------------------------------------------------------------
576+ * Data API implementation
586577 */
587578
588579$ ( document ) . on ( EVENT_CLICK_DATA_API , SELECTOR_DATA_SLIDE , Carousel . _dataApiClickHandler )
@@ -596,9 +587,7 @@ $(window).on(EVENT_LOAD_DATA_API, () => {
596587} )
597588
598589/**
599- * ------------------------------------------------------------------------
600590 * jQuery
601- * ------------------------------------------------------------------------
602591 */
603592
604593$ . fn [ NAME ] = Carousel . _jQueryInterface
0 commit comments