cycle2-rails 1.0.0 → 1.1.0

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.
@@ -0,0 +1,17 @@
1
+ //= require jquery.cycle2
2
+
3
+ /*! scrollVert transition plugin for Cycle2; version: 20121120 */
4
+ (function($) {
5
+ "use strict";
6
+
7
+ $.fn.cycle.transitions.scrollVert = {
8
+ before: function( opts, curr, next, fwd ) {
9
+ opts.API.stackSlides( opts, curr, next, fwd );
10
+ var height = opts.container.css('overflow','hidden').height();
11
+ opts.cssBefore = { top: fwd ? -height : height, left: 0, opacity: 1, display: 'block' };
12
+ opts.animIn = { top: 0 };
13
+ opts.animOut = { top: fwd ? height : -height };
14
+ }
15
+ };
16
+
17
+ })(jQuery);
@@ -0,0 +1,64 @@
1
+ //= require jquery.cycle2
2
+
3
+ /*! shuffle transition plugin for Cycle2; version: 20121120 */
4
+ (function($) {
5
+ "use strict";
6
+
7
+ $.fn.cycle.transitions.shuffle = {
8
+
9
+ transition: function( opts, currEl, nextEl, fwd, callback ) {
10
+ $( nextEl ).show();
11
+ var width = opts.container.css( 'overflow', 'visible' ).width();
12
+ var speed = opts.speed / 2; // shuffle has 2 transitions
13
+ var element = fwd ? currEl : nextEl;
14
+
15
+ opts = opts.API.getSlideOpts( fwd ? opts.currSlide : opts.nextSlide );
16
+ var props1 = { left:-width, top:15 };
17
+ var props2 = opts.slideCss || { left:0, top:0 };
18
+
19
+ if ( opts.shuffleLeft !== undefined ) {
20
+ props1.left = props1.left + parseInt(opts.shuffleLeft, 10) || 0;
21
+ }
22
+ else if ( opts.shuffleRight !== undefined ) {
23
+ props1.left = width + parseInt(opts.shuffleRight, 10) || 0;
24
+ }
25
+ if ( opts.shuffleTop ) {
26
+ props1.top = opts.shuffleTop;
27
+ }
28
+
29
+ // transition slide in 3 steps: move, re-zindex, move
30
+ $( element )
31
+ .animate( props1, speed, opts.easeIn || opts.easing )
32
+ .queue( 'fx', $.proxy(reIndex, this))
33
+ .animate( props2, speed, opts.easeOut || opts.easing, callback );
34
+
35
+ function reIndex(nextFn) {
36
+ /*jshint validthis:true */
37
+ this.stack(opts, currEl, nextEl, fwd);
38
+ nextFn();
39
+ }
40
+ },
41
+
42
+ stack: function( opts, currEl, nextEl, fwd ) {
43
+ var i, z;
44
+
45
+ if (fwd) {
46
+ opts.API.stackSlides( nextEl, currEl, fwd );
47
+ // force curr slide to bottom of the stack
48
+ $(currEl).css( 'zIndex', 1 );
49
+ }
50
+ else {
51
+ z = 1;
52
+ for (i = opts.nextSlide - 1; i >= 0; i--) {
53
+ $(opts.slides[i]).css('zIndex', z++);
54
+ }
55
+ for (i = opts.slideCount - 1; i > opts.nextSlide; i--) {
56
+ $(opts.slides[i]).css('zIndex', z++);
57
+ }
58
+ $(nextEl).css( 'zIndex', opts.maxZ );
59
+ $(currEl).css( 'zIndex', opts.maxZ - 1 );
60
+ }
61
+ }
62
+ };
63
+
64
+ })(jQuery);
@@ -0,0 +1,72 @@
1
+ //= require jquery.cycle2
2
+
3
+ /*! swipe plugin for Cycle2; version: 20121120 */
4
+ (function($) {
5
+ "use strict";
6
+
7
+ // this script adds support for touch events. the logic is lifted from jQuery Mobile.
8
+ // if you have jQuery Mobile installed, you do NOT need this script
9
+
10
+ var supportTouch = 'ontouchend' in document;
11
+
12
+ $.event.special.swipe = $.event.special.swipe || {
13
+ scrollSupressionThreshold: 10, // More than this horizontal displacement, and we will suppress scrolling.
14
+ durationThreshold: 1000, // More time than this, and it isn't a swipe.
15
+ horizontalDistanceThreshold: 30, // Swipe horizontal displacement must be more than this.
16
+ verticalDistanceThreshold: 75, // Swipe vertical displacement must be less than this.
17
+
18
+ setup: function() {
19
+ var $this = $( this );
20
+
21
+ $this.bind( 'touchstart', function( event ) {
22
+ var data = event.originalEvent.touches ? event.originalEvent.touches[ 0 ] : event;
23
+ var stop, start = {
24
+ time: ( new Date() ).getTime(),
25
+ coords: [ data.pageX, data.pageY ],
26
+ origin: $( event.target )
27
+ };
28
+
29
+ function moveHandler( event ) {
30
+ if ( !start )
31
+ return;
32
+
33
+ var data = event.originalEvent.touches ? event.originalEvent.touches[ 0 ] : event;
34
+
35
+ stop = {
36
+ time: ( new Date() ).getTime(),
37
+ coords: [ data.pageX, data.pageY ]
38
+ };
39
+
40
+ // prevent scrolling
41
+ if ( Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.scrollSupressionThreshold ) {
42
+ event.preventDefault();
43
+ }
44
+ }
45
+
46
+ $this.bind( 'touchmove', moveHandler )
47
+ .one( 'touchend', function( event ) {
48
+ $this.unbind( 'touchmove', moveHandler );
49
+
50
+ if ( start && stop ) {
51
+ if ( stop.time - start.time < $.event.special.swipe.durationThreshold &&
52
+ Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.horizontalDistanceThreshold &&
53
+ Math.abs( start.coords[ 1 ] - stop.coords[ 1 ] ) < $.event.special.swipe.verticalDistanceThreshold ) {
54
+
55
+ start.origin.trigger( "swipe" )
56
+ .trigger( start.coords[0] > stop.coords[ 0 ] ? "swipeleft" : "swiperight" );
57
+ }
58
+ }
59
+ start = stop = undefined;
60
+ });
61
+ });
62
+ }
63
+ };
64
+
65
+ $.event.special.swipeleft = $.event.special.swipeleft || {
66
+ setup: function() {
67
+ $( this ).bind( 'swipe', $.noop );
68
+ }
69
+ };
70
+ $.event.special.swiperight = $.event.special.swiperight || $.event.special.swipeleft;
71
+
72
+ })(jQuery);
@@ -0,0 +1,133 @@
1
+ //= require jquery.cycle2
2
+
3
+ /*! tile transition plugin for Cycle2; version: 20121120 */
4
+ (function ($) {
5
+ "use strict";
6
+
7
+ $.fn.cycle.transitions.tileSlide =
8
+ $.fn.cycle.transitions.tileBlind = {
9
+
10
+ before: function( opts, curr, next, fwd ) {
11
+ opts.API.stackSlides( curr, next, fwd );
12
+ $(curr).show();
13
+ opts.container.css('overflow', 'hidden');
14
+ // set defaults
15
+ opts.tileDelay = opts.tileDelay || opts.fx == 'tileSlide' ? 100 : 125;
16
+ opts.tileCount = opts.tileCount || 7;
17
+ opts.tileVertical = opts.tileVertical !== false;
18
+
19
+ if (!opts.container.data('cycleTileInitialized')) {
20
+ opts.container.on('cycle-destroyed', $.proxy(this.onDestroy, opts.API));
21
+ opts.container.data('cycleTileInitialized', true);
22
+ }
23
+ },
24
+
25
+ transition: function( opts, curr, next, fwd, callback ) {
26
+ opts.slides.not(curr).not(next).hide();
27
+
28
+ var tiles = $();
29
+ var $curr = $(curr), $next = $(next);
30
+ var tile, tileWidth, tileHeight, lastTileWidth, lastTileHeight,
31
+ num = opts.tileCount,
32
+ vert = opts.tileVertical,
33
+ height = opts.container.height(),
34
+ width = opts.container.width();
35
+
36
+ if ( vert ) {
37
+ tileWidth = Math.floor(width / num);
38
+ lastTileWidth = width - (tileWidth * (num - 1));
39
+ tileHeight = lastTileHeight = height;
40
+ }
41
+ else {
42
+ tileWidth = lastTileWidth = width;
43
+ tileHeight = Math.floor(height / num);
44
+ lastTileHeight = height - (tileHeight * (num - 1));
45
+ }
46
+
47
+ // opts.speed = opts.speed / 2;
48
+ opts.container.find('.cycle-tiles-container').remove();
49
+
50
+ var animCSS;
51
+ var tileCSS = { left: 0, top: 0, overflow: 'hidden', position: 'absolute', margin: 0, padding: 0 };
52
+ if ( vert ) {
53
+ animCSS = opts.fx == 'tileSlide' ? { top: height } : { width: 0 };
54
+ }
55
+ else {
56
+ animCSS = opts.fx == 'tileSlide' ? { left: width } : { height: 0 };
57
+ }
58
+
59
+ var tilesContainer = $('<div class="cycle-tiles-container"></div>');
60
+ tilesContainer.css({
61
+ zIndex: $curr.css('z-index'),
62
+ overflow: 'visible',
63
+ position: 'absolute',
64
+ top: 0
65
+ });
66
+ tilesContainer.insertBefore( next );
67
+
68
+ for (var i = 0; i < num; i++) {
69
+ tile = $('<div></div>')
70
+ .css( tileCSS )
71
+ .css({
72
+ width: ((num - 1 === i) ? lastTileWidth : tileWidth),
73
+ height: ((num - 1 === i) ? lastTileHeight : tileHeight),
74
+ marginLeft: vert ? ((i * tileWidth)) : 0,
75
+ marginTop: vert ? 0 : (i * tileHeight)
76
+ })
77
+ .append($curr.clone().css({
78
+ position: 'relative',
79
+ maxWidth: 'none',
80
+ width: $curr.width(),
81
+ margin: 0, padding: 0,
82
+ marginLeft: vert ? -(i * tileWidth) : 0,
83
+ marginTop: vert ? 0 : -(i * tileHeight)
84
+ }));
85
+ tiles = tiles.add(tile);
86
+ }
87
+
88
+ tilesContainer.append(tiles);
89
+ $curr.hide();
90
+ $next.show().css( 'opacity', 1 );
91
+ animateTile(fwd ? 0 : num - 1);
92
+
93
+ opts._tileAniCallback = function() {
94
+ $next.show();
95
+ $curr.hide();
96
+ tilesContainer.remove();
97
+ callback();
98
+ };
99
+
100
+ function animateTile(i) {
101
+ tiles.eq(i).animate( animCSS, {
102
+ duration: opts.speed,
103
+ easing: opts.easing,
104
+ complete: function () {
105
+ if (fwd ? (num - 1 === i) : (0 === i)) {
106
+ opts._tileAniCallback();
107
+ }
108
+ }
109
+ });
110
+
111
+ setTimeout(function () {
112
+ if (fwd ? (num - 1 !== i) : (0 !== i)) {
113
+ animateTile(fwd ? (i + 1) : (i - 1));
114
+ }
115
+ }, opts.tileDelay);
116
+ }
117
+ },
118
+
119
+ // tx API impl
120
+ stopTransition: function( opts ) {
121
+ opts.container.find('*').stop( true, true );
122
+ if (opts._tileAniCallback)
123
+ opts._tileAniCallback();
124
+ },
125
+
126
+ // core API supplement
127
+ onDestroy: function( e ) {
128
+ var opts = this.opts();
129
+ opts.container.find('.cycle-tiles-container').remove();
130
+ }
131
+ };
132
+
133
+ })(jQuery);
@@ -0,0 +1,42 @@
1
+ //= require jquery.cycle2.core
2
+
3
+ /*! tmpl plugin for Cycle2; version: 20121227 */
4
+ (function($) {
5
+ "use strict";
6
+
7
+ $.extend($.fn.cycle.defaults, {
8
+ tmplRegex: '{{((.)?.*?)}}'
9
+ });
10
+
11
+ $.extend($.fn.cycle.API, {
12
+ tmpl: function( str, opts /*, ... */) {
13
+ var regex = new RegExp( opts.tmplRegex || $.fn.cycle.defaults.tmplRegex, 'g' );
14
+ var args = $.makeArray( arguments );
15
+ args.shift();
16
+ return str.replace(regex, function(_, str) {
17
+ var i, j, obj, prop, names = str.split('.');
18
+ for (i=0; i < args.length; i++) {
19
+ obj = args[i];
20
+ if ( ! obj )
21
+ continue;
22
+ if (names.length > 1) {
23
+ prop = obj;
24
+ for (j=0; j < names.length; j++) {
25
+ obj = prop;
26
+ prop = prop[ names[j] ] || str;
27
+ }
28
+ } else {
29
+ prop = obj[str];
30
+ }
31
+
32
+ if ($.isFunction(prop))
33
+ return prop.apply(obj, args);
34
+ if (prop !== undefined && prop !== null && prop != str)
35
+ return prop;
36
+ }
37
+ return str;
38
+ });
39
+ }
40
+ });
41
+
42
+ })(jQuery);
@@ -0,0 +1,68 @@
1
+ //= require jquery.cycle2
2
+
3
+ /*! youtube plugin for Cycle2; version: 20121120 */
4
+ (function($) {
5
+ "use strict";
6
+
7
+ var template = '<div><object width="640" height="360">' +
8
+ '<param name="movie" value="{{url}}"></param>' +
9
+ '<param name="allowFullScreen" value="{{allowFullScreen}}"></param>' +
10
+ '<param name="allowscriptaccess" value="always"></param>' +
11
+ '<embed src="{{url}}" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="{{allowFullScreen}}"></embed>' +
12
+ '</object></div>';
13
+
14
+ $.extend($.fn.cycle.defaults, {
15
+ youtubeAllowFullScreen: true,
16
+ youtubeAutostart: false,
17
+ youtubeAutostop: true
18
+ });
19
+
20
+ $(document).on( 'cycle-bootstrap', function( e, opts ) {
21
+ if ( ! opts.youtube )
22
+ return;
23
+
24
+ // don't hide inactive slides; hiding video causes reload when it's shown again
25
+ opts.hideNonActive = false;
26
+
27
+ opts.container.find( opts.slides ).each(function(i) {
28
+ // convert anchors to template markup
29
+ var markup, slide = $(this), url = slide.attr( 'href' );
30
+ var fs = opts.youtubeAllowFullScreen ? 'true' : 'false';
31
+ url += ( /\?/.test( url ) ? '&' : '?') + 'enablejsapi=1';
32
+ if ( opts.youtubeAutostart && opts.startingSlide === i )
33
+ url += '&autoplay=1';
34
+ markup = opts.API.tmpl( template, { url: url, allowFullScreen: fs });
35
+ slide.replaceWith( markup );
36
+ });
37
+ opts.slides = '>div';
38
+
39
+ if ( opts.youtubeAutostart ) {
40
+ opts.container.on( 'cycle-initialized cycle-after', function( e, opts ) {
41
+ var index = e.type == 'cycle-initialized' ? opts.currSlide : opts.nextSlide;
42
+ $( opts.slides[ index ] ).find('object,embed').each( play );
43
+ });
44
+ }
45
+
46
+ if ( opts.youtubeAutostop ) {
47
+ opts.container.on( 'cycle-before', function( e, opts ) {
48
+ $( opts.slides[ opts.currSlide ] ).find('object,embed').each( pause );
49
+ });
50
+ }
51
+ });
52
+
53
+ function play() {
54
+ /*jshint validthis:true */
55
+ try {
56
+ this.playVideo();
57
+ }
58
+ catch( ignore ) {}
59
+ }
60
+ function pause() {
61
+ /*jshint validthis:true */
62
+ try {
63
+ this.pauseVideo();
64
+ }
65
+ catch( ignore ) {}
66
+ }
67
+
68
+ })(jQuery);
@@ -1,5 +1,5 @@
1
1
  module Cycle2
