nivo_slider 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ OTVjZGY0MDQxZDE4OTg4MTVmNGE1OTdmNDNhNDhjNzlhODM1NWQyNQ==
5
+ data.tar.gz: !binary |-
6
+ ZGJkNjYwNjJiODUxOGRjODY3ZGZiZjE3MmRmNjIzODI3MzEwYmE0Mg==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ NDAzOWNlYTNhYjllYTM0ZjUxMmFkMGVjMzc5N2QzMjYwYzEyNTlmMjhlZDM2
10
+ ZWRiMDNiMTc3NGRiY2ZkNmMyZTZhYTgwOGM3NjVmNTE3ZmJiYTc0ODkxODk1
11
+ NmQ4ZjdlN2MyZDYwNGU1YjVlNTkzYWJlNzM2ZDVhOTVkYjI4MGQ=
12
+ data.tar.gz: !binary |-
13
+ N2MzZDBmY2MwMDZhNWI1YzVkMzgyYzY0YmUyZDdlNDQ1M2FhMjAwOWYzMWEy
14
+ M2ExYzJiNjJmYmQ0YmI3NzM1ZGY3Y2Y2N2YxOWZmNDkwMWU4NDc4ZDBkMzk2
15
+ YWM3NWU0NTI1OGRlMjJmNTU1MTQyZmJlZGU1ODkzMjZjOTQ0MDY=
data/README.md ADDED
@@ -0,0 +1,45 @@
1
+ slim_scroll is a small jQuery plugin gem that transforms any div into a scrollable area with a nice scrollbar - similar to the one Facebook and Google started using in their products recently. slim_scroll doesn't occupy any visual space as it only appears on a user initiated mouse-over. User can drag the scrollbar or use mouse-wheel to change the scroll value..
2
+
3
+ ## Setup
4
+
5
+ Add the gem to your Gemfile and run the `bundle` command to install it.
6
+
7
+ ```ruby
8
+ gem "slim_scroll"
9
+ ```
10
+
11
+ Run the generator to create the initial files.
12
+
13
+ ```
14
+ rails g slim_scroll:install
15
+ ```
16
+ **In Rails 3.1** add the JavaScript file to your application.js file manifest.
17
+
18
+ ```javascript
19
+ //= require slim_scroll
20
+ ```
21
+
22
+
23
+ **In Rails 3.0** add the generated slim_scroll file to your layout.
24
+
25
+ ```rhtml
26
+ <%= javascript_include_tag "slim_scroll" %>
27
+
28
+ ## Usage
29
+ Slim scroll provide various option to for user
30
+ ```rhtml
31
+ <%= subscribe_to "/messages/new" %>
32
+ ```
33
+ Use the `publish_to` helper method to send JavaScript to that channel. This is usually done in a JavaScript AJAX template (such as a create.js.erb file).
34
+
35
+ ```rhtml
36
+ <% publish_to "/messages/new" do %>
37
+ $("#chat").append("<%= j render(@messages) %>");
38
+ <% end %>
39
+ ```
40
+
41
+ This JavaScript will be immediately evaluated on all clients who have subscribed to that channel. In this example they will see the new chat message appear in real-time without reloading the browser.
42
+
43
+ ## Development & Feedback
44
+
45
+ Questions or comments? Please use the [issue tracker](https://github.com/ciserfan/slim_scroll/issues). Tests can be run with `bundle` and `rake` commands.
@@ -0,0 +1,8 @@
1
+ Description:
2
+ Setup jQuerylive assets on your application
3
+
4
+ Example:
5
+ rails g livequery:install
6
+
7
+ This will replace the default application assets:
8
+ /app/assets/javascripts/application.js
@@ -0,0 +1,58 @@
1
+ require 'rails'
2
+
3
+ # Supply generator for Rails 3.0.x or if asset pipeline is not enabled
4
+ if ::Rails.version < "3.1"
5
+ module NivoSlider
6
+ module Generators
7
+ class InstallGenerator < ::Rails::Generators::Base
8
+ desc "This generator installs Nivo slider"
9
+ source_root File.expand_path('../../../../../vendor/assets/', __FILE__)
10
+ def copy_nivo_slider
11
+ say_status("copying", "nivo_slider", :green)
12
+ copy_file "javascripts/jquery.nivo.slider.js", "public/javascripts/jquery.nivo.slider.js"
13
+ copy_file "javascripts/jquery.nivo.slider.pack.js", "public/javascripts/jquery.nivo.slider.pack.js"
14
+ copy_file "stylesheets/nivo-slider.css", "public/stylesheets/nivo-slider.css"
15
+ copy_file "stylesheets/nivo_default.css", "public/stylesheets/nivo_default.css"
16
+ copy_file "images/arrows.png", "public/images/arrows.png"
17
+ copy_file "images/bullets.png", "public/images/bullets.png"
18
+ copy_file "images/loading.gif", "public/images/loading.gif"
19
+ end
20
+ end
21
+ end
22
+ end
23
+ else
24
+ module NivoSlider
25
+ module Generators
26
+ class InstallGenerator < ::Rails::Generators::Base
27
+ desc "This generator add nivo slider to application.js or application.js.coffee"
28
+ source_root File.expand_path('../../../../../vendor/assets/', __FILE__)
29
+ def add_assets
30
+ js_manifest = 'app/assets/javascripts/application.js'
31
+ if File.exist?(js_manifest)
32
+ insert_into_file js_manifest, "//= require jquery.nivo.slider\n", :after => "jquery_ujs\n"
33
+ else
34
+ copy_file "application.js", js_manifest
35
+ end
36
+ css_manifest = 'app/assets/stylesheets/application.css'
37
+ if File.exist?(css_manifest)
38
+ # Add our own require:
39
+ content = File.read(css_manifest)
40
+ if content.match(/require_tree\s+\.\s*$/)
41
+ # Good enough - that'll include our bootstrap_and_overrides.css.less
42
+ else
43
+ insert_into_file css_manifest, " *= require nivo_default\n", :after => "require_self\n"
44
+ insert_into_file css_manifest, " *= require nivo-slider\n", :after => "require_self\n"
45
+ end
46
+ else
47
+ copy_file "application.css", "app/assets/stylesheets/application.css"
48
+ end
49
+
50
+ end
51
+ def detect_js_format
52
+ return ['.js.coffee', '#='] if File.exist?('app/assets/javascripts/application.js.coffee')
53
+ return ['.js', '//='] if File.exist?('app/assets/javascripts/application.js')
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,25 @@
1
+ module ActionDispatch
2
+ module Assertions
3
+ module SelectorAssertions
4
+
5
+ PATTERN_HTML = %Q{"((\\\\\"|[^\"])*)"}
6
+ PATTERN_UNICODE_ESCAPED_CHAR = /\\u([0-9a-zA-Z]{4})/
7
+
8
+ private
9
+
10
+ # Unescapes a JS string.
11
+ def unescape_js(js_string)
12
+ # js encodes double quotes and line breaks.
13
+ unescaped= js_string.gsub('\"', '"')
14
+ unescaped.gsub!('\\\'', "'")
15
+ unescaped.gsub!(/\\\//, '/')
16
+ unescaped.gsub!('\n', "\n")
17
+ unescaped.gsub!('\076', '>')
18
+ unescaped.gsub!('\074', '<')
19
+ # js encodes non-ascii characters.
20
+ unescaped.gsub!(PATTERN_UNICODE_ESCAPED_CHAR) {|u| [$1.hex].pack('U*')}
21
+ unescaped
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,6 @@
1
+ module NivoSlider
2
+ module Rails
3
+ class Engine < ::Rails::Engine
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,13 @@
1
+ # Used to ensure that Rails 3.0.x, as well as Rails >= 3.1 with asset pipeline disabled
2
+ # get the minified version of the scripts included into the layout in production.
3
+ module NivoSlider
4
+ module Rails
5
+ class Railtie < ::Rails::Railtie
6
+ config.before_configuration do
7
+ if config.action_view.javascript_expansions
8
+ nivo_slider_defaults = ::Rails.env.production? || ::Rails.env.test? ? %w(jquery.nivo.slider.pack) : %w(jquery.nivo.slider)
9
+ end
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,8 @@
1
+ require 'rails'
2
+ require 'nivo_slider/assert_select' if ::Rails.env.test?
3
+ require 'nivo_slider/rails/engine' if ::Rails.version >= '3.1'
4
+ require 'nivo_slider/rails/railtie'
5
+ module NivoSlider
6
+ module Rails
7
+ end
8
+ end
@@ -0,0 +1 @@
1
+ require 'nivo_slider/rails'
Binary file
Binary file
Binary file
@@ -0,0 +1,662 @@
1
+ /*
2
+ * jQuery Nivo Slider v3.2
3
+ * http://nivo.dev7studios.com
4
+ *
5
+ * Copyright 2012, Dev7studios
6
+ * Free to use and abuse under the MIT license.
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ */
9
+
10
+ (function($) {
11
+ var NivoSlider = function(element, options){
12
+ // Defaults are below
13
+ var settings = $.extend({}, $.fn.nivoSlider.defaults, options);
14
+
15
+ // Useful variables. Play carefully.
16
+ var vars = {
17
+ currentSlide: 0,
18
+ currentImage: '',
19
+ totalSlides: 0,
20
+ running: false,
21
+ paused: false,
22
+ stop: false,
23
+ controlNavEl: false
24
+ };
25
+ console.log(vars);
26
+ // Get this slider
27
+ var slider = $(element);
28
+ slider.data('nivo:vars', vars).addClass('nivoSlider');
29
+
30
+ // Find our slider children
31
+ var kids = slider.children();
32
+ kids.each(function() {
33
+ var child = $(this);
34
+ var link = '';
35
+ if(!child.is('img')){
36
+ if(child.is('a')){
37
+ child.addClass('nivo-imageLink');
38
+ link = child;
39
+ }
40
+ child = child.find('img:first');
41
+ }
42
+ // Get img width & height
43
+ var childWidth = (childWidth === 0) ? child.attr('width') : child.width(),
44
+ childHeight = (childHeight === 0) ? child.attr('height') : child.height();
45
+
46
+ if(link !== ''){
47
+ link.css('display','none');
48
+ }
49
+ child.css('display','none');
50
+ vars.totalSlides++;
51
+ });
52
+
53
+ // If randomStart
54
+ if(settings.randomStart){
55
+ settings.startSlide = Math.floor(Math.random() * vars.totalSlides);
56
+ }
57
+
58
+ // Set startSlide
59
+ if(settings.startSlide > 0){
60
+ if(settings.startSlide >= vars.totalSlides) { settings.startSlide = vars.totalSlides - 1; }
61
+ vars.currentSlide = settings.startSlide;
62
+ }
63
+
64
+ // Get initial image
65
+ if($(kids[vars.currentSlide]).is('img')){
66
+ vars.currentImage = $(kids[vars.currentSlide]);
67
+ } else {
68
+ vars.currentImage = $(kids[vars.currentSlide]).find('img:first');
69
+ }
70
+
71
+ // Show initial link
72
+ if($(kids[vars.currentSlide]).is('a')){
73
+ $(kids[vars.currentSlide]).css('display','block');
74
+ }
75
+
76
+ // Set first background
77
+ var sliderImg = $('<img/>').addClass('nivo-main-image');
78
+ sliderImg.attr('src', vars.currentImage.attr('src')).show();
79
+ slider.append(sliderImg);
80
+
81
+ // Detect Window Resize
82
+ $(window).resize(function() {
83
+ slider.children('img').width(slider.width());
84
+ sliderImg.attr('src', vars.currentImage.attr('src'));
85
+ sliderImg.stop().height('auto');
86
+ $('.nivo-slice').remove();
87
+ $('.nivo-box').remove();
88
+ });
89
+
90
+ //Create caption
91
+ slider.append($('<div class="nivo-caption"></div>'));
92
+
93
+ // Process caption function
94
+ var processCaption = function(settings){
95
+ var nivoCaption = $('.nivo-caption', slider);
96
+ if(vars.currentImage.attr('title') != '' && vars.currentImage.attr('title') != undefined){
97
+ var title = vars.currentImage.attr('title');
98
+ if(title.substr(0,1) == '#') title = $(title).html();
99
+
100
+ if(nivoCaption.css('display') == 'block'){
101
+ setTimeout(function(){
102
+ nivoCaption.html(title);
103
+ }, settings.animSpeed);
104
+ } else {
105
+ nivoCaption.html(title);
106
+ nivoCaption.stop().fadeIn(settings.animSpeed);
107
+ }
108
+ } else {
109
+ nivoCaption.stop().fadeOut(settings.animSpeed);
110
+ }
111
+ }
112
+
113
+ //Process initial caption
114
+ processCaption(settings);
115
+
116
+ // In the words of Super Mario "let's a go!"
117
+ var timer = 0;
118
+ if(!settings.manualAdvance && kids.length > 1){
119
+ timer = setInterval(function(){ nivoRun(slider, kids, settings, false); }, settings.pauseTime);
120
+ }
121
+
122
+ // Add Direction nav
123
+ if(settings.directionNav){
124
+ slider.append('<div class="nivo-directionNav"><a class="nivo-prevNav">'+ settings.prevText +'</a><a class="nivo-nextNav">'+ settings.nextText +'</a></div>');
125
+
126
+ $(slider).on('click', 'a.nivo-prevNav', function(){
127
+ if(vars.running) { return false; }
128
+ clearInterval(timer);
129
+ timer = '';
130
+ vars.currentSlide -= 2;
131
+ nivoRun(slider, kids, settings, 'prev');
132
+ });
133
+
134
+ $(slider).on('click', 'a.nivo-nextNav', function(){
135
+ if(vars.running) { return false; }
136
+ clearInterval(timer);
137
+ timer = '';
138
+ nivoRun(slider, kids, settings, 'next');
139
+ });
140
+ }
141
+
142
+ // Add Control nav
143
+ if(settings.controlNav){
144
+ vars.controlNavEl = $('<div class="nivo-controlNav"></div>');
145
+ slider.after(vars.controlNavEl);
146
+ for(var i = 0; i < kids.length; i++){
147
+ if(settings.controlNavThumbs){
148
+ vars.controlNavEl.addClass('nivo-thumbs-enabled');
149
+ var child = kids.eq(i);
150
+ if(!child.is('img')){
151
+ child = child.find('img:first');
152
+ }
153
+ if(child.attr('data-thumb')) vars.controlNavEl.append('<a class="nivo-control" rel="'+ i +'"><img src="'+ child.attr('data-thumb') +'" alt="" /></a>');
154
+ } else {
155
+ vars.controlNavEl.append('<a class="nivo-control" rel="'+ i +'">'+ (i + 1) +'</a>');
156
+ }
157
+ }
158
+
159
+ //Set initial active link
160
+ $('a:eq('+ vars.currentSlide +')', vars.controlNavEl).addClass('active');
161
+
162
+ $('a', vars.controlNavEl).bind('click', function(){
163
+ if(vars.running) return false;
164
+ if($(this).hasClass('active')) return false;
165
+ clearInterval(timer);
166
+ timer = '';
167
+ sliderImg.attr('src', vars.currentImage.attr('src'));
168
+ vars.currentSlide = $(this).attr('rel') - 1;
169
+ nivoRun(slider, kids, settings, 'control');
170
+ });
171
+ }
172
+
173
+ //For pauseOnHover setting
174
+ if(settings.pauseOnHover){
175
+ slider.hover(function(){
176
+ vars.paused = true;
177
+ clearInterval(timer);
178
+ timer = '';
179
+ }, function(){
180
+ vars.paused = false;
181
+ // Restart the timer
182
+ if(timer === '' && !settings.manualAdvance){
183
+ timer = setInterval(function(){ nivoRun(slider, kids, settings, false); }, settings.pauseTime);
184
+ }
185
+ });
186
+ }
187
+
188
+ // Event when Animation finishes
189
+ slider.bind('nivo:animFinished', function(){
190
+ sliderImg.attr('src', vars.currentImage.attr('src'));
191
+ vars.running = false;
192
+ // Hide child links
193
+ $(kids).each(function(){
194
+ if($(this).is('a')){
195
+ $(this).css('display','none');
196
+ }
197
+ });
198
+ // Show current link
199
+ if($(kids[vars.currentSlide]).is('a')){
200
+ $(kids[vars.currentSlide]).css('display','block');
201
+ }
202
+ // Restart the timer
203
+ if(timer === '' && !vars.paused && !settings.manualAdvance){
204
+ timer = setInterval(function(){ nivoRun(slider, kids, settings, false); }, settings.pauseTime);
205
+ }
206
+ // Trigger the afterChange callback
207
+ settings.afterChange.call(this);
208
+ });
209
+
210
+ // Add slices for slice animations
211
+ var createSlices = function(slider, settings, vars) {
212
+ if($(vars.currentImage).parent().is('a')) $(vars.currentImage).parent().css('display','block');
213
+ $('img[src="'+ vars.currentImage.attr('src') +'"]', slider).not('.nivo-main-image,.nivo-control img').width(slider.width()).css('visibility', 'hidden').show();
214
+ var sliceHeight = ($('img[src="'+ vars.currentImage.attr('src') +'"]', slider).not('.nivo-main-image,.nivo-control img').parent().is('a')) ? $('img[src="'+ vars.currentImage.attr('src') +'"]', slider).not('.nivo-main-image,.nivo-control img').parent().height() : $('img[src="'+ vars.currentImage.attr('src') +'"]', slider).not('.nivo-main-image,.nivo-control img').height();
215
+
216
+ for(var i = 0; i < settings.slices; i++){
217
+ var sliceWidth = Math.round(slider.width()/settings.slices);
218
+
219
+ if(i === settings.slices-1){
220
+ slider.append(
221
+ $('<div class="nivo-slice" name="'+i+'"><img src="'+ vars.currentImage.attr('src') +'" style="position:absolute; width:'+ slider.width() +'px; height:auto; display:block !important; top:0; left:-'+ ((sliceWidth + (i * sliceWidth)) - sliceWidth) +'px;" /></div>').css({
222
+ left:(sliceWidth*i)+'px',
223
+ width:(slider.width()-(sliceWidth*i))+'px',
224
+ height:sliceHeight+'px',
225
+ opacity:'0',
226
+ overflow:'hidden'
227
+ })
228
+ );
229
+ } else {
230
+ slider.append(
231
+ $('<div class="nivo-slice" name="'+i+'"><img src="'+ vars.currentImage.attr('src') +'" style="position:absolute; width:'+ slider.width() +'px; height:auto; display:block !important; top:0; left:-'+ ((sliceWidth + (i * sliceWidth)) - sliceWidth) +'px;" /></div>').css({
232
+ left:(sliceWidth*i)+'px',
233
+ width:sliceWidth+'px',
234
+ height:sliceHeight+'px',
235
+ opacity:'0',
236
+ overflow:'hidden'
237
+ })
238
+ );
239
+ }
240
+ }
241
+
242
+ $('.nivo-slice', slider).height(sliceHeight);
243
+ sliderImg.stop().animate({
244
+ height: $(vars.currentImage).height()
245
+ }, settings.animSpeed);
246
+ };
247
+
248
+ // Add boxes for box animations
249
+ var createBoxes = function(slider, settings, vars){
250
+ if($(vars.currentImage).parent().is('a')) $(vars.currentImage).parent().css('display','block');
251
+ $('img[src="'+ vars.currentImage.attr('src') +'"]', slider).not('.nivo-main-image,.nivo-control img').width(slider.width()).css('visibility', 'hidden').show();
252
+ var boxWidth = Math.round(slider.width()/settings.boxCols),
253
+ boxHeight = Math.round($('img[src="'+ vars.currentImage.attr('src') +'"]', slider).not('.nivo-main-image,.nivo-control img').height() / settings.boxRows);
254
+
255
+
256
+ for(var rows = 0; rows < settings.boxRows; rows++){
257
+ for(var cols = 0; cols < settings.boxCols; cols++){
258
+ if(cols === settings.boxCols-1){
259
+ slider.append(
260
+ $('<div class="nivo-box" name="'+ cols +'" rel="'+ rows +'"><img src="'+ vars.currentImage.attr('src') +'" style="position:absolute; width:'+ slider.width() +'px; height:auto; display:block; top:-'+ (boxHeight*rows) +'px; left:-'+ (boxWidth*cols) +'px;" /></div>').css({
261
+ opacity:0,
262
+ left:(boxWidth*cols)+'px',
263
+ top:(boxHeight*rows)+'px',
264
+ width:(slider.width()-(boxWidth*cols))+'px'
265
+
266
+ })
267
+ );
268
+ $('.nivo-box[name="'+ cols +'"]', slider).height($('.nivo-box[name="'+ cols +'"] img', slider).height()+'px');
269
+ } else {
270
+ slider.append(
271
+ $('<div class="nivo-box" name="'+ cols +'" rel="'+ rows +'"><img src="'+ vars.currentImage.attr('src') +'" style="position:absolute; width:'+ slider.width() +'px; height:auto; display:block; top:-'+ (boxHeight*rows) +'px; left:-'+ (boxWidth*cols) +'px;" /></div>').css({
272
+ opacity:0,
273
+ left:(boxWidth*cols)+'px',
274
+ top:(boxHeight*rows)+'px',
275
+ width:boxWidth+'px'
276
+ })
277
+ );
278
+ $('.nivo-box[name="'+ cols +'"]', slider).height($('.nivo-box[name="'+ cols +'"] img', slider).height()+'px');
279
+ }
280
+ }
281
+ }
282
+
283
+ sliderImg.stop().animate({
284
+ height: $(vars.currentImage).height()
285
+ }, settings.animSpeed);
286
+ };
287
+
288
+ // Private run method
289
+ var nivoRun = function(slider, kids, settings, nudge){
290
+ // Get our vars
291
+ var vars = slider.data('nivo:vars');
292
+
293
+ // Trigger the lastSlide callback
294
+ if(vars && (vars.currentSlide === vars.totalSlides - 1)){
295
+ settings.lastSlide.call(this);
296
+ }
297
+
298
+ // Stop
299
+ if((!vars || vars.stop) && !nudge) { return false; }
300
+
301
+ // Trigger the beforeChange callback
302
+ settings.beforeChange.call(this);
303
+
304
+ // Set current background before change
305
+ if(!nudge){
306
+ sliderImg.attr('src', vars.currentImage.attr('src'));
307
+ } else {
308
+ if(nudge === 'prev'){
309
+ sliderImg.attr('src', vars.currentImage.attr('src'));
310
+ }
311
+ if(nudge === 'next'){
312
+ sliderImg.attr('src', vars.currentImage.attr('src'));
313
+ }
314
+ }
315
+
316
+ vars.currentSlide++;
317
+ // Trigger the slideshowEnd callback
318
+ if(vars.currentSlide === vars.totalSlides){
319
+ vars.currentSlide = 0;
320
+ settings.slideshowEnd.call(this);
321
+ }
322
+ if(vars.currentSlide < 0) { vars.currentSlide = (vars.totalSlides - 1); }
323
+ // Set vars.currentImage
324
+ if($(kids[vars.currentSlide]).is('img')){
325
+ vars.currentImage = $(kids[vars.currentSlide]);
326
+ } else {
327
+ vars.currentImage = $(kids[vars.currentSlide]).find('img:first');
328
+ }
329
+
330
+ // Set active links
331
+ if(settings.controlNav){
332
+ $('a', vars.controlNavEl).removeClass('active');
333
+ $('a:eq('+ vars.currentSlide +')', vars.controlNavEl).addClass('active');
334
+ }
335
+
336
+ // Process caption
337
+ processCaption(settings);
338
+
339
+ // Remove any slices from last transition
340
+ $('.nivo-slice', slider).remove();
341
+
342
+ // Remove any boxes from last transition
343
+ $('.nivo-box', slider).remove();
344
+
345
+ var currentEffect = settings.effect,
346
+ anims = '';
347
+
348
+ // Generate random effect
349
+ if(settings.effect === 'random'){
350
+ anims = new Array('sliceDownRight','sliceDownLeft','sliceUpRight','sliceUpLeft','sliceUpDown','sliceUpDownLeft','fold','fade',
351
+ 'boxRandom','boxRain','boxRainReverse','boxRainGrow','boxRainGrowReverse');
352
+ currentEffect = anims[Math.floor(Math.random()*(anims.length + 1))];
353
+ if(currentEffect === undefined) { currentEffect = 'fade'; }
354
+ }
355
+
356
+ // Run random effect from specified set (eg: effect:'fold,fade')
357
+ if(settings.effect.indexOf(',') !== -1){
358
+ anims = settings.effect.split(',');
359
+ currentEffect = anims[Math.floor(Math.random()*(anims.length))];
360
+ if(currentEffect === undefined) { currentEffect = 'fade'; }
361
+ }
362
+
363
+ // Custom transition as defined by "data-transition" attribute
364
+ if(vars.currentImage.attr('data-transition')){
365
+ currentEffect = vars.currentImage.attr('data-transition');
366
+ }
367
+
368
+ // Run effects
369
+ vars.running = true;
370
+ var timeBuff = 0,
371
+ i = 0,
372
+ slices = '',
373
+ firstSlice = '',
374
+ totalBoxes = '',
375
+ boxes = '';
376
+
377
+ if(currentEffect === 'sliceDown' || currentEffect === 'sliceDownRight' || currentEffect === 'sliceDownLeft'){
378
+ createSlices(slider, settings, vars);
379
+ timeBuff = 0;
380
+ i = 0;
381
+ slices = $('.nivo-slice', slider);
382
+ if(currentEffect === 'sliceDownLeft') { slices = $('.nivo-slice', slider)._reverse(); }
383
+
384
+ slices.each(function(){
385
+ var slice = $(this);
386
+ slice.css({ 'top': '0px' });
387
+ if(i === settings.slices-1){
388
+ setTimeout(function(){
389
+ slice.animate({opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); });
390
+ }, (100 + timeBuff));
391
+ } else {
392
+ setTimeout(function(){
393
+ slice.animate({opacity:'1.0' }, settings.animSpeed);
394
+ }, (100 + timeBuff));
395
+ }
396
+ timeBuff += 50;
397
+ i++;
398
+ });
399
+ } else if(currentEffect === 'sliceUp' || currentEffect === 'sliceUpRight' || currentEffect === 'sliceUpLeft'){
400
+ createSlices(slider, settings, vars);
401
+ timeBuff = 0;
402
+ i = 0;
403
+ slices = $('.nivo-slice', slider);
404
+ if(currentEffect === 'sliceUpLeft') { slices = $('.nivo-slice', slider)._reverse(); }
405
+
406
+ slices.each(function(){
407
+ var slice = $(this);
408
+ slice.css({ 'bottom': '0px' });
409
+ if(i === settings.slices-1){
410
+ setTimeout(function(){
411
+ slice.animate({opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); });
412
+ }, (100 + timeBuff));
413
+ } else {
414
+ setTimeout(function(){
415
+ slice.animate({opacity:'1.0' }, settings.animSpeed);
416
+ }, (100 + timeBuff));
417
+ }
418
+ timeBuff += 50;
419
+ i++;
420
+ });
421
+ } else if(currentEffect === 'sliceUpDown' || currentEffect === 'sliceUpDownRight' || currentEffect === 'sliceUpDownLeft'){
422
+ createSlices(slider, settings, vars);
423
+ timeBuff = 0;
424
+ i = 0;
425
+ var v = 0;
426
+ slices = $('.nivo-slice', slider);
427
+ if(currentEffect === 'sliceUpDownLeft') { slices = $('.nivo-slice', slider)._reverse(); }
428
+
429
+ slices.each(function(){
430
+ var slice = $(this);
431
+ if(i === 0){
432
+ slice.css('top','0px');
433
+ i++;
434
+ } else {
435
+ slice.css('bottom','0px');
436
+ i = 0;
437
+ }
438
+
439
+ if(v === settings.slices-1){
440
+ setTimeout(function(){
441
+ slice.animate({opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); });
442
+ }, (100 + timeBuff));
443
+ } else {
444
+ setTimeout(function(){
445
+ slice.animate({opacity:'1.0' }, settings.animSpeed);
446
+ }, (100 + timeBuff));
447
+ }
448
+ timeBuff += 50;
449
+ v++;
450
+ });
451
+ } else if(currentEffect === 'fold'){
452
+ createSlices(slider, settings, vars);
453
+ timeBuff = 0;
454
+ i = 0;
455
+
456
+ $('.nivo-slice', slider).each(function(){
457
+ var slice = $(this);
458
+ var origWidth = slice.width();
459
+ slice.css({ top:'0px', width:'0px' });
460
+ if(i === settings.slices-1){
461
+ setTimeout(function(){
462
+ slice.animate({ width:origWidth, opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); });
463
+ }, (100 + timeBuff));
464
+ } else {
465
+ setTimeout(function(){
466
+ slice.animate({ width:origWidth, opacity:'1.0' }, settings.animSpeed);
467
+ }, (100 + timeBuff));
468
+ }
469
+ timeBuff += 50;
470
+ i++;
471
+ });
472
+ } else if(currentEffect === 'fade'){
473
+ createSlices(slider, settings, vars);
474
+
475
+ firstSlice = $('.nivo-slice:first', slider);
476
+ firstSlice.css({
477
+ 'width': slider.width() + 'px'
478
+ });
479
+
480
+ firstSlice.animate({ opacity:'1.0' }, (settings.animSpeed*2), '', function(){ slider.trigger('nivo:animFinished'); });
481
+ } else if(currentEffect === 'slideInRight'){
482
+ createSlices(slider, settings, vars);
483
+
484
+ firstSlice = $('.nivo-slice:first', slider);
485
+ firstSlice.css({
486
+ 'width': '0px',
487
+ 'opacity': '1'
488
+ });
489
+
490
+ firstSlice.animate({ width: slider.width() + 'px' }, (settings.animSpeed*2), '', function(){ slider.trigger('nivo:animFinished'); });
491
+ } else if(currentEffect === 'slideInLeft'){
492
+ createSlices(slider, settings, vars);
493
+
494
+ firstSlice = $('.nivo-slice:first', slider);
495
+ firstSlice.css({
496
+ 'width': '0px',
497
+ 'opacity': '1',
498
+ 'left': '',
499
+ 'right': '0px'
500
+ });
501
+
502
+ firstSlice.animate({ width: slider.width() + 'px' }, (settings.animSpeed*2), '', function(){
503
+ // Reset positioning
504
+ firstSlice.css({
505
+ 'left': '0px',
506
+ 'right': ''
507
+ });
508
+ slider.trigger('nivo:animFinished');
509
+ });
510
+ } else if(currentEffect === 'boxRandom'){
511
+ createBoxes(slider, settings, vars);
512
+
513
+ totalBoxes = settings.boxCols * settings.boxRows;
514
+ i = 0;
515
+ timeBuff = 0;
516
+
517
+ boxes = shuffle($('.nivo-box', slider));
518
+ boxes.each(function(){
519
+ var box = $(this);
520
+ if(i === totalBoxes-1){
521
+ setTimeout(function(){
522
+ box.animate({ opacity:'1' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); });
523
+ }, (100 + timeBuff));
524
+ } else {
525
+ setTimeout(function(){
526
+ box.animate({ opacity:'1' }, settings.animSpeed);
527
+ }, (100 + timeBuff));
528
+ }
529
+ timeBuff += 20;
530
+ i++;
531
+ });
532
+ } else if(currentEffect === 'boxRain' || currentEffect === 'boxRainReverse' || currentEffect === 'boxRainGrow' || currentEffect === 'boxRainGrowReverse'){
533
+ createBoxes(slider, settings, vars);
534
+
535
+ totalBoxes = settings.boxCols * settings.boxRows;
536
+ i = 0;
537
+ timeBuff = 0;
538
+
539
+ // Split boxes into 2D array
540
+ var rowIndex = 0;
541
+ var colIndex = 0;
542
+ var box2Darr = [];
543
+ box2Darr[rowIndex] = [];
544
+ boxes = $('.nivo-box', slider);
545
+ if(currentEffect === 'boxRainReverse' || currentEffect === 'boxRainGrowReverse'){
546
+ boxes = $('.nivo-box', slider)._reverse();
547
+ }
548
+ boxes.each(function(){
549
+ box2Darr[rowIndex][colIndex] = $(this);
550
+ colIndex++;
551
+ if(colIndex === settings.boxCols){
552
+ rowIndex++;
553
+ colIndex = 0;
554
+ box2Darr[rowIndex] = [];
555
+ }
556
+ });
557
+
558
+ // Run animation
559
+ for(var cols = 0; cols < (settings.boxCols * 2); cols++){
560
+ var prevCol = cols;
561
+ for(var rows = 0; rows < settings.boxRows; rows++){
562
+ if(prevCol >= 0 && prevCol < settings.boxCols){
563
+ /* Due to some weird JS bug with loop vars
564
+ being used in setTimeout, this is wrapped
565
+ with an anonymous function call */
566
+ (function(row, col, time, i, totalBoxes) {
567
+ var box = $(box2Darr[row][col]);
568
+ var w = box.width();
569
+ var h = box.height();
570
+ if(currentEffect === 'boxRainGrow' || currentEffect === 'boxRainGrowReverse'){
571
+ box.width(0).height(0);
572
+ }
573
+ if(i === totalBoxes-1){
574
+ setTimeout(function(){
575
+ box.animate({ opacity:'1', width:w, height:h }, settings.animSpeed/1.3, '', function(){ slider.trigger('nivo:animFinished'); });
576
+ }, (100 + time));
577
+ } else {
578
+ setTimeout(function(){
579
+ box.animate({ opacity:'1', width:w, height:h }, settings.animSpeed/1.3);
580
+ }, (100 + time));
581
+ }
582
+ })(rows, prevCol, timeBuff, i, totalBoxes);
583
+ i++;
584
+ }
585
+ prevCol--;
586
+ }
587
+ timeBuff += 100;
588
+ }
589
+ }
590
+ };
591
+
592
+ // Shuffle an array
593
+ var shuffle = function(arr){
594
+ for(var j, x, i = arr.length; i; j = parseInt(Math.random() * i, 10), x = arr[--i], arr[i] = arr[j], arr[j] = x);
595
+ return arr;
596
+ };
597
+
598
+ // For debugging
599
+ var trace = function(msg){
600
+ if(this.console && typeof console.log !== 'undefined') { console.log(msg); }
601
+ };
602
+
603
+ // Start / Stop
604
+ this.stop = function(){
605
+ if(!$(element).data('nivo:vars').stop){
606
+ $(element).data('nivo:vars').stop = true;
607
+ trace('Stop Slider');
608
+ }
609
+ };
610
+
611
+ this.start = function(){
612
+ if($(element).data('nivo:vars').stop){
613
+ $(element).data('nivo:vars').stop = false;
614
+ trace('Start Slider');
615
+ }
616
+ };
617
+
618
+ // Trigger the afterLoad callback
619
+ settings.afterLoad.call(this);
620
+
621
+ return this;
622
+ };
623
+
624
+ $.fn.nivoSlider = function(options) {
625
+ return this.each(function(key, value){
626
+ var element = $(this);
627
+ // Return early if this element already has a plugin instance
628
+ if (element.data('nivoslider')) { return element.data('nivoslider'); }
629
+ // Pass options to plugin constructor
630
+ var nivoslider = new NivoSlider(this, options);
631
+ // Store plugin object in this element's data
632
+ element.data('nivoslider', nivoslider);
633
+ });
634
+ };
635
+
636
+ //Default settings
637
+ $.fn.nivoSlider.defaults = {
638
+ effect: 'random',
639
+ slices: 15,
640
+ boxCols: 8,
641
+ boxRows: 4,
642
+ animSpeed: 500,
643
+ pauseTime: 3000,
644
+ startSlide: 0,
645
+ directionNav: true,
646
+ controlNav: true,
647
+ controlNavThumbs: false,
648
+ pauseOnHover: true,
649
+ manualAdvance: false,
650
+ prevText: 'Prev',
651
+ nextText: 'Next',
652
+ randomStart: false,
653
+ beforeChange: function(){},
654
+ afterChange: function(){},
655
+ slideshowEnd: function(){},
656
+ lastSlide: function(){},
657
+ afterLoad: function(){}
658
+ };
659
+
660
+ $.fn._reverse = [].reverse;
661
+
662
+ })(jQuery);
@@ -0,0 +1,10 @@
1
+ /*
2
+ * jQuery Nivo Slider v3.2
3
+ * http://nivo.dev7studios.com
4
+ *
5
+ * Copyright 2012, Dev7studios
6
+ * Free to use and abuse under the MIT license.
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ */
9
+
10
+ (function(e){var t=function(t,n){var r=e.extend({},e.fn.nivoSlider.defaults,n);var i={currentSlide:0,currentImage:"",totalSlides:0,running:false,paused:false,stop:false,controlNavEl:false};var s=e(t);s.data("nivo:vars",i).addClass("nivoSlider");var o=s.children();o.each(function(){var t=e(this);var n="";if(!t.is("img")){if(t.is("a")){t.addClass("nivo-imageLink");n=t}t=t.find("img:first")}var r=r===0?t.attr("width"):t.width(),s=s===0?t.attr("height"):t.height();if(n!==""){n.css("display","none")}t.css("display","none");i.totalSlides++});if(r.randomStart){r.startSlide=Math.floor(Math.random()*i.totalSlides)}if(r.startSlide>0){if(r.startSlide>=i.totalSlides){r.startSlide=i.totalSlides-1}i.currentSlide=r.startSlide}if(e(o[i.currentSlide]).is("img")){i.currentImage=e(o[i.currentSlide])}else{i.currentImage=e(o[i.currentSlide]).find("img:first")}if(e(o[i.currentSlide]).is("a")){e(o[i.currentSlide]).css("display","block")}var u=e("<img/>").addClass("nivo-main-image");u.attr("src",i.currentImage.attr("src")).show();s.append(u);e(window).resize(function(){s.children("img").width(s.width());u.attr("src",i.currentImage.attr("src"));u.stop().height("auto");e(".nivo-slice").remove();e(".nivo-box").remove()});s.append(e('<div class="nivo-caption"></div>'));var a=function(t){var n=e(".nivo-caption",s);if(i.currentImage.attr("title")!=""&&i.currentImage.attr("title")!=undefined){var r=i.currentImage.attr("title");if(r.substr(0,1)=="#")r=e(r).html();if(n.css("display")=="block"){setTimeout(function(){n.html(r)},t.animSpeed)}else{n.html(r);n.stop().fadeIn(t.animSpeed)}}else{n.stop().fadeOut(t.animSpeed)}};a(r);var f=0;if(!r.manualAdvance&&o.length>1){f=setInterval(function(){d(s,o,r,false)},r.pauseTime)}if(r.directionNav){s.append('<div class="nivo-directionNav"><a class="nivo-prevNav">'+r.prevText+'</a><a class="nivo-nextNav">'+r.nextText+"</a></div>");e(s).on("click","a.nivo-prevNav",function(){if(i.running){return false}clearInterval(f);f="";i.currentSlide-=2;d(s,o,r,"prev")});e(s).on("click","a.nivo-nextNav",function(){if(i.running){return false}clearInterval(f);f="";d(s,o,r,"next")})}if(r.controlNav){i.controlNavEl=e('<div class="nivo-controlNav"></div>');s.after(i.controlNavEl);for(var l=0;l<o.length;l++){if(r.controlNavThumbs){i.controlNavEl.addClass("nivo-thumbs-enabled");var c=o.eq(l);if(!c.is("img")){c=c.find("img:first")}if(c.attr("data-thumb"))i.controlNavEl.append('<a class="nivo-control" rel="'+l+'"><img src="'+c.attr("data-thumb")+'" alt="" /></a>')}else{i.controlNavEl.append('<a class="nivo-control" rel="'+l+'">'+(l+1)+"</a>")}}e("a:eq("+i.currentSlide+")",i.controlNavEl).addClass("active");e("a",i.controlNavEl).bind("click",function(){if(i.running)return false;if(e(this).hasClass("active"))return false;clearInterval(f);f="";u.attr("src",i.currentImage.attr("src"));i.currentSlide=e(this).attr("rel")-1;d(s,o,r,"control")})}if(r.pauseOnHover){s.hover(function(){i.paused=true;clearInterval(f);f=""},function(){i.paused=false;if(f===""&&!r.manualAdvance){f=setInterval(function(){d(s,o,r,false)},r.pauseTime)}})}s.bind("nivo:animFinished",function(){u.attr("src",i.currentImage.attr("src"));i.running=false;e(o).each(function(){if(e(this).is("a")){e(this).css("display","none")}});if(e(o[i.currentSlide]).is("a")){e(o[i.currentSlide]).css("display","block")}if(f===""&&!i.paused&&!r.manualAdvance){f=setInterval(function(){d(s,o,r,false)},r.pauseTime)}r.afterChange.call(this)});var h=function(t,n,r){if(e(r.currentImage).parent().is("a"))e(r.currentImage).parent().css("display","block");e('img[src="'+r.currentImage.attr("src")+'"]',t).not(".nivo-main-image,.nivo-control img").width(t.width()).css("visibility","hidden").show();var i=e('img[src="'+r.currentImage.attr("src")+'"]',t).not(".nivo-main-image,.nivo-control img").parent().is("a")?e('img[src="'+r.currentImage.attr("src")+'"]',t).not(".nivo-main-image,.nivo-control img").parent().height():e('img[src="'+r.currentImage.attr("src")+'"]',t).not(".nivo-main-image,.nivo-control img").height();for(var s=0;s<n.slices;s++){var o=Math.round(t.width()/n.slices);if(s===n.slices-1){t.append(e('<div class="nivo-slice" name="'+s+'"><img src="'+r.currentImage.attr("src")+'" style="position:absolute; width:'+t.width()+"px; height:auto; display:block !important; top:0; left:-"+(o+s*o-o)+'px;" /></div>').css({left:o*s+"px",width:t.width()-o*s+"px",height:i+"px",opacity:"0",overflow:"hidden"}))}else{t.append(e('<div class="nivo-slice" name="'+s+'"><img src="'+r.currentImage.attr("src")+'" style="position:absolute; width:'+t.width()+"px; height:auto; display:block !important; top:0; left:-"+(o+s*o-o)+'px;" /></div>').css({left:o*s+"px",width:o+"px",height:i+"px",opacity:"0",overflow:"hidden"}))}}e(".nivo-slice",t).height(i);u.stop().animate({height:e(r.currentImage).height()},n.animSpeed)};var p=function(t,n,r){if(e(r.currentImage).parent().is("a"))e(r.currentImage).parent().css("display","block");e('img[src="'+r.currentImage.attr("src")+'"]',t).not(".nivo-main-image,.nivo-control img").width(t.width()).css("visibility","hidden").show();var i=Math.round(t.width()/n.boxCols),s=Math.round(e('img[src="'+r.currentImage.attr("src")+'"]',t).not(".nivo-main-image,.nivo-control img").height()/n.boxRows);for(var o=0;o<n.boxRows;o++){for(var a=0;a<n.boxCols;a++){if(a===n.boxCols-1){t.append(e('<div class="nivo-box" name="'+a+'" rel="'+o+'"><img src="'+r.currentImage.attr("src")+'" style="position:absolute; width:'+t.width()+"px; height:auto; display:block; top:-"+s*o+"px; left:-"+i*a+'px;" /></div>').css({opacity:0,left:i*a+"px",top:s*o+"px",width:t.width()-i*a+"px"}));e('.nivo-box[name="'+a+'"]',t).height(e('.nivo-box[name="'+a+'"] img',t).height()+"px")}else{t.append(e('<div class="nivo-box" name="'+a+'" rel="'+o+'"><img src="'+r.currentImage.attr("src")+'" style="position:absolute; width:'+t.width()+"px; height:auto; display:block; top:-"+s*o+"px; left:-"+i*a+'px;" /></div>').css({opacity:0,left:i*a+"px",top:s*o+"px",width:i+"px"}));e('.nivo-box[name="'+a+'"]',t).height(e('.nivo-box[name="'+a+'"] img',t).height()+"px")}}}u.stop().animate({height:e(r.currentImage).height()},n.animSpeed)};var d=function(t,n,r,i){var s=t.data("nivo:vars");if(s&&s.currentSlide===s.totalSlides-1){r.lastSlide.call(this)}if((!s||s.stop)&&!i){return false}r.beforeChange.call(this);if(!i){u.attr("src",s.currentImage.attr("src"))}else{if(i==="prev"){u.attr("src",s.currentImage.attr("src"))}if(i==="next"){u.attr("src",s.currentImage.attr("src"))}}s.currentSlide++;if(s.currentSlide===s.totalSlides){s.currentSlide=0;r.slideshowEnd.call(this)}if(s.currentSlide<0){s.currentSlide=s.totalSlides-1}if(e(n[s.currentSlide]).is("img")){s.currentImage=e(n[s.currentSlide])}else{s.currentImage=e(n[s.currentSlide]).find("img:first")}if(r.controlNav){e("a",s.controlNavEl).removeClass("active");e("a:eq("+s.currentSlide+")",s.controlNavEl).addClass("active")}a(r);e(".nivo-slice",t).remove();e(".nivo-box",t).remove();var o=r.effect,f="";if(r.effect==="random"){f=new Array("sliceDownRight","sliceDownLeft","sliceUpRight","sliceUpLeft","sliceUpDown","sliceUpDownLeft","fold","fade","boxRandom","boxRain","boxRainReverse","boxRainGrow","boxRainGrowReverse");o=f[Math.floor(Math.random()*(f.length+1))];if(o===undefined){o="fade"}}if(r.effect.indexOf(",")!==-1){f=r.effect.split(",");o=f[Math.floor(Math.random()*f.length)];if(o===undefined){o="fade"}}if(s.currentImage.attr("data-transition")){o=s.currentImage.attr("data-transition")}s.running=true;var l=0,c=0,d="",m="",g="",y="";if(o==="sliceDown"||o==="sliceDownRight"||o==="sliceDownLeft"){h(t,r,s);l=0;c=0;d=e(".nivo-slice",t);if(o==="sliceDownLeft"){d=e(".nivo-slice",t)._reverse()}d.each(function(){var n=e(this);n.css({top:"0px"});if(c===r.slices-1){setTimeout(function(){n.animate({opacity:"1.0"},r.animSpeed,"",function(){t.trigger("nivo:animFinished")})},100+l)}else{setTimeout(function(){n.animate({opacity:"1.0"},r.animSpeed)},100+l)}l+=50;c++})}else if(o==="sliceUp"||o==="sliceUpRight"||o==="sliceUpLeft"){h(t,r,s);l=0;c=0;d=e(".nivo-slice",t);if(o==="sliceUpLeft"){d=e(".nivo-slice",t)._reverse()}d.each(function(){var n=e(this);n.css({bottom:"0px"});if(c===r.slices-1){setTimeout(function(){n.animate({opacity:"1.0"},r.animSpeed,"",function(){t.trigger("nivo:animFinished")})},100+l)}else{setTimeout(function(){n.animate({opacity:"1.0"},r.animSpeed)},100+l)}l+=50;c++})}else if(o==="sliceUpDown"||o==="sliceUpDownRight"||o==="sliceUpDownLeft"){h(t,r,s);l=0;c=0;var b=0;d=e(".nivo-slice",t);if(o==="sliceUpDownLeft"){d=e(".nivo-slice",t)._reverse()}d.each(function(){var n=e(this);if(c===0){n.css("top","0px");c++}else{n.css("bottom","0px");c=0}if(b===r.slices-1){setTimeout(function(){n.animate({opacity:"1.0"},r.animSpeed,"",function(){t.trigger("nivo:animFinished")})},100+l)}else{setTimeout(function(){n.animate({opacity:"1.0"},r.animSpeed)},100+l)}l+=50;b++})}else if(o==="fold"){h(t,r,s);l=0;c=0;e(".nivo-slice",t).each(function(){var n=e(this);var i=n.width();n.css({top:"0px",width:"0px"});if(c===r.slices-1){setTimeout(function(){n.animate({width:i,opacity:"1.0"},r.animSpeed,"",function(){t.trigger("nivo:animFinished")})},100+l)}else{setTimeout(function(){n.animate({width:i,opacity:"1.0"},r.animSpeed)},100+l)}l+=50;c++})}else if(o==="fade"){h(t,r,s);m=e(".nivo-slice:first",t);m.css({width:t.width()+"px"});m.animate({opacity:"1.0"},r.animSpeed*2,"",function(){t.trigger("nivo:animFinished")})}else if(o==="slideInRight"){h(t,r,s);m=e(".nivo-slice:first",t);m.css({width:"0px",opacity:"1"});m.animate({width:t.width()+"px"},r.animSpeed*2,"",function(){t.trigger("nivo:animFinished")})}else if(o==="slideInLeft"){h(t,r,s);m=e(".nivo-slice:first",t);m.css({width:"0px",opacity:"1",left:"",right:"0px"});m.animate({width:t.width()+"px"},r.animSpeed*2,"",function(){m.css({left:"0px",right:""});t.trigger("nivo:animFinished")})}else if(o==="boxRandom"){p(t,r,s);g=r.boxCols*r.boxRows;c=0;l=0;y=v(e(".nivo-box",t));y.each(function(){var n=e(this);if(c===g-1){setTimeout(function(){n.animate({opacity:"1"},r.animSpeed,"",function(){t.trigger("nivo:animFinished")})},100+l)}else{setTimeout(function(){n.animate({opacity:"1"},r.animSpeed)},100+l)}l+=20;c++})}else if(o==="boxRain"||o==="boxRainReverse"||o==="boxRainGrow"||o==="boxRainGrowReverse"){p(t,r,s);g=r.boxCols*r.boxRows;c=0;l=0;var w=0;var E=0;var S=[];S[w]=[];y=e(".nivo-box",t);if(o==="boxRainReverse"||o==="boxRainGrowReverse"){y=e(".nivo-box",t)._reverse()}y.each(function(){S[w][E]=e(this);E++;if(E===r.boxCols){w++;E=0;S[w]=[]}});for(var x=0;x<r.boxCols*2;x++){var T=x;for(var N=0;N<r.boxRows;N++){if(T>=0&&T<r.boxCols){(function(n,i,s,u,a){var f=e(S[n][i]);var l=f.width();var c=f.height();if(o==="boxRainGrow"||o==="boxRainGrowReverse"){f.width(0).height(0)}if(u===a-1){setTimeout(function(){f.animate({opacity:"1",width:l,height:c},r.animSpeed/1.3,"",function(){t.trigger("nivo:animFinished")})},100+s)}else{setTimeout(function(){f.animate({opacity:"1",width:l,height:c},r.animSpeed/1.3)},100+s)}})(N,T,l,c,g);c++}T--}l+=100}}};var v=function(e){for(var t,n,r=e.length;r;t=parseInt(Math.random()*r,10),n=e[--r],e[r]=e[t],e[t]=n);return e};var m=function(e){if(this.console&&typeof console.log!=="undefined"){console.log(e)}};this.stop=function(){if(!e(t).data("nivo:vars").stop){e(t).data("nivo:vars").stop=true;m("Stop Slider")}};this.start=function(){if(e(t).data("nivo:vars").stop){e(t).data("nivo:vars").stop=false;m("Start Slider")}};r.afterLoad.call(this);return this};e.fn.nivoSlider=function(n){return this.each(function(r,i){var s=e(this);if(s.data("nivoslider")){return s.data("nivoslider")}var o=new t(this,n);s.data("nivoslider",o)})};e.fn.nivoSlider.defaults={effect:"random",slices:15,boxCols:8,boxRows:4,animSpeed:500,pauseTime:3e3,startSlide:0,directionNav:true,controlNav:true,controlNavThumbs:false,pauseOnHover:true,manualAdvance:false,prevText:"Prev",nextText:"Next",randomStart:false,beforeChange:function(){},afterChange:function(){},slideshowEnd:function(){},lastSlide:function(){},afterLoad:function(){}};e.fn._reverse=[].reverse})(jQuery)
@@ -0,0 +1,113 @@
1
+ /*
2
+ * jQuery Nivo Slider v3.2
3
+ * http://nivo.dev7studios.com
4
+ *
5
+ * Copyright 2012, Dev7studios
6
+ * Free to use and abuse under the MIT license.
7
+ * http://www.opensource.org/licenses/mit-license.php
8
+ */
9
+
10
+ /* The Nivo Slider styles */
11
+ .nivoSlider {
12
+ position:relative;
13
+ width:100%;
14
+ height:auto;
15
+ overflow: hidden;
16
+ }
17
+ .nivoSlider img {
18
+ position:absolute;
19
+ top:0px;
20
+ left:0px;
21
+ max-width: none;
22
+ }
23
+ .nivo-main-image {
24
+ display: block !important;
25
+ position: relative !important;
26
+ width: 100% !important;
27
+ }
28
+
29
+ /* If an image is wrapped in a link */
30
+ .nivoSlider a.nivo-imageLink {
31
+ position:absolute;
32
+ top:0px;
33
+ left:0px;
34
+ width:100%;
35
+ height:100%;
36
+ border:0;
37
+ padding:0;
38
+ margin:0;
39
+ z-index:6;
40
+ display:none;
41
+ background:white;
42
+ filter:alpha(opacity=0);
43
+ opacity:0;
44
+ }
45
+ /* The slices and boxes in the Slider */
46
+ .nivo-slice {
47
+ display:block;
48
+ position:absolute;
49
+ z-index:5;
50
+ height:100%;
51
+ top:0;
52
+ }
53
+ .nivo-box {
54
+ display:block;
55
+ position:absolute;
56
+ z-index:5;
57
+ overflow:hidden;
58
+ }
59
+ .nivo-box img { display:block; }
60
+
61
+ /* Caption styles */
62
+ .nivo-caption {
63
+ position:absolute;
64
+ left:0px;
65
+ bottom:0px;
66
+ background:#000;
67
+ color:#fff;
68
+ width:100%;
69
+ z-index:8;
70
+ padding: 5px 10px;
71
+ opacity: 0.8;
72
+ overflow: hidden;
73
+ display: none;
74
+ -moz-opacity: 0.8;
75
+ filter:alpha(opacity=8);
76
+ -webkit-box-sizing: border-box; /* Safari/Chrome, other WebKit */
77
+ -moz-box-sizing: border-box; /* Firefox, other Gecko */
78
+ box-sizing: border-box; /* Opera/IE 8+ */
79
+ }
80
+ .nivo-caption p {
81
+ padding:5px;
82
+ margin:0;
83
+ }
84
+ .nivo-caption a {
85
+ display:inline !important;
86
+ }
87
+ .nivo-html-caption {
88
+ display:none;
89
+ }
90
+ /* Direction nav styles (e.g. Next & Prev) */
91
+ .nivo-directionNav a {
92
+ position:absolute;
93
+ top:45%;
94
+ z-index:9;
95
+ cursor:pointer;
96
+ }
97
+ .nivo-prevNav {
98
+ left:0px;
99
+ }
100
+ .nivo-nextNav {
101
+ right:0px;
102
+ }
103
+ /* Control nav styles (e.g. 1,2,3...) */
104
+ .nivo-controlNav {
105
+ text-align:center;
106
+ padding: 15px 0;
107
+ }
108
+ .nivo-controlNav a {
109
+ cursor:pointer;
110
+ }
111
+ .nivo-controlNav a.active {
112
+ font-weight:bold;
113
+ }
@@ -0,0 +1,93 @@
1
+ /*
2
+ Skin Name: Nivo Slider Default Theme
3
+ Skin URI: http://nivo.dev7studios.com
4
+ Description: The default skin for the Nivo Slider.
5
+ Version: 1.3
6
+ Author: Gilbert Pellegrom
7
+ Author URI: http://dev7studios.com
8
+ Supports Thumbs: true
9
+ */
10
+
11
+ .theme-default .nivoSlider {
12
+ position:relative;
13
+ background:#fff url(/assets/loading.gif) no-repeat 50% 50%;
14
+ margin-bottom:10px;
15
+ -webkit-box-shadow: 0px 1px 5px 0px #4a4a4a;
16
+ -moz-box-shadow: 0px 1px 5px 0px #4a4a4a;
17
+ box-shadow: 0px 1px 5px 0px #4a4a4a;
18
+ }
19
+ .theme-default .nivoSlider img {
20
+ position:absolute;
21
+ top:0px;
22
+ left:0px;
23
+ display:none;
24
+ }
25
+ .theme-default .nivoSlider a {
26
+ border:0;
27
+ display:block;
28
+ }
29
+
30
+ .theme-default .nivo-controlNav {
31
+ text-align: center;
32
+ padding: 20px 0;
33
+ }
34
+ .theme-default .nivo-controlNav a {
35
+ display:inline-block;
36
+ width:22px;
37
+ height:22px;
38
+ background:url(/assets/bullets.png) no-repeat;
39
+ text-indent:-9999px;
40
+ border:0;
41
+ margin: 0 2px;
42
+ }
43
+ .theme-default .nivo-controlNav a.active {
44
+ background-position:0 -22px;
45
+ }
46
+
47
+ .theme-default .nivo-directionNav a {
48
+ display:block;
49
+ width:30px;
50
+ height:30px;
51
+ background:url(arrows.png) no-repeat;
52
+ text-indent:-9999px;
53
+ border:0;
54
+ opacity: 0;
55
+ -webkit-transition: all 200ms ease-in-out;
56
+ -moz-transition: all 200ms ease-in-out;
57
+ -o-transition: all 200ms ease-in-out;
58
+ transition: all 200ms ease-in-out;
59
+ }
60
+ .theme-default:hover .nivo-directionNav a { opacity: 1; }
61
+ .theme-default a.nivo-nextNav {
62
+ background-position:-30px 0;
63
+ right:15px;
64
+ }
65
+ .theme-default a.nivo-prevNav {
66
+ left:15px;
67
+ }
68
+
69
+ .theme-default .nivo-caption {
70
+ font-family: Helvetica, Arial, sans-serif;
71
+ }
72
+ .theme-default .nivo-caption a {
73
+ color:#fff;
74
+ border-bottom:1px dotted #fff;
75
+ }
76
+ .theme-default .nivo-caption a:hover {
77
+ color:#fff;
78
+ }
79
+
80
+ .theme-default .nivo-controlNav.nivo-thumbs-enabled {
81
+ width: 100%;
82
+ }
83
+ .theme-default .nivo-controlNav.nivo-thumbs-enabled a {
84
+ width: auto;
85
+ height: auto;
86
+ background: none;
87
+ margin-bottom: 5px;
88
+ }
89
+ .theme-default .nivo-controlNav.nivo-thumbs-enabled img {
90
+ display: block;
91
+ width: 120px;
92
+ height: auto;
93
+ }
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nivo_slider
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Erfan Mansuri
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-01 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Nivo slider gem user to create slider
14
+ email: erfan.m@cisinlabs.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/nivo_slider.rb
20
+ - lib/nivo_slider/assert_select.rb
21
+ - lib/nivo_slider/rails/railtie.rb
22
+ - lib/nivo_slider/rails/engine.rb
23
+ - lib/nivo_slider/rails.rb
24
+ - lib/generators/nivo_slider/install/install_generator.rb
25
+ - lib/generators/nivo_slider/install/USAGE
26
+ - vendor/assets/javascripts/jquery.nivo.slider.js
27
+ - vendor/assets/javascripts/jquery.nivo.slider.pack.js
28
+ - vendor/assets/images/arrows.png
29
+ - vendor/assets/images/bullets.png
30
+ - vendor/assets/images/loading.gif
31
+ - vendor/assets/stylesheets/nivo_default.css
32
+ - vendor/assets/stylesheets/nivo-slider.css
33
+ - README.md
34
+ homepage: ''
35
+ licenses:
36
+ - MIT
37
+ metadata: {}
38
+ post_install_message:
39
+ rdoc_options: []
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ! '>='
50
+ - !ruby/object:Gem::Version
51
+ version: 1.3.6
52
+ requirements: []
53
+ rubyforge_project:
54
+ rubygems_version: 2.1.5
55
+ signing_key:
56
+ specification_version: 4
57
+ summary: Nivo slider gem used to create nivo slider using its jquery librery
58
+ test_files: []