11"use strict" ;
22
3+ /**
4+ * Slideshow that uses pure HTML for each slide element.
5+ *
6+ * @constructor
7+ *
8+ * @param {object } param
9+ * @param {HTMLElement|string } [param.container="#slideshow"] Container of all the slides.
10+ * @param {string } [param.slideshowSelector=".slideshow"] Class selector for the slideshow.
11+ * @param {string } [param.slideSelector=".slide"] Class selector for all the slides.
12+ * @param {string } [param.currentSelector=".current"] Class selector for the current slide.
13+ * @param {number } [param.duration=0]
14+ * @param {boolean } [param.cycle=true]
15+ * @param {boolean } [param.swipe=false]
16+ * @param {boolean } [param.throwsSlideIndexError=false]
17+ *
18+ * @version 1.0.0
19+ *
20+ * @author Gennaro Landolfi <[email protected] > 21+ */
322function Slideshow ( _ref ) {
423 var _this = this ;
524
@@ -17,8 +36,8 @@ function Slideshow(_ref) {
1736 cycle = _ref$cycle === void 0 ? true : _ref$cycle ,
1837 _ref$swipe = _ref . swipe ,
1938 swipe = _ref$swipe === void 0 ? false : _ref$swipe ,
20- _ref$throwsOpenIndexE = _ref . throwsOpenIndexError ,
21- throwsSlideIndexError = _ref$throwsOpenIndexE === void 0 ? false : _ref$throwsOpenIndexE ;
39+ _ref$throwsSlideIndex = _ref . throwsSlideIndexError ,
40+ throwsSlideIndexError = _ref$throwsSlideIndex === void 0 ? false : _ref$throwsSlideIndex ;
2241
2342 // Type-checks
2443 if ( typeof container === 'string' ) {
@@ -224,11 +243,11 @@ function Slideshow(_ref) {
224243 } // Public methods:
225244
226245 /**
227- * Shows the previous `<figure>`. If the ovelay is closed, opens it .
246+ * Shows the previous slide .
228247 *
229248 * @param {boolean } [cycleState] Determines if the counter must cycle.
230249 *
231- * @emits FigureGallery#fig-gallery :prev
250+ * @emits Slideshow#slideshow :prev
232251 *
233252 * @return {this }
234253 */
@@ -244,38 +263,35 @@ function Slideshow(_ref) {
244263 prevEvent = document . createEvent ( 'slideshow:prev' ) ;
245264 prevEvent . initCustomEvent ( 'slideshow:prev' , false , false , {
246265 current : current ,
247- next : oldCurrent ,
248- active : that . getCurrentSlide ( )
266+ next : oldCurrent
249267 } ) ;
250268 } else {
251269 prevEvent = new CustomEvent ( 'slideshow:prev' , {
252270 detail : {
253271 current : current ,
254- next : oldCurrent ,
255- active : that . getCurrentSlide ( )
272+ next : oldCurrent
256273 }
257274 } ) ;
258275 }
259276 /**
260- * Event triggered when the gallery gets navigated to the previous element.
277+ * Event triggered when the slideshow gets navigated to the previous element.
261278 *
262- * @event FigureGallery#fig-gallery :prev
279+ * @event Slideshow#slideshow :prev
263280 * @type {object }
264- * @property {HTMLElement } current - Current active <figure> element in container.
265- * @property {HTMLElement } next - Old active <figure> element in container which succeeds the current.
266- * @property {HTMLElement } active - Active <figure> element in overlay.
281+ * @property {HTMLElement } current - Current slide element in container.
282+ * @property {HTMLElement } next - Old current slide element in container which succeeds the current.
267283 */
268284
269285
270286 container . dispatchEvent ( prevEvent ) ;
271287 return _this ;
272288 } ;
273289 /**
274- * Shows the next `<figure>`. If the ovelay is closed, opens it .
290+ * Shows the next slide .
275291 *
276292 * @param {boolean } [cycleState] Determines if the counter must cycle.
277293 *
278- * @emits FigureGallery#fig-gallery :next
294+ * @emits Slideshow#slideshow :next
279295 *
280296 * @return {this }
281297 */
@@ -291,40 +307,37 @@ function Slideshow(_ref) {
291307 nextEvent = document . createEvent ( 'slideshow:next' ) ;
292308 nextEvent . initCustomEvent ( 'slideshow:next' , false , false , {
293309 current : current ,
294- prev : oldCurrent ,
295- active : that . getCurrentSlide ( )
310+ prev : oldCurrent
296311 } ) ;
297312 } else {
298313 nextEvent = new CustomEvent ( 'slideshow:next' , {
299314 detail : {
300315 current : current ,
301- prev : oldCurrent ,
302- active : that . getCurrentSlide ( )
316+ prev : oldCurrent
303317 }
304318 } ) ;
305319 }
306320 /**
307- * Event triggered when the gallery gets navigated to the next element.
321+ * Event triggered when the slideshow gets navigated to the next element.
308322 *
309- * @event FigureGallery#fig-gallery :next
323+ * @event Slideshow#slideshow :next
310324 * @type {object }
311- * @property {HTMLElement } current - Current active <figure> element in container.
312- * @property {HTMLElement } prev - Old active <figure> element in container which precedes the current.
313- * @property {HTMLElement } active - Active <figure> element in overlay.
325+ * @property {HTMLElement } current - Current slide element in container.
326+ * @property {HTMLElement } prev - Old current slide element in container which precedes the current.
314327 */
315328
316329
317330 container . dispatchEvent ( nextEvent ) ;
318331 return _this ;
319332 } ;
320333 /**
321- * Sets the current `< slide>` .
334+ * Sets the current slide.
322335 *
323336 * @param {number|HTMLElement|Node } slide Index of the element or the
324337 * element itself to bet setted as
325338 * current.
326339 *
327- * @emits FigureGallery#fig-gallery :setted
340+ * @emits Slideshow#slideshow :setted
328341 *
329342 * @return {this }
330343 *
@@ -366,26 +379,23 @@ function Slideshow(_ref) {
366379 settedEvent = document . createEvent ( 'slideshow:setted' ) ;
367380 settedEvent . initCustomEvent ( 'slideshow:setted' , false , false , {
368381 current : current ,
369- old : oldCurrent ,
370- active : that . getCurrentSlide ( )
382+ old : oldCurrent
371383 } ) ;
372384 } else {
373385 settedEvent = new CustomEvent ( 'slideshow:setted' , {
374386 detail : {
375387 current : current ,
376- old : oldCurrent ,
377- active : that . getCurrentSlide ( )
388+ old : oldCurrent
378389 }
379390 } ) ;
380391 }
381392 /**
382- * Event triggered when the gallery gets setted on a specific element.
393+ * Event triggered when the slideshow gets setted on a specific element.
383394 *
384- * @event FigureGallery#fig-gallery :setted
395+ * @event Slideshow#slideshow :setted
385396 * @type {object }
386- * @property {HTMLElement } current - Current active <slide> element in container.
387- * @property {HTMLElement } old - Old active <slide> element in container.
388- * @property {HTMLElement } active - Active <slide> element in overlay.
397+ * @property {HTMLElement } current - Current slide element in container.
398+ * @property {HTMLElement } old - Old current slide element in container.
389399 */
390400
391401
@@ -433,10 +443,24 @@ function Slideshow(_ref) {
433443 * Returns the swipe handler instance, if exists.
434444 *
435445 * @return {SwipeEvent|null }
446+ *
447+ * @see {@link https://github.com/dencreativityspace/swipe-event|swipe-event }
436448 */
437449
438450
439451 this . getSwipeHandler = function ( ) {
440452 return swipeHandler ;
441453 } ;
454+ /**
455+ * Returns the swipe handler instance, if exists.
456+ *
457+ * @return {Interval|null }
458+ *
459+ * @see {@link https://github.com/dencreativityspace/interval|interval }
460+ */
461+
462+
463+ this . getInterval = function ( ) {
464+ return interval ;
465+ } ;
442466}
0 commit comments