2
2
  module Rails
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cycle2-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
5
4
  prerelease:
5
+ version: 1.1.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Mike Alsup
@@ -10,39 +10,39 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-05-09 00:00:00.000000000 Z
13
+ date: 2013-06-04 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: jquery-rails
17
- type: :runtime
18
- requirement: !ruby/object:Gem::Requirement
17
+ version_requirements: !ruby/object:Gem::Requirement
19
18
  none: false
20
19
  requirements:
21
20
  - - ~>
22
21
  - !ruby/object:Gem::Version
23
22
  version: '2.0'
24
- version_requirements: !ruby/object:Gem::Requirement
23
+ requirement: !ruby/object:Gem::Requirement
25
24
  none: false
26
25
  requirements:
27
26
  - - ~>
28
27
  - !ruby/object:Gem::Version
29
28
  version: '2.0'
29
+ type: :runtime
30
30
  prerelease: false
31
31
  - !ruby/object:Gem::Dependency
32
32
  name: rake
33
- type: :development
34
- requirement: !ruby/object:Gem::Requirement
33
+ version_requirements: !ruby/object:Gem::Requirement
35
34
  none: false
36
35
  requirements:
37
36
  - - ! '>='
38
37
  - !ruby/object:Gem::Version
39
38
  version: '0'
