vticker_rails 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 147d729aec8c427497b4e5d1f2be9c513387e40f
4
- data.tar.gz: bca8dfd83f1695123aa228e15230fbc1bd581651
3
+ metadata.gz: d404d1b293be3f4bd1a8e8063885db62a816b855
4
+ data.tar.gz: b20e4948a7bcaf96981e14ca9110052f3b622a5f
5
5
  SHA512:
6
- metadata.gz: 56f8e571efe4c145333f1f577fcf8653c2c7e9f13c55831efeb69dc9020a8b0e0011a2a3a557f985ae03fb2c3141eab501f06cb2fb456f2a2493a34020796be8
7
- data.tar.gz: 688b24341e915784cbe13d62eb17e13841280ee7fb5e6c7012aa247c7ae145c3bd11a9718ac2bf904a359fbd39d06744447bbe31fcf900bb9c36faf36420d4d7
6
+ metadata.gz: 80e97c467ad6ec8ac3fd4809cd04c4552a68c02dc903f9e7c00bc820aa9a0f85526092f2944e23b5b407465cbae5bea3ae09adda334eba91d1f91e4897dc4c8a
7
+ data.tar.gz: 4fc4009da0d208553cbe6ec2586b57ed7bb2c012ca8b585ac8d5c9438132fc441daeeabc40508bc0c42eb19e16f4028b7ba67024e8ad8f1eb625049b7f806627
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
data/Gemfile ADDED
@@ -0,0 +1,14 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Declare your gem's dependencies in vticker_rails.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+ gemspec
7
+
8
+ # Declare any dependencies that are still in development here instead of in
9
+ # your gemspec. These might include edge Rails or gems from your path or
10
+ # Git. Remember to move these dependencies to your gemspec before releasing
11
+ # your gem to rubygems.org.
12
+
13
+ # To use debugger
14
+ # gem 'debugger'
data/Gemfile.lock ADDED
@@ -0,0 +1,87 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ vticker_rails (0.0.1)
5
+ rails (~> 4.1.8)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ actionmailer (4.1.8)
11
+ actionpack (= 4.1.8)
12
+ actionview (= 4.1.8)
13
+ mail (~> 2.5, >= 2.5.4)
14
+ actionpack (4.1.8)
15
+ actionview (= 4.1.8)
16
+ activesupport (= 4.1.8)
17
+ rack (~> 1.5.2)
18
+ rack-test (~> 0.6.2)
19
+ actionview (4.1.8)
20
+ activesupport (= 4.1.8)
21
+ builder (~> 3.1)
22
+ erubis (~> 2.7.0)
23
+ activemodel (4.1.8)
24
+ activesupport (= 4.1.8)
25
+ builder (~> 3.1)
26
+ activerecord (4.1.8)
27
+ activemodel (= 4.1.8)
28
+ activesupport (= 4.1.8)
29
+ arel (~> 5.0.0)
30
+ activesupport (4.1.8)
31
+ i18n (~> 0.6, >= 0.6.9)
32
+ json (~> 1.7, >= 1.7.7)
33
+ minitest (~> 5.1)
34
+ thread_safe (~> 0.1)
35
+ tzinfo (~> 1.1)
36
+ arel (5.0.1.20140414130214)
37
+ builder (3.2.2)
38
+ erubis (2.7.0)
39
+ hike (1.2.3)
40
+ i18n (0.6.11)
41
+ json (1.8.1)
42
+ mail (2.6.3)
43
+ mime-types (>= 1.16, < 3)
44
+ mime-types (2.4.3)
45
+ minitest (5.4.3)
46
+ multi_json (1.10.1)
47
+ rack (1.5.2)
48
+ rack-test (0.6.2)
49
+ rack (>= 1.0)
50
+ rails (4.1.8)
51
+ actionmailer (= 4.1.8)
52
+ actionpack (= 4.1.8)
53
+ actionview (= 4.1.8)
54
+ activemodel (= 4.1.8)
55
+ activerecord (= 4.1.8)
56
+ activesupport (= 4.1.8)
57
+ bundler (>= 1.3.0, < 2.0)
58
+ railties (= 4.1.8)
59
+ sprockets-rails (~> 2.0)
60
+ railties (4.1.8)
61
+ actionpack (= 4.1.8)
62
+ activesupport (= 4.1.8)
63
+ rake (>= 0.8.7)
64
+ thor (>= 0.18.1, < 2.0)
65
+ rake (10.4.2)
66
+ sprockets (2.12.3)
67
+ hike (~> 1.2)
68
+ multi_json (~> 1.0)
69
+ rack (~> 1.0)
70
+ tilt (~> 1.1, != 1.3.0)
71
+ sprockets-rails (2.2.2)
72
+ actionpack (>= 3.0)
73
+ activesupport (>= 3.0)
74
+ sprockets (>= 2.8, < 4.0)
75
+ sqlite3 (1.3.10)
76
+ thor (0.19.1)
77
+ thread_safe (0.3.4)
78
+ tilt (1.4.1)
79
+ tzinfo (1.2.2)
80
+ thread_safe (~> 0.1)
81
+
82
+ PLATFORMS
83
+ ruby
84
+
85
+ DEPENDENCIES
86
+ sqlite3
87
+ vticker_rails!
@@ -1,3 +1,3 @@
1
1
  module VtickerRails
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
@@ -0,0 +1,226 @@
1
+ /*
2
+ Vertical News Ticker 1.15
3
+
4
+ Original by: Tadas Juozapaitis ( kasp3rito [eta] gmail (dot) com )
5
+ http://www.jugbit.com/jquery-vticker-vertical-news-ticker/
6
+
7
+ Forked/Modified by: Richard Hollis @richhollis - richhollis.co.uk
8
+ */
9
+
10
+ (function($){
11
+
12
+ var defaults = {
13
+ speed: 700,
14
+ pause: 4000,
15
+ showItems: 1,
16
+ mousePause: true,
17
+ height: 0,
18
+ animate: true,
19
+ margin: 0,
20
+ padding: 0,
21
+ startPaused: false
22
+ };
23
+
24
+ var internal = {
25
+
26
+ moveUp: function(state, attribs) {
27
+ internal.animate(state, attribs, 'up');
28
+ },
29
+
30
+ moveDown: function(state, attribs){
31
+ internal.animate(state, attribs, 'down');
32
+ },
33
+
34
+ animate: function(state, attribs, dir) {
35
+ var height = state.itemHeight;
36
+ var options = state.options;
37
+ var el = state.element;
38
+ var obj = el.children('ul');
39
+ var selector = (dir === 'up') ? 'li:first' : 'li:last';
40
+
41
+ el.trigger("vticker.beforeTick");
42
+
43
+ var clone = obj.children(selector).clone(true);
44
+
45
+ if(options.height > 0) height = obj.children('li:first').height();
46
+ height += (options.margin) + (options.padding*2); // adjust for margins & padding
47
+
48
+ if(dir==='down') obj.css('top', '-' + height + 'px').prepend(clone);
49
+
50
+ if(attribs && attribs.animate) {
51
+ if(state.animating) return;
52
+ state.animating = true;
53
+ var opts = (dir === 'up') ? {top: '-=' + height + 'px'} : {top: 0};
54
+ obj.animate(opts, options.speed, function() {
55
+ $(obj).children(selector).remove();
56
+ $(obj).css('top', '0px');
57
+ state.animating = false;
58
+ el.trigger("vticker.afterTick");
59
+ });
60
+ } else {
61
+ obj.children(selector).remove();
62
+ obj.css('top', '0px');
63
+ el.trigger("vticker.afterTick");
64
+ }
65
+ if(dir==='up') clone.appendTo(obj);
66
+ },
67
+
68
+ nextUsePause: function() {
69
+ var state = $(this).data('state');
70
+ var options = state.options;
71
+ if(state.isPaused || state.itemCount < 2) return;
72
+ methods.next.call( this, {animate:options.animate} );
73
+ },
74
+
75
+ startInterval: function() {
76
+ var state = $(this).data('state');
77
+ var options = state.options;
78
+ var initThis = this;
79
+ state.intervalId = setInterval(function(){
80
+ internal.nextUsePause.call( initThis );
81
+ }, options.pause);
82
+ },
83
+
84
+ stopInterval: function() {
85
+ var state = $(this).data('state');
86
+ if(!state) return;
87
+ if(state.intervalId) clearInterval(state.intervalId);
88
+ state.intervalId = undefined;
89
+ },
90
+
91
+ restartInterval: function() {
92
+ internal.stopInterval.call(this);
93
+ internal.startInterval.call(this);
94
+ }
95
+ };
96
+
97
+ var methods = {
98
+
99
+ init: function(options) {
100
+ // if init called second time then stop first, then re-init
101
+ methods.stop.call(this);
102
+ // init
103
+ var defaultsClone = jQuery.extend({}, defaults);
104
+ var options = $.extend(defaultsClone, options);
105
+ var el = $(this);
106
+ var state = {
107
+ itemCount: el.children('ul').children('li').length,
108
+ itemHeight: 0,
109
+ itemMargin: 0,
110
+ element: el,
111
+ animating: false,
112
+ options: options,
113
+ isPaused: (options.startPaused) ? true : false,
114
+ pausedByCode: false
115
+ };
116
+ $(this).data('state', state);
117
+
118
+ el.css({overflow: 'hidden', position: 'relative'})
119
+ .children('ul').css({position: 'absolute', margin: 0, padding: 0})
120
+ .children('li').css({margin: options.margin, padding: options.padding});
121
+
122
+ if(isNaN(options.height) || options.height === 0)
123
+ {
124
+ el.children('ul').children('li').each(function(){
125
+ var current = $(this);
126
+ if(current.height() > state.itemHeight)
127
+ state.itemHeight = current.height();
128
+ });
129
+ // set the same height on all child elements
130
+ el.children('ul').children('li').each(function(){
131
+ var current = $(this);
132
+ current.height(state.itemHeight);
133
+ });
134
+ // set element to total height
135
+ var box = (options.margin) + (options.padding * 2);
136
+ el.height(((state.itemHeight + box) * options.showItems) + options.margin);
137
+ }
138
+ else
139
+ {
140
+ // set the preferred height
141
+ el.height(options.height);
142
+ }
143
+
144
+ var initThis = this;
145
+ if(!options.startPaused) {
146
+ internal.startInterval.call( initThis );
147
+ }
148
+
149
+ if(options.mousePause)
150
+ {
151
+ el.bind("mouseenter", function () {
152
+ //if the automatic scroll is paused, don't change that.
153
+ if (state.isPaused === true) return;
154
+ state.pausedByCode = true;
155
+ // stop interval
156
+ internal.stopInterval.call( initThis );
157
+ methods.pause.call( initThis, true );
158
+ }).bind("mouseleave", function () {
159
+ //if the automatic scroll is paused, don't change that.
160
+ if (state.isPaused === true && !state.pausedByCode) return;
161
+ state.pausedByCode = false;
162
+ methods.pause.call(initThis, false);
163
+ // restart interval
164
+ internal.startInterval.call( initThis );
165
+ });
166
+ }
167
+ },
168
+
169
+ pause: function(pauseState) {
170
+ var state = $(this).data('state');
171
+ if(!state) return undefined;
172
+ if(state.itemCount < 2) return false;
173
+ state.isPaused = pauseState;
174
+ var el = state.element;
175
+ if(pauseState) {
176
+ $(this).addClass('paused');
177
+ el.trigger("vticker.pause");
178
+ }
179
+ else {
180
+ $(this).removeClass('paused');
181
+ el.trigger("vticker.resume");
182
+ }
183
+ },
184
+
185
+ next: function(attribs) {
186
+ var state = $(this).data('state');
187
+ if(!state) return undefined;
188
+ if(state.animating || state.itemCount < 2) return false;
189
+ internal.restartInterval.call( this );
190
+ internal.moveUp(state, attribs);
191
+ },
192
+
193
+ prev: function(attribs) {
194
+ var state = $(this).data('state');
195
+ if(!state) return undefined;
196
+ if(state.animating || state.itemCount < 2) return false;
197
+ internal.restartInterval.call( this );
198
+ internal.moveDown(state, attribs);
199
+ },
200
+
201
+ stop: function() {
202
+ var state = $(this).data('state');
203
+ if(!state) return undefined;
204
+ internal.stopInterval.call( this );
205
+ },
206
+
207
+ remove: function() {
208
+ var state = $(this).data('state');
209
+ if(!state) return undefined;
210
+ internal.stopInterval.call( this );
211
+ var el = state.element;
212
+ el.unbind();
213
+ el.remove();
214
+ }
215
+ };
216
+
217
+ $.fn.vTicker = function( method ) {
218
+ if ( methods[method] ) {
219
+ return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 ));
220
+ } else if ( typeof method === 'object' || ! method ) {
221
+ return methods.init.apply( this, arguments );
222
+ } else {
223
+ $.error( 'Method ' + method + ' does not exist on jQuery.vTicker' );
224
+ }
225
+ };
226
+ })(jQuery);
@@ -0,0 +1,26 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ # Maintain your gem's version:
4
+ require "vticker_rails/version"
5
+
6
+ # Describe your gem and declare its dependencies:
7
+ Gem::Specification.new do |s|
8
+ s.name = "vticker_rails"
9
+ s.version = VtickerRails::VERSION
10
+ s.authors = ["Süleyman ÖZEV"]
11
+ s.email = ["sulozev@gmail.com"]
12
+ s.homepage = "http://github.com/suleymanozev/vticker-rails"
13
+ s.summary = "Jquery news ticker"
14
+ s.description = "News ticker for jquery"
15
+ s.license = "MIT"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_dependency "rails"
23
+ s.add_dependency 'jquery-rails'
24
+
25
+ s.add_development_dependency "rake"
26
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vticker_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Süleyman ÖZEV
@@ -59,12 +59,17 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - Gemfile.lock
62
65
  - MIT-LICENSE
63
66
  - README.rdoc
64
67
  - Rakefile
65
68
  - lib/tasks/vticker_rails_tasks.rake
66
69
  - lib/vticker_rails.rb
67
70
  - lib/vticker_rails/version.rb
71
+ - vendor/assets/javascripts/vticker.js
72
+ - vticker_rails.gemspec
68
73
  homepage: http://github.com/suleymanozev/vticker-rails
69
74
  licenses:
70
75
  - MIT