groundworkcss-rails 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/groundworkcss/rails/version.rb +1 -1
- data/lib/groundworkcss/rails/version.rb~ +1 -1
- data/vendor/assets/javascripts/groundworkcss/groundwork.all.js +96 -20
- data/vendor/assets/javascripts/groundworkcss/groundwork.js +51 -12
- data/vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.caption2.js +67 -0
- data/vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.carousel.js +265 -0
- data/vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.center.js +63 -0
- data/vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.ie-fade.js +46 -0
- data/vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.scrollVert.js +15 -0
- data/vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.shuffle.js +62 -0
- data/vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.swipe.js +70 -0
- data/vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.tile.js +131 -0
- data/vendor/assets/javascripts/groundworkcss/plugins/cycle/jquery.cycle2.video.js +66 -0
- data/vendor/assets/javascripts/groundworkcss/plugins/jquery.cycle2.js +1426 -0
- data/vendor/assets/stylesheets/groundworkcss-scss/_buttons.scss +4 -3
- data/vendor/assets/stylesheets/groundworkcss-scss/_cycle.scss +20 -0
- data/vendor/assets/stylesheets/groundworkcss-scss/_modals.scss +2 -1
- data/vendor/assets/stylesheets/groundworkcss-scss/_navigation.scss +9 -3
- data/vendor/assets/stylesheets/groundworkcss-scss/_tabs.scss +5 -0
- data/vendor/assets/stylesheets/groundworkcss-scss/groundwork.scss +2 -2
- metadata +25 -14
@@ -0,0 +1,1426 @@
|
|
1
|
+
/*!
|
2
|
+
* jQuery Cycle2 - Version: 20130307
|
3
|
+
* http://malsup.com/jquery/cycle2/
|
4
|
+
* Copyright (c) 2012 M. Alsup; Dual licensed: MIT/GPL
|
5
|
+
* Requires: jQuery v1.7 or later
|
6
|
+
*/
|
7
|
+
;(function($) {
|
8
|
+
"use strict";
|
9
|
+
|
10
|
+
var version = '20130307';
|
11
|
+
|
12
|
+
$.fn.cycle = function( options ) {
|
13
|
+
// fix mistakes with the ready state
|
14
|
+
var o;
|
15
|
+
if ( this.length === 0 && !$.isReady ) {
|
16
|
+
o = { s: this.selector, c: this.context };
|
17
|
+
$.fn.cycle.log('requeuing slideshow (dom not ready)');
|
18
|
+
$(function() {
|
19
|
+
$( o.s, o.c ).cycle(options);
|
20
|
+
});
|
21
|
+
return this;
|
22
|
+
}
|
23
|
+
|
24
|
+
return this.each(function() {
|
25
|
+
var data, opts, shortName, val;
|
26
|
+
var container = $(this);
|
27
|
+
var log = $.fn.cycle.log;
|
28
|
+
|
29
|
+
if ( container.data('cycle.opts') )
|
30
|
+
return; // already initialized
|
31
|
+
|
32
|
+
if ( container.data('cycle-log') === false ||
|
33
|
+
( options && options.log === false ) ||
|
34
|
+
( opts && opts.log === false) ) {
|
35
|
+
log = $.noop;
|
36
|
+
}
|
37
|
+
|
38
|
+
log('--c2 init--');
|
39
|
+
data = container.data();
|
40
|
+
for (var p in data) {
|
41
|
+
// allow props to be accessed sans 'cycle' prefix and log the overrides
|
42
|
+
if (data.hasOwnProperty(p) && /^cycle[A-Z]+/.test(p) ) {
|
43
|
+
val = data[p];
|
44
|
+
shortName = p.match(/^cycle(.*)/)[1].replace(/^[A-Z]/, lowerCase);
|
45
|
+
log(shortName+':', val, '('+typeof val +')');
|
46
|
+
data[shortName] = val;
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
opts = $.extend( {}, $.fn.cycle.defaults, data, options || {});
|
51
|
+
|
52
|
+
opts.timeoutId = 0;
|
53
|
+
opts.paused = opts.paused || false; // #57
|
54
|
+
opts.container = container;
|
55
|
+
opts._maxZ = opts.maxZ;
|
56
|
+
|
57
|
+
opts.API = $.extend ( { _container: container }, $.fn.cycle.API );
|
58
|
+
opts.API.log = log;
|
59
|
+
opts.API.trigger = function( eventName, args ) {
|
60
|
+
opts.container.trigger( eventName, args );
|
61
|
+
return opts.API;
|
62
|
+
};
|
63
|
+
|
64
|
+
container.data( 'cycle.opts', opts );
|
65
|
+
container.data( 'cycle.API', opts.API );
|
66
|
+
|
67
|
+
// opportunity for plugins to modify opts and API
|
68
|
+
opts.API.trigger('cycle-bootstrap', [ opts, opts.API ]);
|
69
|
+
|
70
|
+
opts.API.addInitialSlides();
|
71
|
+
opts.API.preInitSlideshow();
|
72
|
+
|
73
|
+
if ( opts.slides.length )
|
74
|
+
opts.API.initSlideshow();
|
75
|
+
});
|
76
|
+
};
|
77
|
+
|
78
|
+
$.fn.cycle.API = {
|
79
|
+
opts: function() {
|
80
|
+
return this._container.data( 'cycle.opts' );
|
81
|
+
},
|
82
|
+
addInitialSlides: function() {
|
83
|
+
var opts = this.opts();
|
84
|
+
var slides = opts.slides;
|
85
|
+
opts.slideCount = 0;
|
86
|
+
opts.slides = $(); // empty set
|
87
|
+
|
88
|
+
// add slides that already exist
|
89
|
+
slides = slides.jquery ? slides : opts.container.find( slides );
|
90
|
+
|
91
|
+
if ( opts.random ) {
|
92
|
+
slides.sort(function() {return Math.random() - 0.5;});
|
93
|
+
}
|
94
|
+
|
95
|
+
opts.API.add( slides );
|
96
|
+
},
|
97
|
+
|
98
|
+
preInitSlideshow: function() {
|
99
|
+
var opts = this.opts();
|
100
|
+
opts.API.trigger('cycle-pre-initialize', [ opts ]);
|
101
|
+
var tx = $.fn.cycle.transitions[opts.fx];
|
102
|
+
if (tx && $.isFunction(tx.preInit))
|
103
|
+
tx.preInit( opts );
|
104
|
+
opts._preInitialized = true;
|
105
|
+
},
|
106
|
+
|
107
|
+
postInitSlideshow: function() {
|
108
|
+
var opts = this.opts();
|
109
|
+
opts.API.trigger('cycle-post-initialize', [ opts ]);
|
110
|
+
var tx = $.fn.cycle.transitions[opts.fx];
|
111
|
+
if (tx && $.isFunction(tx.postInit))
|
112
|
+
tx.postInit( opts );
|
113
|
+
},
|
114
|
+
|
115
|
+
initSlideshow: function() {
|
116
|
+
var opts = this.opts();
|
117
|
+
var pauseObj = opts.container;
|
118
|
+
var slideOpts;
|
119
|
+
opts.API.calcFirstSlide();
|
120
|
+
|
121
|
+
if ( opts.container.css('position') == 'static' )
|
122
|
+
opts.container.css('position', 'relative');
|
123
|
+
|
124
|
+
$(opts.slides[opts.currSlide]).css('opacity',1).show();
|
125
|
+
opts.API.stackSlides( opts.slides[opts.currSlide], opts.slides[opts.nextSlide], !opts.reverse );
|
126
|
+
|
127
|
+
if ( opts.pauseOnHover ) {
|
128
|
+
// allow pauseOnHover to specify an element
|
129
|
+
if ( opts.pauseOnHover !== true )
|
130
|
+
pauseObj = $( opts.pauseOnHover );
|
131
|
+
|
132
|
+
pauseObj.hover(
|
133
|
+
function(){
|
134
|
+
opts.hoverPaused = true;
|
135
|
+
if ( ! opts.paused )
|
136
|
+
opts.API.trigger('cycle-paused', [ opts ] );
|
137
|
+
},
|
138
|
+
function(){
|
139
|
+
opts.hoverPaused = false;
|
140
|
+
if ( ! opts.paused )
|
141
|
+
opts.API.trigger('cycle-resumed', [ opts ] );
|
142
|
+
}
|
143
|
+
);
|
144
|
+
}
|
145
|
+
|
146
|
+
// stage initial transition
|
147
|
+
if ( opts.timeout ) {
|
148
|
+
slideOpts = opts.API.getSlideOpts( opts.nextSlide );
|
149
|
+
opts.API.queueTransition( slideOpts );
|
150
|
+
}
|
151
|
+
|
152
|
+
opts._initialized = true;
|
153
|
+
opts.API.updateView( true );
|
154
|
+
opts.container.on('cycle-paused cycle-resumed', function(e) {
|
155
|
+
opts.container[ e.type === 'cycle-paused' ? 'addClass' : 'removeClass' ]('cycle-paused');
|
156
|
+
});
|
157
|
+
opts.API.trigger('cycle-initialized', [ opts ]);
|
158
|
+
opts.API.postInitSlideshow();
|
159
|
+
},
|
160
|
+
|
161
|
+
|
162
|
+
add: function( slides, prepend ) {
|
163
|
+
var opts = this.opts();
|
164
|
+
var oldSlideCount = opts.slideCount;
|
165
|
+
var startSlideshow = false;
|
166
|
+
var len;
|
167
|
+
|
168
|
+
if ( $.type(slides) == 'string')
|
169
|
+
slides = $.trim( slides );
|
170
|
+
|
171
|
+
$( slides ).each(function(i) {
|
172
|
+
var slideOpts;
|
173
|
+
var slide = $(this);
|
174
|
+
|
175
|
+
if ( prepend )
|
176
|
+
opts.container.prepend( slide );
|
177
|
+
else
|
178
|
+
opts.container.append( slide );
|
179
|
+
|
180
|
+
opts.slideCount++;
|
181
|
+
slideOpts = opts.API.buildSlideOpts( slide );
|
182
|
+
|
183
|
+
if ( prepend )
|
184
|
+
opts.slides = $( slide ).add( opts.slides );
|
185
|
+
else
|
186
|
+
opts.slides = opts.slides.add( slide );
|
187
|
+
|
188
|
+
opts.API.initSlide( slideOpts, slide, --opts._maxZ );
|
189
|
+
|
190
|
+
slide.data('cycle.opts', slideOpts);
|
191
|
+
opts.API.trigger('cycle-slide-added', [ opts, slideOpts, slide ]);
|
192
|
+
});
|
193
|
+
|
194
|
+
opts.API.updateView( true );
|
195
|
+
|
196
|
+
startSlideshow = opts._preInitialized && (oldSlideCount < 2 && opts.slideCount >= 1);
|
197
|
+
if ( startSlideshow ) {
|
198
|
+
if ( !opts._initialized )
|
199
|
+
opts.API.initSlideshow();
|
200
|
+
else if ( opts.timeout ) {
|
201
|
+
len = opts.slides.length;
|
202
|
+
opts.nextSlide = opts.reverse ? len - 1 : 1;
|
203
|
+
if ( !opts.timeoutId ) {
|
204
|
+
opts.API.queueTransition( opts );
|
205
|
+
}
|
206
|
+
}
|
207
|
+
}
|
208
|
+
},
|
209
|
+
|
210
|
+
calcFirstSlide: function() {
|
211
|
+
var opts = this.opts();
|
212
|
+
var firstSlideIndex;
|
213
|
+
firstSlideIndex = parseInt( opts.startingSlide || 0, 10 );
|
214
|
+
if (firstSlideIndex >= opts.slides.length || firstSlideIndex < 0)
|
215
|
+
firstSlideIndex = 0;
|
216
|
+
|
217
|
+
opts.currSlide = firstSlideIndex;
|
218
|
+
if ( opts.reverse ) {
|
219
|
+
opts.nextSlide = firstSlideIndex - 1;
|
220
|
+
if (opts.nextSlide < 0)
|
221
|
+
opts.nextSlide = opts.slides.length - 1;
|
222
|
+
}
|
223
|
+
else {
|
224
|
+
opts.nextSlide = firstSlideIndex + 1;
|
225
|
+
if (opts.nextSlide == opts.slides.length)
|
226
|
+
opts.nextSlide = 0;
|
227
|
+
}
|
228
|
+
},
|
229
|
+
|
230
|
+
calcNextSlide: function() {
|
231
|
+
var opts = this.opts();
|
232
|
+
var roll;
|
233
|
+
if ( opts.reverse ) {
|
234
|
+
roll = (opts.nextSlide - 1) < 0;
|
235
|
+
opts.nextSlide = roll ? opts.slideCount - 1 : opts.nextSlide-1;
|
236
|
+
opts.currSlide = roll ? 0 : opts.nextSlide+1;
|
237
|
+
}
|
238
|
+
else {
|
239
|
+
roll = (opts.nextSlide + 1) == opts.slides.length;
|
240
|
+
opts.nextSlide = roll ? 0 : opts.nextSlide+1;
|
241
|
+
opts.currSlide = roll ? opts.slides.length-1 : opts.nextSlide-1;
|
242
|
+
}
|
243
|
+
},
|
244
|
+
|
245
|
+
calcTx: function( slideOpts, manual ) {
|
246
|
+
var opts = slideOpts;
|
247
|
+
var tx;
|
248
|
+
if ( manual && opts.manualFx )
|
249
|
+
tx = $.fn.cycle.transitions[opts.manualFx];
|
250
|
+
if ( !tx )
|
251
|
+
tx = $.fn.cycle.transitions[opts.fx];
|
252
|
+
|
253
|
+
if (!tx) {
|
254
|
+
tx = $.fn.cycle.transitions.fade;
|
255
|
+
opts.API.log('Transition "' + opts.fx + '" not found. Using fade.');
|
256
|
+
}
|
257
|
+
return tx;
|
258
|
+
},
|
259
|
+
|
260
|
+
prepareTx: function( manual, fwd ) {
|
261
|
+
var opts = this.opts();
|
262
|
+
var after, curr, next, slideOpts, tx;
|
263
|
+
|
264
|
+
if ( opts.slideCount < 2 ) {
|
265
|
+
opts.timeoutId = 0;
|
266
|
+
return;
|
267
|
+
}
|
268
|
+
if ( manual && ( !opts.busy || opts.manualTrump ) ) {
|
269
|
+
opts.API.stopTransition();
|
270
|
+
opts.busy = false;
|
271
|
+
clearTimeout(opts.timeoutId);
|
272
|
+
opts.timeoutId = 0;
|
273
|
+
}
|
274
|
+
if ( opts.busy )
|
275
|
+
return;
|
276
|
+
if ( opts.timeoutId === 0 && !manual )
|
277
|
+
return;
|
278
|
+
|
279
|
+
curr = opts.slides[opts.currSlide];
|
280
|
+
next = opts.slides[opts.nextSlide];
|
281
|
+
slideOpts = opts.API.getSlideOpts( opts.nextSlide );
|
282
|
+
tx = opts.API.calcTx( slideOpts, manual );
|
283
|
+
|
284
|
+
opts._tx = tx;
|
285
|
+
|
286
|
+
if ( manual && slideOpts.manualSpeed !== undefined )
|
287
|
+
slideOpts.speed = slideOpts.manualSpeed;
|
288
|
+
|
289
|
+
// if ( opts.nextSlide === opts.currSlide )
|
290
|
+
// opts.API.calcNextSlide();
|
291
|
+
|
292
|
+
// ensure that:
|
293
|
+
// 1. advancing to a different slide
|
294
|
+
// 2. this is either a manual event (prev/next, pager, cmd) or
|
295
|
+
// a timer event and slideshow is not paused
|
296
|
+
if ( opts.nextSlide != opts.currSlide &&
|
297
|
+
(manual || (!opts.paused && !opts.hoverPaused && opts.timeout) )) { // #62
|
298
|
+
|
299
|
+
opts.API.trigger('cycle-before', [ slideOpts, curr, next, fwd ]);
|
300
|
+
if ( tx.before )
|
301
|
+
tx.before( slideOpts, curr, next, fwd );
|
302
|
+
|
303
|
+
after = function() {
|
304
|
+
opts.busy = false;
|
305
|
+
// #76; bail if slideshow has been destroyed
|
306
|
+
if (! opts.container.data( 'cycle.opts' ) )
|
307
|
+
return;
|
308
|
+
|
309
|
+
if (tx.after)
|
310
|
+
tx.after( slideOpts, curr, next, fwd );
|
311
|
+
opts.API.trigger('cycle-after', [ slideOpts, curr, next, fwd ]);
|
312
|
+
opts.API.queueTransition( slideOpts);
|
313
|
+
opts.API.updateView( true );
|
314
|
+
};
|
315
|
+
|
316
|
+
opts.busy = true;
|
317
|
+
if (tx.transition)
|
318
|
+
tx.transition(slideOpts, curr, next, fwd, after);
|
319
|
+
else
|
320
|
+
opts.API.doTransition( slideOpts, curr, next, fwd, after);
|
321
|
+
|
322
|
+
opts.API.calcNextSlide();
|
323
|
+
opts.API.updateView();
|
324
|
+
} else {
|
325
|
+
opts.API.queueTransition( slideOpts );
|
326
|
+
}
|
327
|
+
},
|
328
|
+
|
329
|
+
// perform the actual animation
|
330
|
+
doTransition: function( slideOpts, currEl, nextEl, fwd, callback) {
|
331
|
+
var opts = slideOpts;
|
332
|
+
var curr = $(currEl), next = $(nextEl);
|
333
|
+
var fn = function() {
|
334
|
+
// make sure animIn has something so that callback doesn't trigger immediately
|
335
|
+
next.animate(opts.animIn || { opacity: 1}, opts.speed, opts.easeIn || opts.easing, callback);
|
336
|
+
};
|
337
|
+
|
338
|
+
next.css(opts.cssBefore || {});
|
339
|
+
curr.animate(opts.animOut || {}, opts.speed, opts.easeOut || opts.easing, function() {
|
340
|
+
curr.css(opts.cssAfter || {});
|
341
|
+
if (!opts.sync) {
|
342
|
+
fn();
|
343
|
+
}
|
344
|
+
});
|
345
|
+
if (opts.sync) {
|
346
|
+
fn();
|
347
|
+
}
|
348
|
+
},
|
349
|
+
|
350
|
+
queueTransition: function( slideOpts ) {
|
351
|
+
var opts = this.opts();
|
352
|
+
if (opts.nextSlide === 0 && --opts.loop === 0) {
|
353
|
+
opts.API.log('terminating; loop=0');
|
354
|
+
opts.timeout = 0;
|
355
|
+
if (slideOpts.timeout) {
|
356
|
+
setTimeout(function() {
|
357
|
+
opts.API.trigger('cycle-finished', [ opts ]);
|
358
|
+
}, slideOpts.timeout);
|
359
|
+
}
|
360
|
+
else {
|
361
|
+
opts.API.trigger('cycle-finished', [ opts ]);
|
362
|
+
}
|
363
|
+
// reset nextSlide
|
364
|
+
opts.nextSlide = opts.currSlide;
|
365
|
+
return;
|
366
|
+
}
|
367
|
+
if (slideOpts.timeout) {
|
368
|
+
opts.timeoutId = setTimeout(function() {
|
369
|
+
opts.API.prepareTx( false, !opts.reverse );
|
370
|
+
}, slideOpts.timeout );
|
371
|
+
}
|
372
|
+
},
|
373
|
+
|
374
|
+
stopTransition: function() {
|
375
|
+
var opts = this.opts();
|
376
|
+
if ( opts.slides.filter(':animated').length ) {
|
377
|
+
opts.slides.stop(false, true);
|
378
|
+
opts.API.trigger('cycle-transition-stopped', [ opts ]);
|
379
|
+
}
|
380
|
+
|
381
|
+
if ( opts._tx && opts._tx.stopTransition )
|
382
|
+
opts._tx.stopTransition( opts );
|
383
|
+
},
|
384
|
+
|
385
|
+
// advance slide forward or back
|
386
|
+
advanceSlide: function( val ) {
|
387
|
+
var opts = this.opts();
|
388
|
+
clearTimeout(opts.timeoutId);
|
389
|
+
opts.timeoutId = 0;
|
390
|
+
opts.nextSlide = opts.currSlide + val;
|
391
|
+
|
392
|
+
if (opts.nextSlide < 0)
|
393
|
+
opts.nextSlide = opts.slides.length - 1;
|
394
|
+
else if (opts.nextSlide >= opts.slides.length)
|
395
|
+
opts.nextSlide = 0;
|
396
|
+
|
397
|
+
opts.API.prepareTx( true, val >= 0 );
|
398
|
+
return false;
|
399
|
+
},
|
400
|
+
|
401
|
+
buildSlideOpts: function( slide ) {
|
402
|
+
var opts = this.opts();
|
403
|
+
var val, shortName;
|
404
|
+
var slideOpts = slide.data() || {};
|
405
|
+
for (var p in slideOpts) {
|
406
|
+
// allow props to be accessed sans 'cycle' prefix and log the overrides
|
407
|
+
if (slideOpts.hasOwnProperty(p) && /^cycle[A-Z]+/.test(p) ) {
|
408
|
+
val = slideOpts[p];
|
409
|
+
shortName = p.match(/^cycle(.*)/)[1].replace(/^[A-Z]/, lowerCase);
|
410
|
+
opts.API.log('['+(opts.slideCount-1)+']', shortName+':', val, '('+typeof val +')');
|
411
|
+
slideOpts[shortName] = val;
|
412
|
+
}
|
413
|
+
}
|
414
|
+
|
415
|
+
slideOpts = $.extend( {}, $.fn.cycle.defaults, opts, slideOpts );
|
416
|
+
slideOpts.slideNum = opts.slideCount;
|
417
|
+
|
418
|
+
try {
|
419
|
+
// these props should always be read from the master state object
|
420
|
+
delete slideOpts.API;
|
421
|
+
delete slideOpts.slideCount;
|
422
|
+
delete slideOpts.currSlide;
|
423
|
+
delete slideOpts.nextSlide;
|
424
|
+
delete slideOpts.slides;
|
425
|
+
} catch(e) {
|
426
|
+
// no op
|
427
|
+
}
|
428
|
+
return slideOpts;
|
429
|
+
},
|
430
|
+
|
431
|
+
getSlideOpts: function( index ) {
|
432
|
+
var opts = this.opts();
|
433
|
+
if ( index === undefined )
|
434
|
+
index = opts.currSlide;
|
435
|
+
|
436
|
+
var slide = opts.slides[index];
|
437
|
+
var slideOpts = $(slide).data('cycle.opts');
|
438
|
+
return $.extend( {}, opts, slideOpts );
|
439
|
+
},
|
440
|
+
|
441
|
+
initSlide: function( slideOpts, slide, suggestedZindex ) {
|
442
|
+
var opts = this.opts();
|
443
|
+
slide.css( slideOpts.slideCss || {} );
|
444
|
+
if ( suggestedZindex > 0 )
|
445
|
+
slide.css( 'zIndex', suggestedZindex );
|
446
|
+
|
447
|
+
// ensure that speed settings are sane
|
448
|
+
if ( isNaN( slideOpts.speed ) )
|
449
|
+
slideOpts.speed = $.fx.speeds[slideOpts.speed] || $.fx.speeds._default;
|
450
|
+
if ( !slideOpts.sync )
|
451
|
+
slideOpts.speed = slideOpts.speed / 2;
|
452
|
+
|
453
|
+
slide.addClass( opts.slideClass );
|
454
|
+
},
|
455
|
+
|
456
|
+
updateView: function( isAfter ) {
|
457
|
+
var opts = this.opts();
|
458
|
+
if ( !opts._initialized )
|
459
|
+
return;
|
460
|
+
var slideOpts = opts.API.getSlideOpts();
|
461
|
+
var currSlide = opts.slides[ opts.currSlide ];
|
462
|
+
|
463
|
+
if ( ! isAfter ) {
|
464
|
+
opts.API.trigger('cycle-update-view-before', [ opts, slideOpts, currSlide ]);
|
465
|
+
if ( opts.updateView < 0 )
|
466
|
+
return;
|
467
|
+
}
|
468
|
+
|
469
|
+
if ( opts.slideActiveClass ) {
|
470
|
+
opts.slides.removeClass( opts.slideActiveClass )
|
471
|
+
.eq( opts.currSlide ).addClass( opts.slideActiveClass );
|
472
|
+
}
|
473
|
+
|
474
|
+
if ( isAfter && opts.hideNonActive )
|
475
|
+
opts.slides.filter( ':not(.' + opts.slideActiveClass + ')' ).hide();
|
476
|
+
|
477
|
+
opts.API.trigger('cycle-update-view', [ opts, slideOpts, currSlide, isAfter ]);
|
478
|
+
opts.API.trigger('cycle-update-view-after', [ opts, slideOpts, currSlide ]);
|
479
|
+
},
|
480
|
+
|
481
|
+
getComponent: function( name ) {
|
482
|
+
var opts = this.opts();
|
483
|
+
var selector = opts[name];
|
484
|
+
if (typeof selector === 'string') {
|
485
|
+
// if selector is a child selector then use find, otherwise query full dom
|
486
|
+
return (/^\s*\>/).test( selector ) ? opts.container.find( selector ) : $( selector );
|
487
|
+
}
|
488
|
+
if (selector.jquery)
|
489
|
+
return selector;
|
490
|
+
|
491
|
+
return $(selector);
|
492
|
+
},
|
493
|
+
|
494
|
+
stackSlides: function( curr, next, fwd ) {
|
495
|
+
var opts = this.opts();
|
496
|
+
if ( !curr ) {
|
497
|
+
curr = opts.slides[opts.currSlide];
|
498
|
+
next = opts.slides[opts.nextSlide];
|
499
|
+
fwd = !opts.reverse;
|
500
|
+
}
|
501
|
+
|
502
|
+
// reset the zIndex for the common case:
|
503
|
+
// curr slide on top, next slide beneath, and the rest in order to be shown
|
504
|
+
$(curr).css('zIndex', opts.maxZ);
|
505
|
+
|
506
|
+
var i;
|
507
|
+
var z = opts.maxZ - 2;
|
508
|
+
var len = opts.slideCount;
|
509
|
+
if (fwd) {
|
510
|
+
for ( i = opts.currSlide + 1; i < len; i++ )
|
511
|
+
$( opts.slides[i] ).css( 'zIndex', z-- );
|
512
|
+
for ( i = 0; i < opts.currSlide; i++ )
|
513
|
+
$( opts.slides[i] ).css( 'zIndex', z-- );
|
514
|
+
}
|
515
|
+
else {
|
516
|
+
for ( i = opts.currSlide - 1; i >= 0; i-- )
|
517
|
+
$( opts.slides[i] ).css( 'zIndex', z-- );
|
518
|
+
for ( i = len - 1; i > opts.currSlide; i-- )
|
519
|
+
$( opts.slides[i] ).css( 'zIndex', z-- );
|
520
|
+
}
|
521
|
+
|
522
|
+
$(next).css('zIndex', opts.maxZ - 1);
|
523
|
+
},
|
524
|
+
|
525
|
+
getSlideIndex: function( el ) {
|
526
|
+
return this.opts().slides.index( el );
|
527
|
+
}
|
528
|
+
|
529
|
+
}; // API
|
530
|
+
|
531
|
+
// default logger
|
532
|
+
$.fn.cycle.log = function log() {
|
533
|
+
/*global console:true */
|
534
|
+
if (window.console && console.log)
|
535
|
+
console.log('[cycle2] ' + Array.prototype.join.call(arguments, ' ') );
|
536
|
+
};
|
537
|
+
|
538
|
+
$.fn.cycle.version = function() { return 'Cycle2: ' + version; };
|
539
|
+
|
540
|
+
// helper functions
|
541
|
+
|
542
|
+
function lowerCase(s) {
|
543
|
+
return (s || '').toLowerCase();
|
544
|
+
}
|
545
|
+
|
546
|
+
// expose transition object
|
547
|
+
$.fn.cycle.transitions = {
|
548
|
+
custom: {
|
549
|
+
},
|
550
|
+
none: {
|
551
|
+
before: function( opts, curr, next, fwd ) {
|
552
|
+
opts.API.stackSlides( next, curr, fwd );
|
553
|
+
opts.cssBefore = { opacity: 1, display: 'block' };
|
554
|
+
}
|
555
|
+
},
|
556
|
+
fade: {
|
557
|
+
before: function( opts, curr, next, fwd ) {
|
558
|
+
var css = opts.API.getSlideOpts( opts.nextSlide ).slideCss || {};
|
559
|
+
opts.API.stackSlides( curr, next, fwd );
|
560
|
+
opts.cssBefore = $.extend(css, { opacity: 0, display: 'block' });
|
561
|
+
opts.animIn = { opacity: 1 };
|
562
|
+
opts.animOut = { opacity: 0 };
|
563
|
+
}
|
564
|
+
},
|
565
|
+
fadeout: {
|
566
|
+
before: function( opts , curr, next, fwd ) {
|
567
|
+
var css = opts.API.getSlideOpts( opts.nextSlide ).slideCss || {};
|
568
|
+
opts.API.stackSlides( curr, next, fwd );
|
569
|
+
opts.cssBefore = $.extend(css, { opacity: 1, display: 'block' });
|
570
|
+
opts.animOut = { opacity: 0 };
|
571
|
+
}
|
572
|
+
},
|
573
|
+
scrollHorz: {
|
574
|
+
before: function( opts, curr, next, fwd ) {
|
575
|
+
opts.API.stackSlides( curr, next, fwd );
|
576
|
+
var w = opts.container.css('overflow','hidden').width();
|
577
|
+
opts.cssBefore = { left: fwd ? w : - w, top: 0, opacity: 1, display: 'block' };
|
578
|
+
opts.cssAfter = { zIndex: opts._maxZ - 2, left: 0 };
|
579
|
+
opts.animIn = { left: 0 };
|
580
|
+
opts.animOut = { left: fwd ? -w : w };
|
581
|
+
}
|
582
|
+
}
|
583
|
+
};
|
584
|
+
|
585
|
+
// @see: http://jquery.malsup.com/cycle2/api
|
586
|
+
$.fn.cycle.defaults = {
|
587
|
+
allowWrap: true,
|
588
|
+
autoSelector: '.cycle-slideshow[data-cycle-auto-init!=false]',
|
589
|
+
delay: 0,
|
590
|
+
easing: null,
|
591
|
+
fx: 'fade',
|
592
|
+
hideNonActive: true,
|
593
|
+
loop: 0,
|
594
|
+
manualFx: undefined,
|
595
|
+
manualSpeed: undefined,
|
596
|
+
manualTrump: true,
|
597
|
+
maxZ: 100,
|
598
|
+
pauseOnHover: false,
|
599
|
+
reverse: false,
|
600
|
+
slideActiveClass: 'cycle-slide-active',
|
601
|
+
slideClass: 'cycle-slide',
|
602
|
+
slideCss: { position: 'absolute', top: 0, left: 0 },
|
603
|
+
slides: '> img',
|
604
|
+
speed: 500,
|
605
|
+
startingSlide: 0,
|
606
|
+
sync: true,
|
607
|
+
timeout: 4000,
|
608
|
+
updateView: -1
|
609
|
+
};
|
610
|
+
|
611
|
+
// automatically find and run slideshows
|
612
|
+
$(document).ready(function() {
|
613
|
+
$( $.fn.cycle.defaults.autoSelector ).cycle();
|
614
|
+
});
|
615
|
+
|
616
|
+
})(jQuery);
|
617
|
+
|
618
|
+
/*! Cycle2 autoheight plugin; Copyright (c) M.Alsup, 2012; version: 20130322 */
|
619
|
+
(function($) {
|
620
|
+
"use strict";
|
621
|
+
|
622
|
+
$.extend($.fn.cycle.defaults, {
|
623
|
+
autoHeight: 0 // setting this option to -1 disables autoHeight logic
|
624
|
+
});
|
625
|
+
|
626
|
+
$(document).on( 'cycle-initialized cycle-slide-added cycle-slide-removed', initAutoHeight);
|
627
|
+
$(document).on( 'cycle-destroyed', cleanup);
|
628
|
+
|
629
|
+
function initAutoHeight(e, opts) {
|
630
|
+
var autoHeight = opts.autoHeight;
|
631
|
+
var clone, ratio, timeout;
|
632
|
+
|
633
|
+
cleanup( e, opts );
|
634
|
+
|
635
|
+
$(window).on( 'resize orientationchange', onResize );
|
636
|
+
opts._autoHeightOnResize = onResize;
|
637
|
+
|
638
|
+
if ( autoHeight === 'calc' || ( $.type( autoHeight ) == 'number' && autoHeight >= 0 ) ) {
|
639
|
+
if ( autoHeight === 'calc' ) {
|
640
|
+
autoHeight = calcSentinelIndex( opts );
|
641
|
+
}
|
642
|
+
else if ( autoHeight >= opts.slides.length ) {
|
643
|
+
autoHeight = 0;
|
644
|
+
}
|
645
|
+
|
646
|
+
// clone existing slide as sentinel
|
647
|
+
clone = $( opts.slides[ autoHeight ] ).clone();
|
648
|
+
|
649
|
+
// #50; remove special attributes from cloned content
|
650
|
+
clone.removeAttr( 'id name rel' ).find( '[id],[name],[rel]' ).removeAttr( 'id name rel' );
|
651
|
+
|
652
|
+
clone.css({
|
653
|
+
position: 'static',
|
654
|
+
visibility: 'hidden',
|
655
|
+
display: 'block'
|
656
|
+
}).prependTo( opts.container ).addClass('cycle-sentinel cycle-slide');
|
657
|
+
clone.find( '*' ).css( 'visibility', 'hidden' );
|
658
|
+
|
659
|
+
opts._sentinel = clone;
|
660
|
+
}
|
661
|
+
else if ( $.type( autoHeight ) == 'string' && /\d+\:\d+/.test( autoHeight ) ) {
|
662
|
+
// use ratio
|
663
|
+
ratio = autoHeight.match(/(\d+)\:(\d+)/);
|
664
|
+
ratio = ratio[1] / ratio[2];
|
665
|
+
opts._autoHeightRatio = ratio;
|
666
|
+
setTimeout(function() {
|
667
|
+
$(window).triggerHandler('resize');
|
668
|
+
},15);
|
669
|
+
}
|
670
|
+
|
671
|
+
function onResize() {
|
672
|
+
if ( opts._autoHeightRatio ) {
|
673
|
+
opts.container.height( opts.container.width() / ratio );
|
674
|
+
}
|
675
|
+
else {
|
676
|
+
clearTimeout( timeout );
|
677
|
+
timeout = setTimeout(function() {
|
678
|
+
initAutoHeight(e, opts);
|
679
|
+
}, 50);
|
680
|
+
}
|
681
|
+
}
|
682
|
+
}
|
683
|
+
|
684
|
+
function cleanup( e, opts ) {
|
685
|
+
if ( opts._sentinel ) {
|
686
|
+
opts._sentinel.remove();
|
687
|
+
opts._sentinel = null;
|
688
|
+
}
|
689
|
+
if ( opts._autoHeightOnResize ) {
|
690
|
+
$(window).off( 'resize orientationchange', opts._autoHeightOnResize );
|
691
|
+
opts._autoHeightOnResize = null;
|
692
|
+
}
|
693
|
+
}
|
694
|
+
|
695
|
+
function calcSentinelIndex( opts ) {
|
696
|
+
var index = 0, max = -1;
|
697
|
+
|
698
|
+
// calculate tallest slide index
|
699
|
+
opts.slides.each(function(i) {
|
700
|
+
var h = $(this).height();
|
701
|
+
if ( h > max ) {
|
702
|
+
max = h;
|
703
|
+
index = i;
|
704
|
+
}
|
705
|
+
});
|
706
|
+
return index;
|
707
|
+
}
|
708
|
+
|
709
|
+
})(jQuery);
|
710
|
+
|
711
|
+
/*! caption plugin for Cycle2; version: 20130306 */
|
712
|
+
(function($) {
|
713
|
+
"use strict";
|
714
|
+
|
715
|
+
$.extend($.fn.cycle.defaults, {
|
716
|
+
caption: '> .cycle-caption',
|
717
|
+
captionTemplate: '{{slideNum}} / {{slideCount}}',
|
718
|
+
overlay: '> .cycle-overlay',
|
719
|
+
overlayTemplate: '<div>{{title}}</div><div>{{desc}}</div>',
|
720
|
+
captionModule: 'caption'
|
721
|
+
});
|
722
|
+
|
723
|
+
$(document).on( 'cycle-update-view', function( e, opts, slideOpts, currSlide ) {
|
724
|
+
if ( opts.captionModule !== 'caption' )
|
725
|
+
return;
|
726
|
+
var el;
|
727
|
+
$.each(['caption','overlay'], function() {
|
728
|
+
var name = this;
|
729
|
+
var template = slideOpts[name+'Template'];
|
730
|
+
var el = opts.API.getComponent( name );
|
731
|
+
if( el.length && template ) {
|
732
|
+
el.html( opts.API.tmpl( template, slideOpts, opts, currSlide ) );
|
733
|
+
el.show();
|
734
|
+
}
|
735
|
+
else {
|
736
|
+
el.hide();
|
737
|
+
}
|
738
|
+
});
|
739
|
+
});
|
740
|
+
|
741
|
+
$(document).on( 'cycle-destroyed', function( e, opts ) {
|
742
|
+
var el;
|
743
|
+
$.each(['caption','overlay'], function() {
|
744
|
+
var name = this, template = opts[name+'Template'];
|
745
|
+
if ( opts[name] && template ) {
|
746
|
+
el = opts.API.getComponent( 'caption' );
|
747
|
+
el.empty();
|
748
|
+
}
|
749
|
+
});
|
750
|
+
});
|
751
|
+
|
752
|
+
})(jQuery);
|
753
|
+
|
754
|
+
/*! command plugin for Cycle2; version: 20130203 */
|
755
|
+
(function($) {
|
756
|
+
"use strict";
|
757
|
+
|
758
|
+
var c2 = $.fn.cycle;
|
759
|
+
|
760
|
+
$.fn.cycle = function( options ) {
|
761
|
+
var cmd, cmdFn, opts;
|
762
|
+
var args = $.makeArray( arguments );
|
763
|
+
|
764
|
+
if ( $.type( options ) == 'number' ) {
|
765
|
+
return this.cycle( 'goto', options );
|
766
|
+
}
|
767
|
+
|
768
|
+
if ( $.type( options ) == 'string' ) {
|
769
|
+
return this.each(function() {
|
770
|
+
var cmdArgs;
|
771
|
+
cmd = options;
|
772
|
+
opts = $(this).data('cycle.opts');
|
773
|
+
|
774
|
+
if ( opts === undefined ) {
|
775
|
+
c2.log('slideshow must be initialized before sending commands; "' + cmd + '" ignored');
|
776
|
+
return;
|
777
|
+
}
|
778
|
+
else {
|
779
|
+
cmd = cmd == 'goto' ? 'jump' : cmd; // issue #3; change 'goto' to 'jump' internally
|
780
|
+
cmdFn = opts.API[ cmd ];
|
781
|
+
if ( $.isFunction( cmdFn )) {
|
782
|
+
cmdArgs = $.makeArray( args );
|
783
|
+
cmdArgs.shift();
|
784
|
+
return cmdFn.apply( opts.API, cmdArgs );
|
785
|
+
}
|
786
|
+
else {
|
787
|
+
c2.log( 'unknown command: ', cmd );
|
788
|
+
}
|
789
|
+
}
|
790
|
+
});
|
791
|
+
}
|
792
|
+
else {
|
793
|
+
return c2.apply( this, arguments );
|
794
|
+
}
|
795
|
+
};
|
796
|
+
|
797
|
+
// copy props
|
798
|
+
$.extend( $.fn.cycle, c2 );
|
799
|
+
|
800
|
+
$.extend( c2.API, {
|
801
|
+
next: function() {
|
802
|
+
var opts = this.opts();
|
803
|
+
if ( opts.busy && ! opts.manualTrump )
|
804
|
+
return;
|
805
|
+
|
806
|
+
var count = opts.reverse ? -1 : 1;
|
807
|
+
if ( opts.allowWrap === false && ( opts.currSlide + count ) >= opts.slideCount )
|
808
|
+
return;
|
809
|
+
|
810
|
+
opts.API.advanceSlide( count );
|
811
|
+
opts.API.trigger('cycle-next', [ opts ]).log('cycle-next');
|
812
|
+
},
|
813
|
+
|
814
|
+
prev: function() {
|
815
|
+
var opts = this.opts();
|
816
|
+
if ( opts.busy && ! opts.manualTrump )
|
817
|
+
return;
|
818
|
+
var count = opts.reverse ? 1 : -1;
|
819
|
+
if ( opts.allowWrap === false && ( opts.currSlide + count ) < 0 )
|
820
|
+
return;
|
821
|
+
|
822
|
+
opts.API.advanceSlide( count );
|
823
|
+
opts.API.trigger('cycle-prev', [ opts ]).log('cycle-prev');
|
824
|
+
},
|
825
|
+
|
826
|
+
destroy: function() {
|
827
|
+
var opts = this.opts();
|
828
|
+
clearTimeout(opts.timeoutId);
|
829
|
+
opts.timeoutId = 0;
|
830
|
+
opts.API.stop();
|
831
|
+
opts.API.trigger( 'cycle-destroyed', [ opts ] ).log('cycle-destroyed');
|
832
|
+
opts.container.removeData( 'cycle.opts' );
|
833
|
+
|
834
|
+
// #75; remove inline styles
|
835
|
+
if ( ! opts.retainStylesOnDestroy ) {
|
836
|
+
opts.container.removeAttr( 'style' );
|
837
|
+
opts.slides.removeAttr( 'style' );
|
838
|
+
opts.slides.removeClass( 'cycle-slide-active' );
|
839
|
+
}
|
840
|
+
},
|
841
|
+
|
842
|
+
jump: function( index ) {
|
843
|
+
// go to the requested slide
|
844
|
+
var fwd;
|
845
|
+
var opts = this.opts();
|
846
|
+
if ( opts.busy && ! opts.manualTrump )
|
847
|
+
return;
|
848
|
+
var num = parseInt( index, 10 );
|
849
|
+
if (isNaN(num) || num < 0 || num >= opts.slides.length) {
|
850
|
+
opts.API.log('goto: invalid slide index: ' + num);
|
851
|
+
return;
|
852
|
+
}
|
853
|
+
if (num == opts.currSlide) {
|
854
|
+
opts.API.log('goto: skipping, already on slide', num);
|
855
|
+
return;
|
856
|
+
}
|
857
|
+
opts.nextSlide = num;
|
858
|
+
clearTimeout(opts.timeoutId);
|
859
|
+
opts.timeoutId = 0;
|
860
|
+
opts.API.log('goto: ', num, ' (zero-index)');
|
861
|
+
fwd = opts.currSlide < opts.nextSlide;
|
862
|
+
opts.API.prepareTx( true, fwd );
|
863
|
+
},
|
864
|
+
|
865
|
+
stop: function() {
|
866
|
+
var opts = this.opts();
|
867
|
+
var pauseObj = opts.container;
|
868
|
+
clearTimeout(opts.timeoutId);
|
869
|
+
opts.timeoutId = 0;
|
870
|
+
opts.API.stopTransition();
|
871
|
+
if ( opts.pauseOnHover ) {
|
872
|
+
if ( opts.pauseOnHover !== true )
|
873
|
+
pauseObj = $( opts.pauseOnHover );
|
874
|
+
pauseObj.off('mouseenter mouseleave');
|
875
|
+
}
|
876
|
+
opts.API.trigger('cycle-stopped', [ opts ]).log('cycle-stopped');
|
877
|
+
},
|
878
|
+
|
879
|
+
pause: function() {
|
880
|
+
var opts = this.opts();
|
881
|
+
opts.paused = true;
|
882
|
+
opts.API.trigger('cycle-paused', [ opts ]).log('cycle-paused');
|
883
|
+
},
|
884
|
+
|
885
|
+
resume: function() {
|
886
|
+
var opts = this.opts();
|
887
|
+
opts.paused = false;
|
888
|
+
opts.API.trigger('cycle-resumed', [ opts ]).log('cycle-resumed');
|
889
|
+
},
|
890
|
+
|
891
|
+
reinit: function() {
|
892
|
+
var opts = this.opts();
|
893
|
+
opts.API.destroy();
|
894
|
+
opts.container.cycle();
|
895
|
+
},
|
896
|
+
|
897
|
+
remove: function( index ) {
|
898
|
+
var opts = this.opts();
|
899
|
+
var slide, slideToRemove, slides = [], slideNum = 1;
|
900
|
+
for ( var i=0; i < opts.slides.length; i++ ) {
|
901
|
+
slide = opts.slides[i];
|
902
|
+
if ( i == index ) {
|
903
|
+
slideToRemove = slide;
|
904
|
+
}
|
905
|
+
else {
|
906
|
+
slides.push( slide );
|
907
|
+
$( slide ).data('cycle.opts').slideNum = slideNum;
|
908
|
+
slideNum++;
|
909
|
+
}
|
910
|
+
}
|
911
|
+
if ( slideToRemove ) {
|
912
|
+
opts.slides = $( slides );
|
913
|
+
opts.slideCount--;
|
914
|
+
$( slideToRemove ).remove();
|
915
|
+
if (index == opts.currSlide) {
|
916
|
+
opts.API.advanceSlide( 1 );
|
917
|
+
}
|
918
|
+
|
919
|
+
opts.API.trigger('cycle-slide-removed', [ opts, index, slideToRemove ]).log('cycle-slide-removed');
|
920
|
+
opts.API.updateView();
|
921
|
+
}
|
922
|
+
}
|
923
|
+
|
924
|
+
});
|
925
|
+
|
926
|
+
// listen for clicks on elements with data-cycle-cmd attribute
|
927
|
+
$(document).on('click.cycle', '[data-cycle-cmd]', function(e) {
|
928
|
+
// issue cycle command
|
929
|
+
e.preventDefault();
|
930
|
+
var el = $(this);
|
931
|
+
var command = el.data('cycle-cmd');
|
932
|
+
var context = el.data('cycle-context') || '.cycle-slideshow';
|
933
|
+
$(context).cycle(command, el.data('cycle-arg'));
|
934
|
+
});
|
935
|
+
|
936
|
+
|
937
|
+
})(jQuery);
|
938
|
+
|
939
|
+
/*! hash plugin for Cycle2; version: 20121120 */
|
940
|
+
(function($) {
|
941
|
+
"use strict";
|
942
|
+
|
943
|
+
$(document).on( 'cycle-pre-initialize', function( e, opts ) {
|
944
|
+
onHashChange( opts, true );
|
945
|
+
|
946
|
+
opts._onHashChange = function() {
|
947
|
+
onHashChange( opts, false );
|
948
|
+
};
|
949
|
+
|
950
|
+
$( window ).on( 'hashchange', opts._onHashChange);
|
951
|
+
});
|
952
|
+
|
953
|
+
$(document).on( 'cycle-update-view', function( e, opts, slideOpts ) {
|
954
|
+
if ( slideOpts.hash ) {
|
955
|
+
opts._hashFence = true;
|
956
|
+
window.location.hash = slideOpts.hash;
|
957
|
+
}
|
958
|
+
});
|
959
|
+
|
960
|
+
$(document).on( 'cycle-destroyed', function( e, opts) {
|
961
|
+
if ( opts._onHashChange ) {
|
962
|
+
$( window ).off( 'hashchange', opts._onHashChange );
|
963
|
+
}
|
964
|
+
});
|
965
|
+
|
966
|
+
function onHashChange( opts, setStartingSlide ) {
|
967
|
+
var hash;
|
968
|
+
if ( opts._hashFence ) {
|
969
|
+
opts._hashFence = false;
|
970
|
+
return;
|
971
|
+
}
|
972
|
+
|
973
|
+
hash = window.location.hash.substring(1);
|
974
|
+
|
975
|
+
opts.slides.each(function(i) {
|
976
|
+
if ( $(this).data( 'cycle-hash' ) == hash ) {
|
977
|
+
if ( setStartingSlide === true ) {
|
978
|
+
opts.startingSlide = i;
|
979
|
+
}
|
980
|
+
else {
|
981
|
+
opts.nextSlide = i;
|
982
|
+
opts.API.prepareTx( true, false );
|
983
|
+
}
|
984
|
+
return false;
|
985
|
+
}
|
986
|
+
});
|
987
|
+
}
|
988
|
+
|
989
|
+
})(jQuery);
|
990
|
+
|
991
|
+
/*! loader plugin for Cycle2; version: 20130307 */
|
992
|
+
(function($) {
|
993
|
+
"use strict";
|
994
|
+
|
995
|
+
$.extend($.fn.cycle.defaults, {
|
996
|
+
loader: false
|
997
|
+
});
|
998
|
+
|
999
|
+
$(document).on( 'cycle-bootstrap', function( e, opts ) {
|
1000
|
+
var addFn;
|
1001
|
+
|
1002
|
+
if ( !opts.loader )
|
1003
|
+
return;
|
1004
|
+
|
1005
|
+
// override API.add for this slideshow
|
1006
|
+
addFn = opts.API.add;
|
1007
|
+
opts.API.add = add;
|
1008
|
+
|
1009
|
+
function add( slides, prepend ) {
|
1010
|
+
var slideArr = [];
|
1011
|
+
if ( $.type( slides ) == 'string' )
|
1012
|
+
slides = $.trim( slides );
|
1013
|
+
else if ( $.type( slides) === 'array' ) {
|
1014
|
+
for (var i=0; i < slides.length; i++ )
|
1015
|
+
slides[i] = $(slides[i])[0];
|
1016
|
+
}
|
1017
|
+
|
1018
|
+
slides = $( slides );
|
1019
|
+
var slideCount = slides.length;
|
1020
|
+
|
1021
|
+
if ( ! slideCount )
|
1022
|
+
return;
|
1023
|
+
|
1024
|
+
slides.hide().appendTo('body').each(function(i) { // appendTo fixes #56
|
1025
|
+
var count = 0;
|
1026
|
+
var slide = $(this);
|
1027
|
+
var images = slide.is('img') ? slide : slide.find('img');
|
1028
|
+
slide.data('index', i);
|
1029
|
+
// allow some images to be marked as unimportant (and filter out images w/o src value)
|
1030
|
+
images = images.filter(':not(.cycle-loader-ignore)').filter(':not([src=""])');
|
1031
|
+
if ( ! images.length ) {
|
1032
|
+
--slideCount;
|
1033
|
+
slideArr.push( slide );
|
1034
|
+
return;
|
1035
|
+
}
|
1036
|
+
|
1037
|
+
count = images.length;
|
1038
|
+
images.each(function() {
|
1039
|
+
// add images that are already loaded
|
1040
|
+
if ( this.complete ) {
|
1041
|
+
imageLoaded();
|
1042
|
+
}
|
1043
|
+
else {
|
1044
|
+
$(this).load(function() {
|
1045
|
+
imageLoaded();
|
1046
|
+
}).error(function() {
|
1047
|
+
if ( --count === 0 ) {
|
1048
|
+
// ignore this slide
|
1049
|
+
opts.API.log('slide skipped; img not loaded:', this.src);
|
1050
|
+
if ( --slideCount === 0 && opts.loader == 'wait') {
|
1051
|
+
addFn.apply( opts.API, [ slideArr, prepend ] );
|
1052
|
+
}
|
1053
|
+
}
|
1054
|
+
});
|
1055
|
+
}
|
1056
|
+
});
|
1057
|
+
|
1058
|
+
function imageLoaded() {
|
1059
|
+
if ( --count === 0 ) {
|
1060
|
+
--slideCount;
|
1061
|
+
addSlide( slide );
|
1062
|
+
}
|
1063
|
+
}
|
1064
|
+
});
|
1065
|
+
|
1066
|
+
if ( slideCount )
|
1067
|
+
opts.container.addClass('cycle-loading');
|
1068
|
+
|
1069
|
+
|
1070
|
+
function addSlide( slide ) {
|
1071
|
+
var curr;
|
1072
|
+
if ( opts.loader == 'wait' ) {
|
1073
|
+
slideArr.push( slide );
|
1074
|
+
if ( slideCount === 0 ) {
|
1075
|
+
// #59; sort slides into original markup order
|
1076
|
+
slideArr.sort( sorter );
|
1077
|
+
addFn.apply( opts.API, [ slideArr, prepend ] );
|
1078
|
+
opts.container.removeClass('cycle-loading');
|
1079
|
+
}
|
1080
|
+
}
|
1081
|
+
else {
|
1082
|
+
curr = $(opts.slides[opts.currSlide]);
|
1083
|
+
addFn.apply( opts.API, [ slide, prepend ] );
|
1084
|
+
curr.show();
|
1085
|
+
opts.container.removeClass('cycle-loading');
|
1086
|
+
}
|
1087
|
+
}
|
1088
|
+
|
1089
|
+
function sorter(a, b) {
|
1090
|
+
return a.data('index') - b.data('index');
|
1091
|
+
}
|
1092
|
+
}
|
1093
|
+
});
|
1094
|
+
|
1095
|
+
})(jQuery);
|
1096
|
+
|
1097
|
+
/*! pager plugin for Cycle2; version: 20130203 */
|
1098
|
+
(function($) {
|
1099
|
+
"use strict";
|
1100
|
+
|
1101
|
+
$.extend($.fn.cycle.defaults, {
|
1102
|
+
pager: '> .cycle-pager',
|
1103
|
+
pagerActiveClass: 'cycle-pager-active',
|
1104
|
+
pagerEvent: 'click.cycle',
|
1105
|
+
pagerTemplate: '<span>•</span>'
|
1106
|
+
});
|
1107
|
+
|
1108
|
+
$(document).on( 'cycle-bootstrap', function( e, opts, API ) {
|
1109
|
+
// add method to API
|
1110
|
+
API.buildPagerLink = buildPagerLink;
|
1111
|
+
});
|
1112
|
+
|
1113
|
+
$(document).on( 'cycle-slide-added', function( e, opts, slideOpts, slideAdded ) {
|
1114
|
+
if ( opts.pager ) {
|
1115
|
+
opts.API.buildPagerLink ( opts, slideOpts, slideAdded );
|
1116
|
+
opts.API.page = page;
|
1117
|
+
}
|
1118
|
+
});
|
1119
|
+
|
1120
|
+
$(document).on( 'cycle-slide-removed', function( e, opts, index, slideRemoved ) {
|
1121
|
+
if ( opts.pager ) {
|
1122
|
+
var pagers = opts.API.getComponent( 'pager' );
|
1123
|
+
pagers.each(function() {
|
1124
|
+
var pager = $(this);
|
1125
|
+
$( pager.children()[index] ).remove();
|
1126
|
+
});
|
1127
|
+
}
|
1128
|
+
});
|
1129
|
+
|
1130
|
+
$(document).on( 'cycle-update-view', function( e, opts, slideOpts ) {
|
1131
|
+
var pagers;
|
1132
|
+
|
1133
|
+
if ( opts.pager ) {
|
1134
|
+
pagers = opts.API.getComponent( 'pager' );
|
1135
|
+
pagers.each(function() {
|
1136
|
+
$(this).children().removeClass( opts.pagerActiveClass )
|
1137
|
+
.eq( opts.currSlide ).addClass( opts.pagerActiveClass );
|
1138
|
+
});
|
1139
|
+
}
|
1140
|
+
});
|
1141
|
+
|
1142
|
+
$(document).on( 'cycle-destroyed', function( e, opts ) {
|
1143
|
+
var pagers;
|
1144
|
+
if (opts.pager && opts.pagerTemplate) {
|
1145
|
+
pagers = opts.API.getComponent( 'pager' );
|
1146
|
+
pagers.empty();
|
1147
|
+
}
|
1148
|
+
});
|
1149
|
+
|
1150
|
+
function buildPagerLink( opts, slideOpts, slide ) {
|
1151
|
+
var pagerLink;
|
1152
|
+
var pagers = opts.API.getComponent( 'pager' );
|
1153
|
+
pagers.each(function() {
|
1154
|
+
var pager = $(this);
|
1155
|
+
if ( slideOpts.pagerTemplate ) {
|
1156
|
+
var markup = opts.API.tmpl( slideOpts.pagerTemplate, slideOpts, opts, slide[0] );
|
1157
|
+
pagerLink = $( markup ).appendTo( pager );
|
1158
|
+
}
|
1159
|
+
else {
|
1160
|
+
pagerLink = pager.children().eq( opts.slideCount - 1 );
|
1161
|
+
}
|
1162
|
+
pagerLink.on( opts.pagerEvent, function(e) {
|
1163
|
+
e.preventDefault();
|
1164
|
+
opts.API.page( pager, e.currentTarget);
|
1165
|
+
});
|
1166
|
+
});
|
1167
|
+
}
|
1168
|
+
|
1169
|
+
function page( pager, target ) {
|
1170
|
+
/*jshint validthis:true */
|
1171
|
+
var opts = this.opts();
|
1172
|
+
if ( opts.busy && ! opts.manualTrump )
|
1173
|
+
return;
|
1174
|
+
|
1175
|
+
var index = pager.children().index( target );
|
1176
|
+
var nextSlide = index;
|
1177
|
+
var fwd = opts.currSlide < nextSlide;
|
1178
|
+
if (opts.currSlide == nextSlide) {
|
1179
|
+
return; // no op, clicked pager for the currently displayed slide
|
1180
|
+
}
|
1181
|
+
opts.nextSlide = nextSlide;
|
1182
|
+
opts.API.prepareTx( true, fwd );
|
1183
|
+
opts.API.trigger('cycle-pager-activated', [opts, pager, target ]);
|
1184
|
+
}
|
1185
|
+
|
1186
|
+
})(jQuery);
|
1187
|
+
|
1188
|
+
|
1189
|
+
/*! prevnext plugin for Cycle2; version: 20130307 */
|
1190
|
+
(function($) {
|
1191
|
+
"use strict";
|
1192
|
+
|
1193
|
+
$.extend($.fn.cycle.defaults, {
|
1194
|
+
next: '> .cycle-next',
|
1195
|
+
nextEvent: 'click.cycle',
|
1196
|
+
disabledClass: 'disabled',
|
1197
|
+
prev: '> .cycle-prev',
|
1198
|
+
prevEvent: 'click.cycle',
|
1199
|
+
swipe: false
|
1200
|
+
});
|
1201
|
+
|
1202
|
+
$(document).on( 'cycle-initialized', function( e, opts ) {
|
1203
|
+
opts.API.getComponent( 'next' ).on( opts.nextEvent, function(e) {
|
1204
|
+
e.preventDefault();
|
1205
|
+
opts.API.next();
|
1206
|
+
});
|
1207
|
+
|
1208
|
+
opts.API.getComponent( 'prev' ).on( opts.prevEvent, function(e) {
|
1209
|
+
e.preventDefault();
|
1210
|
+
opts.API.prev();
|
1211
|
+
});
|
1212
|
+
|
1213
|
+
if ( opts.swipe ) {
|
1214
|
+
var nextEvent = opts.swipeVert ? 'swipeUp.cycle' : 'swipeLeft.cycle swipeleft.cycle';
|
1215
|
+
var prevEvent = opts.swipeVert ? 'swipeDown.cycle' : 'swipeRight.cycle swiperight.cycle';
|
1216
|
+
opts.container.on( nextEvent, function(e) {
|
1217
|
+
opts.API.next();
|
1218
|
+
});
|
1219
|
+
opts.container.on( prevEvent, function() {
|
1220
|
+
opts.API.prev();
|
1221
|
+
});
|
1222
|
+
}
|
1223
|
+
});
|
1224
|
+
|
1225
|
+
$(document).on( 'cycle-update-view', function( e, opts, slideOpts, currSlide ) {
|
1226
|
+
if ( opts.allowWrap )
|
1227
|
+
return;
|
1228
|
+
|
1229
|
+
var cls = opts.disabledClass;
|
1230
|
+
var next = opts.API.getComponent( 'next' );
|
1231
|
+
var prev = opts.API.getComponent( 'prev' );
|
1232
|
+
var prevBoundry = opts._prevBoundry || 0;
|
1233
|
+
var nextBoundry = opts._nextBoundry || opts.slideCount - 1;
|
1234
|
+
|
1235
|
+
if ( opts.currSlide == nextBoundry )
|
1236
|
+
next.addClass( cls ).prop( 'disabled', true );
|
1237
|
+
else
|
1238
|
+
next.removeClass( cls ).prop( 'disabled', false );
|
1239
|
+
|
1240
|
+
if ( opts.currSlide === prevBoundry )
|
1241
|
+
prev.addClass( cls ).prop( 'disabled', true );
|
1242
|
+
else
|
1243
|
+
prev.removeClass( cls ).prop( 'disabled', false );
|
1244
|
+
});
|
1245
|
+
|
1246
|
+
|
1247
|
+
$(document).on( 'cycle-destroyed', function( e, opts ) {
|
1248
|
+
opts.API.getComponent( 'prev' ).off( opts.nextEvent );
|
1249
|
+
opts.API.getComponent( 'next' ).off( opts.prevEvent );
|
1250
|
+
opts.container.off( 'swipeleft.cycle swiperight.cycle swipeLeft.cycle swipeRight.cycle swipeUp.cycle swipeDown.cycle' );
|
1251
|
+
});
|
1252
|
+
|
1253
|
+
})(jQuery);
|
1254
|
+
|
1255
|
+
/*! progressive loader plugin for Cycle2; version: 20130315 */
|
1256
|
+
(function($) {
|
1257
|
+
"use strict";
|
1258
|
+
|
1259
|
+
$.extend($.fn.cycle.defaults, {
|
1260
|
+
progressive: false
|
1261
|
+
});
|
1262
|
+
|
1263
|
+
$(document).on( 'cycle-pre-initialize', function( e, opts ) {
|
1264
|
+
if ( !opts.progressive )
|
1265
|
+
return;
|
1266
|
+
|
1267
|
+
var API = opts.API;
|
1268
|
+
var nextFn = API.next;
|
1269
|
+
var prevFn = API.prev;
|
1270
|
+
var prepareTxFn = API.prepareTx;
|
1271
|
+
var type = $.type( opts.progressive );
|
1272
|
+
var slides, scriptEl;
|
1273
|
+
|
1274
|
+
if ( type == 'array' ) {
|
1275
|
+
slides = opts.progressive;
|
1276
|
+
}
|
1277
|
+
else if ($.isFunction( opts.progressive ) ) {
|
1278
|
+
slides = opts.progressive( opts );
|
1279
|
+
}
|
1280
|
+
else if ( type == 'string' ) {
|
1281
|
+
scriptEl = $( opts.progressive );
|
1282
|
+
slides = $.trim( scriptEl.html() );
|
1283
|
+
if ( !slides )
|
1284
|
+
return;
|
1285
|
+
// is it json array?
|
1286
|
+
if ( /^(\[)/.test( slides ) ) {
|
1287
|
+
try {
|
1288
|
+
slides = $.parseJSON( slides );
|
1289
|
+
}
|
1290
|
+
catch(err) {
|
1291
|
+
API.log( 'error parsing progressive slides', err );
|
1292
|
+
return;
|
1293
|
+
}
|
1294
|
+
}
|
1295
|
+
else {
|
1296
|
+
// plain text, split on delimeter
|
1297
|
+
slides = slides.split( new RegExp( scriptEl.data('cycle-split') || '\n') );
|
1298
|
+
|
1299
|
+
// #95; look for empty slide
|
1300
|
+
if ( ! slides[ slides.length - 1 ] )
|
1301
|
+
slides.pop();
|
1302
|
+
}
|
1303
|
+
}
|
1304
|
+
|
1305
|
+
|
1306
|
+
|
1307
|
+
if ( prepareTxFn ) {
|
1308
|
+
API.prepareTx = function( manual, fwd ) {
|
1309
|
+
var index, slide;
|
1310
|
+
|
1311
|
+
if ( manual || slides.length === 0 ) {
|
1312
|
+
prepareTxFn.apply( opts.API, [ manual, fwd ] );
|
1313
|
+
return;
|
1314
|
+
}
|
1315
|
+
|
1316
|
+
if ( fwd && opts.currSlide == ( opts.slideCount-1) ) {
|
1317
|
+
slide = slides[ 0 ];
|
1318
|
+
slides = slides.slice( 1 );
|
1319
|
+
opts.container.one('cycle-slide-added', function(e, opts ) {
|
1320
|
+
setTimeout(function() {
|
1321
|
+
opts.API.advanceSlide( 1 );
|
1322
|
+
},50);
|
1323
|
+
});
|
1324
|
+
opts.API.add( slide );
|
1325
|
+
}
|
1326
|
+
else if ( !fwd && opts.currSlide === 0 ) {
|
1327
|
+
index = slides.length-1;
|
1328
|
+
slide = slides[ index ];
|
1329
|
+
slides = slides.slice( 0, index );
|
1330
|
+
opts.container.one('cycle-slide-added', function(e, opts ) {
|
1331
|
+
setTimeout(function() {
|
1332
|
+
opts.currSlide = 1;
|
1333
|
+
opts.API.advanceSlide( -1 );
|
1334
|
+
},50);
|
1335
|
+
});
|
1336
|
+
opts.API.add( slide, true );
|
1337
|
+
}
|
1338
|
+
else {
|
1339
|
+
prepareTxFn.apply( opts.API, [ manual, fwd ] );
|
1340
|
+
}
|
1341
|
+
};
|
1342
|
+
}
|
1343
|
+
|
1344
|
+
if ( nextFn ) {
|
1345
|
+
API.next = function() {
|
1346
|
+
var opts = this.opts();
|
1347
|
+
if ( slides.length && opts.currSlide == ( opts.slideCount - 1 ) ) {
|
1348
|
+
var slide = slides[ 0 ];
|
1349
|
+
slides = slides.slice( 1 );
|
1350
|
+
opts.container.one('cycle-slide-added', function(e, opts ) {
|
1351
|
+
nextFn.apply( opts.API );
|
1352
|
+
opts.container.removeClass('cycle-loading');
|
1353
|
+
});
|
1354
|
+
opts.container.addClass('cycle-loading');
|
1355
|
+
opts.API.add( slide );
|
1356
|
+
}
|
1357
|
+
else {
|
1358
|
+
nextFn.apply( opts.API );
|
1359
|
+
}
|
1360
|
+
};
|
1361
|
+
}
|
1362
|
+
|
1363
|
+
if ( prevFn ) {
|
1364
|
+
API.prev = function() {
|
1365
|
+
var opts = this.opts();
|
1366
|
+
if ( slides.length && opts.currSlide === 0 ) {
|
1367
|
+
var index = slides.length-1;
|
1368
|
+
var slide = slides[ index ];
|
1369
|
+
slides = slides.slice( 0, index );
|
1370
|
+
opts.container.one('cycle-slide-added', function(e, opts ) {
|
1371
|
+
opts.currSlide = 1;
|
1372
|
+
opts.API.advanceSlide( -1 );
|
1373
|
+
opts.container.removeClass('cycle-loading');
|
1374
|
+
});
|
1375
|
+
opts.container.addClass('cycle-loading');
|
1376
|
+
opts.API.add( slide, true );
|
1377
|
+
}
|
1378
|
+
else {
|
1379
|
+
prevFn.apply( opts.API );
|
1380
|
+
}
|
1381
|
+
};
|
1382
|
+
}
|
1383
|
+
});
|
1384
|
+
|
1385
|
+
})(jQuery);
|
1386
|
+
|
1387
|
+
/*! tmpl plugin for Cycle2; version: 20121227 */
|
1388
|
+
(function($) {
|
1389
|
+
"use strict";
|
1390
|
+
|
1391
|
+
$.extend($.fn.cycle.defaults, {
|
1392
|
+
tmplRegex: '{{((.)?.*?)}}'
|
1393
|
+
});
|
1394
|
+
|
1395
|
+
$.extend($.fn.cycle.API, {
|
1396
|
+
tmpl: function( str, opts /*, ... */) {
|
1397
|
+
var regex = new RegExp( opts.tmplRegex || $.fn.cycle.defaults.tmplRegex, 'g' );
|
1398
|
+
var args = $.makeArray( arguments );
|
1399
|
+
args.shift();
|
1400
|
+
return str.replace(regex, function(_, str) {
|
1401
|
+
var i, j, obj, prop, names = str.split('.');
|
1402
|
+
for (i=0; i < args.length; i++) {
|
1403
|
+
obj = args[i];
|
1404
|
+
if ( ! obj )
|
1405
|
+
continue;
|
1406
|
+
if (names.length > 1) {
|
1407
|
+
prop = obj;
|
1408
|
+
for (j=0; j < names.length; j++) {
|
1409
|
+
obj = prop;
|
1410
|
+
prop = prop[ names[j] ] || str;
|
1411
|
+
}
|
1412
|
+
} else {
|
1413
|
+
prop = obj[str];
|
1414
|
+
}
|
1415
|
+
|
1416
|
+
if ($.isFunction(prop))
|
1417
|
+
return prop.apply(obj, args);
|
1418
|
+
if (prop !== undefined && prop !== null && prop != str)
|
1419
|
+
return prop;
|
1420
|
+
}
|
1421
|
+
return str;
|
1422
|
+
});
|
1423
|
+
}
|
1424
|
+
});
|
1425
|
+
|
1426
|
+
})(jQuery);
|