slim_scroll 0.0.1
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 +15 -0
- data/README.md +45 -0
- data/lib/generators/slim_scroll/install/USAGE +8 -0
- data/lib/generators/slim_scroll/install/install_generator.rb +37 -0
- data/lib/slim_scroll.rb +1 -0
- data/lib/slim_scroll/assert_select.rb +25 -0
- data/lib/slim_scroll/rails.rb +8 -0
- data/lib/slim_scroll/rails/engine.rb +6 -0
- data/lib/slim_scroll/rails/railtie.rb +13 -0
- data/vendor/assets/javascripts/slim_scroll.js +228 -0
- data/vendor/assets/javascripts/slim_scroll.min.js +16 -0
- metadata +54 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MGRhOTljZjBlNGMxNjNiYTRlMWZhZGU4MjhlOGQyY2I2NTk0NTU1YQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NmQwZTM0MTQyN2M5YTgxNzlmNmFhMjMxNjhlNWRlYjY4OWE3ZjJjNA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NmNjNzViOWNkODM4YWE2NzdkODJmMzllZmUwOTk4NGYxMDA2NTdmOTE5Nzgw
|
10
|
+
N2IzNjAwZWZmOTUxODkzMDc1ZjExODFmMjcyMGU2NzE5MDQ0NzFiY2JiMjNl
|
11
|
+
ODIyMjQ1OWMyYjYxZGY4NjE3ZDU4NzZjYjIyYjI0ZDZlOWUyNjk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YTY0ZmRmN2NlZDczNTFiZmNkYWZkODE1NzUyNWI4ZGRiMjdjMmEzN2NjZjM3
|
14
|
+
ZmQwMDQyNGVkZjg2OTdkNzY5YzIwMzk4NWYyMGE0ZjkxOTBkZTMzZDU4NWNj
|
15
|
+
NTg5YWQxMmQzMjlmYTAzOTY2NzI1NTU0ZTAzYTc0NmM2YzY0NzA=
|
data/README.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
slim_scroll is a small jQuery plugin gem that transforms any div into a scrollable area with a nice scrollbar - similar to the one Facebook and Google started using in their products recently. slim_scroll doesn't occupy any visual space as it only appears on a user initiated mouse-over. User can drag the scrollbar or use mouse-wheel to change the scroll value..
|
2
|
+
|
3
|
+
## Setup
|
4
|
+
|
5
|
+
Add the gem to your Gemfile and run the `bundle` command to install it.
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem "slim_scroll"
|
9
|
+
```
|
10
|
+
|
11
|
+
Run the generator to create the initial files.
|
12
|
+
|
13
|
+
```
|
14
|
+
rails g slim_scroll:install
|
15
|
+
```
|
16
|
+
**In Rails 3.1** add the JavaScript file to your application.js file manifest.
|
17
|
+
|
18
|
+
```javascript
|
19
|
+
//= require slim_scroll
|
20
|
+
```
|
21
|
+
|
22
|
+
|
23
|
+
**In Rails 3.0** add the generated slim_scroll file to your layout.
|
24
|
+
|
25
|
+
```rhtml
|
26
|
+
<%= javascript_include_tag "slim_scroll" %>
|
27
|
+
|
28
|
+
## Usage
|
29
|
+
Slim scroll provide various option to for user
|
30
|
+
```rhtml
|
31
|
+
<%= subscribe_to "/messages/new" %>
|
32
|
+
```
|
33
|
+
Use the `publish_to` helper method to send JavaScript to that channel. This is usually done in a JavaScript AJAX template (such as a create.js.erb file).
|
34
|
+
|
35
|
+
```rhtml
|
36
|
+
<% publish_to "/messages/new" do %>
|
37
|
+
$("#chat").append("<%= j render(@messages) %>");
|
38
|
+
<% end %>
|
39
|
+
```
|
40
|
+
|
41
|
+
This JavaScript will be immediately evaluated on all clients who have subscribed to that channel. In this example they will see the new chat message appear in real-time without reloading the browser.
|
42
|
+
|
43
|
+
## Development & Feedback
|
44
|
+
|
45
|
+
Questions or comments? Please use the [issue tracker](https://github.com/ciserfan/slim_scroll/issues). Tests can be run with `bundle` and `rake` commands.
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'rails'
|
2
|
+
|
3
|
+
# Supply generator for Rails 3.0.x or if asset pipeline is not enabled
|
4
|
+
if ::Rails.version < "3.1" || !::Rails.application.config.assets.enabled || !File.exist?('app/assets/javascripts/application.js') || !File.exist?('app/assets/javascripts/application.js.coffee')
|
5
|
+
module SlimScroll
|
6
|
+
module Generators
|
7
|
+
class InstallGenerator < ::Rails::Generators::Base
|
8
|
+
|
9
|
+
desc "This generator installs SlimScroll"
|
10
|
+
source_root File.expand_path('../../../../../vendor/assets/javascripts', __FILE__)
|
11
|
+
|
12
|
+
def copy_slim_scroll
|
13
|
+
say_status("copying", "slim_scroll", :green)
|
14
|
+
copy_file "slim_scroll.js", "public/javascripts/slim_scroll.js"
|
15
|
+
copy_file "slim_scroll.min.js", "public/javascripts/slim_scroll.min.js"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
else
|
21
|
+
module SlimScroll
|
22
|
+
module Generators
|
23
|
+
class InstallGenerator < ::Rails::Generators::Base
|
24
|
+
desc "This generator add SlimScroll to application.js or application.js.coffee"
|
25
|
+
source_root File.expand_path('../../../../../vendor/assets/javascripts', __FILE__)
|
26
|
+
def add_assets
|
27
|
+
insert_into_file "app/assets/javascripts/application#{detect_js_format[0]}", "#{detect_js_format[1]} require slim_scroll\n", :after => "jquery_ujs\n"
|
28
|
+
end
|
29
|
+
|
30
|
+
def detect_js_format
|
31
|
+
return ['.js.coffee', '#='] if File.exist?('app/assets/javascripts/application.js.coffee')
|
32
|
+
return ['.js', '//='] if File.exist?('app/assets/javascripts/application.js')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/slim_scroll.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'slim_scroll/rails'
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module ActionDispatch
|
2
|
+
module Assertions
|
3
|
+
module SelectorAssertions
|
4
|
+
|
5
|
+
PATTERN_HTML = %Q{"((\\\\\"|[^\"])*)"}
|
6
|
+
PATTERN_UNICODE_ESCAPED_CHAR = /\\u([0-9a-zA-Z]{4})/
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
# Unescapes a JS string.
|
11
|
+
def unescape_js(js_string)
|
12
|
+
# js encodes double quotes and line breaks.
|
13
|
+
unescaped= js_string.gsub('\"', '"')
|
14
|
+
unescaped.gsub!('\\\'', "'")
|
15
|
+
unescaped.gsub!(/\\\//, '/')
|
16
|
+
unescaped.gsub!('\n', "\n")
|
17
|
+
unescaped.gsub!('\076', '>')
|
18
|
+
unescaped.gsub!('\074', '<')
|
19
|
+
# js encodes non-ascii characters.
|
20
|
+
unescaped.gsub!(PATTERN_UNICODE_ESCAPED_CHAR) {|u| [$1.hex].pack('U*')}
|
21
|
+
unescaped
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# Used to ensure that Rails 3.0.x, as well as Rails >= 3.1 with asset pipeline disabled
|
2
|
+
# get the minified version of the scripts included into the layout in production.
|
3
|
+
module SlimScroll
|
4
|
+
module Rails
|
5
|
+
class Railtie < ::Rails::Railtie
|
6
|
+
config.before_configuration do
|
7
|
+
if config.action_view.javascript_expansions
|
8
|
+
slim_scroll_defaults = ::Rails.env.production? || ::Rails.env.test? ? %w(slim_scroll.min) : %w(slim_scroll)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,228 @@
|
|
1
|
+
/*! Copyright (c) 2011 Piotr Rochala (http://rocha.la)
|
2
|
+
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
3
|
+
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
4
|
+
*
|
5
|
+
* Version: 1.3.0
|
6
|
+
*
|
7
|
+
*/
|
8
|
+
(function (f) {
|
9
|
+
jQuery.fn.extend({
|
10
|
+
slimScroll: function (h) {
|
11
|
+
var a = f.extend({
|
12
|
+
width: "auto",
|
13
|
+
height: "250px",
|
14
|
+
size: "7px",
|
15
|
+
color: "#000",
|
16
|
+
position: "right",
|
17
|
+
distance: "1px",
|
18
|
+
start: "top",
|
19
|
+
opacity: 0.4,
|
20
|
+
alwaysVisible: !1,
|
21
|
+
disableFadeOut: !1,
|
22
|
+
railVisible: !1,
|
23
|
+
railColor: "#333",
|
24
|
+
railOpacity: 0.2,
|
25
|
+
railDraggable: !0,
|
26
|
+
railClass: "slimScrollRail",
|
27
|
+
barClass: "slimScrollBar",
|
28
|
+
wrapperClass: "slimScrollDiv",
|
29
|
+
allowPageScroll: !1,
|
30
|
+
wheelStep: 20,
|
31
|
+
touchScrollStep: 200,
|
32
|
+
borderRadius: "7px",
|
33
|
+
railBorderRadius: "7px"
|
34
|
+
}, h);
|
35
|
+
this.each(function () {
|
36
|
+
function r(d) {
|
37
|
+
if (s) {
|
38
|
+
d = d ||
|
39
|
+
window.event;
|
40
|
+
var c = 0;
|
41
|
+
d.wheelDelta && (c = -d.wheelDelta / 120);
|
42
|
+
d.detail && (c = d.detail / 3);
|
43
|
+
f(d.target || d.srcTarget || d.srcElement).closest("." + a.wrapperClass).is(b.parent()) && m(c, !0);
|
44
|
+
d.preventDefault && !k && d.preventDefault();
|
45
|
+
k || (d.returnValue = !1)
|
46
|
+
}
|
47
|
+
}
|
48
|
+
|
49
|
+
function m(d, f, h) {
|
50
|
+
k = !1;
|
51
|
+
var e = d,
|
52
|
+
g = b.outerHeight() - c.outerHeight();
|
53
|
+
f && (e = parseInt(c.css("top")) + d * parseInt(a.wheelStep) / 100 * c.outerHeight(), e = Math.min(Math.max(e, 0), g), e = 0 < d ? Math.ceil(e) : Math.floor(e), c.css({
|
54
|
+
top: e + "px"
|
55
|
+
}));
|
56
|
+
l = parseInt(c.css("top")) / (b.outerHeight() - c.outerHeight());
|
57
|
+
e = l * (b[0].scrollHeight - b.outerHeight());
|
58
|
+
h && (e = d, d = e / b[0].scrollHeight * b.outerHeight(), d = Math.min(Math.max(d, 0), g), c.css({
|
59
|
+
top: d + "px"
|
60
|
+
}));
|
61
|
+
b.scrollTop(e);
|
62
|
+
b.trigger("slimscrolling", ~~e);
|
63
|
+
v();
|
64
|
+
p()
|
65
|
+
}
|
66
|
+
|
67
|
+
function C() {
|
68
|
+
window.addEventListener ? (this.addEventListener("DOMMouseScroll", r, !1), this.addEventListener("mousewheel", r, !1), this.addEventListener("MozMousePixelScroll", r, !1)) : document.attachEvent("onmousewheel", r)
|
69
|
+
}
|
70
|
+
|
71
|
+
function w() {
|
72
|
+
u = Math.max(b.outerHeight() / b[0].scrollHeight * b.outerHeight(), D);
|
73
|
+
c.css({
|
74
|
+
height: u + "px"
|
75
|
+
});
|
76
|
+
var a = u == b.outerHeight() ? "none" : "block";
|
77
|
+
c.css({
|
78
|
+
display: a
|
79
|
+
})
|
80
|
+
}
|
81
|
+
|
82
|
+
function v() {
|
83
|
+
w();
|
84
|
+
clearTimeout(A);
|
85
|
+
l == ~~l ? (k = a.allowPageScroll, B != l && b.trigger("slimscroll", 0 == ~~l ? "top" : "bottom")) : k = !1;
|
86
|
+
B = l;
|
87
|
+
u >= b.outerHeight() ? k = !0 : (c.stop(!0, !0).fadeIn("fast"), a.railVisible && g.stop(!0, !0).fadeIn("fast"))
|
88
|
+
}
|
89
|
+
|
90
|
+
function p() {
|
91
|
+
a.alwaysVisible || (A = setTimeout(function () {
|
92
|
+
a.disableFadeOut && s || (x || y) || (c.fadeOut("slow"), g.fadeOut("slow"))
|
93
|
+
}, 1E3))
|
94
|
+
}
|
95
|
+
var s, x, y, A, z, u, l, B, D = 30,
|
96
|
+
k = !1,
|
97
|
+
b = f(this);
|
98
|
+
if (b.parent().hasClass(a.wrapperClass)) {
|
99
|
+
var n = b.scrollTop(),
|
100
|
+
c = b.parent().find("." + a.barClass),
|
101
|
+
g = b.parent().find("." + a.railClass);
|
102
|
+
w();
|
103
|
+
if (f.isPlainObject(h)) {
|
104
|
+
if ("height" in h && "auto" == h.height) {
|
105
|
+
b.parent().css("height", "auto");
|
106
|
+
b.css("height", "auto");
|
107
|
+
var q = b.parent().parent().height();
|
108
|
+
b.parent().css("height", q);
|
109
|
+
b.css("height", q)
|
110
|
+
}
|
111
|
+
if ("scrollTo" in h) n = parseInt(a.scrollTo);
|
112
|
+
else if ("scrollBy" in h) n += parseInt(a.scrollBy);
|
113
|
+
else if ("destroy" in h) {
|
114
|
+
c.remove();
|
115
|
+
g.remove();
|
116
|
+
b.unwrap();
|
117
|
+
return
|
118
|
+
}
|
119
|
+
m(n, !1, !0)
|
120
|
+
}
|
121
|
+
} else {
|
122
|
+
a.height = "auto" == a.height ? b.parent().height() : a.height;
|
123
|
+
n = f("<div></div>").addClass(a.wrapperClass).css({
|
124
|
+
position: "relative",
|
125
|
+
overflow: "hidden",
|
126
|
+
width: a.width,
|
127
|
+
height: a.height
|
128
|
+
});
|
129
|
+
b.css({
|
130
|
+
overflow: "hidden",
|
131
|
+
width: a.width,
|
132
|
+
height: a.height
|
133
|
+
});
|
134
|
+
var g = f("<div></div>").addClass(a.railClass).css({
|
135
|
+
width: a.size,
|
136
|
+
height: "100%",
|
137
|
+
position: "absolute",
|
138
|
+
top: 0,
|
139
|
+
display: a.alwaysVisible && a.railVisible ? "block" : "none",
|
140
|
+
"border-radius": a.railBorderRadius,
|
141
|
+
background: a.railColor,
|
142
|
+
opacity: a.railOpacity,
|
143
|
+
zIndex: 90
|
144
|
+
}),
|
145
|
+
c = f("<div></div>").addClass(a.barClass).css({
|
146
|
+
background: a.color,
|
147
|
+
width: a.size,
|
148
|
+
position: "absolute",
|
149
|
+
top: 0,
|
150
|
+
opacity: a.opacity,
|
151
|
+
display: a.alwaysVisible ? "block" : "none",
|
152
|
+
"border-radius": a.borderRadius,
|
153
|
+
BorderRadius: a.borderRadius,
|
154
|
+
MozBorderRadius: a.borderRadius,
|
155
|
+
WebkitBorderRadius: a.borderRadius,
|
156
|
+
zIndex: 99
|
157
|
+
}),
|
158
|
+
q = "right" == a.position ? {
|
159
|
+
right: a.distance
|
160
|
+
} : {
|
161
|
+
left: a.distance
|
162
|
+
};
|
163
|
+
g.css(q);
|
164
|
+
c.css(q);
|
165
|
+
b.wrap(n);
|
166
|
+
b.parent().append(c);
|
167
|
+
b.parent().append(g);
|
168
|
+
a.railDraggable && c.bind("mousedown", function (a) {
|
169
|
+
var b = f(document);
|
170
|
+
y = !0;
|
171
|
+
t = parseFloat(c.css("top"));
|
172
|
+
pageY = a.pageY;
|
173
|
+
b.bind("mousemove.slimscroll", function (a) {
|
174
|
+
currTop = t + a.pageY - pageY;
|
175
|
+
c.css("top", currTop);
|
176
|
+
m(0, c.position().top, !1)
|
177
|
+
});
|
178
|
+
b.bind("mouseup.slimscroll", function (a) {
|
179
|
+
y = !1;
|
180
|
+
p();
|
181
|
+
b.unbind(".slimscroll")
|
182
|
+
});
|
183
|
+
return !1
|
184
|
+
}).bind("selectstart.slimscroll", function (a) {
|
185
|
+
a.stopPropagation();
|
186
|
+
a.preventDefault();
|
187
|
+
return !1
|
188
|
+
});
|
189
|
+
g.hover(function () {
|
190
|
+
v()
|
191
|
+
}, function () {
|
192
|
+
p()
|
193
|
+
});
|
194
|
+
c.hover(function () {
|
195
|
+
x = !0
|
196
|
+
}, function () {
|
197
|
+
x = !1
|
198
|
+
});
|
199
|
+
b.hover(function () {
|
200
|
+
s = !0;
|
201
|
+
v();
|
202
|
+
p()
|
203
|
+
}, function () {
|
204
|
+
s = !1;
|
205
|
+
p()
|
206
|
+
});
|
207
|
+
b.bind("touchstart", function (a, b) {
|
208
|
+
a.originalEvent.touches.length && (z = a.originalEvent.touches[0].pageY)
|
209
|
+
});
|
210
|
+
b.bind("touchmove", function (b) {
|
211
|
+
k || b.originalEvent.preventDefault();
|
212
|
+
b.originalEvent.touches.length &&
|
213
|
+
(m((z - b.originalEvent.touches[0].pageY) / a.touchScrollStep, !0), z = b.originalEvent.touches[0].pageY)
|
214
|
+
});
|
215
|
+
w();
|
216
|
+
"bottom" === a.start ? (c.css({
|
217
|
+
top: b.outerHeight() - c.outerHeight()
|
218
|
+
}), m(0, !0)) : "top" !== a.start && (m(f(a.start).position().top, null, !0), a.alwaysVisible || c.hide());
|
219
|
+
C()
|
220
|
+
}
|
221
|
+
});
|
222
|
+
return this
|
223
|
+
}
|
224
|
+
});
|
225
|
+
jQuery.fn.extend({
|
226
|
+
slimscroll: jQuery.fn.slimScroll
|
227
|
+
})
|
228
|
+
})(jQuery);
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/*! Copyright (c) 2011 Piotr Rochala (http://rocha.la)
|
2
|
+
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
|
3
|
+
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
|
4
|
+
*
|
5
|
+
* Version: 1.3.0
|
6
|
+
*
|
7
|
+
*/
|
8
|
+
(function(f){jQuery.fn.extend({slimScroll:function(h){var a=f.extend({width:"auto",height:"250px",size:"7px",color:"#000",position:"right",distance:"1px",start:"top",opacity:0.4,alwaysVisible:!1,disableFadeOut:!1,railVisible:!1,railColor:"#333",railOpacity:0.2,railDraggable:!0,railClass:"slimScrollRail",barClass:"slimScrollBar",wrapperClass:"slimScrollDiv",allowPageScroll:!1,wheelStep:20,touchScrollStep:200,borderRadius:"7px",railBorderRadius:"7px"},h);this.each(function(){function r(d){if(s){d=d||
|
9
|
+
window.event;var c=0;d.wheelDelta&&(c=-d.wheelDelta/120);d.detail&&(c=d.detail/3);f(d.target||d.srcTarget||d.srcElement).closest("."+a.wrapperClass).is(b.parent())&&m(c,!0);d.preventDefault&&!k&&d.preventDefault();k||(d.returnValue=!1)}}function m(d,f,h){k=!1;var e=d,g=b.outerHeight()-c.outerHeight();f&&(e=parseInt(c.css("top"))+d*parseInt(a.wheelStep)/100*c.outerHeight(),e=Math.min(Math.max(e,0),g),e=0<d?Math.ceil(e):Math.floor(e),c.css({top:e+"px"}));l=parseInt(c.css("top"))/(b.outerHeight()-c.outerHeight());
|
10
|
+
e=l*(b[0].scrollHeight-b.outerHeight());h&&(e=d,d=e/b[0].scrollHeight*b.outerHeight(),d=Math.min(Math.max(d,0),g),c.css({top:d+"px"}));b.scrollTop(e);b.trigger("slimscrolling",~~e);v();p()}function C(){window.addEventListener?(this.addEventListener("DOMMouseScroll",r,!1),this.addEventListener("mousewheel",r,!1),this.addEventListener("MozMousePixelScroll",r,!1)):document.attachEvent("onmousewheel",r)}function w(){u=Math.max(b.outerHeight()/b[0].scrollHeight*b.outerHeight(),D);c.css({height:u+"px"});
|
11
|
+
var a=u==b.outerHeight()?"none":"block";c.css({display:a})}function v(){w();clearTimeout(A);l==~~l?(k=a.allowPageScroll,B!=l&&b.trigger("slimscroll",0==~~l?"top":"bottom")):k=!1;B=l;u>=b.outerHeight()?k=!0:(c.stop(!0,!0).fadeIn("fast"),a.railVisible&&g.stop(!0,!0).fadeIn("fast"))}function p(){a.alwaysVisible||(A=setTimeout(function(){a.disableFadeOut&&s||(x||y)||(c.fadeOut("slow"),g.fadeOut("slow"))},1E3))}var s,x,y,A,z,u,l,B,D=30,k=!1,b=f(this);if(b.parent().hasClass(a.wrapperClass)){var n=b.scrollTop(),
|
12
|
+
c=b.parent().find("."+a.barClass),g=b.parent().find("."+a.railClass);w();if(f.isPlainObject(h)){if("height"in h&&"auto"==h.height){b.parent().css("height","auto");b.css("height","auto");var q=b.parent().parent().height();b.parent().css("height",q);b.css("height",q)}if("scrollTo"in h)n=parseInt(a.scrollTo);else if("scrollBy"in h)n+=parseInt(a.scrollBy);else if("destroy"in h){c.remove();g.remove();b.unwrap();return}m(n,!1,!0)}}else{a.height="auto"==a.height?b.parent().height():a.height;n=f("<div></div>").addClass(a.wrapperClass).css({position:"relative",
|
13
|
+
overflow:"hidden",width:a.width,height:a.height});b.css({overflow:"hidden",width:a.width,height:a.height});var g=f("<div></div>").addClass(a.railClass).css({width:a.size,height:"100%",position:"absolute",top:0,display:a.alwaysVisible&&a.railVisible?"block":"none","border-radius":a.railBorderRadius,background:a.railColor,opacity:a.railOpacity,zIndex:90}),c=f("<div></div>").addClass(a.barClass).css({background:a.color,width:a.size,position:"absolute",top:0,opacity:a.opacity,display:a.alwaysVisible?
|
14
|
+
"block":"none","border-radius":a.borderRadius,BorderRadius:a.borderRadius,MozBorderRadius:a.borderRadius,WebkitBorderRadius:a.borderRadius,zIndex:99}),q="right"==a.position?{right:a.distance}:{left:a.distance};g.css(q);c.css(q);b.wrap(n);b.parent().append(c);b.parent().append(g);a.railDraggable&&c.bind("mousedown",function(a){var b=f(document);y=!0;t=parseFloat(c.css("top"));pageY=a.pageY;b.bind("mousemove.slimscroll",function(a){currTop=t+a.pageY-pageY;c.css("top",currTop);m(0,c.position().top,!1)});
|
15
|
+
b.bind("mouseup.slimscroll",function(a){y=!1;p();b.unbind(".slimscroll")});return!1}).bind("selectstart.slimscroll",function(a){a.stopPropagation();a.preventDefault();return!1});g.hover(function(){v()},function(){p()});c.hover(function(){x=!0},function(){x=!1});b.hover(function(){s=!0;v();p()},function(){s=!1;p()});b.bind("touchstart",function(a,b){a.originalEvent.touches.length&&(z=a.originalEvent.touches[0].pageY)});b.bind("touchmove",function(b){k||b.originalEvent.preventDefault();b.originalEvent.touches.length&&
|
16
|
+
(m((z-b.originalEvent.touches[0].pageY)/a.touchScrollStep,!0),z=b.originalEvent.touches[0].pageY)});w();"bottom"===a.start?(c.css({top:b.outerHeight()-c.outerHeight()}),m(0,!0)):"top"!==a.start&&(m(f(a.start).position().top,null,!0),a.alwaysVisible||c.hide());C()}});return this}});jQuery.fn.extend({slimscroll:jQuery.fn.slimScroll})})(jQuery);
|
metadata
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: slim_scroll
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Erfan Mansuri
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-10-09 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: slim scroller used for create a simple attractive scroller
|
14
|
+
email: erfan.m@cisinlabs.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/slim_scroll.rb
|
20
|
+
- lib/slim_scroll/assert_select.rb
|
21
|
+
- lib/slim_scroll/rails/railtie.rb
|
22
|
+
- lib/slim_scroll/rails/engine.rb
|
23
|
+
- lib/slim_scroll/rails.rb
|
24
|
+
- lib/generators/slim_scroll/install/install_generator.rb
|
25
|
+
- lib/generators/slim_scroll/install/USAGE
|
26
|
+
- vendor/assets/javascripts/slim_scroll.js
|
27
|
+
- vendor/assets/javascripts/slim_scroll.min.js
|
28
|
+
- README.md
|
29
|
+
homepage: https://github.com/ciserfan/slim_scroll
|
30
|
+
licenses:
|
31
|
+
- MIT
|
32
|
+
metadata: {}
|
33
|
+
post_install_message:
|
34
|
+
rdoc_options: []
|
35
|
+
require_paths:
|
36
|
+
- lib
|
37
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ! '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.3.6
|
47
|
+
requirements: []
|
48
|
+
rubyforge_project:
|
49
|
+
rubygems_version: 2.1.5
|
50
|
+
signing_key:
|
51
|
+
specification_version: 4
|
52
|
+
summary: slim scroll gem used a jquery librery that will creae a attrective scroller
|
53
|
+
in you page when content hight is greter then wrapper hight
|
54
|
+
test_files: []
|