40
- version_requirements: !ruby/object:Gem::Requirement
39
+ requirement: !ruby/object:Gem::Requirement
41
40
  none: false
42
41
  requirements:
43
42
  - - ! '>='
44
43
  - !ruby/object:Gem::Version
45
44
  version: '0'
45
+ type: :development
46
46
  prerelease: false
47
47
  description: Cycle2 is a versatile slideshow plugin for jQuery built around ease-of-use.
48
48
  email:
@@ -51,16 +51,37 @@ executables: []
51
51
  extensions: []
52
52
  extra_rdoc_files: []
53
53
  files:
54
+ - .gitignore
54
55
  - Gemfile
55
56
  - Gemfile.lock
56
57
  - LICENSE
57
58
  - README.md
58
59
  - Rakefile
60
+ - app/assets/javascripts/jquery.cycle2.all.js
61
+ - app/assets/javascripts/jquery.cycle2.autoheight.js
62
+ - app/assets/javascripts/jquery.cycle2.caption.js
63
+ - app/assets/javascripts/jquery.cycle2.caption2.js
64
+ - app/assets/javascripts/jquery.cycle2.carousel.js
65
+ - app/assets/javascripts/jquery.cycle2.center.js
66
+ - app/assets/javascripts/jquery.cycle2.command.js
67
+ - app/assets/javascripts/jquery.cycle2.core.js
68
+ - app/assets/javascripts/jquery.cycle2.hash.js
69
+ - app/assets/javascripts/jquery.cycle2.ie-fade.js
70
+ - app/assets/javascripts/jquery.cycle2.js
71
+ - app/assets/javascripts/jquery.cycle2.loader.js
72
+ - app/assets/javascripts/jquery.cycle2.pager.js
73
+ - app/assets/javascripts/jquery.cycle2.prevnext.js
74
+ - app/assets/javascripts/jquery.cycle2.progressive.js
75
+ - app/assets/javascripts/jquery.cycle2.scrollVert.js
76
+ - app/assets/javascripts/jquery.cycle2.shuffle.js
77
+ - app/assets/javascripts/jquery.cycle2.swipe.js
78
+ - app/assets/javascripts/jquery.cycle2.tile.js
79
+ - app/assets/javascripts/jquery.cycle2.tmpl.js
80
+ - app/assets/javascripts/jquery.cycle2.video.js
59
81
  - cycle2-rails.gemspec
