vticker_rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 4ebbd6840aa7cf6f884589f6e85eb8dd1a1e55e8
4
+ data.tar.gz: 4a9652bca05ec204b510cec6ee8d1a6a301cab3b
5
+ SHA512:
6
+ metadata.gz: 619a2c47e40833d3dc1173b38a025a1269e11c0b8633293b3778e5618548412064380758dc3ebd04131ed6086bfee2bd9640dee46e4dbd092dddc800a13261f5
7
+ data.tar.gz: 9279c6989c031c1060a7e1e0b0cc627faba37540394bca5975c63b7c2c77fcddb396c02fddc3bb33e5aafc8da41ef777fdf760f49338740075f1fbef4c163ebe
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vticker_rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Süleyman ÖZEV
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,31 @@
1
+ # VtickerRails
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'vticker_rails'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install vticker_rails
20
+
21
+ ## Usage
22
+
23
+ TODO: Write usage instructions here
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it ( https://github.com/[my-github-username]/vticker_rails/fork )
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,3 @@
1
+ module VtickerRails
2
+ VERSION = "0.0.1"
3
+ end
@@ -0,0 +1,5 @@
1
+ require "vticker_rails/version"
2
+
3
+ module VtickerRails
4
+ # Your code goes here...
5
+ 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,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vticker_rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vticker_rails"
8
+ spec.version = VtickerRails::VERSION
9
+ spec.authors = ["Süleyman ÖZEV"]
10
+ spec.email = ["sulozev@gmail.com"]
11
+ spec.summary = %q{jQuery news ticker}
12
+ spec.description = %q{News ticker for jQuery}
13
+ spec.homepage = "http://github.com/suleymanozev/vticker_rails"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
metadata ADDED
@@ -0,0 +1,81 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vticker_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Süleyman ÖZEV
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-12-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: News ticker for jQuery
42
+ email:
43
+ - sulozev@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - lib/vticker_rails.rb
54
+ - lib/vticker_rails/version.rb
55
+ - vendor/assets/javascripts/vticker.js
56
+ - vticker_rails.gemspec
57
+ homepage: http://github.com/suleymanozev/vticker_rails
58
+ licenses:
59
+ - MIT
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.2.2
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: jQuery news ticker
81
+ test_files: []