sn-jquery-scrollto-rails 1.4.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 5d8d496899290bb2447ed2dea4f250822a466353269e7b6a392d07fe6d3ca5a3
4
+ data.tar.gz: ddca278cc5273cbc14ec76cf32d5be4c730936b0d32b55a4ee88b15d6f7d329e
5
+ SHA512:
6
+ metadata.gz: ca04063698cce7402a7e84e8c23f1efe63c522122762e433da75cb893738e0e81561146b56dfd4165962ecd2b998160f6c093066789042217d3ed129f7114c9d
7
+ data.tar.gz: 4da0ff2282ce3f8d3fb3b6f45cbd0eca6b872b4952f6ddcd9c30c4f42ec212c38f419ef060fac6d777cf72fdb0bbab6e7f37363dea532a1e34ad61ba58ff8aac
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ .project
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in jquery-scrollto-rails.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ This gem packages the scrollTo project for Rails.
2
+
3
+ The scrollTo license can be found at https://raw.githubusercontent.com/JohnColvin/jquery-scrollto-rails/master/LICENSE and is copied below:
4
+ Apprise was created by Ariel Flesler. The project page is http://archive.plugins.jquery.com/project/ScrollTo. The javascript files claim as of version 1.4.1 that the project is dual licensed under MIT and GPL.
5
+
6
+ Please respect the scrollTo licensing.
7
+
8
+ The gem code is released under MIT license.
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Ariel Flesler (scrollTo author), John Colvin (gem author)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,25 @@
1
+ # Recommend using bower
2
+
3
+ The bower package is maintained by the owner of scrollTo. Which means it will be way more up to date and not require a Rails engine.
4
+
5
+ See [the scrollTo README](https://github.com/flesler/jquery.scrollTo#installation-and-usage) for details on installing with bower.
6
+
7
+ See [the bower-rails README](https://github.com/42dev/bower-rails) for a guide to getting bower working in your Rails project.
8
+
9
+ # jquery-scrollto-rails
10
+
11
+ This gem provides the jquery scrollTo project found at http://archive.plugins.jquery.com/project/ScrollTo for the Rails asset pipeline (available since Rails 3.1).
12
+
13
+ ### Installation
14
+
15
+ In your Gemfile, add this line:
16
+
17
+ gem "jquery-scrollto-rails"
18
+
19
+ Then, run `bundle install`.
20
+
21
+ Add this to 'app/assets/javascripts/application.js':
22
+
23
+ //= require jquery.scrollTo
24
+
25
+ That's it!
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "jquery-scrollto-rails/rails/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "sn-jquery-scrollto-rails"
7
+ s.version = JqueryScrollto::Rails::VERSION
8
+ s.authors = ["John Colvin"]
9
+ s.email = ["colvin.john@gmail.com"]
10
+ s.homepage = "https://github.com/JohnColvin/jquery-scrollto-rails"
11
+ s.summary = %q{Use jQuery scrollTo with Rails 3.1 - 4.x}
12
+ s.description = %q{This provides jQUery scrollTo for your Rails 3.1 - 4.x application}
13
+
14
+ # This gem packages the scrollTo project for Rails
15
+ # Please look at the license for that project
16
+ s.licenses = ['MIT', 'GPL']
17
+
18
+ s.rubyforge_project = "jquery-scrollto-rails"
19
+
20
+ s.add_dependency "railties"
21
+
22
+ s.files = `git ls-files`.split("\n")
23
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
24
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
25
+ s.require_paths = ["lib"]
26
+
27
+ # specify any dependencies here; for example:
28
+ # s.add_development_dependency "rspec"
29
+ # s.add_runtime_dependency "rest-client"
30
+ end
@@ -0,0 +1 @@
1
+ require "jquery-scrollto-rails/rails"
@@ -0,0 +1,2 @@
1
+ require 'jquery-scrollto-rails/rails/engine'
2
+ require 'jquery-scrollto-rails/rails/version'
@@ -0,0 +1,6 @@
1
+ module JqueryScrollto
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module JqueryScrollto
2
+ module Rails
3
+ VERSION = "1.4.4"
4
+ end
5
+ end
@@ -0,0 +1,218 @@
1
+ /*!
2
+ * jQuery.ScrollTo
3
+ * Copyright (c) 2007-2012 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
4
+ * Dual licensed under MIT and GPL.
5
+ * Date: 4/09/2012
6
+ *
7
+ * @projectDescription Easy element scrolling using jQuery.
8
+ * http://flesler.blogspot.com/2007/10/jqueryscrollto.html
9
+ * @author Ariel Flesler
10
+ * @version 1.4.3.1
11
+ *
12
+ * @id jQuery.scrollTo
13
+ * @id jQuery.fn.scrollTo
14
+ * @param {String, Number, DOMElement, jQuery, Object} target Where to scroll the matched elements.
15
+ * The different options for target are:
16
+ * - A number position (will be applied to all axes).
17
+ * - A string position ('44', '100px', '+=90', etc ) will be applied to all axes
18
+ * - A jQuery/DOM element ( logically, child of the element to scroll )
19
+ * - A string selector, that will be relative to the element to scroll ( 'li:eq(2)', etc )
20
+ * - A hash { top:x, left:y }, x and y can be any kind of number/string like above.
21
+ * - A percentage of the container's dimension/s, for example: 50% to go to the middle.
22
+ * - The string 'max' for go-to-end.
23
+ * @param {Number, Function} duration The OVERALL length of the animation, this argument can be the settings object instead.
24
+ * @param {Object,Function} settings Optional set of settings or the onAfter callback.
25
+ * @option {String} axis Which axis must be scrolled, use 'x', 'y', 'xy' or 'yx'.
26
+ * @option {Number, Function} duration The OVERALL length of the animation.
27
+ * @option {String} easing The easing method for the animation.
28
+ * @option {Boolean} margin If true, the margin of the target element will be deducted from the final position.
29
+ * @option {Object, Number} offset Add/deduct from the end position. One number for both axes or { top:x, left:y }.
30
+ * @option {Object, Number} over Add/deduct the height/width multiplied by 'over', can be { top:x, left:y } when using both axes.
31
+ * @option {Boolean} queue If true, and both axis are given, the 2nd axis will only be animated after the first one ends.
32
+ * @option {Function} onAfter Function to be called after the scrolling ends.
33
+ * @option {Function} onAfterFirst If queuing is activated, this function will be called after the first scrolling ends.
34
+ * @return {jQuery} Returns the same jQuery object, for chaining.
35
+ *
36
+ * @desc Scroll to a fixed position
37
+ * @example $('div').scrollTo( 340 );
38
+ *
39
+ * @desc Scroll relatively to the actual position
40
+ * @example $('div').scrollTo( '+=340px', { axis:'y' } );
41
+ *
42
+ * @desc Scroll using a selector (relative to the scrolled element)
43
+ * @example $('div').scrollTo( 'p.paragraph:eq(2)', 500, { easing:'swing', queue:true, axis:'xy' } );
44
+ *
45
+ * @desc Scroll to a DOM element (same for jQuery object)
46
+ * @example var second_child = document.getElementById('container').firstChild.nextSibling;
47
+ * $('#container').scrollTo( second_child, { duration:500, axis:'x', onAfter:function(){
48
+ * alert('scrolled!!');
49
+ * }});
50
+ *
51
+ * @desc Scroll on both axes, to different values
52
+ * @example $('div').scrollTo( { top: 300, left:'+=200' }, { axis:'xy', offset:-20 } );
53
+ */
54
+
55
+ ;(function( $ ){
56
+
57
+ var $scrollTo = $.scrollTo = function( target, duration, settings ){
58
+ $(window).scrollTo( target, duration, settings );
59
+ };
60
+
61
+ $scrollTo.defaults = {
62
+ axis:'xy',
63
+ duration: parseFloat($.fn.jquery) >= 1.3 ? 0 : 1,
64
+ limit:true
65
+ };
66
+
67
+ // Returns the element that needs to be animated to scroll the window.
68
+ // Kept for backwards compatibility (specially for localScroll & serialScroll)
69
+ $scrollTo.window = function( scope ){
70
+ return $(window)._scrollable();
71
+ };
72
+
73
+ // Hack, hack, hack :)
74
+ // Returns the real elements to scroll (supports window/iframes, documents and regular nodes)
75
+ $.fn._scrollable = function(){
76
+ return this.map(function(){
77
+ var elem = this,
78
+ isWin = !elem.nodeName || $.inArray( elem.nodeName.toLowerCase(), ['iframe','#document','html','body'] ) != -1;
79
+
80
+ if( !isWin )
81
+ return elem;
82
+
83
+ var doc = (elem.contentWindow || elem).document || elem.ownerDocument || elem;
84
+
85
+ return /webkit/i.test(navigator.userAgent) || doc.compatMode == 'BackCompat' ?
86
+ doc.body :
87
+ doc.documentElement;
88
+ });
89
+ };
90
+
91
+ $.fn.scrollTo = function( target, duration, settings ){
92
+ if( typeof duration == 'object' ){
93
+ settings = duration;
94
+ duration = 0;
95
+ }
96
+ if( typeof settings == 'function' )
97
+ settings = { onAfter:settings };
98
+
99
+ if( target == 'max' )
100
+ target = 9e9;
101
+
102
+ settings = $.extend( {}, $scrollTo.defaults, settings );
103
+ // Speed is still recognized for backwards compatibility
104
+ duration = duration || settings.duration;
105
+ // Make sure the settings are given right
106
+ settings.queue = settings.queue && settings.axis.length > 1;
107
+
108
+ if( settings.queue )
109
+ // Let's keep the overall duration
110
+ duration /= 2;
111
+ settings.offset = both( settings.offset );
112
+ settings.over = both( settings.over );
113
+
114
+ return this._scrollable().each(function(){
115
+ // Null target yields nothing, just like jQuery does
116
+ if (target == null) return;
117
+
118
+ var elem = this,
119
+ $elem = $(elem),
120
+ targ = target, toff, attr = {},
121
+ win = $elem.is('html,body');
122
+
123
+ switch( typeof targ ){
124
+ // A number will pass the regex
125
+ case 'number':
126
+ case 'string':
127
+ if( /^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ) ){
128
+ targ = both( targ );
129
+ // We are done
130
+ break;
131
+ }
132
+ // Relative selector, no break!
133
+ targ = $(targ,this);
134
+ if (!targ.length) return;
135
+ case 'object':
136
+ // DOMElement / jQuery
137
+ if( targ.is || targ.style )
138
+ // Get the real position of the target
139
+ toff = (targ = $(targ)).offset();
140
+ }
141
+ $.each( settings.axis.split(''), function( i, axis ){
142
+ var Pos = axis == 'x' ? 'Left' : 'Top',
143
+ pos = Pos.toLowerCase(),
144
+ key = 'scroll' + Pos,
145
+ old = elem[key],
146
+ max = $scrollTo.max(elem, axis);
147
+
148
+ if( toff ){// jQuery / DOMElement
149
+ attr[key] = toff[pos] + ( win ? 0 : old - $elem.offset()[pos] );
150
+
151
+ // If it's a dom element, reduce the margin
152
+ if( settings.margin ){
153
+ attr[key] -= parseInt(targ.css('margin'+Pos)) || 0;
154
+ attr[key] -= parseInt(targ.css('border'+Pos+'Width')) || 0;
155
+ }
156
+
157
+ attr[key] += settings.offset[pos] || 0;
158
+
159
+ if( settings.over[pos] )
160
+ // Scroll to a fraction of its width/height
161
+ attr[key] += targ[axis=='x'?'width':'height']() * settings.over[pos];
162
+ }else{
163
+ var val = targ[pos];
164
+ // Handle percentage values
165
+ attr[key] = val.slice && val.slice(-1) == '%' ?
166
+ parseFloat(val) / 100 * max
167
+ : val;
168
+ }
169
+
170
+ // Number or 'number'
171
+ if( settings.limit && /^\d+$/.test(attr[key]) )
172
+ // Check the limits
173
+ attr[key] = attr[key] <= 0 ? 0 : Math.min( attr[key], max );
174
+
175
+ // Queueing axes
176
+ if( !i && settings.queue ){
177
+ // Don't waste time animating, if there's no need.
178
+ if( old != attr[key] )
179
+ // Intermediate animation
180
+ animate( settings.onAfterFirst );
181
+ // Don't animate this axis again in the next iteration.
182
+ delete attr[key];
183
+ }
184
+ });
185
+
186
+ animate( settings.onAfter );
187
+
188
+ function animate( callback ){
189
+ $elem.animate( attr, duration, settings.easing, callback && function(){
190
+ callback.call(this, target, settings);
191
+ });
192
+ };
193
+
194
+ }).end();
195
+ };
196
+
197
+ // Max scrolling position, works on quirks mode
198
+ // It only fails (not too badly) on IE, quirks mode.
199
+ $scrollTo.max = function( elem, axis ){
200
+ var Dim = axis == 'x' ? 'Width' : 'Height',
201
+ scroll = 'scroll'+Dim;
202
+
203
+ if( !$(elem).is('html,body') )
204
+ return elem[scroll] - $(elem)[Dim.toLowerCase()]();
205
+
206
+ var size = 'client' + Dim,
207
+ html = elem.ownerDocument.documentElement,
208
+ body = elem.ownerDocument.body;
209
+
210
+ return Math.max( html[scroll], body[scroll] )
211
+ - Math.min( html[size] , body[size] );
212
+ };
213
+
214
+ function both( val ){
215
+ return typeof val == 'object' ? val : { top:val, left:val };
216
+ };
217
+
218
+ })( jQuery );
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright (c) 2007-2012 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
3
+ * Dual licensed under MIT and GPL.
4
+ * @author Ariel Flesler
5
+ * @version 1.4.3.1
6
+ */
7
+ ;(function($){var h=$.scrollTo=function(a,b,c){$(window).scrollTo(a,b,c)};h.defaults={axis:'xy',duration:parseFloat($.fn.jquery)>=1.3?0:1,limit:true};h.window=function(a){return $(window)._scrollable()};$.fn._scrollable=function(){return this.map(function(){var a=this,isWin=!a.nodeName||$.inArray(a.nodeName.toLowerCase(),['iframe','#document','html','body'])!=-1;if(!isWin)return a;var b=(a.contentWindow||a).document||a.ownerDocument||a;return/webkit/i.test(navigator.userAgent)||b.compatMode=='BackCompat'?b.body:b.documentElement})};$.fn.scrollTo=function(e,f,g){if(typeof f=='object'){g=f;f=0}if(typeof g=='function')g={onAfter:g};if(e=='max')e=9e9;g=$.extend({},h.defaults,g);f=f||g.duration;g.queue=g.queue&&g.axis.length>1;if(g.queue)f/=2;g.offset=both(g.offset);g.over=both(g.over);return this._scrollable().each(function(){if(e==null)return;var d=this,$elem=$(d),targ=e,toff,attr={},win=$elem.is('html,body');switch(typeof targ){case'number':case'string':if(/^([+-]=)?\d+(\.\d+)?(px|%)?$/.test(targ)){targ=both(targ);break}targ=$(targ,this);if(!targ.length)return;case'object':if(targ.is||targ.style)toff=(targ=$(targ)).offset()}$.each(g.axis.split(''),function(i,a){var b=a=='x'?'Left':'Top',pos=b.toLowerCase(),key='scroll'+b,old=d[key],max=h.max(d,a);if(toff){attr[key]=toff[pos]+(win?0:old-$elem.offset()[pos]);if(g.margin){attr[key]-=parseInt(targ.css('margin'+b))||0;attr[key]-=parseInt(targ.css('border'+b+'Width'))||0}attr[key]+=g.offset[pos]||0;if(g.over[pos])attr[key]+=targ[a=='x'?'width':'height']()*g.over[pos]}else{var c=targ[pos];attr[key]=c.slice&&c.slice(-1)=='%'?parseFloat(c)/100*max:c}if(g.limit&&/^\d+$/.test(attr[key]))attr[key]=attr[key]<=0?0:Math.min(attr[key],max);if(!i&&g.queue){if(old!=attr[key])animate(g.onAfterFirst);delete attr[key]}});animate(g.onAfter);function animate(a){$elem.animate(attr,f,g.easing,a&&function(){a.call(this,e,g)})}}).end()};h.max=function(a,b){var c=b=='x'?'Width':'Height',scroll='scroll'+c;if(!$(a).is('html,body'))return a[scroll]-$(a)[c.toLowerCase()]();var d='client'+c,html=a.ownerDocument.documentElement,body=a.ownerDocument.body;return Math.max(html[scroll],body[scroll])-Math.min(html[d],body[d])};function both(a){return typeof a=='object'?a:{top:a,left:a}}})(jQuery);
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sn-jquery-scrollto-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.4.4
5
+ platform: ruby
6
+ authors:
7
+ - John Colvin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-09-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: This provides jQUery scrollTo for your Rails 3.1 - 4.x application
28
+ email:
29
+ - colvin.john@gmail.com
30
+ executables: []
31
+ extensions: []
32
+ extra_rdoc_files: []
33
+ files:
34
+ - ".gitignore"
35
+ - Gemfile
36
+ - LICENSE
37
+ - MIT License
38
+ - README.md
39
+ - Rakefile
40
+ - jquery-scrollto-rails.gemspec
41
+ - lib/jquery-scrollto-rails.rb
42
+ - lib/jquery-scrollto-rails/rails.rb
43
+ - lib/jquery-scrollto-rails/rails/engine.rb
44
+ - lib/jquery-scrollto-rails/rails/version.rb
45
+ - vendor/assets/javascripts/jquery.scrollTo.js
46
+ - vendor/assets/javascripts/jquery.scrollTo.min.js
47
+ homepage: https://github.com/JohnColvin/jquery-scrollto-rails
48
+ licenses:
49
+ - MIT
50
+ - GPL
51
+ metadata: {}
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ requirements: []
67
+ rubyforge_project: jquery-scrollto-rails
68
+ rubygems_version: 2.7.7
69
+ signing_key:
70
+ specification_version: 4
71
+ summary: Use jQuery scrollTo with Rails 3.1 - 4.x
72
+ test_files: []