simplyscroll-rails 1.0.0

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: 613c890183aff15e4f71319771d98629c6069714
4
+ data.tar.gz: f346372b87d33b27d3b1086776d8f0c6f9322e4d
5
+ SHA512:
6
+ metadata.gz: 042a09a501c17e6789dbfd1c3ff1d1282d3ef02d9e208bb9b4656e5fe069f3a3698bde774fbe80c971e1c19cb2f89e68699829a935642a5c18ae4c61fa9753bd
7
+ data.tar.gz: a1ac1d830fa78cc409f9cdad885900f39084ead62f6ab4374cc01d83afb9223acbf0e5dc81f626981ffbd06cc493d8da5a5311e8bc2cdb9c39e44b9bbc5291b2
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2015 TwoWeb
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,41 @@
1
+ # SimplyScroll Rails Gem
2
+
3
+
4
+ ## Installation
5
+
6
+ Add this line to your application's Gemfile:
7
+
8
+ gem 'simplyscroll-rails'
9
+
10
+ Alternatively, you can get it from Github
11
+
12
+ gem 'simplyscroll-rails', :git => 'https://github.com/twoweb/simplyscroll-rails.git'
13
+
14
+ And then execute:
15
+
16
+ $ bundle install
17
+
18
+ ## Usage
19
+
20
+ simplyscroll-rails is dependant on jQuery, so make sure you have it in your Gemfile.
21
+
22
+ //= require jquery
23
+
24
+ Add to your app/assets/javascripts/application.js
25
+
26
+ //= require jquery.simplyscroll
27
+
28
+ Or for the minified version
29
+
30
+ //= require jquery.simplyscroll-min
31
+
32
+ And to your app/assets/stylesheets/application.css
33
+
34
+ *= require simplyscroll.css
35
+
36
+ ## Documentation
37
+
38
+ Usage documentation as well as demos can be found at:
39
+
40
+ https://github.com/logicbox/jquery-simplyscroll
41
+ http://logicbox.net/jquery/simplyscroll/
@@ -0,0 +1,3 @@
1
+ module Simplyscroll
2
+ VERSION = "1.0.0"
3
+ end
@@ -0,0 +1,17 @@
1
+ require "simplyscroll-rails/version"
2
+
3
+ module Simplyscroll
4
+ module Rails
5
+ class Engine < ::Rails::Engine
6
+ initializer :append_dependent_assets_path, :group => :all do |app|
7
+ app.config.assets.paths += %w( fonts )
8
+
9
+ app.config.assets.precompile += %w( simplyscroll.css )
10
+ app.config.assets.precompile += %w( jquery.simplyscroll.js )
11
+
12
+ app.config.assets.precompile += %w( buttons.png )
13
+
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" standalone="no"?>
2
+ <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
3
+ <svg xmlns="http://www.w3.org/2000/svg">
4
+ <metadata>
5
+ This is a custom SVG font generated by IcoMoon.
6
+ <iconset grid="14"></iconset>
7
+ </metadata>
8
+ <defs>
9
+ <font id="flexslider-icon" horiz-adv-x="448" >
10
+ <font-face units-per-em="448" ascent="384" descent="-64" />
11
+ <missing-glyph horiz-adv-x="448" />
12
+ <glyph unicode="&#xf001;" d="M 185.50-9.25l-163.00,162.75q-9.25,9.25 -9.25,22.625t 9.25,22.625l 163.00,162.75q 9.25,9.25 22.625,9.25t 22.625-9.25l 18.75-18.75q 9.25-9.25 9.25-22.625t-9.25-22.625l-121.50-121.50l 121.50-121.25q 9.25-9.50 9.25-22.75t-9.25-22.50l-18.75-18.75q-9.25-9.25 -22.625-9.25t-22.625,9.25z" horiz-adv-x="288" />
13
+ <glyph unicode="&#xf002;" d="M 274.75,176.00q0.00-13.00 -9.25-22.75l-163.00-162.75q-9.25-9.25 -22.50-9.25t-22.50,9.25l-19.00,18.75q-9.25,9.75 -9.25,22.75q0.00,13.25 9.25,22.50l 121.50,121.50l-121.50,121.25q-9.25,9.75 -9.25,22.75q0.00,13.25 9.25,22.50l 19.00,18.75q 9.00,9.50 22.50,9.50t 22.50-9.50l 163.00-162.75q 9.25-9.25 9.25-22.50z" horiz-adv-x="288" />
14
+ <glyph unicode="&#xf003;" d="M 346.00,152.25l-332.00-184.50q-5.75-3.25 -9.875-0.75t-4.125,9.00l0.00,368.00 q0.00,6.50 4.125,9.00t 9.875-0.75l 332.00-184.50q 5.75-3.25 5.75-7.75t-5.75-7.75z" horiz-adv-x="352" />
15
+ <glyph unicode="&#xf004;" d="M 384.00,336.00l0.00-352.00 q0.00-6.50 -4.75-11.25t-11.25-4.75l-128.00,0.00 q-6.50,0.00 -11.25,4.75t-4.75,11.25l0.00,352.00 q0.00,6.50 4.75,11.25t 11.25,4.75l 128.00,0.00 q 6.50,0.00 11.25-4.75t 4.75-11.25zM 160.00,336.00l0.00-352.00 q0.00-6.50 -4.75-11.25t-11.25-4.75l-128.00,0.00 q-6.50,0.00 -11.25,4.75t-4.75,11.25l0.00,352.00 q0.00,6.50 4.75,11.25t 11.25,4.75l 128.00,0.00 q 6.50,0.00 11.25-4.75t 4.75-11.25z" horiz-adv-x="384" />
16
+ <glyph unicode="&#xf005;" d="M 402.75,208.00q0.00-13.25 -9.25-22.50l-162.75-162.75q-9.50-9.50 -22.75-9.50q-13.50,0.00 -22.50,9.50l-162.75,162.75q-9.50,9.00 -9.50,22.50q0.00,13.25 9.50,22.75l 18.50,18.75q 9.75,9.25 22.75,9.25q 13.25,0.00 22.50-9.25l 121.50-121.50l 121.50,121.50q 9.25,9.25 22.50,9.25q 13.00,0.00 22.75-9.25l 18.75-18.75q 9.25-9.75 9.25-22.75z" horiz-adv-x="416" />
17
+ <glyph unicode="&#x20;" horiz-adv-x="224" />
18
+ <glyph class="hidden" unicode="&#xf000;" d="M0,384L 448 -64L0 -64 z" horiz-adv-x="0" />
19
+ </font></defs></svg>
Binary file
@@ -0,0 +1,389 @@
1
+ /*
2
+ * simplyScroll 2 - a scroll-tastic jQuery plugin
3
+ *
4
+ * http://logicbox.net/jquery/simplyscroll/
5
+ *
6
+ * Copyright (c) 2009-2012 Will Kelly - http://logicbox.net
7
+ *
8
+ * Dual licensed under the MIT and GPL licenses.
9
+ *
10
+ * Version: 2.0.5 Last revised: 10/05/2012
11
+ *
12
+ */
13
+
14
+ (function($,window,undefined) {
15
+
16
+ $.fn.simplyScroll = function(options) {
17
+ return this.each(function() {
18
+ new $.simplyScroll(this,options);
19
+ });
20
+ };
21
+
22
+ var defaults = {
23
+ customClass: 'simply-scroll',
24
+ frameRate: 24, //No of movements per second
25
+ speed: 1, //No of pixels per frame
26
+ orientation: 'horizontal', //'horizontal or 'vertical' - not to be confused with device orientation
27
+ auto: true,
28
+ autoMode: 'loop', //auto = true, 'loop' or 'bounce',
29
+ manualMode: 'end', //auto = false, 'loop' or 'end'
30
+ direction: 'forwards', //'forwards' or 'backwards'.
31
+ pauseOnHover: true, //autoMode = loop|bounce only
32
+ pauseOnTouch: true, //" touch device only
33
+ pauseButton: false, //" generates an extra element to allow manual pausing
34
+ startOnLoad: false //use this to delay starting of plugin until all page assets have loaded
35
+ };
36
+
37
+ $.simplyScroll = function(el,options) {
38
+
39
+ var self = this;
40
+
41
+ this.o = $.extend({}, defaults, options || {});
42
+ this.isAuto = this.o.auto!==false && this.o.autoMode.match(/^loop|bounce$/)!==null;
43
+ this.isHorizontal = this.o.orientation.match(/^horizontal|vertical$/)!==null && this.o.orientation==defaults.orientation;
44
+ this.isRTL = this.isHorizontal && $("html").attr('dir') == 'rtl';
45
+ this.isForwards = !this.isAuto || (this.isAuto && this.o.direction.match(/^forwards|backwards$/)!==null && this.o.direction==defaults.direction) && !this.isRTL;
46
+ this.isLoop = this.isAuto && this.o.autoMode == 'loop' || !this.isAuto && this.o.manualMode == 'loop';
47
+
48
+ this.supportsTouch = ('createTouch' in document);
49
+
50
+ this.events = this.supportsTouch ?
51
+ {start:'touchstart MozTouchDown',move:'touchmove MozTouchMove',end:'touchend touchcancel MozTouchRelease'} :
52
+ {start:'mouseenter',end:'mouseleave'};
53
+
54
+ this.$list = $(el); //called on ul/ol/div etc
55
+ var $items = this.$list.children();
56
+
57
+ //generate extra markup
58
+ this.$list.addClass('simply-scroll-list')
59
+ .wrap('<div class="simply-scroll-clip"></div>')
60
+ .parent().wrap('<div class="' + this.o.customClass + ' simply-scroll-container"></div>');
61
+
62
+ if (!this.isAuto) { //button placeholders
63
+ this.$list.parent().parent()
64
+ .prepend('<div class="simply-scroll-forward"></div>')
65
+ .prepend('<div class="simply-scroll-back"></div>');
66
+ } else {
67
+ if (this.o.pauseButton) {
68
+ this.$list.parent().parent()
69
+ .prepend('<div class="simply-scroll-btn simply-scroll-btn-pause"></div>');
70
+ this.o.pauseOnHover = false;
71
+ }
72
+ }
73
+
74
+ //wrap an extra div around the whole lot if elements scrolled aren't equal
75
+ if ($items.length > 1) {
76
+
77
+ var extra_wrap = false,
78
+ total = 0;
79
+
80
+ if (this.isHorizontal) {
81
+ $items.each(function() { total+=$(this).outerWidth(true); });
82
+ extra_wrap = $items.eq(0).outerWidth(true) * $items.length !== total;
83
+ } else {
84
+ $items.each(function() { total+=$(this).outerHeight(true); });
85
+ extra_wrap = $items.eq(0).outerHeight(true) * $items.length !== total;
86
+ }
87
+
88
+ if (extra_wrap) {
89
+ this.$list = this.$list.wrap('<div></div>').parent().addClass('simply-scroll-list');
90
+ if (this.isHorizontal) {
91
+ this.$list.children().css({"float":'left',width: total + 'px'});
92
+ } else {
93
+ this.$list.children().css({height: total + 'px'});
94
+ }
95
+ }
96
+ }
97
+
98
+ if (!this.o.startOnLoad) {
99
+ this.init();
100
+ } else {
101
+ //wait for load before completing setup
102
+ $(window).load(function() { self.init(); });
103
+ }
104
+
105
+ };
106
+
107
+ $.simplyScroll.fn = $.simplyScroll.prototype = {};
108
+
109
+ $.simplyScroll.fn.extend = $.simplyScroll.extend = $.extend;
110
+
111
+ $.simplyScroll.fn.extend({
112
+ init: function() {
113
+
114
+ this.$items = this.$list.children();
115
+ this.$clip = this.$list.parent(); //this is the element that scrolls
116
+ this.$container = this.$clip.parent();
117
+ this.$btnBack = $('.simply-scroll-back',this.$container);
118
+ this.$btnForward = $('.simply-scroll-forward',this.$container);
119
+
120
+ if (!this.isHorizontal) {
121
+ this.itemMax = this.$items.eq(0).outerHeight(true);
122
+ this.clipMax = this.$clip.height();
123
+ this.dimension = 'height';
124
+ this.moveBackClass = 'simply-scroll-btn-up';
125
+ this.moveForwardClass = 'simply-scroll-btn-down';
126
+ this.scrollPos = 'Top';
127
+ } else {
128
+ this.itemMax = this.$items.eq(0).outerWidth(true);
129
+ this.clipMax = this.$clip.width();
130
+ this.dimension = 'width';
131
+ this.moveBackClass = 'simply-scroll-btn-left';
132
+ this.moveForwardClass = 'simply-scroll-btn-right';
133
+ this.scrollPos = 'Left';
134
+ }
135
+
136
+ this.posMin = 0;
137
+
138
+ this.posMax = this.$items.length * this.itemMax;
139
+
140
+ var addItems = Math.ceil(this.clipMax / this.itemMax);
141
+
142
+ //auto scroll loop & manual scroll bounce or end(to-end)
143
+ if (this.isAuto && this.o.autoMode=='loop') {
144
+
145
+ this.$list.css(this.dimension,this.posMax+(this.itemMax*addItems) +'px');
146
+
147
+ this.posMax += (this.clipMax - this.o.speed);
148
+
149
+ if (this.isForwards) {
150
+ this.$items.slice(0,addItems).clone(true).appendTo(this.$list);
151
+ this.resetPosition = 0;
152
+
153
+ } else {
154
+ this.$items.slice(-addItems).clone(true).prependTo(this.$list);
155
+ this.resetPosition = this.$items.length * this.itemMax;
156
+ //due to inconsistent RTL implementation force back to LTR then fake
157
+ if (this.isRTL) {
158
+ this.$clip[0].dir = 'ltr';
159
+ //based on feedback seems a good idea to force float right
160
+ this.$items.css('float','right');
161
+ }
162
+ }
163
+
164
+ //manual and loop
165
+ } else if (!this.isAuto && this.o.manualMode=='loop') {
166
+
167
+ this.posMax += this.itemMax * addItems;
168
+
169
+ this.$list.css(this.dimension,this.posMax+(this.itemMax*addItems) +'px');
170
+
171
+ this.posMax += (this.clipMax - this.o.speed);
172
+
173
+ var items_append = this.$items.slice(0,addItems).clone(true).appendTo(this.$list);
174
+ var items_prepend = this.$items.slice(-addItems).clone(true).prependTo(this.$list);
175
+
176
+ this.resetPositionForwards = this.resetPosition = addItems * this.itemMax;
177
+ this.resetPositionBackwards = this.$items.length * this.itemMax;
178
+
179
+ //extra events to force scroll direction change
180
+ var self = this;
181
+
182
+ this.$btnBack.bind(this.events.start,function() {
183
+ self.isForwards = false;
184
+ self.resetPosition = self.resetPositionBackwards;
185
+ });
186
+
187
+ this.$btnForward.bind(this.events.start,function() {
188
+ self.isForwards = true;
189
+ self.resetPosition = self.resetPositionForwards;
190
+ });
191
+
192
+ } else { //(!this.isAuto && this.o.manualMode=='end')
193
+
194
+ this.$list.css(this.dimension,this.posMax +'px');
195
+
196
+ if (this.isForwards) {
197
+ this.resetPosition = 0;
198
+
199
+ } else {
200
+ this.resetPosition = this.$items.length * this.itemMax;
201
+ //due to inconsistent RTL implementation force back to LTR then fake
202
+ if (this.isRTL) {
203
+ this.$clip[0].dir = 'ltr';
204
+ //based on feedback seems a good idea to force float right
205
+ this.$items.css('float','right');
206
+ }
207
+ }
208
+ }
209
+
210
+ this.resetPos() //ensure scroll position is reset
211
+
212
+ this.interval = null;
213
+ this.intervalDelay = Math.floor(1000 / this.o.frameRate);
214
+
215
+ if (!(!this.isAuto && this.o.manualMode=='end')) { //loop mode
216
+ //ensure that speed is divisible by item width. Helps to always make images even not odd widths!
217
+ while (this.itemMax % this.o.speed !== 0) {
218
+ this.o.speed--;
219
+ if (this.o.speed===0) {
220
+ this.o.speed=1; break;
221
+ }
222
+ }
223
+ }
224
+
225
+ var self = this;
226
+ this.trigger = null;
227
+ this.funcMoveBack = function(e) {
228
+ if (e !== undefined) {
229
+ e.preventDefault();
230
+ }
231
+ self.trigger = !self.isAuto && self.o.manualMode=='end' ? this : null;
232
+ if (self.isAuto) {
233
+ self.isForwards ? self.moveBack() : self.moveForward();
234
+ } else {
235
+ self.moveBack();
236
+ }
237
+ };
238
+ this.funcMoveForward = function(e) {
239
+ if (e !== undefined) {
240
+ e.preventDefault();
241
+ }
242
+ self.trigger = !self.isAuto && self.o.manualMode=='end' ? this : null;
243
+ if (self.isAuto) {
244
+ self.isForwards ? self.moveForward() : self.moveBack();
245
+ } else {
246
+ self.moveForward();
247
+ }
248
+ };
249
+ this.funcMovePause = function() { self.movePause(); };
250
+ this.funcMoveStop = function() { self.moveStop(); };
251
+ this.funcMoveResume = function() { self.moveResume(); };
252
+
253
+
254
+
255
+ if (this.isAuto) {
256
+
257
+ this.paused = false;
258
+
259
+ function togglePause() {
260
+ if (self.paused===false) {
261
+ self.paused=true;
262
+ self.funcMovePause();
263
+ } else {
264
+ self.paused=false;
265
+ self.funcMoveResume();
266
+ }
267
+ return self.paused;
268
+ };
269
+
270
+ //disable pauseTouch when links are present
271
+ if (this.supportsTouch && this.$items.find('a').length) {
272
+ this.supportsTouch=false;
273
+ }
274
+
275
+ if (this.isAuto && this.o.pauseOnHover && !this.supportsTouch) {
276
+ this.$clip.bind(this.events.start,this.funcMovePause).bind(this.events.end,this.funcMoveResume);
277
+ } else if (this.isAuto && this.o.pauseOnTouch && !this.o.pauseButton && this.supportsTouch) {
278
+
279
+ var touchStartPos, scrollStartPos;
280
+
281
+ this.$clip.bind(this.events.start,function(e) {
282
+ togglePause();
283
+ var touch = e.originalEvent.touches[0];
284
+ touchStartPos = self.isHorizontal ? touch.pageX : touch.pageY;
285
+ scrollStartPos = self.$clip[0]['scroll' + self.scrollPos];
286
+ e.stopPropagation();
287
+ e.preventDefault();
288
+
289
+ }).bind(this.events.move,function(e) {
290
+
291
+ e.stopPropagation();
292
+ e.preventDefault();
293
+
294
+ var touch = e.originalEvent.touches[0],
295
+ endTouchPos = self.isHorizontal ? touch.pageX : touch.pageY,
296
+ pos = (touchStartPos - endTouchPos) + scrollStartPos;
297
+
298
+ if (pos < 0) pos = 0;
299
+ else if (pos > self.posMax) pos = self.posMax;
300
+
301
+ self.$clip[0]['scroll' + self.scrollPos] = pos;
302
+
303
+ //force pause
304
+ self.funcMovePause();
305
+ self.paused = true;
306
+ });
307
+ } else {
308
+ if (this.o.pauseButton) {
309
+
310
+ this.$btnPause = $(".simply-scroll-btn-pause",this.$container)
311
+ .bind('click',function(e) {
312
+ e.preventDefault();
313
+ togglePause() ? $(this).addClass('active') : $(this).removeClass('active');
314
+ });
315
+ }
316
+ }
317
+ this.funcMoveForward();
318
+ } else {
319
+
320
+ this.$btnBack
321
+ .addClass('simply-scroll-btn' + ' ' + this.moveBackClass)
322
+ .bind(this.events.start,this.funcMoveBack).bind(this.events.end,this.funcMoveStop);
323
+ this.$btnForward
324
+ .addClass('simply-scroll-btn' + ' ' + this.moveForwardClass)
325
+ .bind(this.events.start,this.funcMoveForward).bind(this.events.end,this.funcMoveStop);
326
+
327
+ if (this.o.manualMode == 'end') {
328
+ !this.isRTL ? this.$btnBack.addClass('disabled') : this.$btnForward.addClass('disabled');
329
+ }
330
+ }
331
+ },
332
+ moveForward: function() {
333
+ var self = this;
334
+ this.movement = 'forward';
335
+ if (this.trigger !== null) {
336
+ this.$btnBack.removeClass('disabled');
337
+ }
338
+ self.interval = setInterval(function() {
339
+ if (self.$clip[0]['scroll' + self.scrollPos] < (self.posMax-self.clipMax)) {
340
+ self.$clip[0]['scroll' + self.scrollPos] += self.o.speed;
341
+ } else if (self.isLoop) {
342
+ self.resetPos();
343
+ } else {
344
+ self.moveStop(self.movement);
345
+ }
346
+ },self.intervalDelay);
347
+ },
348
+ moveBack: function() {
349
+ var self = this;
350
+ this.movement = 'back';
351
+ if (this.trigger !== null) {
352
+ this.$btnForward.removeClass('disabled');
353
+ }
354
+ self.interval = setInterval(function() {
355
+ if (self.$clip[0]['scroll' + self.scrollPos] > self.posMin) {
356
+ self.$clip[0]['scroll' + self.scrollPos] -= self.o.speed;
357
+ } else if (self.isLoop) {
358
+ self.resetPos();
359
+ } else {
360
+ self.moveStop(self.movement);
361
+ }
362
+ },self.intervalDelay);
363
+ },
364
+ movePause: function() {
365
+ clearInterval(this.interval);
366
+ },
367
+ moveStop: function(moveDir) {
368
+ this.movePause();
369
+ if (this.trigger!==null) {
370
+ if (typeof moveDir !== 'undefined') {
371
+ $(this.trigger).addClass('disabled');
372
+ }
373
+ this.trigger = null;
374
+ }
375
+ if (this.isAuto) {
376
+ if (this.o.autoMode=='bounce') {
377
+ moveDir == 'forward' ? this.moveBack() : this.moveForward();
378
+ }
379
+ }
380
+ },
381
+ moveResume: function() {
382
+ this.movement=='forward' ? this.moveForward() : this.moveBack();
383
+ },
384
+ resetPos: function() {
385
+ this.$clip[0]['scroll' + this.scrollPos] = this.resetPosition;
386
+ }
387
+ });
388
+
389
+ })(jQuery,window);
@@ -0,0 +1,27 @@
1
+ /*
2
+ * simplyScroll 2 - a scroll-tastic jQuery plugin
3
+ *
4
+ * http://logicbox.net/jquery/simplyscroll/
5
+ *
6
+ * Copyright (c) 2009-2012 Will Kelly - http://logicbox.net
7
+ *
8
+ * Dual licensed under the MIT and GPL licenses.
9
+ *
10
+ * Version: 2.0.5 Last revised: 10/05/2012
11
+ *
12
+ */
13
+ (function(c,j,i){c.fn.simplyScroll=function(a){return this.each(function(){new c.simplyScroll(this,a)})};var h={customClass:"simply-scroll",frameRate:24,speed:1,orientation:"horizontal",auto:!0,autoMode:"loop",manualMode:"end",direction:"forwards",pauseOnHover:!0,pauseOnTouch:!0,pauseButton:!1,startOnLoad:!1};c.simplyScroll=function(a,b){var g=this;this.o=c.extend({},h,b||{});this.isAuto=!1!==this.o.auto&&null!==this.o.autoMode.match(/^loop|bounce$/);this.isRTL=(this.isHorizontal=null!==this.o.orientation.match(/^horizontal|vertical$/)&&
14
+ this.o.orientation==h.orientation)&&"rtl"==c("html").attr("dir");this.isForwards=!this.isAuto||this.isAuto&&(null!==this.o.direction.match(/^forwards|backwards$/)&&this.o.direction==h.direction)&&!this.isRTL;this.isLoop=this.isAuto&&"loop"==this.o.autoMode||!this.isAuto&&"loop"==this.o.manualMode;this.events=(this.supportsTouch="createTouch"in document)?{start:"touchstart MozTouchDown",move:"touchmove MozTouchMove",end:"touchend touchcancel MozTouchRelease"}:{start:"mouseenter",end:"mouseleave"};
15
+ this.$list=c(a);var d=this.$list.children();this.$list.addClass("simply-scroll-list").wrap('<div class="simply-scroll-clip"></div>').parent().wrap('<div class="'+this.o.customClass+' simply-scroll-container"></div>');this.isAuto?this.o.pauseButton&&(this.$list.parent().parent().prepend('<div class="simply-scroll-btn simply-scroll-btn-pause"></div>'),this.o.pauseOnHover=!1):this.$list.parent().parent().prepend('<div class="simply-scroll-forward"></div>').prepend('<div class="simply-scroll-back"></div>');
16
+ if(1<d.length){var f=!1,e=0;this.isHorizontal?(d.each(function(){e=e+c(this).outerWidth(true)}),f=d.eq(0).outerWidth(!0)*d.length!==e):(d.each(function(){e=e+c(this).outerHeight(true)}),f=d.eq(0).outerHeight(!0)*d.length!==e);f&&(this.$list=this.$list.wrap("<div></div>").parent().addClass("simply-scroll-list"),this.isHorizontal?this.$list.children().css({"float":"left",width:e+"px"}):this.$list.children().css({height:e+"px"}))}this.o.startOnLoad?c(j).load(function(){g.init()}):this.init()};c.simplyScroll.fn=
17
+ c.simplyScroll.prototype={};c.simplyScroll.fn.extend=c.simplyScroll.extend=c.extend;c.simplyScroll.fn.extend({init:function(){this.$items=this.$list.children();this.$clip=this.$list.parent();this.$container=this.$clip.parent();this.$btnBack=c(".simply-scroll-back",this.$container);this.$btnForward=c(".simply-scroll-forward",this.$container);this.isHorizontal?(this.itemMax=this.$items.eq(0).outerWidth(!0),this.clipMax=this.$clip.width(),this.dimension="width",this.moveBackClass="simply-scroll-btn-left",
18
+ this.moveForwardClass="simply-scroll-btn-right",this.scrollPos="Left"):(this.itemMax=this.$items.eq(0).outerHeight(!0),this.clipMax=this.$clip.height(),this.dimension="height",this.moveBackClass="simply-scroll-btn-up",this.moveForwardClass="simply-scroll-btn-down",this.scrollPos="Top");this.posMin=0;this.posMax=this.$items.length*this.itemMax;var a=Math.ceil(this.clipMax/this.itemMax);if(this.isAuto&&"loop"==this.o.autoMode)this.$list.css(this.dimension,this.posMax+this.itemMax*a+"px"),this.posMax+=
19
+ this.clipMax-this.o.speed,this.isForwards?(this.$items.slice(0,a).clone(!0).appendTo(this.$list),this.resetPosition=0):(this.$items.slice(-a).clone(!0).prependTo(this.$list),this.resetPosition=this.$items.length*this.itemMax,this.isRTL&&(this.$clip[0].dir="ltr",this.$items.css("float","right")));else if(!this.isAuto&&"loop"==this.o.manualMode){this.posMax+=this.itemMax*a;this.$list.css(this.dimension,this.posMax+this.itemMax*a+"px");this.posMax+=this.clipMax-this.o.speed;this.$items.slice(0,a).clone(!0).appendTo(this.$list);
20
+ this.$items.slice(-a).clone(!0).prependTo(this.$list);this.resetPositionForwards=this.resetPosition=a*this.itemMax;this.resetPositionBackwards=this.$items.length*this.itemMax;var b=this;this.$btnBack.bind(this.events.start,function(){b.isForwards=false;b.resetPosition=b.resetPositionBackwards});this.$btnForward.bind(this.events.start,function(){b.isForwards=true;b.resetPosition=b.resetPositionForwards})}else this.$list.css(this.dimension,this.posMax+"px"),this.isForwards?this.resetPosition=0:(this.resetPosition=
21
+ this.$items.length*this.itemMax,this.isRTL&&(this.$clip[0].dir="ltr",this.$items.css("float","right")));this.resetPos();this.interval=null;this.intervalDelay=Math.floor(1E3/this.o.frameRate);if(this.isAuto||"end"!=this.o.manualMode)for(;0!==this.itemMax%this.o.speed;)if(this.o.speed--,0===this.o.speed){this.o.speed=1;break}b=this;this.trigger=null;this.funcMoveBack=function(a){a!==i&&a.preventDefault();b.trigger=!b.isAuto&&b.o.manualMode=="end"?this:null;b.isAuto?b.isForwards?b.moveBack():b.moveForward():
22
+ b.moveBack()};this.funcMoveForward=function(a){a!==i&&a.preventDefault();b.trigger=!b.isAuto&&b.o.manualMode=="end"?this:null;b.isAuto?b.isForwards?b.moveForward():b.moveBack():b.moveForward()};this.funcMovePause=function(){b.movePause()};this.funcMoveStop=function(){b.moveStop()};this.funcMoveResume=function(){b.moveResume()};if(this.isAuto){this.paused=!1;var g=function(){if(b.paused===false){b.paused=true;b.funcMovePause()}else{b.paused=false;b.funcMoveResume()}return b.paused};this.supportsTouch&&
23
+ this.$items.find("a").length&&(this.supportsTouch=!1);if(this.isAuto&&this.o.pauseOnHover&&!this.supportsTouch)this.$clip.bind(this.events.start,this.funcMovePause).bind(this.events.end,this.funcMoveResume);else if(this.isAuto&&this.o.pauseOnTouch&&!this.o.pauseButton&&this.supportsTouch){var d,f;this.$clip.bind(this.events.start,function(a){g();var c=a.originalEvent.touches[0];d=b.isHorizontal?c.pageX:c.pageY;f=b.$clip[0]["scroll"+b.scrollPos];a.stopPropagation();a.preventDefault()}).bind(this.events.move,
24
+ function(a){a.stopPropagation();a.preventDefault();a=a.originalEvent.touches[0];a=d-(b.isHorizontal?a.pageX:a.pageY)+f;if(a<0)a=0;else if(a>b.posMax)a=b.posMax;b.$clip[0]["scroll"+b.scrollPos]=a;b.funcMovePause();b.paused=true})}else this.o.pauseButton&&(this.$btnPause=c(".simply-scroll-btn-pause",this.$container).bind("click",function(a){a.preventDefault();g()?c(this).addClass("active"):c(this).removeClass("active")}));this.funcMoveForward()}else this.$btnBack.addClass("simply-scroll-btn "+this.moveBackClass).bind(this.events.start,
25
+ this.funcMoveBack).bind(this.events.end,this.funcMoveStop),this.$btnForward.addClass("simply-scroll-btn "+this.moveForwardClass).bind(this.events.start,this.funcMoveForward).bind(this.events.end,this.funcMoveStop),"end"==this.o.manualMode&&(!this.isRTL?this.$btnBack.addClass("disabled"):this.$btnForward.addClass("disabled"))},moveForward:function(){var a=this;this.movement="forward";null!==this.trigger&&this.$btnBack.removeClass("disabled");a.interval=setInterval(function(){a.$clip[0]["scroll"+a.scrollPos]<
26
+ a.posMax-a.clipMax?a.$clip[0]["scroll"+a.scrollPos]+=a.o.speed:a.isLoop?a.resetPos():a.moveStop(a.movement)},a.intervalDelay)},moveBack:function(){var a=this;this.movement="back";null!==this.trigger&&this.$btnForward.removeClass("disabled");a.interval=setInterval(function(){a.$clip[0]["scroll"+a.scrollPos]>a.posMin?a.$clip[0]["scroll"+a.scrollPos]-=a.o.speed:a.isLoop?a.resetPos():a.moveStop(a.movement)},a.intervalDelay)},movePause:function(){clearInterval(this.interval)},moveStop:function(a){this.movePause();
27
+ null!==this.trigger&&("undefined"!==typeof a&&c(this.trigger).addClass("disabled"),this.trigger=null);this.isAuto&&"bounce"==this.o.autoMode&&("forward"==a?this.moveBack():this.moveForward())},moveResume:function(){"forward"==this.movement?this.moveForward():this.moveBack()},resetPos:function(){this.$clip[0]["scroll"+this.scrollPos]=this.resetPosition}})})(jQuery,window);
@@ -0,0 +1,217 @@
1
+ /*
2
+ * simplyScroll 2 - a scroll-tastic jQuery plugin
3
+ *
4
+ * http://logicbox.net/jquery/simplyscroll
5
+ *
6
+ * Copyright (c) 2009-2012 Will Kelly - http://logicbox.net
7
+ *
8
+ * Dual licensed under the MIT and GPL licenses.
9
+ *
10
+ * Last revised: 31/01/2012
11
+ *
12
+ */
13
+
14
+ /* Default/Master classes
15
+
16
+ Example markup format (for horizontal scroller)
17
+ Note all DIVs are generated and should not be hard-coded
18
+
19
+ <div class="your-custom-class simply-scroll-container">
20
+ <div class="simply-scroll-btn simply-scroll-btn-left"></div>
21
+ <div class="simply-scroll-btn simply-scroll-btn-right"></div>
22
+ <div class="simply-scroll-clip">
23
+ <ul class="simply-scroll-list">
24
+ <li>...</li>
25
+ ...
26
+ </ul>
27
+ </div>
28
+ </div>
29
+
30
+
31
+ */
32
+
33
+ .simply-scroll-container { /* Container DIV - automatically generated */
34
+ position: relative;
35
+ }
36
+
37
+ .simply-scroll-clip { /* Clip DIV - automatically generated */
38
+ position: relative;
39
+ overflow: hidden;
40
+ }
41
+
42
+ .simply-scroll-list { /* UL/OL/DIV - the element that simplyScroll is inited on */
43
+ overflow: hidden;
44
+ margin: 0;
45
+ padding: 0;
46
+ list-style: none;
47
+ }
48
+
49
+ .simply-scroll-list li {
50
+ padding: 0;
51
+ margin: 0;
52
+ list-style: none;
53
+ }
54
+
55
+ .simply-scroll-list li img {
56
+ border: none;
57
+ display: block;
58
+ }
59
+
60
+ .simply-scroll-btn {
61
+ position: absolute;
62
+ background-image: url(../images/buttons.png);
63
+ width: 42px;
64
+ height: 44px;
65
+ z-index:3;
66
+ cursor: pointer;
67
+ }
68
+
69
+ .simply-scroll-btn-left {
70
+ left: 6px;
71
+ bottom: 6px;
72
+ background-position: 0 -44px;
73
+ }
74
+ .simply-scroll-btn-left.disabled {
75
+ background-position: 0 0 !important;
76
+ }
77
+ .simply-scroll-btn-left:hover, .simply-scroll-btn-left:focus {
78
+ background-position: 0 -88px;
79
+ }
80
+
81
+ .simply-scroll-btn-right {
82
+ right: 6px;
83
+ bottom: 6px;
84
+ background-position: -84px -44px;
85
+ }
86
+ .simply-scroll-btn-right.disabled {
87
+ background-position: -84px 0 !important;
88
+ }
89
+ .simply-scroll-btn-right:hover, .simply-scroll-btn-right:focus {
90
+ background-position: -84px -88px;
91
+ }
92
+
93
+ .simply-scroll-btn-up {
94
+ right: 6px;
95
+ top: 6px;
96
+ background-position: -126px -44px;
97
+ }
98
+ .simply-scroll-btn-up.disabled {
99
+ background-position: -126px 0 !important;
100
+ }
101
+ .simply-scroll-btn-up:hover, .simply-scroll-btn-up:focus {
102
+ background-position: -126px -88px;
103
+ }
104
+
105
+ .simply-scroll-btn-down {
106
+ right: 6px;
107
+ bottom: 6px;
108
+ background-position: -42px -44px;
109
+ }
110
+ .simply-scroll-btn-down.disabled {
111
+ background-position: -42px 0 !important;
112
+ }
113
+ .simply-scroll-btn-down:hover, .simply-scroll-btn-down:focus {
114
+ background-position: -42px -88px;
115
+ }
116
+
117
+ .simply-scroll-btn-pause {
118
+ right: 6px;
119
+ bottom: 6px;
120
+ background-position: -168px -44px;
121
+ }
122
+ .simply-scroll-btn-pause:hover, .simply-scroll-btn-pause:focus {
123
+ background-position: -168px -88px;
124
+ }
125
+
126
+ .simply-scroll-btn-pause.active {
127
+ background-position: -84px -44px;
128
+ }
129
+ .simply-scroll-btn-pause.active:hover, .simply-scroll-btn-pause.active:focus {
130
+ background-position: -84px -88px;
131
+ }
132
+
133
+ /* Custom class modifications - override classees
134
+
135
+ .simply-scroll is default
136
+
137
+ */
138
+
139
+ .simply-scroll { /* Customisable base class for style override DIV */
140
+ width: 576px;
141
+ height: 200px;
142
+ margin-bottom: 1em;
143
+ }
144
+
145
+ .simply-scroll .simply-scroll-clip {
146
+ width: 576px;
147
+ height: 200px;
148
+ }
149
+
150
+ .simply-scroll .simply-scroll-list {}
151
+
152
+ .simply-scroll .simply-scroll-list li {
153
+ float: left;
154
+ width: 290px;
155
+ height: 200px;
156
+ }
157
+ .simply-scroll .simply-scroll-list li img {}
158
+
159
+ .simply-scroll .simply-scroll-btn {}
160
+
161
+ .simply-scroll .simply-scroll-btn-left {}
162
+ .simply-scroll .simply-scroll-btn-left.disabled {}
163
+ .simply-scroll .simply-scroll-btn-left:hover {}
164
+
165
+ .simply-scroll .simply-scroll-btn-right {}
166
+ .simply-scroll .simply-scroll-btn-right.disabled {}
167
+ .simply-scroll .simply-scroll-btn-right:hover {}
168
+
169
+ .simply-scroll .simply-scroll-btn-up {}
170
+ .simply-scroll .simply-scroll-btn-up.disabled {}
171
+ .simply-scroll .simply-scroll-btn-up:hover {}
172
+
173
+ .simply-scroll .simply-scroll-btn-down {}
174
+ .simply-scroll .simply-scroll-btn-down.disabled {}
175
+ .simply-scroll .simply-scroll-btn-down:hover {}
176
+
177
+
178
+
179
+ /* Vertical scroller example */
180
+
181
+ .vert { /* wider than clip to position buttons to side */
182
+ width: 340px;
183
+ height: 400px;
184
+ margin-bottom: 1.5em;
185
+ }
186
+
187
+ .vert .simply-scroll-clip {
188
+ width: 290px;
189
+ height: 400px;
190
+ }
191
+
192
+ .vert .simply-scroll-list {}
193
+
194
+ .vert .simply-scroll-list li {
195
+ width: 290px;
196
+ height: 200px;
197
+ }
198
+ .vert .simply-scroll-list li img {}
199
+
200
+ .vert .simply-scroll-btn {}
201
+
202
+ .vert .simply-scroll-btn-up { /* modified btn pos */
203
+ right: 0;
204
+ top: 0;
205
+ }
206
+ .vert .simply-scroll-btn-up.disabled {}
207
+ .vert .simply-scroll-btn-up:hover {}
208
+
209
+ .vert .simply-scroll-btn-down { /* modified btn pos */
210
+ right: 0;
211
+ top: 52px;
212
+ }
213
+ .vert .simply-scroll-btn-down.disabled {}
214
+ .vert .simply-scroll-btn-down:hover {}
215
+
216
+ /* NOTE left-right classes wouldn't be needed on vertical scroller */
217
+
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: simplyscroll-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - TwoWeb
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2015-01-31 00:00:00 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ prerelease: false
17
+ requirement: &id001 !ruby/object:Gem::Requirement
18
+ requirements:
19
+ - &id002
20
+ - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: "0"
23
+ type: :runtime
24
+ version_requirements: *id001
25
+ description: gem simplyscroll for rails
26
+ email:
27
+ - dev@twoweb.com.br
28
+ executables: []
29
+
30
+ extensions: []
31
+
32
+ extra_rdoc_files: []
33
+
34
+ files:
35
+ - lib/simplyscroll-rails.rb
36
+ - lib/simplyscroll-rails/version.rb
37
+ - vendor/assets/images/buttons.png
38
+ - vendor/assets/images/bg_play_pause.png
39
+ - vendor/assets/images/bg_direction_nav.png
40
+ - vendor/assets/javascripts/jquery.simplyscroll.min.js
41
+ - vendor/assets/javascripts/jquery.simplyscroll.js
42
+ - vendor/assets/stylesheets/simplyscroll.css
43
+ - vendor/assets/fonts/flexslider-icon.woff
44
+ - vendor/assets/fonts/flexslider-icon.ttf
45
+ - vendor/assets/fonts/flexslider-icon.svg
46
+ - vendor/assets/fonts/flexslider-icon.eot
47
+ - LICENSE
48
+ - README.md
49
+ homepage: https://github.com/twoweb/simplyscroll-rails
50
+ licenses: []
51
+
52
+ metadata: {}
53
+
54
+ post_install_message:
55
+ rdoc_options: []
56
+
57
+ require_paths:
58
+ - lib
59
+ required_ruby_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - *id002
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - *id002
65
+ requirements: []
66
+
67
+ rubyforge_project:
68
+ rubygems_version: 2.0.14
69
+ signing_key:
70
+ specification_version: 4
71
+ summary: gem simplyscroll
72
+ test_files: []
73
+