slidesjs-rails 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.
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in slidesjs-rails.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Daniel Libanori
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.
@@ -0,0 +1,29 @@
1
+ # Slidesjs::Rails
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'slidesjs-rails'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install slidesjs-rails
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,7 @@
1
+ require "slidesjs/rails/version"
2
+ require "slidesjs/rails/engine"
3
+
4
+ module Slidesjs
5
+ module Rails
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ module Jquery
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,5 @@
1
+ module Slidesjs
2
+ module Rails
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'slidesjs/rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "slidesjs-rails"
8
+ spec.version = Slidesjs::Rails::VERSION
9
+ spec.authors = ["Daniel Libanori"]
10
+ spec.email = ["daniellibanori@gmail.com"]
11
+ spec.description = "Slidesjs assets for Rails 3.1"
12
+ spec.summary = "Slidesjs assets for Rails 3.1"
13
+ spec.homepage = "https://github.com/dlibanori/slidesjs-rails"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
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.3"
22
+ spec.add_development_dependency "rake"
23
+ spec.add_dependency "railties", "~> 3.1"
24
+ end
@@ -0,0 +1,624 @@
1
+ /*
2
+ SlidesJS 3.0.3
3
+
4
+ Documentation and examples http://slidesjs.com
5
+ Support forum http://groups.google.com/group/slidesjs
6
+ Created by Nathan Searles http://nathansearles.com
7
+
8
+ Version: 3.0.3
9
+ Updated: March 15th, 2013
10
+
11
+ SlidesJS is an open source project, contribute at GitHub:
12
+ https://github.com/nathansearles/Slides
13
+
14
+ (c) 2013 by Nathan Searles
15
+
16
+ Licensed under the Apache License, Version 2.0 (the "License");
17
+ you may not use this file except in compliance with the License.
18
+ You may obtain a copy of the License at
19
+
20
+ http://www.apache.org/licenses/LICENSE-2.0
21
+
22
+ Unless required by applicable law or agreed to in writing, software
23
+ distributed under the License is distributed on an "AS IS" BASIS,
24
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25
+ See the License for the specific language governing permissions and
26
+ limitations under the License.
27
+ */
28
+ (function() {
29
+
30
+ (function($, window, document) {
31
+ var Plugin, defaults, pluginName;
32
+ pluginName = "slidesjs";
33
+ defaults = {
34
+ width: 940,
35
+ height: 528,
36
+ start: 1,
37
+ navigation: {
38
+ active: true,
39
+ effect: "slide"
40
+ },
41
+ pagination: {
42
+ active: true,
43
+ effect: "slide"
44
+ },
45
+ play: {
46
+ active: false,
47
+ effect: "slide",
48
+ interval: 5000,
49
+ auto: false,
50
+ swap: true,
51
+ pauseOnHover: false,
52
+ restartDelay: 2500
53
+ },
54
+ effect: {
55
+ slide: {
56
+ speed: 500
57
+ },
58
+ fade: {
59
+ speed: 300,
60
+ crossfade: true
61
+ }
62
+ },
63
+ callback: {
64
+ loaded: function() {},
65
+ start: function() {},
66
+ complete: function() {}
67
+ }
68
+ };
69
+ Plugin = (function() {
70
+
71
+ function Plugin(element, options) {
72
+ this.element = element;
73
+ this.options = $.extend(true, {}, defaults, options);
74
+ this._defaults = defaults;
75
+ this._name = pluginName;
76
+ this.init();
77
+ }
78
+
79
+ return Plugin;
80
+
81
+ })();
82
+ Plugin.prototype.init = function() {
83
+ var $element, nextButton, pagination, playButton, prevButton, stopButton,
84
+ _this = this;
85
+ $element = $(this.element);
86
+ this.data = $.data(this);
87
+ $.data(this, "animating", false);
88
+ $.data(this, "total", $element.children().not(".slidesjs-navigation", $element).length);
89
+ $.data(this, "current", this.options.start - 1);
90
+ $.data(this, "vendorPrefix", this._getVendorPrefix());
91
+ if (typeof TouchEvent !== "undefined") {
92
+ $.data(this, "touch", true);
93
+ this.options.effect.slide.speed = this.options.effect.slide.speed / 2;
94
+ }
95
+ $element.css({
96
+ overflow: "hidden"
97
+ });
98
+ $element.slidesContainer = $element.children().not(".slidesjs-navigation", $element).wrapAll("<div class='slidesjs-container'>", $element).parent().css({
99
+ overflow: "hidden",
100
+ position: "relative"
101
+ });
102
+ $(".slidesjs-container", $element).wrapInner("<div class='slidesjs-control'>", $element).children();
103
+ $(".slidesjs-control", $element).css({
104
+ position: "relative",
105
+ left: 0
106
+ });
107
+ $(".slidesjs-control", $element).children().addClass("slidesjs-slide").css({
108
+ position: "absolute",
109
+ top: 0,
110
+ left: 0,
111
+ width: "100%",
112
+ zIndex: 0,
113
+ display: "none",
114
+ webkitBackfaceVisibility: "hidden"
115
+ });
116
+ $.each($(".slidesjs-control", $element).children(), function(i) {
117
+ var $slide;
118
+ $slide = $(this);
119
+ return $slide.attr("slidesjs-index", i);
120
+ });
121
+ if (this.data.touch) {
122
+ $(".slidesjs-control", $element).on("touchstart", function(e) {
123
+ return _this._touchstart(e);
124
+ });
125
+ $(".slidesjs-control", $element).on("touchmove", function(e) {
126
+ return _this._touchmove(e);
127
+ });
128
+ $(".slidesjs-control", $element).on("touchend", function(e) {
129
+ return _this._touchend(e);
130
+ });
131
+ }
132
+ $element.fadeIn(0);
133
+ this.update();
134
+ if (this.data.touch) {
135
+ this._setuptouch();
136
+ }
137
+ $(".slidesjs-control", $element).children(":eq(" + this.data.current + ")").eq(0).fadeIn(0, function() {
138
+ return $(this).css({
139
+ zIndex: 10
140
+ });
141
+ });
142
+ if (this.options.navigation.active) {
143
+ prevButton = $("<a>", {
144
+ "class": "slidesjs-previous slidesjs-navigation",
145
+ href: "#",
146
+ title: "Previous",
147
+ text: "Previous"
148
+ }).appendTo($element);
149
+ nextButton = $("<a>", {
150
+ "class": "slidesjs-next slidesjs-navigation",
151
+ href: "#",
152
+ title: "Next",
153
+ text: "Next"
154
+ }).appendTo($element);
155
+ }
156
+ $(".slidesjs-next", $element).click(function(e) {
157
+ e.preventDefault();
158
+ _this.stop(true);
159
+ return _this.next(_this.options.navigation.effect);
160
+ });
161
+ $(".slidesjs-previous", $element).click(function(e) {
162
+ e.preventDefault();
163
+ _this.stop(true);
164
+ return _this.previous(_this.options.navigation.effect);
165
+ });
166
+ if (this.options.play.active) {
167
+ playButton = $("<a>", {
168
+ "class": "slidesjs-play slidesjs-navigation",
169
+ href: "#",
170
+ title: "Play",
171
+ text: "Play"
172
+ }).appendTo($element);
173
+ stopButton = $("<a>", {
174
+ "class": "slidesjs-stop slidesjs-navigation",
175
+ href: "#",
176
+ title: "Stop",
177
+ text: "Stop"
178
+ }).appendTo($element);
179
+ playButton.click(function(e) {
180
+ e.preventDefault();
181
+ return _this.play(true);
182
+ });
183
+ stopButton.click(function(e) {
184
+ e.preventDefault();
185
+ return _this.stop(true);
186
+ });
187
+ if (this.options.play.swap) {
188
+ stopButton.css({
189
+ display: "none"
190
+ });
191
+ }
192
+ }
193
+ if (this.options.pagination.active) {
194
+ pagination = $("<ul>", {
195
+ "class": "slidesjs-pagination"
196
+ }).appendTo($element);
197
+ $.each(new Array(this.data.total), function(i) {
198
+ var paginationItem, paginationLink;
199
+ paginationItem = $("<li>", {
200
+ "class": "slidesjs-pagination-item"
201
+ }).appendTo(pagination);
202
+ paginationLink = $("<a>", {
203
+ href: "#",
204
+ "data-slidesjs-item": i,
205
+ html: i + 1
206
+ }).appendTo(paginationItem);
207
+ return paginationLink.click(function(e) {
208
+ e.preventDefault();
209
+ _this.stop(true);
210
+ return _this.goto(($(e.currentTarget).attr("data-slidesjs-item") * 1) + 1);
211
+ });
212
+ });
213
+ }
214
+ $(window).bind("resize", function() {
215
+ return _this.update();
216
+ });
217
+ this._setActive();
218
+ if (this.options.play.auto) {
219
+ this.play();
220
+ }
221
+ return this.options.callback.loaded(this.options.start);
222
+ };
223
+ Plugin.prototype._setActive = function(number) {
224
+ var $element, current;
225
+ $element = $(this.element);
226
+ this.data = $.data(this);
227
+ current = number > -1 ? number : this.data.current;
228
+ $(".active", $element).removeClass("active");
229
+ return $("li:eq(" + current + ") a", $element).addClass("active");
230
+ };
231
+ Plugin.prototype.update = function() {
232
+ var $element, height, width;
233
+ $element = $(this.element);
234
+ this.data = $.data(this);
235
+ $(".slidesjs-control", $element).children(":not(:eq(" + this.data.current + "))").css({
236
+ display: "none",
237
+ left: 0,
238
+ zIndex: 0
239
+ });
240
+ width = $element.width();
241
+ height = (this.options.height / this.options.width) * width;
242
+ this.options.width = width;
243
+ this.options.height = height;
244
+ return $(".slidesjs-control, .slidesjs-container", $element).css({
245
+ width: width,
246
+ height: height
247
+ });
248
+ };
249
+ Plugin.prototype.next = function(effect) {
250
+ var $element;
251
+ $element = $(this.element);
252
+ this.data = $.data(this);
253
+ $.data(this, "direction", "next");
254
+ if (effect === void 0) {
255
+ effect = this.options.navigation.effect;
256
+ }
257
+ if (effect === "fade") {
258
+ return this._fade();
259
+ } else {
260
+ return this._slide();
261
+ }
262
+ };
263
+ Plugin.prototype.previous = function(effect) {
264
+ var $element;
265
+ $element = $(this.element);
266
+ this.data = $.data(this);
267
+ $.data(this, "direction", "previous");
268
+ if (effect === void 0) {
269
+ effect = this.options.navigation.effect;
270
+ }
271
+ if (effect === "fade") {
272
+ return this._fade();
273
+ } else {
274
+ return this._slide();
275
+ }
276
+ };
277
+ Plugin.prototype.goto = function(number) {
278
+ var $element, effect;
279
+ $element = $(this.element);
280
+ this.data = $.data(this);
281
+ if (effect === void 0) {
282
+ effect = this.options.pagination.effect;
283
+ }
284
+ if (number > this.data.total) {
285
+ number = this.data.total;
286
+ } else if (number < 1) {
287
+ number = 1;
288
+ }
289
+ if (typeof number === "number") {
290
+ if (effect === "fade") {
291
+ return this._fade(number);
292
+ } else {
293
+ return this._slide(number);
294
+ }
295
+ } else if (typeof number === "string") {
296
+ if (number === "first") {
297
+ if (effect === "fade") {
298
+ return this._fade(0);
299
+ } else {
300
+ return this._slide(0);
301
+ }
302
+ } else if (number === "last") {
303
+ if (effect === "fade") {
304
+ return this._fade(this.data.total);
305
+ } else {
306
+ return this._slide(this.data.total);
307
+ }
308
+ }
309
+ }
310
+ };
311
+ Plugin.prototype._setuptouch = function() {
312
+ var $element, next, previous, slidesControl;
313
+ $element = $(this.element);
314
+ this.data = $.data(this);
315
+ slidesControl = $(".slidesjs-control", $element);
316
+ next = this.data.current + 1;
317
+ previous = this.data.current - 1;
318
+ if (previous < 0) {
319
+ previous = this.data.total - 1;
320
+ }
321
+ if (next > this.data.total - 1) {
322
+ next = 0;
323
+ }
324
+ slidesControl.children(":eq(" + next + ")").css({
325
+ display: "block",
326
+ left: this.options.width
327
+ });
328
+ return slidesControl.children(":eq(" + previous + ")").css({
329
+ display: "block",
330
+ left: -this.options.width
331
+ });
332
+ };
333
+ Plugin.prototype._touchstart = function(e) {
334
+ var $element, touches;
335
+ $element = $(this.element);
336
+ this.data = $.data(this);
337
+ touches = e.originalEvent.touches[0];
338
+ this._setuptouch();
339
+ $.data(this, "touchtimer", Number(new Date()));
340
+ $.data(this, "touchstartx", touches.pageX);
341
+ $.data(this, "touchstarty", touches.pageY);
342
+ return e.stopPropagation();
343
+ };
344
+ Plugin.prototype._touchend = function(e) {
345
+ var $element, duration, prefix, slidesControl, timing, touches, transform,
346
+ _this = this;
347
+ $element = $(this.element);
348
+ this.data = $.data(this);
349
+ touches = e.originalEvent.touches[0];
350
+ slidesControl = $(".slidesjs-control", $element);
351
+ if (slidesControl.position().left > this.options.width * 0.5 || slidesControl.position().left > this.options.width * 0.1 && (Number(new Date()) - this.data.touchtimer < 250)) {
352
+ $.data(this, "direction", "previous");
353
+ this._slide();
354
+ } else if (slidesControl.position().left < -(this.options.width * 0.5) || slidesControl.position().left < -(this.options.width * 0.1) && (Number(new Date()) - this.data.touchtimer < 250)) {
355
+ $.data(this, "direction", "next");
356
+ this._slide();
357
+ } else {
358
+ prefix = this.data.vendorPrefix;
359
+ transform = prefix + "Transform";
360
+ duration = prefix + "TransitionDuration";
361
+ timing = prefix + "TransitionTimingFunction";
362
+ slidesControl[0].style[transform] = "translateX(0px)";
363
+ slidesControl[0].style[duration] = this.options.effect.slide.speed * 0.85 + "ms";
364
+ }
365
+ slidesControl.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd", function() {
366
+ prefix = _this.data.vendorPrefix;
367
+ transform = prefix + "Transform";
368
+ duration = prefix + "TransitionDuration";
369
+ timing = prefix + "TransitionTimingFunction";
370
+ slidesControl[0].style[transform] = "";
371
+ slidesControl[0].style[duration] = "";
372
+ return slidesControl[0].style[timing] = "";
373
+ });
374
+ return e.stopPropagation();
375
+ };
376
+ Plugin.prototype._touchmove = function(e) {
377
+ var $element, prefix, slidesControl, touches, transform;
378
+ $element = $(this.element);
379
+ this.data = $.data(this);
380
+ touches = e.originalEvent.touches[0];
381
+ prefix = this.data.vendorPrefix;
382
+ slidesControl = $(".slidesjs-control", $element);
383
+ transform = prefix + "Transform";
384
+ $.data(this, "scrolling", Math.abs(touches.pageX - this.data.touchstartx) < Math.abs(touches.pageY - this.data.touchstarty));
385
+ if (!this.data.animating && !this.data.scrolling) {
386
+ e.preventDefault();
387
+ this._setuptouch();
388
+ slidesControl[0].style[transform] = "translateX(" + (touches.pageX - this.data.touchstartx) + "px)";
389
+ }
390
+ return e.stopPropagation();
391
+ };
392
+ Plugin.prototype.play = function(next) {
393
+ var $element, currentSlide, slidesContainer,
394
+ _this = this;
395
+ $element = $(this.element);
396
+ this.data = $.data(this);
397
+ if (!this.data.playInterval) {
398
+ if (next) {
399
+ currentSlide = this.data.current;
400
+ this.data.direction = "next";
401
+ if (this.options.play.effect === "fade") {
402
+ this._fade();
403
+ } else {
404
+ this._slide();
405
+ }
406
+ }
407
+ $.data(this, "playInterval", setInterval((function() {
408
+ currentSlide = _this.data.current;
409
+ _this.data.direction = "next";
410
+ if (_this.options.play.effect === "fade") {
411
+ return _this._fade();
412
+ } else {
413
+ return _this._slide();
414
+ }
415
+ }), this.options.play.interval));
416
+ slidesContainer = $(".slidesjs-container", $element);
417
+ if (this.options.play.pauseOnHover) {
418
+ slidesContainer.unbind();
419
+ slidesContainer.bind("mouseenter", function() {
420
+ return _this.stop();
421
+ });
422
+ slidesContainer.bind("mouseleave", function() {
423
+ if (_this.options.play.restartDelay) {
424
+ return $.data(_this, "restartDelay", setTimeout((function() {
425
+ return _this.play(true);
426
+ }), _this.options.play.restartDelay));
427
+ } else {
428
+ return _this.play();
429
+ }
430
+ });
431
+ }
432
+ $.data(this, "playing", true);
433
+ $(".slidesjs-play", $element).addClass("slidesjs-playing");
434
+ if (this.options.play.swap) {
435
+ $(".slidesjs-play", $element).hide();
436
+ return $(".slidesjs-stop", $element).show();
437
+ }
438
+ }
439
+ };
440
+ Plugin.prototype.stop = function(clicked) {
441
+ var $element;
442
+ $element = $(this.element);
443
+ this.data = $.data(this);
444
+ clearInterval(this.data.playInterval);
445
+ if (this.options.play.pauseOnHover && clicked) {
446
+ $(".slidesjs-container", $element).unbind();
447
+ }
448
+ $.data(this, "playInterval", null);
449
+ $.data(this, "playing", false);
450
+ $(".slidesjs-play", $element).removeClass("slidesjs-playing");
451
+ if (this.options.play.swap) {
452
+ $(".slidesjs-stop", $element).hide();
453
+ return $(".slidesjs-play", $element).show();
454
+ }
455
+ };
456
+ Plugin.prototype._slide = function(number) {
457
+ var $element, currentSlide, direction, duration, next, prefix, slidesControl, timing, transform, value,
458
+ _this = this;
459
+ $element = $(this.element);
460
+ this.data = $.data(this);
461
+ if (!this.data.animating && number !== this.data.current + 1) {
462
+ $.data(this, "animating", true);
463
+ currentSlide = this.data.current;
464
+ if (number > -1) {
465
+ number = number - 1;
466
+ value = number > currentSlide ? 1 : -1;
467
+ direction = number > currentSlide ? -this.options.width : this.options.width;
468
+ next = number;
469
+ } else {
470
+ value = this.data.direction === "next" ? 1 : -1;
471
+ direction = this.data.direction === "next" ? -this.options.width : this.options.width;
472
+ next = currentSlide + value;
473
+ }
474
+ if (next === -1) {
475
+ next = this.data.total - 1;
476
+ }
477
+ if (next === this.data.total) {
478
+ next = 0;
479
+ }
480
+ this._setActive(next);
481
+ slidesControl = $(".slidesjs-control", $element);
482
+ if (number > -1) {
483
+ slidesControl.children(":not(:eq(" + currentSlide + "))").css({
484
+ display: "none",
485
+ left: 0,
486
+ zIndex: 0
487
+ });
488
+ }
489
+ slidesControl.children(":eq(" + next + ")").css({
490
+ display: "block",
491
+ left: value * this.options.width,
492
+ zIndex: 10
493
+ });
494
+ this.options.callback.start(currentSlide + 1);
495
+ if (this.data.vendorPrefix) {
496
+ prefix = this.data.vendorPrefix;
497
+ transform = prefix + "Transform";
498
+ duration = prefix + "TransitionDuration";
499
+ timing = prefix + "TransitionTimingFunction";
500
+ slidesControl[0].style[transform] = "translateX(" + direction + "px)";
501
+ slidesControl[0].style[duration] = this.options.effect.slide.speed + "ms";
502
+ return slidesControl.on("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd", function() {
503
+ slidesControl[0].style[transform] = "";
504
+ slidesControl[0].style[duration] = "";
505
+ slidesControl.children(":eq(" + next + ")").css({
506
+ left: 0
507
+ });
508
+ slidesControl.children(":eq(" + currentSlide + ")").css({
509
+ display: "none",
510
+ left: 0,
511
+ zIndex: 0
512
+ });
513
+ $.data(_this, "current", next);
514
+ $.data(_this, "animating", false);
515
+ slidesControl.unbind("transitionend webkitTransitionEnd oTransitionEnd otransitionend MSTransitionEnd");
516
+ slidesControl.children(":not(:eq(" + next + "))").css({
517
+ display: "none",
518
+ left: 0,
519
+ zIndex: 0
520
+ });
521
+ if (_this.data.touch) {
522
+ _this._setuptouch();
523
+ }
524
+ return _this.options.callback.complete(next + 1);
525
+ });
526
+ } else {
527
+ return slidesControl.stop().animate({
528
+ left: direction
529
+ }, this.options.effect.slide.speed, (function() {
530
+ slidesControl.css({
531
+ left: 0
532
+ });
533
+ slidesControl.children(":eq(" + next + ")").css({
534
+ left: 0
535
+ });
536
+ return slidesControl.children(":eq(" + currentSlide + ")").css({
537
+ display: "none",
538
+ left: 0,
539
+ zIndex: 0
540
+ }, $.data(_this, "current", next), $.data(_this, "animating", false), _this.options.callback.complete(next + 1));
541
+ }));
542
+ }
543
+ }
544
+ };
545
+ Plugin.prototype._fade = function(number) {
546
+ var $element, currentSlide, next, slidesControl, value,
547
+ _this = this;
548
+ $element = $(this.element);
549
+ this.data = $.data(this);
550
+ if (!this.data.animating && number !== this.data.current + 1) {
551
+ $.data(this, "animating", true);
552
+ currentSlide = this.data.current;
553
+ if (number) {
554
+ number = number - 1;
555
+ value = number > currentSlide ? 1 : -1;
556
+ next = number;
557
+ } else {
558
+ value = this.data.direction === "next" ? 1 : -1;
559
+ next = currentSlide + value;
560
+ }
561
+ if (next === -1) {
562
+ next = this.data.total - 1;
563
+ }
564
+ if (next === this.data.total) {
565
+ next = 0;
566
+ }
567
+ this._setActive(next);
568
+ slidesControl = $(".slidesjs-control", $element);
569
+ slidesControl.children(":eq(" + next + ")").css({
570
+ display: "none",
571
+ left: 0,
572
+ zIndex: 10
573
+ });
574
+ this.options.callback.start(currentSlide + 1);
575
+ if (this.options.effect.fade.crossfade) {
576
+ slidesControl.children(":eq(" + this.data.current + ")").stop().fadeOut(this.options.effect.fade.speed);
577
+ return slidesControl.children(":eq(" + next + ")").stop().fadeIn(this.options.effect.fade.speed, (function() {
578
+ slidesControl.children(":eq(" + next + ")").css({
579
+ zIndex: 0
580
+ });
581
+ $.data(_this, "animating", false);
582
+ $.data(_this, "current", next);
583
+ return _this.options.callback.complete(next + 1);
584
+ }));
585
+ } else {
586
+ return slidesControl.children(":eq(" + currentSlide + ")").stop().fadeOut(this.options.effect.fade.speed, (function() {
587
+ slidesControl.children(":eq(" + next + ")").stop().fadeIn(_this.options.effect.fade.speed, (function() {
588
+ return slidesControl.children(":eq(" + next + ")").css({
589
+ zIndex: 10
590
+ });
591
+ }));
592
+ $.data(_this, "animating", false);
593
+ $.data(_this, "current", next);
594
+ return _this.options.callback.complete(next + 1);
595
+ }));
596
+ }
597
+ }
598
+ };
599
+ Plugin.prototype._getVendorPrefix = function() {
600
+ var body, i, style, transition, vendor;
601
+ body = document.body || document.documentElement;
602
+ style = body.style;
603
+ transition = "transition";
604
+ vendor = ["Moz", "Webkit", "Khtml", "O", "ms"];
605
+ transition = transition.charAt(0).toUpperCase() + transition.substr(1);
606
+ i = 0;
607
+ while (i < vendor.length) {
608
+ if (typeof style[vendor[i] + transition] === "string") {
609
+ return vendor[i];
610
+ }
611
+ i++;
612
+ }
613
+ return false;
614
+ };
615
+ return $.fn[pluginName] = function(options) {
616
+ return this.each(function() {
617
+ if (!$.data(this, "plugin_" + pluginName)) {
618
+ return $.data(this, "plugin_" + pluginName, new Plugin(this, options));
619
+ }
620
+ });
621
+ };
622
+ })(jQuery, window, document);
623
+
624
+ }).call(this);
metadata ADDED
@@ -0,0 +1,110 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: slidesjs-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Daniel Libanori
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-23 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '1.3'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.3'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: railties
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '3.1'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '3.1'
62
+ description: Slidesjs assets for Rails 3.1
63
+ email:
64
+ - daniellibanori@gmail.com
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - .gitignore
70
+ - Gemfile
71
+ - LICENSE.txt
72
+ - README.md
73
+ - Rakefile
74
+ - lib/slidesjs/rails.rb
75
+ - lib/slidesjs/rails/engine.rb
76
+ - lib/slidesjs/rails/version.rb
77
+ - slidesjs-rails.gemspec
78
+ - vendor/assets/javascripts/jquery.slides.js
79
+ homepage: https://github.com/dlibanori/slidesjs-rails
80
+ licenses:
81
+ - MIT
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ! '>='
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ segments:
93
+ - 0
94
+ hash: -3035318746943975511
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ! '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ segments:
102
+ - 0
103
+ hash: -3035318746943975511
104
+ requirements: []
105
+ rubyforge_project:
106
+ rubygems_version: 1.8.23
107
+ signing_key:
108
+ specification_version: 3
109
+ summary: Slidesjs assets for Rails 3.1
110
+ test_files: []