rambling-slider-rails 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,24 @@
1
+ Copyright (c) 2012 Rambling Labs
2
+
3
+ Permission is hereby granted, free of charge, to any person
4
+ obtaining a copy of this software and associated documentation
5
+ files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use,
7
+ copy, modify, merge, publish, distribute, sublicense, and/or
8
+ sell copies of the Software, and to permit persons to whom
9
+ the Software is furnished to do so, subject to the following
10
+ conditions:
11
+
12
+ The above copyright notice and this permission notice shall
13
+ be included in all copies or substantial portions of the
14
+ Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
19
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
20
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
23
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+
data/README.markdown ADDED
@@ -0,0 +1,36 @@
1
+ # rambling-slider-rails
2
+
3
+ The `rambling-slider-rails` gem provides an easy way to include the [jQuery Rambling Slider](https://github.com/ramblinglabs/rambling.slider) on your Rails application.
4
+
5
+ ## Usage
6
+
7
+ Just include the `rambling-slider-rails` on your `Gemfile`, like this:
8
+
9
+ ``` ruby
10
+ gem 'rambling-slider-rails'
11
+ ```
12
+
13
+ And run:
14
+
15
+ ``` bash
16
+ bundle install
17
+ ```
18
+
19
+ Then, on your `application.js`, you can say something like this:
20
+
21
+ ``` javascript
22
+ //= require jquery
23
+ //= require jquery_rambling_slider
24
+ ```
25
+
26
+ For more information on how to use the jQuery Rambling Slider, you can go to [its wiki](https://github.com/ramblinglabs/rambling.slider/wiki).
27
+
28
+ ## License and copyright
29
+
30
+ Copyright (c) 2012 Rambling Labs
31
+
32
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
33
+
34
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
35
+
36
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,2 @@
1
+ require 'rambling-slider-rails/engine'
2
+ require 'rambling-slider-rails/version'
@@ -0,0 +1,8 @@
1
+ module Rambling
2
+ module Slider
3
+ module Rails
4
+ class Engine < ::Rails::Engine
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,14 @@
1
+ module Rambling
2
+ module Slider
3
+ module Rails
4
+ unless defined?(Rambling::Slider::Rails::VERSION)
5
+ # Current version of rambling-slider-rails.
6
+ VERSION = '0.0.1'
7
+ end
8
+
9
+ unless defined?(Rambling::Slider::Rails::JQUERY_RAMBLING_SLIDER_VERSION)
10
+ JQUERY_RAMBLING_SLIDER_VERSION = '0.3.1'
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,1359 @@
1
+ (function() {
2
+ /*!
3
+ * jQuery Rambling Slider
4
+ * http://github.com/egonzalez0787/rambling.slider
5
+ * http://ramblinglabs.com
6
+ *
7
+ * Copyright 2011-2012, Rambling Labs
8
+ * Released under the MIT license.
9
+ * http://www.opensource.org/licenses/mit-license.php
10
+ *
11
+ * January 2012
12
+ *
13
+ * Based on jQuery Nivo Slider by Gilbert Pellegrom
14
+ */
15
+ var RamblingBoxGenerator, RamblingBoxer, RamblingSliceGenerator, RamblingSlicer, root;
16
+ var __indexOf = Array.prototype.indexOf || function(item) {
17
+ for (var i = 0, l = this.length; i < l; i++) {
18
+ if (this[i] === item) return i;
19
+ }
20
+ return -1;
21
+ }, __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __slice = Array.prototype.slice;
22
+ Array.prototype.shuffle = function() {
23
+ var i, j, _ref, _ref2;
24
+ for (i = _ref = this.length; _ref <= 1 ? i <= 1 : i >= 1; _ref <= 1 ? i++ : i--) {
25
+ j = parseInt(Math.random() * i);
26
+ _ref2 = [this[j], this[--i]], this[i] = _ref2[0], this[j] = _ref2[1];
27
+ }
28
+ return this;
29
+ };
30
+ Array.prototype.contains = function(value) {
31
+ return __indexOf.call(this, value) >= 0;
32
+ };
33
+ Array.prototype.where = function(predicate) {
34
+ var element, _i, _len, _results;
35
+ _results = [];
36
+ for (_i = 0, _len = this.length; _i < _len; _i++) {
37
+ element = this[_i];
38
+ if (predicate(element)) {
39
+ _results.push(element);
40
+ }
41
+ }
42
+ return _results;
43
+ };
44
+ Array.prototype.first = function(predicate) {
45
+ var element;
46
+ if (!predicate) {
47
+ predicate = (function(element) {
48
+ return true;
49
+ });
50
+ }
51
+ return ((function() {
52
+ var _i, _len, _results;
53
+ _results = [];
54
+ for (_i = 0, _len = this.length; _i < _len; _i++) {
55
+ element = this[_i];
56
+ if (predicate(element)) {
57
+ _results.push(element);
58
+ }
59
+ }
60
+ return _results;
61
+ }).call(this))[0];
62
+ };
63
+ Array.prototype.map = function(map) {
64
+ var element, _i, _len, _results;
65
+ if (!map) {
66
+ map = (function(element) {
67
+ return element;
68
+ });
69
+ }
70
+ _results = [];
71
+ for (_i = 0, _len = this.length; _i < _len; _i++) {
72
+ element = this[_i];
73
+ _results.push(map(element));
74
+ }
75
+ return _results;
76
+ };
77
+ Array.prototype.random = function() {
78
+ return this[Math.floor(Math.random() * this.length)];
79
+ };
80
+ Array.prototype.fromObject = function(object, valueSelector) {
81
+ var key, value, _fn;
82
+ if (!valueSelector) {
83
+ valueSelector = (function(key, value) {
84
+ return value;
85
+ });
86
+ }
87
+ _fn = __bind(function(key, value) {
88
+ return this.push(valueSelector(key, value));
89
+ }, this);
90
+ for (key in object) {
91
+ value = object[key];
92
+ _fn(key, value);
93
+ }
94
+ return this;
95
+ };
96
+ Array.prototype.sortOutIn = function() {
97
+ var halfLength, i, length, newArray, _fn;
98
+ newArray = [];
99
+ length = this.length;
100
+ halfLength = Math.floor(length / 2);
101
+ _fn = __bind(function(i) {
102
+ newArray.push(this[i]);
103
+ return newArray.push(this[length - i - 1]);
104
+ }, this);
105
+ for (i = 0; 0 <= halfLength ? i < halfLength : i > halfLength; 0 <= halfLength ? i++ : i--) {
106
+ _fn(i);
107
+ }
108
+ if (length % 2) {
109
+ newArray.push(this[halfLength]);
110
+ }
111
+ return newArray;
112
+ };
113
+ (function($) {
114
+ $.fn.reverse = [].reverse;
115
+ $.fn.shuffle = [].shuffle;
116
+ $.fn.sortOutIn = function() {
117
+ return $(Array.prototype.sortOutIn.apply(this));
118
+ };
119
+ $.fn.sortInOut = function() {
120
+ return this.sortOutIn().reverse();
121
+ };
122
+ $.fn.as2dArray = function(totalColumns) {
123
+ var array_2d, colIndex, rowIndex;
124
+ rowIndex = 0;
125
+ colIndex = 0;
126
+ array_2d = $('');
127
+ array_2d[rowIndex] = $('');
128
+ this.each(function() {
129
+ array_2d[rowIndex][colIndex] = $(this);
130
+ colIndex++;
131
+ if (colIndex === totalColumns) {
132
+ rowIndex++;
133
+ colIndex = 0;
134
+ return array_2d[rowIndex] = $('');
135
+ }
136
+ });
137
+ return array_2d;
138
+ };
139
+ $.fn.containsFlash = function() {
140
+ return this.find('object,embed').length;
141
+ };
142
+ return $.fn.equals = function(other) {
143
+ var result;
144
+ result = true;
145
+ result = this.length === other.length;
146
+ this.each(function(index, element) {
147
+ return result = result && element === other.get(index);
148
+ });
149
+ return result;
150
+ };
151
+ })(jQuery);
152
+ RamblingBoxGenerator = (function() {
153
+ function RamblingBoxGenerator(slider, settings, vars) {
154
+ this.slider = slider;
155
+ this.settings = settings;
156
+ this.vars = vars;
157
+ this.boxer = new RamblingBoxer(this.slider);
158
+ }
159
+ RamblingBoxGenerator.prototype.createBoxes = function(boxCols, boxRows) {
160
+ var animationContainer, boxHeight, boxWidth, row, _fn;
161
+ if (boxCols == null) {
162
+ boxCols = this.settings.boxCols;
163
+ }
164
+ if (boxRows == null) {
165
+ boxRows = this.settings.boxRows;
166
+ }
167
+ boxWidth = Math.round(this.slider.width() / boxCols);
168
+ boxHeight = Math.round(this.slider.height() / boxRows);
169
+ animationContainer = this.slider.find('#rambling-animation');
170
+ _fn = __bind(function(row) {
171
+ var column, _results;
172
+ _results = [];
173
+ for (column = 0; 0 <= boxCols ? column < boxCols : column > boxCols; 0 <= boxCols ? column++ : column--) {
174
+ _results.push(__bind(function(column) {
175
+ return animationContainer.append(this.boxer.getRamblingBox(boxWidth, boxHeight, row, column, this.settings, this.vars));
176
+ }, this)(column));
177
+ }
178
+ return _results;
179
+ }, this);
180
+ for (row = 0; 0 <= boxRows ? row < boxRows : row > boxRows; 0 <= boxRows ? row++ : row--) {
181
+ _fn(row);
182
+ }
183
+ return this.slider.find('.rambling-box');
184
+ };
185
+ return RamblingBoxGenerator;
186
+ })();
187
+ root = typeof global !== "undefined" && global !== null ? global : window;
188
+ root.RamblingBoxGenerator = RamblingBoxGenerator;
189
+ RamblingBoxer = (function() {
190
+ function RamblingBoxer(slider) {
191
+ this.slider = slider;
192
+ }
193
+ RamblingBoxer.prototype.getBox = function(boxWidth, boxHeight, row, column, settings) {
194
+ var boxCss;
195
+ boxCss = {
196
+ opacity: 0,
197
+ left: boxWidth * column,
198
+ top: boxHeight * row,
199
+ width: column === (settings.boxCols - 1) ? this.slider.width() - (boxWidth * column) : boxWidth,
200
+ height: boxHeight,
201
+ overflow: 'hidden'
202
+ };
203
+ return $('<div class="rambling-box"></div>').css(boxCss);
204
+ };
205
+ RamblingBoxer.prototype.getRamblingBox = function(boxWidth, boxHeight, row, column, settings, vars) {
206
+ var bottom, ramblingBox, ramblingBoxImageStyle, top;
207
+ ramblingBox = this.getBox(boxWidth, boxHeight, row, column, settings);
208
+ bottom = settings.alignBottom ? boxHeight * (settings.boxRows - (row + 1)) : 'auto';
209
+ top = settings.alignBottom ? 'auto' : row * boxHeight;
210
+ ramblingBoxImageStyle = {
211
+ display: 'block',
212
+ width: this.slider.width(),
213
+ left: -(column * boxWidth),
214
+ top: settings.alignBottom ? 'auto' : -top,
215
+ bottom: settings.alignBottom ? -bottom : 'auto'
216
+ };
217
+ ramblingBox.css({
218
+ top: top,
219
+ bottom: bottom
220
+ });
221
+ ramblingBox.append("<span><img src='" + (vars.currentSlideElement.attr('src') || vars.currentSlideElement.find('img').attr('src')) + "' alt=''/></span>");
222
+ ramblingBox.find('img').css(ramblingBoxImageStyle);
223
+ return ramblingBox;
224
+ };
225
+ return RamblingBoxer;
226
+ })();
227
+ root = typeof global !== "undefined" && global !== null ? global : window;
228
+ root.RamblingBoxer = RamblingBoxer;
229
+ RamblingSliceGenerator = (function() {
230
+ function RamblingSliceGenerator(slider, settings, vars) {
231
+ this.slider = slider;
232
+ this.settings = settings;
233
+ this.vars = vars;
234
+ this.slicer = new RamblingSlicer(this.slider);
235
+ }
236
+ RamblingSliceGenerator.prototype.getOneSlice = function(slideElement) {
237
+ if (slideElement == null) {
238
+ slideElement = this.vars.currentSlideElement;
239
+ }
240
+ return this.createSlices(1, slideElement);
241
+ };
242
+ RamblingSliceGenerator.prototype.createSlices = function(slices, slideElement) {
243
+ var animationContainer, i, sliceWidth, _fn;
244
+ if (slices == null) {
245
+ slices = this.settings.slices;
246
+ }
247
+ if (slideElement == null) {
248
+ slideElement = this.vars.currentSlideElement;
249
+ }
250
+ sliceWidth = Math.round(this.slider.width() / slices);
251
+ animationContainer = this.slider.find('#rambling-animation');
252
+ _fn = __bind(function(i) {
253
+ return animationContainer.append(this.slicer.getRamblingSlice(sliceWidth, i, slices, slideElement, this.settings));
254
+ }, this);
255
+ for (i = 0; 0 <= slices ? i < slices : i > slices; 0 <= slices ? i++ : i--) {
256
+ _fn(i);
257
+ }
258
+ return this.slider.find('.rambling-slice');
259
+ };
260
+ return RamblingSliceGenerator;
261
+ })();
262
+ root = typeof global !== "undefined" && global !== null ? global : window;
263
+ root.RamblingSliceGenerator = RamblingSliceGenerator;
264
+ RamblingSlicer = (function() {
265
+ function RamblingSlicer(slider) {
266
+ this.slider = slider;
267
+ }
268
+ RamblingSlicer.prototype.getSlice = function(sliceWidth, position, total) {
269
+ var sliceCss;
270
+ sliceCss = {
271
+ left: sliceWidth * position,
272
+ width: position === (total - 1) ? this.slider.width() - (sliceWidth * position) : sliceWidth,
273
+ height: 0,
274
+ opacity: 0,
275
+ overflow: 'hidden'
276
+ };
277
+ return $('<div class="rambling-slice"></div>').css(sliceCss);
278
+ };
279
+ RamblingSlicer.prototype.getRamblingSlice = function(sliceWidth, position, total, slideElement, settings) {
280
+ var ramblingSlice, ramblingSliceImageStyle;
281
+ ramblingSlice = this.getSlice(sliceWidth, position, total);
282
+ ramblingSlice.append("<span><img src=\"" + (slideElement.attr('src') || slideElement.find('img').attr('src')) + "\" alt=\"\"/></span>");
283
+ ramblingSliceImageStyle = {
284
+ display: 'block',
285
+ width: this.slider.width(),
286
+ left: -position * sliceWidth,
287
+ bottom: settings.alignBottom ? 0 : 'auto',
288
+ top: settings.alignBottom ? 'auto' : 0
289
+ };
290
+ ramblingSlice.find('img').css(ramblingSliceImageStyle);
291
+ return ramblingSlice;
292
+ };
293
+ return RamblingSlicer;
294
+ })();
295
+ root = typeof global !== "undefined" && global !== null ? global : window;
296
+ root.RamblingSlicer = RamblingSlicer;
297
+ (function($) {
298
+ var RamblingSlider, cannotChange, publicMethods;
299
+ publicMethods = ['stop', 'start', 'option', 'effect', 'destroy', 'previousSlide', 'nextSlide', 'slide', 'theme'];
300
+ $.fn.ramblingSlider = function() {
301
+ var isCallingGetter, methodExists, options, optionsIsString, others, ramblingSlider, value;
302
+ options = arguments[0], others = 2 <= arguments.length ? __slice.call(arguments, 1) : [];
303
+ methodExists = __indexOf.call(publicMethods, options) >= 0;
304
+ optionsIsString = typeof options === 'string';
305
+ ramblingSlider = this.data('rambling:slider');
306
+ isCallingGetter = function(options, others) {
307
+ return !others.length || (options === 'option' && others.length === 1 && typeof others[0] === 'string');
308
+ };
309
+ if (ramblingSlider) {
310
+ if (methodExists) {
311
+ value = ramblingSlider[options].apply(ramblingSlider, others);
312
+ if (isCallingGetter(options, others)) {
313
+ return value;
314
+ } else {
315
+ return this;
316
+ }
317
+ } else {
318
+ if (optionsIsString) {
319
+ return $.error("Method '" + options + "' not found.");
320
+ } else {
321
+ return $.error("Slider already initialized.");
322
+ }
323
+ }
324
+ } else {
325
+ if (methodExists || optionsIsString) {
326
+ return $.error("Tried to call method '" + options + "' on element without slider.");
327
+ }
328
+ }
329
+ return this.each(function(key, value) {
330
+ var element;
331
+ element = $(this);
332
+ if (element.data('rambling:slider')) {
333
+ return;
334
+ }
335
+ ramblingSlider = new RamblingSlider(this, options);
336
+ element.data('rambling:slider', ramblingSlider);
337
+ ramblingSlider.initialize();
338
+ return ramblingSlider.run();
339
+ });
340
+ };
341
+ $.fn.ramblingSlider.defaults = {
342
+ slices: 15,
343
+ boxCols: 8,
344
+ boxRows: 4,
345
+ speed: 500,
346
+ pauseTime: 4500,
347
+ manualAdvance: false,
348
+ captionOpacity: 0.8,
349
+ theme: 'default',
350
+ alignBottom: false,
351
+ effect: 'random',
352
+ startSlide: 0,
353
+ directionNav: true,
354
+ directionNavHide: true,
355
+ controlNav: true,
356
+ controlNavThumbs: false,
357
+ controlNavThumbsFromRel: false,
358
+ controlNavThumbsSearch: '.jpg',
359
+ controlNavThumbsReplace: '_thumb.jpg',
360
+ adaptImages: false,
361
+ useLargerImage: true,
362
+ keyboardNav: true,
363
+ pauseOnHover: true,
364
+ prevText: 'Prev',
365
+ nextText: 'Next',
366
+ imageTransitions: null,
367
+ flashTransitions: null,
368
+ imageFlashTransitions: null,
369
+ transitionGroups: [],
370
+ transitionGroupSuffixes: [],
371
+ beforeChange: function() {},
372
+ afterChange: function() {},
373
+ slideshowEnd: function() {},
374
+ lastSlide: function() {},
375
+ afterLoad: function() {}
376
+ };
377
+ cannotChange = ['startSlide', 'directionNav', 'directionNavHide', 'controlNav', 'controlNavThumbs', 'controlNavThumbsFromRel', 'controlNavThumbsSearch', 'controlNavThumbsReplace', 'adaptImages', 'useLargerImage', 'keyboardNav', 'pauseOnHover', 'prevText', 'nextText', 'imageTransitions', 'flashTransitions', 'imageFlashTransitions', 'transitionGroups', 'transitionGroupSuffixes', 'afterLoad'];
378
+ return RamblingSlider = function(element, options) {
379
+ var addCaption, addControlNavigation, addDirectionNavigation, addKeyboardNavigation, animateBoxes, animateBoxesIn2d, animateFullImage, animateSlices, animationTimeBuffer, children, extendAvailableTransitions, fadeBoxes, fadeSlices, flashTransitions, foldSlices, getAnimationHelpers, getAnimationsForCurrentSlideElement, getAvailableTransitions, getRandomAnimation, getSettingsArrayFor, growBoxes, imageFlashTransitions, imageTransitions, pauseSlider, prepareAdaptiveSlider, prepareAnimationContainer, prepareSliderChildren, processCaption, rainBoxes, raiseAnimationFinished, ramblingBoxGenerator, ramblingRun, ramblingSliceGenerator, resetTimer, setAnimationFinishedActions, setCurrentSlideElement, setSliderBackground, setSliderInitialState, setUpTransitions, settings, slideDownSlices, slideTo, slideUpDownSlices, slideUpSlices, slider, timer, transitionGroupSuffixes, transitionGroups, unpauseSlider, vars;
380
+ slider = $(element);
381
+ children = slider.children(':not(#rambling-animation)');
382
+ settings = $.extend({}, $.fn.ramblingSlider.defaults, options);
383
+ timer = 0;
384
+ animationTimeBuffer = 0;
385
+ imageTransitions = null;
386
+ imageFlashTransitions = null;
387
+ flashTransitions = null;
388
+ transitionGroups = [];
389
+ transitionGroupSuffixes = [];
390
+ vars = {
391
+ currentSlide: 0,
392
+ currentSlideElement: '',
393
+ previousSlideElement: '',
394
+ totalSlides: 0,
395
+ running: false,
396
+ paused: false,
397
+ stopped: false
398
+ };
399
+ slider.data('rambling:vars', vars);
400
+ ramblingSliceGenerator = new RamblingSliceGenerator(slider, settings, vars);
401
+ ramblingBoxGenerator = new RamblingBoxGenerator(slider, settings, vars);
402
+ this.stop = function() {
403
+ vars.stopped = true;
404
+ return slider;
405
+ };
406
+ this.start = function() {
407
+ vars.stopped = false;
408
+ return slider;
409
+ };
410
+ this.previousSlide = function() {
411
+ slideTo('prev');
412
+ return slider;
413
+ };
414
+ this.nextSlide = function() {
415
+ slideTo('next');
416
+ return slider;
417
+ };
418
+ this.slide = function() {
419
+ var slideNumber, slideNumbers;
420
+ slideNumbers = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
421
+ if (!slideNumbers.length) {
422
+ return vars.currentSlide;
423
+ }
424
+ slideNumber = slideNumbers[0] % vars.totalSlides;
425
+ if (!(vars.running || vars.totalSlides === 1)) {
426
+ vars.currentSlide = slideNumber - 1;
427
+ ramblingRun(slider, children, settings, 'control');
428
+ }
429
+ return slider;
430
+ };
431
+ this.destroy = function() {
432
+ slider.find('#rambling-animation,.rambling-slice,.rambling-box,.rambling-caption,.rambling-directionNav,.rambling-controlNav').remove();
433
+ slider.removeClass('ramblingSlider adaptingSlider');
434
+ slider.removeAttr('style');
435
+ slider.data('rambling:vars', null);
436
+ slider.data('rambling:slider', null);
437
+ slider.unbind('rambling:finished');
438
+ slider.unbind('hover');
439
+ resetTimer();
440
+ slider.children().show().children().show();
441
+ return slider;
442
+ };
443
+ this.option = __bind(function() {
444
+ var option, optionIsObject, options, value;
445
+ options = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
446
+ if (!options.length) {
447
+ return settings;
448
+ }
449
+ option = options[0], value = options[1];
450
+ optionIsObject = typeof option === 'object';
451
+ if (option === 'effect') {
452
+ return this.effect.apply(this, value ? [value] : void 0);
453
+ }
454
+ if (option === 'theme') {
455
+ return this.theme.apply(this, value ? [value] : void 0);
456
+ }
457
+ if (optionIsObject) {
458
+ return $.extend(settings, option);
459
+ } else {
460
+ if (value != null) {
461
+ if (__indexOf.call(cannotChange, option) >= 0) {
462
+ return $.error("Slider already running. Option '" + option + "' cannot be changed.");
463
+ }
464
+ return settings[option] = value;
465
+ } else {
466
+ return settings[option];
467
+ }
468
+ }
469
+ }, this);
470
+ this.effect = function() {
471
+ var effects;
472
+ effects = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
473
+ if (!effects.length) {
474
+ return settings.effect;
475
+ }
476
+ settings.effect = effects[0];
477
+ return slider;
478
+ };
479
+ this.theme = function() {
480
+ var classes, oldTheme, themes;
481
+ themes = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
482
+ if (!themes.length) {
483
+ return settings.theme;
484
+ }
485
+ oldTheme = settings.theme;
486
+ settings.theme = themes[0];
487
+ classes = ["theme-" + oldTheme, "theme-" + $.fn.ramblingSlider.defaults.theme];
488
+ slider.parents(classes.map(function(c) {
489
+ return "." + c;
490
+ }).join(',')).removeClass(classes.join(' ')).addClass("theme-" + settings.theme);
491
+ return slider;
492
+ };
493
+ this.initialize = function() {
494
+ setSliderInitialState();
495
+ vars.currentSlide = settings.startSlide = settings.startSlide % vars.totalSlides;
496
+ setCurrentSlideElement(children);
497
+ setSliderBackground();
498
+ addCaption();
499
+ addDirectionNavigation();
500
+ addControlNavigation(children);
501
+ addKeyboardNavigation();
502
+ if (settings.pauseOnHover) {
503
+ slider.hover(pauseSlider, unpauseSlider);
504
+ }
505
+ setAnimationFinishedActions();
506
+ return extendAvailableTransitions();
507
+ };
508
+ this.run = function() {
509
+ if (!settings.manualAdvance && vars.totalSlides > 1) {
510
+ return timer = window.setInterval((function() {
511
+ return ramblingRun(slider, children, settings, false);
512
+ }), settings.pauseTime);
513
+ }
514
+ };
515
+ setUpTransitions = function() {
516
+ imageTransitions = $.extend({}, $.fn.ramblingSlider.defaults.imageTransitions, settings.imageTransitions);
517
+ imageFlashTransitions = $.extend({}, $.fn.ramblingSlider.defaults.imageFlashTransitions, settings.imageFlashTransitions);
518
+ flashTransitions = $.extend({}, $.fn.ramblingSlider.defaults.flashTransitions, settings.flashTransitions);
519
+ transitionGroups = getSettingsArrayFor('transitionGroups');
520
+ return transitionGroupSuffixes = getSettingsArrayFor('transitionGroupSuffixes');
521
+ };
522
+ getSettingsArrayFor = function(key) {
523
+ var array;
524
+ array = [];
525
+ $.each($.fn.ramblingSlider.defaults[key], function(index, element) {
526
+ return array.push(element);
527
+ });
528
+ $.each(settings[key], function(index, element) {
529
+ return array.push(element);
530
+ });
531
+ return array;
532
+ };
533
+ setSliderInitialState = __bind(function() {
534
+ this.effect(settings.effect);
535
+ this.theme(settings.theme);
536
+ setUpTransitions();
537
+ slider.css({
538
+ position: 'relative'
539
+ });
540
+ slider.addClass("ramblingSlider");
541
+ vars.totalSlides = children.length;
542
+ prepareAnimationContainer();
543
+ if (settings.adaptImages) {
544
+ prepareAdaptiveSlider();
545
+ }
546
+ return prepareSliderChildren();
547
+ }, this);
548
+ prepareAnimationContainer = function() {
549
+ return slider.prepend($('<div id="rambling-animation"></div>').css({
550
+ width: slider.width(),
551
+ height: slider.height(),
552
+ overflow: 'hidden'
553
+ }));
554
+ };
555
+ prepareAdaptiveSlider = function() {
556
+ return slider.addClass('adaptingSlider');
557
+ };
558
+ prepareSliderChildren = function() {
559
+ var child, ramblingAnimationContainer;
560
+ ramblingAnimationContainer = slider.find('#rambling-animation');
561
+ children.each(function() {
562
+ var child, clone;
563
+ child = $(this);
564
+ child.css({
565
+ display: 'none'
566
+ });
567
+ clone = child.clone().addClass('slideElement');
568
+ if (clone.containsFlash()) {
569
+ if (!clone.find('param[name=wmode]').length) {
570
+ clone.find('object').prepend('<param name="wmode" value="opaque" />');
571
+ }
572
+ clone.find('embed').attr({
573
+ wmode: 'opaque'
574
+ });
575
+ }
576
+ return ramblingAnimationContainer.append(clone);
577
+ });
578
+ children = ramblingAnimationContainer.children();
579
+ children.each(function() {
580
+ var child, childHeight, childWidth, link, object;
581
+ child = $(this);
582
+ link = null;
583
+ if (child.is('a') && !child.containsFlash()) {
584
+ link = child.addClass('rambling-imageLink');
585
+ child = child.find('img:first');
586
+ }
587
+ childWidth = child.width() || child.attr('width');
588
+ childHeight = child.height() || child.attr('height');
589
+ if (childWidth > slider.width() && settings.useLargerImage) {
590
+ slider.width(childWidth);
591
+ }
592
+ if (childHeight > slider.height() && (settings.useLargerImage || !settings.adaptImages)) {
593
+ slider.height(childHeight);
594
+ }
595
+ object = child.find('object,embed');
596
+ object.height(slider.height());
597
+ object.width(slider.width());
598
+ if (link) {
599
+ link.css({
600
+ display: 'none'
601
+ });
602
+ }
603
+ return child.css({
604
+ display: 'none'
605
+ });
606
+ });
607
+ child = setCurrentSlideElement(children);
608
+ if (child.is('a')) {
609
+ return child.css({
610
+ display: 'block'
611
+ });
612
+ }
613
+ };
614
+ addCaption = function() {
615
+ slider.append($('<div class="rambling-caption"><p></p></div>').css({
616
+ display: 'none',
617
+ opacity: settings.captionOpacity
618
+ }));
619
+ return processCaption(settings);
620
+ };
621
+ addDirectionNavigation = function() {
622
+ var directionNav;
623
+ if (settings.directionNav && vars.totalSlides > 1) {
624
+ directionNav = $("<div class='rambling-directionNav'><a class='rambling-prevNav'>" + settings.prevText + "</a><a class='rambling-nextNav'>" + settings.nextText + "</a></div>");
625
+ slider.append(directionNav);
626
+ if (settings.directionNavHide) {
627
+ directionNav.hide();
628
+ slider.hover((function() {
629
+ return directionNav.show();
630
+ }), (function() {
631
+ return directionNav.hide();
632
+ }));
633
+ }
634
+ slider.find('a.rambling-prevNav').live('click', function() {
635
+ return slideTo('prev');
636
+ });
637
+ return slider.find('a.rambling-nextNav').live('click', function() {
638
+ return slideTo('next');
639
+ });
640
+ }
641
+ };
642
+ addControlNavigation = __bind(function() {
643
+ var controlNavAnchors, i, ramblingControl, self, _fn, _ref;
644
+ self = this;
645
+ if (settings.controlNav) {
646
+ ramblingControl = $('<div class="rambling-controlNav"></div>');
647
+ slider.append(ramblingControl);
648
+ _fn = function(i) {
649
+ var child;
650
+ if (settings.controlNavThumbs) {
651
+ child = children.eq(i);
652
+ if (!child.is('img')) {
653
+ child = child.find('img:first');
654
+ }
655
+ if (settings.controlNavThumbsFromRel) {
656
+ return ramblingControl.append("<a class='rambling-control' rel='" + i + "'><img src='" + (child.attr('rel')) + "' alt='' /></a>");
657
+ } else {
658
+ return ramblingControl.append("<a class='rambling-control' rel='" + i + "'><img src='" + (child.attr('src').replace(settings.controlNavThumbsSearch, settings.controlNavThumbsReplace)) + "' alt='' /></a>");
659
+ }
660
+ } else {
661
+ return ramblingControl.append("<a class='rambling-control' rel='" + i + "'>" + (i + 1) + "'</a>");
662
+ }
663
+ };
664
+ for (i = 0, _ref = children.length; 0 <= _ref ? i < _ref : i > _ref; 0 <= _ref ? i++ : i--) {
665
+ _fn(i);
666
+ }
667
+ controlNavAnchors = slider.find('.rambling-controlNav a');
668
+ controlNavAnchors.filter(":eq(" + vars.currentSlide + ")").addClass('active');
669
+ return controlNavAnchors.live('click', function() {
670
+ if (vars.running) {
671
+ return false;
672
+ }
673
+ if ($(this).hasClass('active')) {
674
+ return false;
675
+ }
676
+ resetTimer();
677
+ setSliderBackground();
678
+ return self.slide($(this).attr('rel'));
679
+ });
680
+ }
681
+ }, this);
682
+ addKeyboardNavigation = function() {
683
+ if (settings.keyboardNav) {
684
+ return $(window).keypress(function(event) {
685
+ if (event.keyCode === 37) {
686
+ slideTo('prev');
687
+ }
688
+ if (event.keyCode === 39) {
689
+ return slideTo('next');
690
+ }
691
+ });
692
+ }
693
+ };
694
+ setAnimationFinishedActions = __bind(function() {
695
+ var self;
696
+ self = this;
697
+ return slider.bind('rambling:finished', function() {
698
+ var child;
699
+ vars.running = false;
700
+ child = $(children.get(vars.currentSlide));
701
+ child.siblings().css({
702
+ display: 'none'
703
+ });
704
+ if (child.is('a')) {
705
+ child.css({
706
+ display: 'block'
707
+ });
708
+ }
709
+ if (timer === '' && !vars.paused) {
710
+ self.run();
711
+ }
712
+ setSliderBackground();
713
+ slider.find('.rambling-slice,.rambling-box').remove();
714
+ return settings.afterChange.call(this);
715
+ });
716
+ }, this);
717
+ extendAvailableTransitions = function() {
718
+ if (settings.imageTransitions) {
719
+ $.extend(imageTransitions, settings.imageTransitions);
720
+ }
721
+ if (settings.imageFlashTransitions) {
722
+ $.extend(imageFlashTransitions, settings.imageFlashTransitions);
723
+ }
724
+ if (settings.flashTransitions) {
725
+ return $.extend(flashTransitions, settings.flashTransitions);
726
+ }
727
+ };
728
+ processCaption = function(settings) {
729
+ var ramblingCaption, title;
730
+ ramblingCaption = slider.find('.rambling-caption');
731
+ title = vars.currentSlideElement.attr('title');
732
+ if (title) {
733
+ if (title.startsWith('#')) {
734
+ title = $(title).html();
735
+ }
736
+ if (ramblingCaption.css('display') === 'block') {
737
+ ramblingCaption.find('p').fadeOut(settings.speed, function() {
738
+ var p;
739
+ p = $(this);
740
+ p.html(title);
741
+ return p.fadeIn(settings.speed);
742
+ });
743
+ } else {
744
+ ramblingCaption.find('p').html(title);
745
+ }
746
+ return ramblingCaption.fadeIn(settings.speed);
747
+ } else {
748
+ return ramblingCaption.fadeOut(settings.speed);
749
+ }
750
+ };
751
+ setCurrentSlideElement = function(children) {
752
+ var child;
753
+ child = $(children.get(vars.currentSlide));
754
+ vars.previousSlideElement = vars.currentSlideElement;
755
+ vars.currentSlideElement = child;
756
+ if (child.is('a') && !child.containsFlash()) {
757
+ vars.currentSlideElement = child.find('img:first');
758
+ }
759
+ return child;
760
+ };
761
+ resetTimer = function() {
762
+ window.clearInterval(timer);
763
+ return timer = '';
764
+ };
765
+ pauseSlider = function() {
766
+ vars.paused = true;
767
+ return resetTimer();
768
+ };
769
+ unpauseSlider = __bind(function() {
770
+ vars.paused = false;
771
+ if (timer === '') {
772
+ return this.run();
773
+ }
774
+ }, this);
775
+ slideTo = function(direction) {
776
+ if (vars.running || vars.totalSlides === 1) {
777
+ return false;
778
+ }
779
+ resetTimer();
780
+ if (direction === 'prev') {
781
+ vars.currentSlide -= 2;
782
+ }
783
+ return ramblingRun(slider, children, settings, direction);
784
+ };
785
+ setSliderBackground = function() {
786
+ var slideElement;
787
+ slideElement = slider.find('.currentSlideElement');
788
+ if (slideElement.equals(vars.currentSlideElement)) {
789
+ return;
790
+ }
791
+ slideElement.removeClass('currentSlideElement alignTop alignBottom').css({
792
+ display: 'none',
793
+ 'z-index': 0
794
+ });
795
+ slideElement = vars.currentSlideElement;
796
+ slideElement.siblings('.slideElement').css({
797
+ display: 'none'
798
+ });
799
+ slideElement.addClass('currentSlideElement').addClass(settings.alignBottom ? 'alignBottom' : 'alignTop');
800
+ slideElement.css({
801
+ display: 'block',
802
+ 'z-index': 0
803
+ });
804
+ return slideElement.find('img').css({
805
+ display: 'block'
806
+ });
807
+ };
808
+ getAvailableTransitions = function() {
809
+ var effects;
810
+ effects = settings.effect.split(',');
811
+ $.each(transitionGroups, function(index, group) {
812
+ var parameters;
813
+ if (effects.contains(group)) {
814
+ parameters = [effects.indexOf(group), 1];
815
+ $.each(transitionGroupSuffixes, function(index, suffix) {
816
+ return parameters.push("" + group + suffix);
817
+ });
818
+ return effects.splice.apply(effects, parameters);
819
+ }
820
+ });
821
+ return effects;
822
+ };
823
+ getAnimationsForCurrentSlideElement = function() {
824
+ var availableTransitions, defaultTransition, sourceTransitions, transitions;
825
+ transitions = [];
826
+ sourceTransitions = [];
827
+ if (vars.currentSlideElement.containsFlash()) {
828
+ if (vars.previousSlideElement.containsFlash()) {
829
+ sourceTransitions = flashTransitions;
830
+ defaultTransition = flashTransitions.slideInRight;
831
+ } else {
832
+ sourceTransitions = imageFlashTransitions;
833
+ defaultTransition = imageFlashTransitions.fadeOut;
834
+ }
835
+ } else {
836
+ sourceTransitions = imageTransitions;
837
+ defaultTransition = imageTransitions.fadeIn;
838
+ }
839
+ availableTransitions = getAvailableTransitions();
840
+ transitions = [].fromObject(sourceTransitions, function(key, value) {
841
+ return key;
842
+ });
843
+ if (settings.effect !== 'random') {
844
+ transitions = transitions.where(function(animationName) {
845
+ return availableTransitions.contains(animationName);
846
+ });
847
+ }
848
+ transitions = transitions.map(function(animationName) {
849
+ return sourceTransitions[animationName];
850
+ });
851
+ transitions["default"] = defaultTransition;
852
+ return transitions;
853
+ };
854
+ getRandomAnimation = function() {
855
+ var transitions;
856
+ transitions = getAnimationsForCurrentSlideElement();
857
+ return transitions.random() || transitions["default"];
858
+ };
859
+ raiseAnimationFinished = function() {
860
+ return slider.trigger('rambling:finished');
861
+ };
862
+ animateFullImage = function(animationSetUp) {
863
+ var slice;
864
+ slice = ramblingSliceGenerator.getOneSlice();
865
+ slice.css({
866
+ top: (settings.alignBottom ? 'auto' : 0),
867
+ bottom: (settings.alignBottom ? 0 : 'auto')
868
+ });
869
+ return slice.animate(animationSetUp.apply(slice, [slider, $.extend({}, settings)]) || {
870
+ width: slider.width()
871
+ }, settings.speed * 2, '', function() {
872
+ if (settings.afterChange) {
873
+ settings.afterChange.apply(slice);
874
+ }
875
+ return raiseAnimationFinished();
876
+ });
877
+ };
878
+ animateSlices = function(animationSetUp, sortCallback) {
879
+ var slices;
880
+ slices = ramblingSliceGenerator.createSlices();
881
+ animationTimeBuffer = 0;
882
+ if (sortCallback) {
883
+ slices = sortCallback.apply(slices);
884
+ }
885
+ return slices.each(function(index, element) {
886
+ var finishedCallback, slice;
887
+ slice = $(element);
888
+ if (index === settings.slices - 1) {
889
+ finishedCallback = raiseAnimationFinished;
890
+ }
891
+ window.setTimeout((function() {
892
+ return slice.animate(animationSetUp.apply(slice, [index, element]) || {}, settings.speed, '', finishedCallback);
893
+ }), 100 + animationTimeBuffer);
894
+ return animationTimeBuffer += 50;
895
+ });
896
+ };
897
+ animateBoxes = function(animationCallback, sortCallback) {
898
+ var boxes;
899
+ boxes = ramblingBoxGenerator.createBoxes();
900
+ animationTimeBuffer = 0;
901
+ if (sortCallback) {
902
+ boxes = sortCallback.apply(boxes);
903
+ }
904
+ return animationCallback.apply(boxes, [raiseAnimationFinished]);
905
+ };
906
+ animateBoxesIn2d = function(animationSetUp, sortCallback) {
907
+ return animateBoxes(function(finishedCallback) {
908
+ var boxes, column, index, totalBoxes, _ref, _results;
909
+ boxes = this;
910
+ totalBoxes = settings.boxCols * settings.boxRows;
911
+ index = 0;
912
+ _results = [];
913
+ for (column = 0, _ref = settings.boxCols * 2; 0 <= _ref ? column < _ref : column > _ref; 0 <= _ref ? column++ : column--) {
914
+ _results.push((function(column) {
915
+ var row, _ref2, _results2;
916
+ _results2 = [];
917
+ for (row = 0, _ref2 = settings.boxRows; 0 <= _ref2 ? row < _ref2 : row > _ref2; 0 <= _ref2 ? row++ : row--) {
918
+ _results2.push((function(row) {
919
+ var box, finished;
920
+ if (column >= 0 && column < settings.boxCols) {
921
+ box = $(boxes[row][column]);
922
+ if (index === totalBoxes - 1) {
923
+ finished = finishedCallback;
924
+ }
925
+ window.setTimeout((function() {
926
+ return box.animate(animationSetUp.apply(box), settings.speed / 1.3, '', finished);
927
+ }), 100 + animationTimeBuffer);
928
+ index++;
929
+ animationTimeBuffer += 20;
930
+ }
931
+ return column--;
932
+ })(row));
933
+ }
934
+ return _results2;
935
+ })(column));
936
+ }
937
+ return _results;
938
+ }, function() {
939
+ var boxes;
940
+ boxes = this;
941
+ if (sortCallback) {
942
+ boxes = sortCallback.call(this);
943
+ }
944
+ return boxes.as2dArray(settings.boxCols);
945
+ });
946
+ };
947
+ slideDownSlices = function(sortCallback) {
948
+ return animateSlices((function(index, element) {
949
+ this.css({
950
+ top: 0
951
+ });
952
+ return {
953
+ height: slider.height(),
954
+ opacity: '1'
955
+ };
956
+ }), sortCallback);
957
+ };
958
+ slideUpSlices = function(sortCallback) {
959
+ return animateSlices((function(index, element) {
960
+ this.css({
961
+ bottom: 0
962
+ });
963
+ return {
964
+ height: slider.height(),
965
+ opacity: '1'
966
+ };
967
+ }), sortCallback);
968
+ };
969
+ slideUpDownSlices = function(sortCallback) {
970
+ return animateSlices((function(index, element) {
971
+ this.css((index % 2 ? {
972
+ bottom: 0
973
+ } : {
974
+ top: 0
975
+ }));
976
+ return {
977
+ height: slider.height(),
978
+ opacity: '1'
979
+ };
980
+ }), sortCallback);
981
+ };
982
+ foldSlices = function(sortCallback) {
983
+ return animateSlices((function(index, element) {
984
+ var animateStyle, slice;
985
+ slice = $(element);
986
+ animateStyle = {
987
+ width: slice.width(),
988
+ opacity: '1'
989
+ };
990
+ slice.css({
991
+ top: 0,
992
+ height: '100%',
993
+ width: 0
994
+ });
995
+ return animateStyle;
996
+ }), sortCallback);
997
+ };
998
+ fadeSlices = function(sortCallback) {
999
+ return animateSlices((function(index, element) {
1000
+ this.css({
1001
+ height: slider.height()
1002
+ });
1003
+ return {
1004
+ opacity: '1'
1005
+ };
1006
+ }), sortCallback);
1007
+ };
1008
+ fadeBoxes = function(sortCallback) {
1009
+ return animateBoxes(function(finishedCallback) {
1010
+ var totalBoxes;
1011
+ totalBoxes = this.length;
1012
+ animationTimeBuffer = 0;
1013
+ return this.each(function(index) {
1014
+ var box, finished;
1015
+ box = $(this);
1016
+ if (index === totalBoxes - 1) {
1017
+ finished = finishedCallback;
1018
+ }
1019
+ window.setTimeout((function() {
1020
+ return box.animate({
1021
+ opacity: '1'
1022
+ }, settings.speed, '', finished);
1023
+ }), 100 + animationTimeBuffer);
1024
+ return animationTimeBuffer += 20;
1025
+ });
1026
+ }, sortCallback);
1027
+ };
1028
+ rainBoxes = function(sortCallback) {
1029
+ return animateBoxesIn2d((function() {
1030
+ return {
1031
+ opacity: '1'
1032
+ };
1033
+ }), sortCallback);
1034
+ };
1035
+ growBoxes = function(sortCallback) {
1036
+ return animateBoxesIn2d((function() {
1037
+ var height, width;
1038
+ width = this.width();
1039
+ height = this.height();
1040
+ this.css({
1041
+ width: 0,
1042
+ height: 0
1043
+ });
1044
+ return {
1045
+ opacity: '1',
1046
+ width: width,
1047
+ height: height
1048
+ };
1049
+ }), sortCallback);
1050
+ };
1051
+ getAnimationHelpers = function() {
1052
+ var animationHelpers;
1053
+ return animationHelpers = {
1054
+ setSliderBackground: setSliderBackground,
1055
+ currentSlideElement: vars.currentSlideElement,
1056
+ previousSlideElement: vars.previousSlideElement,
1057
+ raiseAnimationFinished: raiseAnimationFinished,
1058
+ settings: $.extend({}, settings),
1059
+ createSlices: function(slices, element) {
1060
+ return ramblingSliceGenerator.createSlices(slices, element);
1061
+ },
1062
+ createBoxes: function(rows, columns) {
1063
+ return ramblingBoxGenerator.createBoxes(rows, columns);
1064
+ },
1065
+ getOneSlice: function(element) {
1066
+ return ramblingSliceGenerator.getOneSlice(element);
1067
+ },
1068
+ animateFullImage: animateFullImage,
1069
+ animateSlices: animateSlices,
1070
+ animateBoxes: animateBoxes,
1071
+ animateBoxesIn2d: animateBoxesIn2d,
1072
+ slideUpSlices: slideUpSlices,
1073
+ slideDownSlices: slideDownSlices,
1074
+ slideUpDownSlices: slideUpDownSlices,
1075
+ foldSlices: foldSlices,
1076
+ fadeSlices: fadeSlices,
1077
+ fadeBoxes: fadeBoxes,
1078
+ rainBoxes: rainBoxes,
1079
+ growBoxes: growBoxes
1080
+ };
1081
+ };
1082
+ ramblingRun = function(slider, children, settings, nudge) {
1083
+ if (vars.currentSlide === vars.totalSlides - 1) {
1084
+ settings.lastSlide.call(this);
1085
+ }
1086
+ if (vars.stopped && !nudge) {
1087
+ return false;
1088
+ }
1089
+ settings.beforeChange.call(this);
1090
+ vars.currentSlide = (vars.currentSlide + 1) % vars.totalSlides;
1091
+ if (vars.currentSlide === 0) {
1092
+ settings.slideshowEnd.call(this);
1093
+ }
1094
+ if (vars.currentSlide < 0) {
1095
+ vars.currentSlide = vars.totalSlides + vars.currentSlide;
1096
+ }
1097
+ setCurrentSlideElement(children);
1098
+ if (settings.controlNav) {
1099
+ slider.find('.rambling-controlNav a').removeClass('active').filter(":eq(" + vars.currentSlide + ")").addClass('active');
1100
+ }
1101
+ processCaption(settings);
1102
+ vars.running = true;
1103
+ return getRandomAnimation().call(getAnimationHelpers());
1104
+ };
1105
+ settings.afterLoad.call(this);
1106
+ return this;
1107
+ };
1108
+ })(jQuery);
1109
+ (function($) {
1110
+ var allAroundTransitions, animationFullImageOptions, boxTransitions, flashHorizontalSlideIn, flashSlideIn, name, transitions, value, _fn;
1111
+ allAroundTransitions = [
1112
+ {
1113
+ name: 'sliceUp',
1114
+ helper: 'slideUpSlices'
1115
+ }, {
1116
+ name: 'sliceDown',
1117
+ helper: 'slideDownSlices'
1118
+ }, {
1119
+ name: 'sliceUpDown',
1120
+ helper: 'slideUpDownSlices'
1121
+ }, {
1122
+ name: 'sliceFade',
1123
+ helper: 'fadeSlices'
1124
+ }, {
1125
+ name: 'fold',
1126
+ helper: 'foldSlices'
1127
+ }
1128
+ ];
1129
+ allAroundTransitions.suffixes = [
1130
+ {
1131
+ name: 'Right',
1132
+ sorter: void 0
1133
+ }, {
1134
+ name: 'Left',
1135
+ sorter: $.fn.reverse
1136
+ }, {
1137
+ name: 'OutIn',
1138
+ sorter: $.fn.sortOutIn
1139
+ }, {
1140
+ name: 'InOut',
1141
+ sorter: $.fn.sortInOut
1142
+ }, {
1143
+ name: 'Random',
1144
+ sorter: $.fn.shuffle
1145
+ }
1146
+ ];
1147
+ boxTransitions = [
1148
+ {
1149
+ name: 'boxRain',
1150
+ helper: 'rainBoxes'
1151
+ }, {
1152
+ name: 'boxGrow',
1153
+ helper: 'growBoxes'
1154
+ }
1155
+ ];
1156
+ boxTransitions.suffixes = [
1157
+ {
1158
+ name: 'Forward',
1159
+ sorter: void 0
1160
+ }, {
1161
+ name: 'Reverse',
1162
+ sorter: $.fn.reverse
1163
+ }, {
1164
+ name: 'OutIn',
1165
+ sorter: $.fn.sortOutIn
1166
+ }, {
1167
+ name: 'InOut',
1168
+ sorter: $.fn.sortInOut
1169
+ }, {
1170
+ name: 'Random',
1171
+ sorter: $.fn.shuffle
1172
+ }
1173
+ ];
1174
+ transitions = [allAroundTransitions, boxTransitions];
1175
+ animationFullImageOptions = {
1176
+ fadeIn: function(slider) {
1177
+ this.css({
1178
+ height: '100%',
1179
+ width: slider.width(),
1180
+ position: 'absolute',
1181
+ top: 0,
1182
+ left: 0
1183
+ });
1184
+ return {
1185
+ opacity: '1'
1186
+ };
1187
+ },
1188
+ fadeOut: function(slider) {
1189
+ this.css({
1190
+ height: '100%',
1191
+ width: slider.width(),
1192
+ position: 'absolute',
1193
+ top: 0,
1194
+ left: 0
1195
+ });
1196
+ return {
1197
+ opacity: '1'
1198
+ };
1199
+ },
1200
+ rolloverRight: function() {
1201
+ this.css({
1202
+ height: '100%',
1203
+ width: 0,
1204
+ opacity: '1'
1205
+ });
1206
+ },
1207
+ rolloverLeft: function(slider, settings) {
1208
+ this.css({
1209
+ height: '100%',
1210
+ width: 0,
1211
+ opacity: '1',
1212
+ left: 'auto',
1213
+ right: 0
1214
+ });
1215
+ this.find('img').css({
1216
+ left: -slider.width()
1217
+ }).animate({
1218
+ left: 0
1219
+ }, settings.speed * 2);
1220
+ return {
1221
+ width: slider.width()
1222
+ };
1223
+ },
1224
+ slideInRight: function(slider, settings) {
1225
+ this.css({
1226
+ height: '100%',
1227
+ width: 0,
1228
+ opacity: '1'
1229
+ });
1230
+ this.find('img').css({
1231
+ left: -slider.width()
1232
+ }).animate({
1233
+ left: 0
1234
+ }, settings.speed * 2);
1235
+ return {
1236
+ width: slider.width()
1237
+ };
1238
+ },
1239
+ slideInLeft: function(slider) {
1240
+ var finishedHandler;
1241
+ this.css({
1242
+ height: '100%',
1243
+ width: 0,
1244
+ opacity: '1',
1245
+ left: 'auto',
1246
+ right: 0
1247
+ });
1248
+ finishedHandler = __bind(function() {
1249
+ this.css({
1250
+ left: 0,
1251
+ right: 'auto'
1252
+ });
1253
+ return slider.unbind('rambling:finished', finishedHandler);
1254
+ }, this);
1255
+ slider.bind('rambling:finished', finishedHandler);
1256
+ }
1257
+ };
1258
+ flashSlideIn = function(beforeAnimation, animateStyle, afterAnimation) {
1259
+ this.currentSlideElement.css(beforeAnimation);
1260
+ return window.setTimeout((__bind(function() {
1261
+ return this.currentSlideElement.animate(animateStyle, this.settings.speed * 2, this.raiseAnimationFinished);
1262
+ }, this)), this.settings.speed * 2);
1263
+ };
1264
+ flashHorizontalSlideIn = function(initialLeft) {
1265
+ var afterAnimation, beforeAnimation;
1266
+ beforeAnimation = {
1267
+ top: (this.settings.alignBottom ? 'auto' : 0),
1268
+ bottom: (this.settings.alignBottom ? 0 : 'auto'),
1269
+ left: initialLeft,
1270
+ position: 'absolute',
1271
+ display: 'block'
1272
+ };
1273
+ afterAnimation = {
1274
+ top: 'auto',
1275
+ left: 'auto',
1276
+ position: 'relative'
1277
+ };
1278
+ return flashSlideIn.apply(this, [
1279
+ beforeAnimation, {
1280
+ left: 0
1281
+ }, afterAnimation
1282
+ ]);
1283
+ };
1284
+ $.fn.ramblingSlider.defaults.imageTransitions = {};
1285
+ $.each(transitions, function(index, group) {
1286
+ return $.each(group, function(index, transition) {
1287
+ return $.each(group.suffixes, function(index, suffix) {
1288
+ return $.fn.ramblingSlider.defaults.imageTransitions["" + transition.name + suffix.name] = function() {
1289
+ return this[transition.helper](suffix.sorter);
1290
+ };
1291
+ });
1292
+ });
1293
+ });
1294
+ _fn = function(name, value) {
1295
+ return $.fn.ramblingSlider.defaults.imageTransitions[name] = function() {
1296
+ return this.animateFullImage(value);
1297
+ };
1298
+ };
1299
+ for (name in animationFullImageOptions) {
1300
+ value = animationFullImageOptions[name];
1301
+ _fn(name, value);
1302
+ }
1303
+ $.fn.ramblingSlider.defaults.imageFlashTransitions = {
1304
+ fadeOut: function() {
1305
+ var self, slice;
1306
+ slice = this.getOneSlice(this.previousSlideElement);
1307
+ slice.css({
1308
+ height: '100%',
1309
+ width: slice.parents('.ramblingSlider').width(),
1310
+ position: 'absolute',
1311
+ top: 0,
1312
+ left: 0,
1313
+ opacity: '1'
1314
+ });
1315
+ this.setSliderBackground();
1316
+ self = this;
1317
+ return slice.animate({
1318
+ opacity: '0'
1319
+ }, this.settings.speed * 2, '', function() {
1320
+ slice.css({
1321
+ display: 'none'
1322
+ });
1323
+ return self.raiseAnimationFinished();
1324
+ });
1325
+ }
1326
+ };
1327
+ $.fn.ramblingSlider.defaults.flashTransitions = {
1328
+ slideInRight: function() {
1329
+ return flashHorizontalSlideIn.apply(this, [-this.currentSlideElement.parents('.ramblingSlider').width()]);
1330
+ },
1331
+ slideInLeft: function() {
1332
+ return flashHorizontalSlideIn.apply(this, [this.currentSlideElement.parents('.ramblingSlider').width()]);
1333
+ }
1334
+ };
1335
+ $.extend($.fn.ramblingSlider.defaults.imageFlashTransitions, $.fn.ramblingSlider.defaults.flashTransitions);
1336
+ $.fn.ramblingSlider.defaults.transitionGroups = ['fade', 'rollover', 'slideIn'];
1337
+ $.each(transitions, function(index, group) {
1338
+ return $.each(group, function(index, element) {
1339
+ return $.fn.ramblingSlider.defaults.transitionGroups.push(element.name);
1340
+ });
1341
+ });
1342
+ return $.fn.ramblingSlider.defaults.transitionGroupSuffixes = ['Right', 'Left', 'OutIn', 'InOut', 'Random', 'Forward', 'Reverse', 'In', 'Out'];
1343
+ })(jQuery);
1344
+ String.prototype.contains = function(string) {
1345
+ return this.indexOf(string) !== -1;
1346
+ };
1347
+ String.prototype.decapitalize = function() {
1348
+ var first, rest;
1349
+ first = this.slice(0, 1);
1350
+ rest = this.slice(1);
1351
+ return "" + (first.toLowerCase()) + rest;
1352
+ };
1353
+ String.prototype.startsWith = function(string) {
1354
+ return this.substring(0, string.length) === string;
1355
+ };
1356
+ String.prototype.endsWith = function(string) {
1357
+ return this.substring(this.length - string.length, this.length) === string;
1358
+ };
1359
+ }).call(this);