swipebox 1.3.0.1.1 → 1.3.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04fb75ab43a213a3833b54715094cef9be18d7b9
4
- data.tar.gz: 0de63ded4ee8db8538999d5e3c1c6c96633ae748
3
+ metadata.gz: 903e8dac097206db8c9e25caee1086e184c33483
4
+ data.tar.gz: cf0b6af816942097436dcaaaf3730d294e0cef4b
5
5
  SHA512:
6
- metadata.gz: 40b8cf9fe703a4af690eee8038b8ecc4004d0ac1b381dca6ce606c1f3e0b9a6b6874bc5ce6b200062a13472ee5cac19b29caab6072bbf052f2fab00542fad905
7
- data.tar.gz: f849ffcfd8b7c137de9a248e6ebe2248b03e85a4982618d102d1e5ddb8793608ea13c544cbb343a0d98f970a06d1abb7f37bc9b40a9782965d90b99a0e72064e
6
+ metadata.gz: 4916614e27134b439bcc79c56392e37dae49770651382b793401c63339b542582d1dac21e37ef9f74a11004037c8d0d3502db404ae5352453b7d6206fb92f3e5
7
+ data.tar.gz: 890aa6af31c3f7f59486d708541c25602a3677e4ac591d77563562061087029db27f5e04e7a0b6657e2574e3e12f44875cb53bc848f01a05a24c6f756f69574c
data/README.md CHANGED
@@ -1,9 +1,9 @@
1
1
  # Swipebox for Rails
2
2
 
3
- [![Gem Version](https://badge.fury.io/rb/swipebox.png)](http://badge.fury.io/rb/swipebox)
4
- [![Build Status](https://travis-ci.org/mrfoto/swipebox.png?branch=master)](https://travis-ci.org/mrfoto/swipebox)
5
- [![Code Climate](https://codeclimate.com/github/mrfoto/swipebox.png)](https://codeclimate.com/github/mrfoto/swipebox)
6
- [![Dependency Status](https://gemnasium.com/mrfoto/swipebox.png)](https://gemnasium.com/mrfoto/swipebox)
3
+ [![Gem Version](http://img.shields.io/gem/v/swipebox.svg?style=flat-square)](http://rubygems.org/gems/swipebox)
4
+ [![Build Status](http://img.shields.io/travis/mrfoto/swipebox.svg?style=flat-square)](https://travis-ci.org/mrfoto/swipebox)
5
+ [![Code Climate](http://img.shields.io/codeclimate/github/mrfoto/swipebox.svg?style=flat-square)](https://codeclimate.com/github/mrfoto/swipebox)
6
+ [![Dependency Status](http://img.shields.io/gemnasium/mrfoto/swipebox.svg?style=flat-square)](https://gemnasium.com/mrfoto/swipebox)
7
7
 
8
8
  [Swipebox | A touchable jQuery lightbox](http://brutaldesign.github.io/swipebox/) for the Rails asset pipeline
9
9
 
@@ -57,7 +57,7 @@ loopAtEnd: false // true will return to the first image after the last image is
57
57
 
58
58
  Look at the original [Swipebox repo](https://github.com/brutaldesign/swipebox#usage) for more.
59
59
 
60
- I have modified source a bit from the 1.3.0.1.1 version:
60
+ I have modified source a bit from the 1.3.0.2 version:
61
61
  - SCSS instead of CSS because we need the `image-url` helpers
62
62
  - .png -> .svg via class not hardcoded image path
63
63
 
@@ -1,3 +1,3 @@
1
1
  module Swipebox
2
- VERSION = '1.3.0.1.1'
2
+ VERSION = '1.3.0.2'
3
3
  end
@@ -1,4 +1,4 @@
1
- /*! Swipebox v1.3.0.1.1 | Constantin Saguin csag.co | MIT License | github.com/brutaldesign/swipebox */
1
+ /*! Swipebox v1.3.0.2 | Constantin Saguin csag.co | MIT License | github.com/brutaldesign/swipebox */
2
2
 
3
3
  ;( function ( window, document, $, undefined ) {
4
4
 
@@ -6,47 +6,48 @@
6
6
 
7
7
  // Default options
8
8
  var ui,
9
- defaults = {
10
- useCSS : true,
11
- useSVG : true,
12
- initialIndexOnArray : 0,
13
- hideCloseButtonOnMobile : false,
14
- hideBarsDelay : 3000,
15
- videoMaxWidth : 1140,
16
- vimeoColor : 'cccccc',
17
- beforeOpen: null,
18
- afterOpen: null,
19
- afterClose: null,
20
- loopAtEnd: false
21
- },
22
-
23
- plugin = this,
24
- elements = [], // slides array [ { href:'...', title:'...' }, ...],
25
- $elem,
26
- selector = elem.selector,
27
- $selector = $( selector ),
28
- isMobile = navigator.userAgent.match( /(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i ),
29
- isTouch = isMobile !== null || document.createTouch !== undefined || ( 'ontouchstart' in window ) || ( 'onmsgesturechange' in window ) || navigator.msMaxTouchPoints,
30
- supportSVG = !! document.createElementNS && !! document.createElementNS( 'http://www.w3.org/2000/svg', 'svg').createSVGRect,
31
- winWidth = window.innerWidth ? window.innerWidth : $( window ).width(),
32
- winHeight = window.innerHeight ? window.innerHeight : $( window ).height(),
33
- currentX = 0,
34
- /* jshint multistr: true */
35
- html = '<div id="swipebox-overlay">\
36
- <div id="swipebox-container">\
37
- <div id="swipebox-slider"></div>\
38
- <div id="swipebox-top-bar">\
39
- <div id="swipebox-title"></div>\
40
- </div>\
41
- <div id="swipebox-bottom-bar">\
42
- <div id="swipebox-arrows">\
43
- <a id="swipebox-prev"></a>\
44
- <a id="swipebox-next"></a>\
45
- </div>\
46
- </div>\
47
- <a id="swipebox-close"></a>\
48
- </div>\
49
- </div>';
9
+ defaults = {
10
+ useCSS : true,
11
+ useSVG : true,
12
+ initialIndexOnArray : 0,
13
+ hideCloseButtonOnMobile : false,
14
+ hideBarsDelay : 3000,
15
+ videoMaxWidth : 1140,
16
+ vimeoColor : 'cccccc',
17
+ beforeOpen: null,
18
+ afterOpen: null,
19
+ afterClose: null,
20
+ loopAtEnd: false,
21
+ autoplayVideos: false
22
+ },
23
+
24
+ plugin = this,
25
+ elements = [], // slides array [ { href:'...', title:'...' }, ...],
26
+ $elem,
27
+ selector = elem.selector,
28
+ $selector = $( selector ),
29
+ isMobile = navigator.userAgent.match( /(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i ),
30
+ isTouch = isMobile !== null || document.createTouch !== undefined || ( 'ontouchstart' in window ) || ( 'onmsgesturechange' in window ) || navigator.msMaxTouchPoints,
31
+ supportSVG = !! document.createElementNS && !! document.createElementNS( 'http://www.w3.org/2000/svg', 'svg').createSVGRect,
32
+ winWidth = window.innerWidth ? window.innerWidth : $( window ).width(),
33
+ winHeight = window.innerHeight ? window.innerHeight : $( window ).height(),
34
+ currentX = 0,
35
+ /* jshint multistr: true */
36
+ html = '<div id="swipebox-overlay">\
37
+ <div id="swipebox-container">\
38
+ <div id="swipebox-slider"></div>\
39
+ <div id="swipebox-top-bar">\
40
+ <div id="swipebox-title"></div>\
41
+ </div>\
42
+ <div id="swipebox-bottom-bar">\
43
+ <div id="swipebox-arrows">\
44
+ <a id="swipebox-prev"></a>\
45
+ <a id="swipebox-next"></a>\
46
+ </div>\
47
+ </div>\
48
+ <a id="swipebox-close"></a>\
49
+ </div>\
50
+ </div>';
50
51
 
51
52
  plugin.settings = {};
52
53
 
@@ -108,7 +109,7 @@
108
109
  $elem.each( function() {
109
110
 
110
111
  var title = null,
111
- href = null;
112
+ href = null;
112
113
 
113
114
  if ( $( this ).attr( 'title' ) ) {
114
115
  title = $( this ).attr( 'title' );
@@ -243,7 +244,7 @@
243
244
  supportTransition : function () {
244
245
 
245
246
  var prefixes = 'transition WebkitTransition MozTransition OTransition msTransition KhtmlTransition'.split( ' ' ),
246
- i;
247
+ i;
247
248
 
248
249
  for ( i = 0; i < prefixes.length; i++ ) {
249
250
  if ( document.createElement( 'div' ).style[ prefixes[i] ] !== undefined ) {
@@ -268,20 +269,20 @@
268
269
  gesture : function () {
269
270
 
270
271
  var $this = this,
271
- index,
272
- hDistance,
273
- vDistance,
274
- hDistanceLast,
275
- vDistanceLast,
276
- hDistancePercent,
277
- vSwipe = false,
278
- hSwipe = false,
279
- hSwipMinDistance = 10,
280
- vSwipMinDistance = 50,
281
- startCoords = {},
282
- endCoords = {},
283
- bars = $( '#swipebox-top-bar, #swipebox-bottom-bar' ),
284
- slider = $( '#swipebox-slider' );
272
+ index,
273
+ hDistance,
274
+ vDistance,
275
+ hDistanceLast,
276
+ vDistanceLast,
277
+ hDistancePercent,
278
+ vSwipe = false,
279
+ hSwipe = false,
280
+ hSwipMinDistance = 10,
281
+ vSwipMinDistance = 50,
282
+ startCoords = {},
283
+ endCoords = {},
284
+ bars = $( '#swipebox-top-bar, #swipebox-bottom-bar' ),
285
+ slider = $( '#swipebox-slider' );
285
286
 
286
287
  bars.addClass( 'visible-bars' );
287
288
  $this.setTimeout();
@@ -347,7 +348,7 @@
347
348
  } );
348
349
  }
349
350
 
350
- // swipe rught
351
+ // swipe rught
351
352
  } else if ( 0 > hDistance ) {
352
353
 
353
354
  // last Slide
@@ -387,10 +388,10 @@
387
388
  if ( Math.abs( vDistance ) >= 2 * vSwipMinDistance && Math.abs( vDistance ) > Math.abs( vDistanceLast ) ) {
388
389
  var vOffset = vDistance > 0 ? slider.height() : - slider.height();
389
390
  slider.animate( { top: vOffset + 'px', 'opacity': 0 },
390
- 300,
391
- function () {
392
- $this.closeSlide();
393
- } );
391
+ 300,
392
+ function () {
393
+ $this.closeSlide();
394
+ } );
394
395
  } else {
395
396
  slider.animate( { top: 0, 'opacity': 1 }, 300 );
396
397
  }
@@ -404,7 +405,7 @@
404
405
 
405
406
  $this.getPrev();
406
407
 
407
- // swipeRight
408
+ // swipeRight
408
409
  } else if ( hDistance <= -hSwipMinDistance && hDistance <= hDistanceLast) {
409
410
 
410
411
  $this.getNext();
@@ -440,430 +441,430 @@
440
441
  var $this = this;
441
442
  $this.clearTimeout();
442
443
  $this.timeout = window.setTimeout( function() {
443
- $this.hideBars();
444
- },
445
-
446
- plugin.settings.hideBarsDelay
447
- );
448
- }
449
- },
444
+ $this.hideBars();
445
+ },
450
446
 
451
- /**
452
- * Clear timer
453
- */
454
- clearTimeout: function () {
455
- window.clearTimeout( this.timeout );
456
- this.timeout = null;
457
- },
458
-
459
- /**
460
- * Show navigation and title bars
461
- */
462
- showBars : function () {
463
- var bars = $( '#swipebox-top-bar, #swipebox-bottom-bar' );
464
- if ( this.doCssTrans() ) {
447
+ plugin.settings.hideBarsDelay
448
+ );
449
+ }
450
+ },
451
+
452
+ /**
453
+ * Clear timer
454
+ */
455
+ clearTimeout: function () {
456
+ window.clearTimeout( this.timeout );
457
+ this.timeout = null;
458
+ },
459
+
460
+ /**
461
+ * Show navigation and title bars
462
+ */
463
+ showBars : function () {
464
+ var bars = $( '#swipebox-top-bar, #swipebox-bottom-bar' );
465
+ if ( this.doCssTrans() ) {
466
+ bars.addClass( 'visible-bars' );
467
+ } else {
468
+ $( '#swipebox-top-bar' ).animate( { top : 0 }, 500 );
469
+ $( '#swipebox-bottom-bar' ).animate( { bottom : 0 }, 500 );
470
+ setTimeout( function() {
465
471
  bars.addClass( 'visible-bars' );
466
- } else {
467
- $( '#swipebox-top-bar' ).animate( { top : 0 }, 500 );
468
- $( '#swipebox-bottom-bar' ).animate( { bottom : 0 }, 500 );
469
- setTimeout( function() {
470
- bars.addClass( 'visible-bars' );
471
- }, 1000 );
472
- }
473
- },
474
-
475
- /**
476
- * Hide navigation and title bars
477
- */
478
- hideBars : function () {
479
- var bars = $( '#swipebox-top-bar, #swipebox-bottom-bar' );
480
- if ( this.doCssTrans() ) {
472
+ }, 1000 );
473
+ }
474
+ },
475
+
476
+ /**
477
+ * Hide navigation and title bars
478
+ */
479
+ hideBars : function () {
480
+ var bars = $( '#swipebox-top-bar, #swipebox-bottom-bar' );
481
+ if ( this.doCssTrans() ) {
482
+ bars.removeClass( 'visible-bars' );
483
+ } else {
484
+ $( '#swipebox-top-bar' ).animate( { top : '-50px' }, 500 );
485
+ $( '#swipebox-bottom-bar' ).animate( { bottom : '-50px' }, 500 );
486
+ setTimeout( function() {
481
487
  bars.removeClass( 'visible-bars' );
482
- } else {
483
- $( '#swipebox-top-bar' ).animate( { top : '-50px' }, 500 );
484
- $( '#swipebox-bottom-bar' ).animate( { bottom : '-50px' }, 500 );
485
- setTimeout( function() {
486
- bars.removeClass( 'visible-bars' );
487
- }, 1000 );
488
- }
489
- },
490
-
491
- /**
492
- * Animate navigation and top bars
493
- */
494
- animBars : function () {
495
- var $this = this,
496
- bars = $( '#swipebox-top-bar, #swipebox-bottom-bar' );
488
+ }, 1000 );
489
+ }
490
+ },
497
491
 
498
- bars.addClass( 'visible-bars' );
499
- $this.setTimeout();
492
+ /**
493
+ * Animate navigation and top bars
494
+ */
495
+ animBars : function () {
496
+ var $this = this,
497
+ bars = $( '#swipebox-top-bar, #swipebox-bottom-bar' );
500
498
 
501
- $( '#swipebox-slider' ).click( function() {
502
- if ( ! bars.hasClass( 'visible-bars' ) ) {
503
- $this.showBars();
504
- $this.setTimeout();
505
- }
506
- } );
499
+ bars.addClass( 'visible-bars' );
500
+ $this.setTimeout();
507
501
 
508
- $( '#swipebox-bottom-bar' ).hover( function() {
502
+ $( '#swipebox-slider' ).click( function() {
503
+ if ( ! bars.hasClass( 'visible-bars' ) ) {
509
504
  $this.showBars();
510
- bars.addClass( 'visible-bars' );
511
- $this.clearTimeout();
512
-
513
- }, function() {
514
- if ( plugin.settings.hideBarsDelay > 0 ) {
515
- bars.removeClass( 'visible-bars' );
516
- $this.setTimeout();
517
- }
505
+ $this.setTimeout();
506
+ }
507
+ } );
518
508
 
519
- } );
520
- },
509
+ $( '#swipebox-bottom-bar' ).hover( function() {
510
+ $this.showBars();
511
+ bars.addClass( 'visible-bars' );
512
+ $this.clearTimeout();
521
513
 
522
- /**
523
- * Keyboard navigation
524
- */
525
- keyboard : function () {
526
- var $this = this;
527
- $( window ).bind( 'keyup', function( event ) {
528
- event.preventDefault();
529
- event.stopPropagation();
514
+ }, function() {
515
+ if ( plugin.settings.hideBarsDelay > 0 ) {
516
+ bars.removeClass( 'visible-bars' );
517
+ $this.setTimeout();
518
+ }
530
519
 
531
- if ( event.keyCode === 37 ) {
520
+ } );
521
+ },
532
522
 
533
- $this.getPrev();
523
+ /**
524
+ * Keyboard navigation
525
+ */
526
+ keyboard : function () {
527
+ var $this = this;
528
+ $( window ).bind( 'keyup', function( event ) {
529
+ event.preventDefault();
530
+ event.stopPropagation();
534
531
 
535
- } else if ( event.keyCode === 39 ) {
532
+ if ( event.keyCode === 37 ) {
536
533
 
537
- $this.getNext();
534
+ $this.getPrev();
538
535
 
539
- } else if ( event.keyCode === 27 ) {
536
+ } else if ( event.keyCode === 39 ) {
540
537
 
541
- $this.closeSlide();
542
- }
543
- } );
544
- },
538
+ $this.getNext();
545
539
 
546
- /**
547
- * Navigation events : go to next slide, go to prevous slide and close
548
- */
549
- actions : function () {
550
- var $this = this,
551
- action = 'touchend click'; // Just detect for both event types to allow for multi-input
540
+ } else if ( event.keyCode === 27 ) {
552
541
 
553
- if ( elements.length < 2 ) {
542
+ $this.closeSlide();
543
+ }
544
+ } );
545
+ },
554
546
 
555
- $( '#swipebox-bottom-bar' ).hide();
547
+ /**
548
+ * Navigation events : go to next slide, go to prevous slide and close
549
+ */
550
+ actions : function () {
551
+ var $this = this,
552
+ action = 'touchend click'; // Just detect for both event types to allow for multi-input
556
553
 
557
- if ( undefined === elements[ 1 ] ) {
558
- $( '#swipebox-top-bar' ).hide();
559
- }
554
+ if ( elements.length < 2 ) {
560
555
 
561
- } else {
562
- $( '#swipebox-prev' ).bind( action, function( event ) {
563
- event.preventDefault();
564
- event.stopPropagation();
565
- $this.getPrev();
566
- $this.setTimeout();
567
- } );
556
+ $( '#swipebox-bottom-bar' ).hide();
568
557
 
569
- $( '#swipebox-next' ).bind( action, function( event ) {
570
- event.preventDefault();
571
- event.stopPropagation();
572
- $this.getNext();
573
- $this.setTimeout();
574
- } );
558
+ if ( undefined === elements[ 1 ] ) {
559
+ $( '#swipebox-top-bar' ).hide();
575
560
  }
576
561
 
577
- $( '#swipebox-close' ).bind( action, function() {
578
- $this.closeSlide();
562
+ } else {
563
+ $( '#swipebox-prev' ).bind( action, function( event ) {
564
+ event.preventDefault();
565
+ event.stopPropagation();
566
+ $this.getPrev();
567
+ $this.setTimeout();
579
568
  } );
580
- },
581
569
 
582
- /**
583
- * Set current slide
584
- */
585
- setSlide : function ( index, isFirst ) {
570
+ $( '#swipebox-next' ).bind( action, function( event ) {
571
+ event.preventDefault();
572
+ event.stopPropagation();
573
+ $this.getNext();
574
+ $this.setTimeout();
575
+ } );
576
+ }
586
577
 
587
- isFirst = isFirst || false;
578
+ $( '#swipebox-close' ).bind( action, function() {
579
+ $this.closeSlide();
580
+ } );
581
+ },
588
582
 
589
- var slider = $( '#swipebox-slider' );
583
+ /**
584
+ * Set current slide
585
+ */
586
+ setSlide : function ( index, isFirst ) {
590
587
 
591
- currentX = -index*100;
588
+ isFirst = isFirst || false;
592
589
 
593
- if ( this.doCssTrans() ) {
594
- slider.css( {
595
- '-webkit-transform' : 'translate3d(' + (-index*100)+'%, 0, 0)',
596
- 'transform' : 'translate3d(' + (-index*100)+'%, 0, 0)'
597
- } );
598
- } else {
599
- slider.animate( { left : ( -index*100 )+'%' } );
600
- }
590
+ var slider = $( '#swipebox-slider' );
601
591
 
602
- $( '#swipebox-slider .slide' ).removeClass( 'current' );
603
- $( '#swipebox-slider .slide' ).eq( index ).addClass( 'current' );
604
- this.setTitle( index );
592
+ currentX = -index*100;
605
593
 
606
- if ( isFirst ) {
607
- slider.fadeIn();
608
- }
594
+ if ( this.doCssTrans() ) {
595
+ slider.css( {
596
+ '-webkit-transform' : 'translate3d(' + (-index*100)+'%, 0, 0)',
597
+ 'transform' : 'translate3d(' + (-index*100)+'%, 0, 0)'
598
+ } );
599
+ } else {
600
+ slider.animate( { left : ( -index*100 )+'%' } );
601
+ }
609
602
 
610
- $( '#swipebox-prev, #swipebox-next' ).removeClass( 'disabled' );
603
+ $( '#swipebox-slider .slide' ).removeClass( 'current' );
604
+ $( '#swipebox-slider .slide' ).eq( index ).addClass( 'current' );
605
+ this.setTitle( index );
611
606
 
612
- if ( index === 0 ) {
613
- $( '#swipebox-prev' ).addClass( 'disabled' );
614
- } else if ( index === elements.length - 1 && plugin.settings.loopAtEnd !== true ) {
615
- $( '#swipebox-next' ).addClass( 'disabled' );
616
- }
617
- },
607
+ if ( isFirst ) {
608
+ slider.fadeIn();
609
+ }
618
610
 
619
- /**
620
- * Open slide
621
- */
622
- openSlide : function ( index ) {
623
- $( 'html' ).addClass( 'swipebox-html' );
624
- if ( isTouch ) {
625
- $( 'html' ).addClass( 'swipebox-touch' );
611
+ $( '#swipebox-prev, #swipebox-next' ).removeClass( 'disabled' );
626
612
 
627
- if ( plugin.settings.hideCloseButtonOnMobile ) {
628
- $( 'html' ).addClass( 'swipebox-no-close-button' );
629
- }
630
- } else {
631
- $( 'html' ).addClass( 'swipebox-no-touch' );
632
- }
633
- $( window ).trigger( 'resize' ); // fix scroll bar visibility on desktop
634
- this.setSlide( index, true );
635
- },
613
+ if ( index === 0 ) {
614
+ $( '#swipebox-prev' ).addClass( 'disabled' );
615
+ } else if ( index === elements.length - 1 && plugin.settings.loopAtEnd !== true ) {
616
+ $( '#swipebox-next' ).addClass( 'disabled' );
617
+ }
618
+ },
636
619
 
637
- /**
638
- * Set a time out if the media is a video
639
- */
640
- preloadMedia : function ( index ) {
641
- var $this = this,
642
- src = null;
620
+ /**
621
+ * Open slide
622
+ */
623
+ openSlide : function ( index ) {
624
+ $( 'html' ).addClass( 'swipebox-html' );
625
+ if ( isTouch ) {
626
+ $( 'html' ).addClass( 'swipebox-touch' );
643
627
 
644
- if ( elements[ index ] !== undefined ) {
645
- src = elements[ index ].href;
628
+ if ( plugin.settings.hideCloseButtonOnMobile ) {
629
+ $( 'html' ).addClass( 'swipebox-no-close-button' );
646
630
  }
631
+ } else {
632
+ $( 'html' ).addClass( 'swipebox-no-touch' );
633
+ }
634
+ $( window ).trigger( 'resize' ); // fix scroll bar visibility on desktop
635
+ this.setSlide( index, true );
636
+ },
637
+
638
+ /**
639
+ * Set a time out if the media is a video
640
+ */
641
+ preloadMedia : function ( index ) {
642
+ var $this = this,
643
+ src = null;
644
+
645
+ if ( elements[ index ] !== undefined ) {
646
+ src = elements[ index ].href;
647
+ }
647
648
 
648
- if ( ! $this.isVideo( src ) ) {
649
- setTimeout( function() {
650
- $this.openMedia( index );
651
- }, 1000);
652
- } else {
649
+ if ( ! $this.isVideo( src ) ) {
650
+ setTimeout( function() {
653
651
  $this.openMedia( index );
654
- }
655
- },
652
+ }, 1000);
653
+ } else {
654
+ $this.openMedia( index );
655
+ }
656
+ },
657
+
658
+ /**
659
+ * Open
660
+ */
661
+ openMedia : function ( index ) {
662
+ var $this = this,
663
+ src,
664
+ slide;
665
+
666
+ if ( elements[ index ] !== undefined ) {
667
+ src = elements[ index ].href;
668
+ }
656
669
 
657
- /**
658
- * Open
659
- */
660
- openMedia : function ( index ) {
661
- var $this = this,
662
- src,
663
- slide;
670
+ if ( index < 0 || index >= elements.length ) {
671
+ return false;
672
+ }
664
673
 
665
- if ( elements[ index ] !== undefined ) {
666
- src = elements[ index ].href;
667
- }
674
+ slide = $( '#swipebox-slider .slide' ).eq( index );
668
675
 
669
- if ( index < 0 || index >= elements.length ) {
670
- return false;
671
- }
676
+ if ( ! $this.isVideo( src ) ) {
677
+ slide.addClass( 'slide-loading' );
678
+ $this.loadMedia( src, function() {
679
+ slide.removeClass( 'slide-loading' );
680
+ slide.html( this );
681
+ } );
682
+ } else {
683
+ slide.html( $this.getVideo( src ) );
684
+ }
672
685
 
673
- slide = $( '#swipebox-slider .slide' ).eq( index );
686
+ },
674
687
 
675
- if ( ! $this.isVideo( src ) ) {
676
- slide.addClass( 'slide-loading' );
677
- $this.loadMedia( src, function() {
678
- slide.removeClass( 'slide-loading' );
679
- slide.html( this );
680
- } );
681
- } else {
682
- slide.html( $this.getVideo( src ) );
683
- }
688
+ /**
689
+ * Set link title attribute as caption
690
+ */
691
+ setTitle : function ( index ) {
692
+ var title = null;
684
693
 
685
- },
694
+ $( '#swipebox-title' ).empty();
686
695
 
687
- /**
688
- * Set link title attribute as caption
689
- */
690
- setTitle : function ( index ) {
691
- var title = null;
696
+ if ( elements[ index ] !== undefined ) {
697
+ title = elements[ index ].title;
698
+ }
692
699
 
693
- $( '#swipebox-title' ).empty();
700
+ if ( title ) {
701
+ $( '#swipebox-top-bar' ).show();
702
+ $( '#swipebox-title' ).append( title );
703
+ } else {
704
+ $( '#swipebox-top-bar' ).hide();
705
+ }
706
+ },
694
707
 
695
- if ( elements[ index ] !== undefined ) {
696
- title = elements[ index ].title;
697
- }
708
+ /**
709
+ * Check if the URL is a video
710
+ */
711
+ isVideo : function ( src ) {
698
712
 
699
- if ( title ) {
700
- $( '#swipebox-top-bar' ).show();
701
- $( '#swipebox-title' ).append( title );
702
- } else {
703
- $( '#swipebox-top-bar' ).hide();
713
+ if ( src ) {
714
+ if ( src.match( /youtube\.com\/watch\?v=([a-zA-Z0-9\-_]+)/) || src.match( /vimeo\.com\/([0-9]*)/ ) || src.match( /youtu\.be\/([a-zA-Z0-9\-_]+)/ ) ) {
715
+ return true;
704
716
  }
705
- },
706
717
 
707
- /**
708
- * Check if the URL is a video
709
- */
710
- isVideo : function ( src ) {
718
+ if ( src.toLowerCase().indexOf( 'swipeboxvideo=1' ) >= 0 ) {
711
719
 
712
- if ( src ) {
713
- if ( src.match( /youtube\.com\/watch\?v=([a-zA-Z0-9\-_]+)/) || src.match( /vimeo\.com\/([0-9]*)/ ) || src.match( /youtu\.be\/([a-zA-Z0-9\-_]+)/ ) ) {
714
- return true;
715
- }
716
-
717
- if ( src.toLowerCase().indexOf( 'swipeboxvideo=1' ) >= 0 ) {
718
-
719
- return true;
720
- }
720
+ return true;
721
721
  }
722
+ }
722
723
 
723
- },
724
-
725
- /**
726
- * Get video iframe code from URL
727
- */
728
- getVideo : function( url ) {
729
- var iframe = '',
730
- youtubeUrl = url.match( /watch\?v=([a-zA-Z0-9\-_]+)/ ),
731
- youtubeShortUrl = url.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/),
732
- vimeoUrl = url.match( /vimeo\.com\/([0-9]*)/ );
733
- if ( youtubeUrl || youtubeShortUrl) {
734
- if ( youtubeShortUrl ) {
735
- youtubeUrl = youtubeShortUrl;
736
- }
737
- iframe = '<iframe width="560" height="315" src="//www.youtube.com/embed/' + youtubeUrl[1] + '" frameborder="0" allowfullscreen></iframe>';
724
+ },
738
725
 
739
- } else if ( vimeoUrl ) {
726
+ /**
727
+ * Get video iframe code from URL
728
+ */
729
+ getVideo : function( url ) {
730
+ var iframe = '',
731
+ youtubeUrl = url.match( /watch\?v=([a-zA-Z0-9\-_]+)/ ),
732
+ youtubeShortUrl = url.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/),
733
+ vimeoUrl = url.match( /vimeo\.com\/([0-9]*)/ );
734
+ if ( youtubeUrl || youtubeShortUrl) {
735
+ if ( youtubeShortUrl ) {
736
+ youtubeUrl = youtubeShortUrl;
737
+ }
738
+ iframe = '<iframe width="560" height="315" src="//www.youtube.com/embed/' + youtubeUrl[1] + '?autoplay='+ plugin.settings.autoplayVideos + '" frameborder="0" allowfullscreen></iframe>';
740
739
 
741
- iframe = '<iframe width="560" height="315" src="//player.vimeo.com/video/' + vimeoUrl[1] + '?byline=0&amp;portrait=0&amp;color='+plugin.settings.vimeoColor+'" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
740
+ } else if ( vimeoUrl ) {
742
741
 
743
- }
742
+ iframe = '<iframe width="560" height="315" src="//player.vimeo.com/video/' + vimeoUrl[1] + '?byline=0&amp;portrait=0&amp;color=' + plugin.settings.vimeoColor + '&autoplay=' + plugin.settings.autoplayVideos + '" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>';
744
743
 
745
- if ( youtubeUrl || youtubeShortUrl || vimeoUrl ) {
744
+ }
746
745
 
747
- } else {
748
- iframe = '<iframe width="560" height="315" src="' + url + '" frameborder="0" allowfullscreen></iframe>';
749
- }
746
+ if ( youtubeUrl || youtubeShortUrl || vimeoUrl ) {
750
747
 
751
- return '<div class="swipebox-video-container" style="max-width:' + plugin.settings.videomaxWidth + 'px"><div class="swipebox-video">'+iframe+'</div></div>';
752
- },
748
+ } else {
749
+ iframe = '<iframe width="560" height="315" src="' + url + '" frameborder="0" allowfullscreen></iframe>';
750
+ }
753
751
 
754
- /**
755
- * Load image
756
- */
757
- loadMedia : function ( src, callback ) {
758
- if ( ! this.isVideo( src ) ) {
759
- var img = $( '<img>' ).on( 'load', function() {
760
- callback.call( img );
761
- } );
752
+ return '<div class="swipebox-video-container" style="max-width:' + plugin.settings.videomaxWidth + 'px"><div class="swipebox-video">' + iframe + '</div></div>';
753
+ },
762
754
 
763
- img.attr( 'src', src );
764
- }
765
- },
755
+ /**
756
+ * Load image
757
+ */
758
+ loadMedia : function ( src, callback ) {
759
+ if ( ! this.isVideo( src ) ) {
760
+ var img = $( '<img>' ).on( 'load', function() {
761
+ callback.call( img );
762
+ } );
766
763
 
767
- /**
768
- * Get next slide
769
- */
770
- getNext : function () {
771
- var $this = this,
772
- src,
773
- index = $( '#swipebox-slider .slide' ).index( $( '#swipebox-slider .slide.current' ) );
774
- if ( index + 1 < elements.length ) {
764
+ img.attr( 'src', src );
765
+ }
766
+ },
767
+
768
+ /**
769
+ * Get next slide
770
+ */
771
+ getNext : function () {
772
+ var $this = this,
773
+ src,
774
+ index = $( '#swipebox-slider .slide' ).index( $( '#swipebox-slider .slide.current' ) );
775
+ if ( index + 1 < elements.length ) {
776
+
777
+ src = $( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe' ).attr( 'src' );
778
+ $( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe' ).attr( 'src', src );
779
+ index++;
780
+ $this.setSlide( index );
781
+ $this.preloadMedia( index+1 );
782
+ } else {
775
783
 
784
+ if ( plugin.settings.loopAtEnd === true ) {
776
785
  src = $( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe' ).attr( 'src' );
777
786
  $( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe' ).attr( 'src', src );
778
- index++;
787
+ index = 0;
788
+ $this.preloadMedia( index );
779
789
  $this.setSlide( index );
780
- $this.preloadMedia( index+1 );
790
+ $this.preloadMedia( index + 1 );
781
791
  } else {
782
-
783
- if ( plugin.settings.loopAtEnd === true ) {
784
- src = $( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe' ).attr( 'src' );
785
- $( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe' ).attr( 'src', src );
786
- index = 0;
787
- $this.preloadMedia( index );
788
- $this.setSlide( index );
789
- $this.preloadMedia( index + 1 );
790
- } else {
791
- $( '#swipebox-overlay' ).addClass( 'rightSpring' );
792
- setTimeout( function() {
793
- $( '#swipebox-overlay' ).removeClass( 'rightSpring' );
794
- }, 500 );
795
- }
796
- }
797
- },
798
-
799
- /**
800
- * Get previous slide
801
- */
802
- getPrev : function () {
803
- var index = $( '#swipebox-slider .slide' ).index( $( '#swipebox-slider .slide.current' ) ),
804
- src;
805
- if ( index > 0 ) {
806
- src = $( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe').attr( 'src' );
807
- $( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe' ).attr( 'src', src );
808
- index--;
809
- this.setSlide( index );
810
- this.preloadMedia( index-1 );
811
- } else {
812
- $( '#swipebox-overlay' ).addClass( 'leftSpring' );
792
+ $( '#swipebox-overlay' ).addClass( 'rightSpring' );
813
793
  setTimeout( function() {
814
- $( '#swipebox-overlay' ).removeClass( 'leftSpring' );
794
+ $( '#swipebox-overlay' ).removeClass( 'rightSpring' );
815
795
  }, 500 );
816
796
  }
817
- },
818
-
819
- /**
820
- * Close
821
- */
822
- closeSlide : function () {
823
- $( 'html' ).removeClass( 'swipebox-html' );
824
- $( 'html' ).removeClass( 'swipebox-touch' );
825
- $( window ).trigger( 'resize' );
826
- this.destroy();
827
- },
828
-
829
- /**
830
- * Destroy the whole thing
831
- */
832
- destroy : function () {
833
- $( window ).unbind( 'keyup' );
834
- $( 'body' ).unbind( 'touchstart' );
835
- $( 'body' ).unbind( 'touchmove' );
836
- $( 'body' ).unbind( 'touchend' );
837
- $( '#swipebox-slider' ).unbind();
838
- $( '#swipebox-overlay' ).remove();
839
-
840
- if ( ! $.isArray( elem ) ) {
841
- elem.removeData( '_swipebox' );
842
- }
797
+ }
798
+ },
799
+
800
+ /**
801
+ * Get previous slide
802
+ */
803
+ getPrev : function () {
804
+ var index = $( '#swipebox-slider .slide' ).index( $( '#swipebox-slider .slide.current' ) ),
805
+ src;
806
+ if ( index > 0 ) {
807
+ src = $( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe').attr( 'src' );
808
+ $( '#swipebox-slider .slide' ).eq( index ).contents().find( 'iframe' ).attr( 'src', src );
809
+ index--;
810
+ this.setSlide( index );
811
+ this.preloadMedia( index-1 );
812
+ } else {
813
+ $( '#swipebox-overlay' ).addClass( 'leftSpring' );
814
+ setTimeout( function() {
815
+ $( '#swipebox-overlay' ).removeClass( 'leftSpring' );
816
+ }, 500 );
817
+ }
818
+ },
819
+
820
+ /**
821
+ * Close
822
+ */
823
+ closeSlide : function () {
824
+ $( 'html' ).removeClass( 'swipebox-html' );
825
+ $( 'html' ).removeClass( 'swipebox-touch' );
826
+ $( window ).trigger( 'resize' );
827
+ this.destroy();
828
+ },
829
+
830
+ /**
831
+ * Destroy the whole thing
832
+ */
833
+ destroy : function () {
834
+ $( window ).unbind( 'keyup' );
835
+ $( 'body' ).unbind( 'touchstart' );
836
+ $( 'body' ).unbind( 'touchmove' );
837
+ $( 'body' ).unbind( 'touchend' );
838
+ $( '#swipebox-slider' ).unbind();
839
+ $( '#swipebox-overlay' ).remove();
840
+
841
+ if ( ! $.isArray( elem ) ) {
842
+ elem.removeData( '_swipebox' );
843
+ }
843
844
 
844
- if ( this.target ) {
845
- this.target.trigger( 'swipebox-destroy' );
846
- }
845
+ if ( this.target ) {
846
+ this.target.trigger( 'swipebox-destroy' );
847
+ }
847
848
 
848
- $.swipebox.isOpen = false;
849
+ $.swipebox.isOpen = false;
849
850
 
850
- if ( plugin.settings.afterClose ) {
851
- plugin.settings.afterClose();
852
- }
851
+ if ( plugin.settings.afterClose ) {
852
+ plugin.settings.afterClose();
853
853
  }
854
- };
855
-
856
- plugin.init();
854
+ }
857
855
  };
858
856
 
859
- $.fn.swipebox = function( options ) {
857
+ plugin.init();
858
+ };
860
859
 
861
- if ( ! $.data( this, '_swipebox' ) ) {
862
- var swipebox = new $.swipebox( this, options );
863
- this.data( '_swipebox', swipebox );
864
- }
865
- return this.data( '_swipebox' );
860
+ $.fn.swipebox = function( options ) {
866
861
 
867
- };
862
+ if ( ! $.data( this, '_swipebox' ) ) {
863
+ var swipebox = new $.swipebox( this, options );
864
+ this.data( '_swipebox', swipebox );
865
+ }
866
+ return this.data( '_swipebox' );
867
+
868
+ };
868
869
 
869
870
  }( window, document, jQuery ) );
@@ -1,4 +1,4 @@
1
- /*! Swipebox v1.3.0.1.1 | Constantin Saguin csag.co | MIT License | github.com/brutaldesign/swipebox */
1
+ /*! Swipebox v1.3.0.2 | Constantin Saguin csag.co | MIT License | github.com/brutaldesign/swipebox */
2
2
 
3
3
  html.swipebox-html.swipebox-touch {
4
4
  overflow: hidden !important;
metadata CHANGED
@@ -1,81 +1,81 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swipebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0.1.1
4
+ version: 1.3.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miha Rekar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-01 00:00:00.000000000 Z
11
+ date: 2015-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.1'
20
- - - <
20
+ - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '5.0'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - '>='
27
+ - - ">="
28
28
  - !ruby/object:Gem::Version
29
29
  version: '3.1'
30
- - - <
30
+ - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '5.0'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: sass-rails
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - '>='
37
+ - - ">="
38
38
  - !ruby/object:Gem::Version
39
39
  version: '3.1'
40
- - - <
40
+ - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '5.0'
42
+ version: '6.0'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - '>='
47
+ - - ">="
48
48
  - !ruby/object:Gem::Version
49
49
  version: '3.1'
50
- - - <
50
+ - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '5.0'
52
+ version: '6.0'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: minitest
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - ~>
57
+ - - "~>"
58
58
  - !ruby/object:Gem::Version
59
59
  version: '5'
60
60
  type: :development
61
61
  prerelease: false
62
62
  version_requirements: !ruby/object:Gem::Requirement
63
63
  requirements:
64
- - - ~>
64
+ - - "~>"
65
65
  - !ruby/object:Gem::Version
66
66
  version: '5'
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: capybara
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
- - - ~>
71
+ - - "~>"
72
72
  - !ruby/object:Gem::Version
73
73
  version: '2'
74
74
  type: :development
75
75
  prerelease: false
76
76
  version_requirements: !ruby/object:Gem::Requirement
77
77
  requirements:
78
- - - ~>
78
+ - - "~>"
79
79
  - !ruby/object:Gem::Version
80
80
  version: '2'
81
81
  description: Swipebox | A touchable lightbox for the Rails asset pipeline.
@@ -85,16 +85,13 @@ executables: []
85
85
  extensions: []
86
86
  extra_rdoc_files: []
87
87
  files:
88
- - lib/swipebox/version.rb
89
- - lib/swipebox.rb
90
- - vendor/assets/images/swipebox-icons.png
91
- - vendor/assets/images/swipebox-icons.svg
92
- - vendor/assets/images/swipebox-loader.gif
93
- - vendor/assets/javascripts/swipebox.js
94
- - vendor/assets/stylesheets/swipebox.css.scss
95
88
  - MIT-LICENSE
96
- - Rakefile
97
89
  - README.md
90
+ - Rakefile
91
+ - lib/swipebox.rb
92
+ - lib/swipebox/version.rb
93
+ - test/dummy/README.rdoc
94
+ - test/dummy/Rakefile
98
95
  - test/dummy/app/assets/javascripts/application.js
99
96
  - test/dummy/app/assets/stylesheets/application.css
100
97
  - test/dummy/app/controllers/application_controller.rb
@@ -103,6 +100,7 @@ files:
103
100
  - test/dummy/bin/bundle
104
101
  - test/dummy/bin/rails
105
102
  - test/dummy/bin/rake
103
+ - test/dummy/config.ru
106
104
  - test/dummy/config/application.rb
107
105
  - test/dummy/config/boot.rb
108
106
  - test/dummy/config/database.yml
@@ -119,14 +117,11 @@ files:
119
117
  - test/dummy/config/initializers/wrap_parameters.rb
120
118
  - test/dummy/config/locales/en.yml
121
119
  - test/dummy/config/routes.rb
122
- - test/dummy/config.ru
123
120
  - test/dummy/log/test.log
124
121
  - test/dummy/public/404.html
125
122
  - test/dummy/public/422.html
126
123
  - test/dummy/public/500.html
127
124
  - test/dummy/public/favicon.ico
128
- - test/dummy/Rakefile
129
- - test/dummy/README.rdoc
130
125
  - test/dummy/tmp/cache/assets/test/sass/af322a0e92ccadac09012d154ee28b4f413653a2/swipebox.css.scssc
131
126
  - test/dummy/tmp/cache/assets/test/sprockets/094fe312f84e24456e939e232419d161
132
127
  - test/dummy/tmp/cache/assets/test/sprockets/3624f679b2faef3c8d4f0be8b412a7b4
@@ -145,6 +140,11 @@ files:
145
140
  - test/dummy/tmp/cache/assets/test/sprockets/ecdcd5383451c2a6f726373f42341806
146
141
  - test/integration/swipebox_integration_test.rb
147
142
  - test/test_helper.rb
143
+ - vendor/assets/images/swipebox-icons.png
144
+ - vendor/assets/images/swipebox-icons.svg
145
+ - vendor/assets/images/swipebox-loader.gif
146
+ - vendor/assets/javascripts/swipebox.js
147
+ - vendor/assets/stylesheets/swipebox.css.scss
148
148
  homepage: https://github.com/mrfoto/swipebox
149
149
  licenses:
150
150
  - MIT
@@ -155,17 +155,17 @@ require_paths:
155
155
  - lib
156
156
  required_ruby_version: !ruby/object:Gem::Requirement
157
157
  requirements:
158
- - - '>='
158
+ - - ">="
159
159
  - !ruby/object:Gem::Version
160
160
  version: '0'
161
161
  required_rubygems_version: !ruby/object:Gem::Requirement
162
162
  requirements:
163
- - - '>='
163
+ - - ">="
164
164
  - !ruby/object:Gem::Version
165
165
  version: '0'
166
166
  requirements: []
167
167
  rubyforge_project:
168
- rubygems_version: 2.0.14
168
+ rubygems_version: 2.2.2
169
169
  signing_key:
170
170
  specification_version: 4
171
171
  summary: Wrapper for Swipebox by @brutaldesign