sick_js 0.1.0 → 0.2.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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/sick_js/helpers/_horizontal_scroll.js +32 -0
- data/app/assets/javascripts/sick_js/libs/waypoints/all.js +1 -0
- data/app/assets/javascripts/sick_js/libs/{jquery.waypoints.js → waypoints/jquery.waypoints.js} +0 -0
- data/app/assets/javascripts/sick_js/libs/waypoints/waypoints.sticky.js +70 -0
- data/lib/sick_js/engine.rb +4 -1
- data/lib/sick_js/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8adcb681abc44f09eab31542c434acedc5691da4
|
4
|
+
data.tar.gz: f9152bf4f2a579141af7861ef9de22c1f168cf3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d643a4fd79fe5e57df254c582aa712997a84f37074da109bfde94566e92cc09f5257e487fe62e956f35c52c8e74de15fcf18b1932177b3b18acfdf66a5ff32b
|
7
|
+
data.tar.gz: 2d85a460c2b7235035113da40aa288440663de46b0985b76d8418f80f87c966aa2a27f9ebce4af2186826c9c37d231d64c25aee4365eb0fe81ae6bca0fc26aa0
|
@@ -0,0 +1,32 @@
|
|
1
|
+
/*
|
2
|
+
USAGE:
|
3
|
+
$('#your_node').horizontalScroll(100); // You can pass (optionally) scrolling amount
|
4
|
+
*/
|
5
|
+
|
6
|
+
(function($){
|
7
|
+
$.fn.horizontalScroll = function (amount) {
|
8
|
+
amount = amount || 120;
|
9
|
+
|
10
|
+
$(this)
|
11
|
+
.bind("mouseover", function(){
|
12
|
+
$(this).data("user_is_interacting", true);
|
13
|
+
})
|
14
|
+
.bind("mouseout", function(){
|
15
|
+
$(this).data("user_is_interacting", false);
|
16
|
+
})
|
17
|
+
.bind("DOMMouseScroll mousewheel", function (event) {
|
18
|
+
var oEvent = event.originalEvent,
|
19
|
+
deltaX = Math.abs(oEvent.wheelDeltaX),
|
20
|
+
deltaY = Math.abs(oEvent.wheelDeltaY);
|
21
|
+
|
22
|
+
if( $(this).data("user_is_interacting") && deltaX < deltaY ){
|
23
|
+
var direction = oEvent.detail ? oEvent.detail * -amount : oEvent.wheelDelta,
|
24
|
+
position = $(this).scrollLeft();
|
25
|
+
position += direction > 0 ? -amount : amount;
|
26
|
+
|
27
|
+
$(this).scrollLeft(position);
|
28
|
+
event.preventDefault();
|
29
|
+
}
|
30
|
+
});
|
31
|
+
};
|
32
|
+
})(jQuery)
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require_tree .
|
data/app/assets/javascripts/sick_js/libs/{jquery.waypoints.js → waypoints/jquery.waypoints.js}
RENAMED
File without changes
|
@@ -0,0 +1,70 @@
|
|
1
|
+
/*!
|
2
|
+
Waypoints Sticky Element Shortcut - 4.0.0
|
3
|
+
Copyright © 2011-2015 Caleb Troughton
|
4
|
+
Licensed under the MIT license.
|
5
|
+
https://github.com/imakewebthings/waypoints/blog/master/licenses.txt
|
6
|
+
*/
|
7
|
+
(function() {
|
8
|
+
'use strict'
|
9
|
+
|
10
|
+
var $ = window.jQuery
|
11
|
+
var Waypoint = window.Waypoint
|
12
|
+
|
13
|
+
/* http://imakewebthings.com/waypoints/shortcuts/sticky-elements */
|
14
|
+
function Sticky(options) {
|
15
|
+
this.options = $.extend({}, Waypoint.defaults, Sticky.defaults, options)
|
16
|
+
this.element = this.options.element
|
17
|
+
this.$element = $(this.element)
|
18
|
+
this.createWrapper()
|
19
|
+
this.createWaypoint()
|
20
|
+
}
|
21
|
+
|
22
|
+
/* Private */
|
23
|
+
Sticky.prototype.createWaypoint = function() {
|
24
|
+
var originalHandler = this.options.handler
|
25
|
+
|
26
|
+
this.waypoint = new Waypoint($.extend({}, this.options, {
|
27
|
+
element: this.wrapper,
|
28
|
+
handler: $.proxy(function(direction) {
|
29
|
+
var shouldBeStuck = this.options.direction.indexOf(direction) > -1
|
30
|
+
var wrapperHeight = shouldBeStuck ? this.$element.outerHeight(true) : ''
|
31
|
+
|
32
|
+
this.$wrapper.height(wrapperHeight)
|
33
|
+
this.$element.toggleClass(this.options.stuckClass, shouldBeStuck)
|
34
|
+
|
35
|
+
if (originalHandler) {
|
36
|
+
originalHandler.call(this, direction)
|
37
|
+
}
|
38
|
+
}, this)
|
39
|
+
}))
|
40
|
+
}
|
41
|
+
|
42
|
+
/* Private */
|
43
|
+
Sticky.prototype.createWrapper = function() {
|
44
|
+
if (this.options.wrapper) {
|
45
|
+
this.$element.wrap(this.options.wrapper)
|
46
|
+
}
|
47
|
+
this.$wrapper = this.$element.parent()
|
48
|
+
this.wrapper = this.$wrapper[0]
|
49
|
+
}
|
50
|
+
|
51
|
+
/* Public */
|
52
|
+
Sticky.prototype.destroy = function() {
|
53
|
+
if (this.$element.parent()[0] === this.wrapper) {
|
54
|
+
this.waypoint.destroy()
|
55
|
+
this.$element.removeClass(this.options.stuckClass)
|
56
|
+
if (this.options.wrapper) {
|
57
|
+
this.$element.unwrap()
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
|
62
|
+
Sticky.defaults = {
|
63
|
+
wrapper: '<div class="sticky-wrapper" />',
|
64
|
+
stuckClass: 'stuck',
|
65
|
+
direction: 'down right'
|
66
|
+
}
|
67
|
+
|
68
|
+
Waypoint.Sticky = Sticky
|
69
|
+
}())
|
70
|
+
;
|
data/lib/sick_js/engine.rb
CHANGED
@@ -5,9 +5,12 @@ module SickJs
|
|
5
5
|
isolate_namespace SickJs
|
6
6
|
|
7
7
|
initializer 'SickJs.precompile' do |app|
|
8
|
+
app.config.assets.precompile += %w(sick_js/helpers/all.js)
|
8
9
|
app.config.assets.precompile += %w(sick_js/libs/all.js)
|
9
|
-
app.config.assets.precompile += %w(sick_js/libs/
|
10
|
+
app.config.assets.precompile += %w(sick_js/libs/waypoints/all.js)
|
10
11
|
app.config.assets.precompile += %w(sick_js/libs/maps/usa.js)
|
12
|
+
app.config.assets.precompile += %w(sick_js/libs/waypoints/jquery.waypoints.js)
|
13
|
+
app.config.assets.precompile += %w(sick_js/libs/waypoints/waypoints.sticky.js)
|
11
14
|
app.config.assets.precompile += %w(sick_js/libs/maps/jvectormap-2.2.0.js)
|
12
15
|
app.config.assets.precompile += %w(sick_js/libs/maps/jvectormap.usa.js)
|
13
16
|
end
|
data/lib/sick_js/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sick_js
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Greene
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -46,12 +46,15 @@ extensions: []
|
|
46
46
|
extra_rdoc_files: []
|
47
47
|
files:
|
48
48
|
- Rakefile
|
49
|
+
- app/assets/javascripts/sick_js/helpers/_horizontal_scroll.js
|
49
50
|
- app/assets/javascripts/sick_js/helpers/all.js
|
50
51
|
- app/assets/javascripts/sick_js/libs/all.js
|
51
|
-
- app/assets/javascripts/sick_js/libs/jquery.waypoints.js
|
52
52
|
- app/assets/javascripts/sick_js/libs/maps/jvectormap-2.2.0.js
|
53
53
|
- app/assets/javascripts/sick_js/libs/maps/jvectormap.usa.js
|
54
54
|
- app/assets/javascripts/sick_js/libs/maps/usa.js
|
55
|
+
- app/assets/javascripts/sick_js/libs/waypoints/all.js
|
56
|
+
- app/assets/javascripts/sick_js/libs/waypoints/jquery.waypoints.js
|
57
|
+
- app/assets/javascripts/sick_js/libs/waypoints/waypoints.sticky.js
|
55
58
|
- app/assets/javascripts/sick_js_main.js
|
56
59
|
- app/assets/stylesheets/sick_js.scss
|
57
60
|
- lib/sick_js.rb
|