60
82
  - lib/cycle2-rails.rb
61
83
  - lib/cycle2-rails/engine.rb
62
84
  - lib/cycle2-rails/version.rb
63
- - vendor/assets/javascripts/cycle2-rails/jquery.cycle2.js
64
85
  homepage: https://github.com/tomasc/cycle2-rails
65
86
  licenses: []
66
87
  post_install_message:
@@ -72,19 +93,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
72
93
  requirements:
73
94
  - - ! '>='
74
95
  - !ruby/object:Gem::Version
75
- segments:
76
- - 0
77
96
  version: '0'
78
- hash: -3052516954767104636
79
97
  required_rubygems_version: !ruby/object:Gem::Requirement
80
98
  none: false
81
99
  requirements:
82
100
  - - ! '>='
83
101
  - !ruby/object:Gem::Version
84
- segments:
85
- - 0
86
102
  version: '0'
87
- hash: -3052516954767104636
88
103
  requirements: []
89
104
  rubyforge_project:
90
105
  rubygems_version: 1.8.25
@@ -95,3 +110,4 @@ summary: Cycle2 is a versatile slideshow plugin for jQuery built around ease-of-
95
110
  any scripting. Simply include the plugin, declare your markup, and Cycle2 does the
96
111
  rest.
97
112
  test_files: []
113
+ has_rdoc: