caroufredsel_rails 6.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +40 -0
- data/Rakefile +1 -0
- data/app/assets/javascripts/jquery.ba-throttle-debounce.js +9 -0
- data/app/assets/javascripts/jquery.carouFredSel.js +4255 -0
- data/app/assets/javascripts/jquery.mousewheel.js +12 -0
- data/app/assets/javascripts/jquery.touchSwipe.js +13 -0
- data/app/assets/javascripts/jquery.transit.js +22 -0
- data/caroufredsel_rails.gemspec +23 -0
- data/lib/caroufredsel_rails.rb +8 -0
- data/lib/caroufredsel_rails/version.rb +3 -0
- metadata +100 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
Yzk0MWYzODI5MjhkZGUyYjRlZWNmOGMyNjM3MmZmZjY3MGMxODk3ZA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MmFhYjIyYWM3ODFhMTVkODMwYjgxM2E0Y2Y4MzkxZDZjYmQzZjIzYg==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ODU3ZDAxYjk3NzJiYWVjNzU1MmRkZjJhMDhkOGNjMGY3YmRiYTVlZTdkZWUy
|
10
|
+
YzljZmE4NjVkZTAyY2RhYzBmMGZkZTQ2MTI0NGYzMGRlYmYwNTE5M2M0NTYy
|
11
|
+
OWE0MGEwNzU3YWM3NDQ0YzU3ZTFkYzE1MDljZTAyZTEyNzUxYjU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ZmQwOGU5MjkyYWMzNTYxZmM3NTY4ZGY4MzI0MDNhYjg1MGVmYmFlNDA5MjFl
|
14
|
+
ZmQ2NzU1YjRkMjQ5OTVhZmViNWZiYjRkOGYwOTlmODI0YTJmY2U1ZmVkOTIw
|
15
|
+
ZDc1NDRmMTMwYjcwNzBjNDE4ODAwZTg4ZWZlMGRmNTYyN2EzY2Q=
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Guy Israeli
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# CaroufredselRails
|
2
|
+
|
3
|
+
carouFredSel. Asset Pipeline. Horray!
|
4
|
+
|
5
|
+
see http://caroufredsel.dev7studios.com/ for more stuff...
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'caroufredsel_rails'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install caroufredsel_rails
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
add to manifest (watch the caps)
|
24
|
+
|
25
|
+
//= jquery.carouFredSel.js
|
26
|
+
|
27
|
+
in case you will use mousewheel/touchswipe/bouncing and such (choose the one that is applicable to your use)
|
28
|
+
|
29
|
+
//= jquery.mousewheel
|
30
|
+
//= jquery.touchSwipe
|
31
|
+
//= jquery.transit
|
32
|
+
//= jquery.ba-throttle-debounce
|
33
|
+
|
34
|
+
## Contributing
|
35
|
+
|
36
|
+
1. Fork it
|
37
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
38
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
39
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
40
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,9 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery throttle / debounce - v1.1 - 3/7/2010
|
3
|
+
* http://benalman.com/projects/jquery-throttle-debounce-plugin/
|
4
|
+
*
|
5
|
+
* Copyright (c) 2010 "Cowboy" Ben Alman
|
6
|
+
* Dual licensed under the MIT and GPL licenses.
|
7
|
+
* http://benalman.com/about/license/
|
8
|
+
*/
|
9
|
+
(function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this);
|
@@ -0,0 +1,4255 @@
|
|
1
|
+
/*
|
2
|
+
* jQuery carouFredSel 6.2.1
|
3
|
+
* Demo's and documentation:
|
4
|
+
* caroufredsel.dev7studios.com
|
5
|
+
*
|
6
|
+
* Copyright (c) 2013 Fred Heusschen
|
7
|
+
* www.frebsite.nl
|
8
|
+
*
|
9
|
+
* Dual licensed under the MIT and GPL licenses.
|
10
|
+
* http://en.wikipedia.org/wiki/MIT_License
|
11
|
+
* http://en.wikipedia.org/wiki/GNU_General_Public_License
|
12
|
+
*/
|
13
|
+
|
14
|
+
|
15
|
+
(function($) {
|
16
|
+
|
17
|
+
|
18
|
+
// LOCAL
|
19
|
+
|
20
|
+
if ( $.fn.carouFredSel )
|
21
|
+
{
|
22
|
+
return;
|
23
|
+
}
|
24
|
+
|
25
|
+
$.fn.caroufredsel = $.fn.carouFredSel = function(options, configs)
|
26
|
+
{
|
27
|
+
|
28
|
+
// no element
|
29
|
+
if (this.length == 0)
|
30
|
+
{
|
31
|
+
debug( true, 'No element found for "' + this.selector + '".' );
|
32
|
+
return this;
|
33
|
+
}
|
34
|
+
|
35
|
+
// multiple elements
|
36
|
+
if (this.length > 1)
|
37
|
+
{
|
38
|
+
return this.each(function() {
|
39
|
+
$(this).carouFredSel(options, configs);
|
40
|
+
});
|
41
|
+
}
|
42
|
+
|
43
|
+
|
44
|
+
var $cfs = this,
|
45
|
+
$tt0 = this[0],
|
46
|
+
starting_position = false;
|
47
|
+
|
48
|
+
if ($cfs.data('_cfs_isCarousel'))
|
49
|
+
{
|
50
|
+
starting_position = $cfs.triggerHandler('_cfs_triggerEvent', 'currentPosition');
|
51
|
+
$cfs.trigger('_cfs_triggerEvent', ['destroy', true]);
|
52
|
+
}
|
53
|
+
|
54
|
+
var FN = {};
|
55
|
+
|
56
|
+
FN._init = function(o, setOrig, start)
|
57
|
+
{
|
58
|
+
o = go_getObject($tt0, o);
|
59
|
+
|
60
|
+
o.items = go_getItemsObject($tt0, o.items);
|
61
|
+
o.scroll = go_getScrollObject($tt0, o.scroll);
|
62
|
+
o.auto = go_getAutoObject($tt0, o.auto);
|
63
|
+
o.prev = go_getPrevNextObject($tt0, o.prev);
|
64
|
+
o.next = go_getPrevNextObject($tt0, o.next);
|
65
|
+
o.pagination = go_getPaginationObject($tt0, o.pagination);
|
66
|
+
o.swipe = go_getSwipeObject($tt0, o.swipe);
|
67
|
+
o.mousewheel = go_getMousewheelObject($tt0, o.mousewheel);
|
68
|
+
|
69
|
+
if (setOrig)
|
70
|
+
{
|
71
|
+
opts_orig = $.extend(true, {}, $.fn.carouFredSel.defaults, o);
|
72
|
+
}
|
73
|
+
|
74
|
+
opts = $.extend(true, {}, $.fn.carouFredSel.defaults, o);
|
75
|
+
opts.d = cf_getDimensions(opts);
|
76
|
+
|
77
|
+
crsl.direction = (opts.direction == 'up' || opts.direction == 'left') ? 'next' : 'prev';
|
78
|
+
|
79
|
+
var a_itm = $cfs.children(),
|
80
|
+
avail_primary = ms_getParentSize($wrp, opts, 'width');
|
81
|
+
|
82
|
+
if (is_true(opts.cookie))
|
83
|
+
{
|
84
|
+
opts.cookie = 'caroufredsel_cookie_' + conf.serialNumber;
|
85
|
+
}
|
86
|
+
|
87
|
+
opts.maxDimension = ms_getMaxDimension(opts, avail_primary);
|
88
|
+
|
89
|
+
// complement items and sizes
|
90
|
+
opts.items = in_complementItems(opts.items, opts, a_itm, start);
|
91
|
+
opts[opts.d['width']] = in_complementPrimarySize(opts[opts.d['width']], opts, a_itm);
|
92
|
+
opts[opts.d['height']] = in_complementSecondarySize(opts[opts.d['height']], opts, a_itm);
|
93
|
+
|
94
|
+
// primary size not set for a responsive carousel
|
95
|
+
if (opts.responsive)
|
96
|
+
{
|
97
|
+
if (!is_percentage(opts[opts.d['width']]))
|
98
|
+
{
|
99
|
+
opts[opts.d['width']] = '100%';
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
// primary size is percentage
|
104
|
+
if (is_percentage(opts[opts.d['width']]))
|
105
|
+
{
|
106
|
+
crsl.upDateOnWindowResize = true;
|
107
|
+
crsl.primarySizePercentage = opts[opts.d['width']];
|
108
|
+
opts[opts.d['width']] = ms_getPercentage(avail_primary, crsl.primarySizePercentage);
|
109
|
+
if (!opts.items.visible)
|
110
|
+
{
|
111
|
+
opts.items.visibleConf.variable = true;
|
112
|
+
}
|
113
|
+
}
|
114
|
+
|
115
|
+
if (opts.responsive)
|
116
|
+
{
|
117
|
+
opts.usePadding = false;
|
118
|
+
opts.padding = [0, 0, 0, 0];
|
119
|
+
opts.align = false;
|
120
|
+
opts.items.visibleConf.variable = false;
|
121
|
+
}
|
122
|
+
else
|
123
|
+
{
|
124
|
+
// visible-items not set
|
125
|
+
if (!opts.items.visible)
|
126
|
+
{
|
127
|
+
opts = in_complementVisibleItems(opts, avail_primary);
|
128
|
+
}
|
129
|
+
|
130
|
+
// primary size not set -> calculate it or set to "variable"
|
131
|
+
if (!opts[opts.d['width']])
|
132
|
+
{
|
133
|
+
if (!opts.items.visibleConf.variable && is_number(opts.items[opts.d['width']]) && opts.items.filter == '*')
|
134
|
+
{
|
135
|
+
opts[opts.d['width']] = opts.items.visible * opts.items[opts.d['width']];
|
136
|
+
opts.align = false;
|
137
|
+
}
|
138
|
+
else
|
139
|
+
{
|
140
|
+
opts[opts.d['width']] = 'variable';
|
141
|
+
}
|
142
|
+
}
|
143
|
+
// align not set -> set to center if primary size is number
|
144
|
+
if (is_undefined(opts.align))
|
145
|
+
{
|
146
|
+
opts.align = (is_number(opts[opts.d['width']]))
|
147
|
+
? 'center'
|
148
|
+
: false;
|
149
|
+
}
|
150
|
+
// set variabe visible-items
|
151
|
+
if (opts.items.visibleConf.variable)
|
152
|
+
{
|
153
|
+
opts.items.visible = gn_getVisibleItemsNext(a_itm, opts, 0);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
// set visible items by filter
|
158
|
+
if (opts.items.filter != '*' && !opts.items.visibleConf.variable)
|
159
|
+
{
|
160
|
+
opts.items.visibleConf.org = opts.items.visible;
|
161
|
+
opts.items.visible = gn_getVisibleItemsNextFilter(a_itm, opts, 0);
|
162
|
+
}
|
163
|
+
|
164
|
+
opts.items.visible = cf_getItemsAdjust(opts.items.visible, opts, opts.items.visibleConf.adjust, $tt0);
|
165
|
+
opts.items.visibleConf.old = opts.items.visible;
|
166
|
+
|
167
|
+
if (opts.responsive)
|
168
|
+
{
|
169
|
+
if (!opts.items.visibleConf.min)
|
170
|
+
{
|
171
|
+
opts.items.visibleConf.min = opts.items.visible;
|
172
|
+
}
|
173
|
+
if (!opts.items.visibleConf.max)
|
174
|
+
{
|
175
|
+
opts.items.visibleConf.max = opts.items.visible;
|
176
|
+
}
|
177
|
+
opts = in_getResponsiveValues(opts, a_itm, avail_primary);
|
178
|
+
}
|
179
|
+
else
|
180
|
+
{
|
181
|
+
opts.padding = cf_getPadding(opts.padding);
|
182
|
+
|
183
|
+
if (opts.align == 'top')
|
184
|
+
{
|
185
|
+
opts.align = 'left';
|
186
|
+
}
|
187
|
+
else if (opts.align == 'bottom')
|
188
|
+
{
|
189
|
+
opts.align = 'right';
|
190
|
+
}
|
191
|
+
|
192
|
+
switch (opts.align)
|
193
|
+
{
|
194
|
+
// align: center, left or right
|
195
|
+
case 'center':
|
196
|
+
case 'left':
|
197
|
+
case 'right':
|
198
|
+
if (opts[opts.d['width']] != 'variable')
|
199
|
+
{
|
200
|
+
opts = in_getAlignPadding(opts, a_itm);
|
201
|
+
opts.usePadding = true;
|
202
|
+
}
|
203
|
+
break;
|
204
|
+
|
205
|
+
// padding
|
206
|
+
default:
|
207
|
+
opts.align = false;
|
208
|
+
opts.usePadding = (
|
209
|
+
opts.padding[0] == 0 &&
|
210
|
+
opts.padding[1] == 0 &&
|
211
|
+
opts.padding[2] == 0 &&
|
212
|
+
opts.padding[3] == 0
|
213
|
+
) ? false : true;
|
214
|
+
break;
|
215
|
+
}
|
216
|
+
}
|
217
|
+
|
218
|
+
if (!is_number(opts.scroll.duration))
|
219
|
+
{
|
220
|
+
opts.scroll.duration = 500;
|
221
|
+
}
|
222
|
+
if (is_undefined(opts.scroll.items))
|
223
|
+
{
|
224
|
+
opts.scroll.items = (opts.responsive || opts.items.visibleConf.variable || opts.items.filter != '*')
|
225
|
+
? 'visible'
|
226
|
+
: opts.items.visible;
|
227
|
+
}
|
228
|
+
|
229
|
+
opts.auto = $.extend(true, {}, opts.scroll, opts.auto);
|
230
|
+
opts.prev = $.extend(true, {}, opts.scroll, opts.prev);
|
231
|
+
opts.next = $.extend(true, {}, opts.scroll, opts.next);
|
232
|
+
opts.pagination = $.extend(true, {}, opts.scroll, opts.pagination);
|
233
|
+
// swipe and mousewheel extend later on, per direction
|
234
|
+
|
235
|
+
opts.auto = go_complementAutoObject($tt0, opts.auto);
|
236
|
+
opts.prev = go_complementPrevNextObject($tt0, opts.prev);
|
237
|
+
opts.next = go_complementPrevNextObject($tt0, opts.next);
|
238
|
+
opts.pagination = go_complementPaginationObject($tt0, opts.pagination);
|
239
|
+
opts.swipe = go_complementSwipeObject($tt0, opts.swipe);
|
240
|
+
opts.mousewheel = go_complementMousewheelObject($tt0, opts.mousewheel);
|
241
|
+
|
242
|
+
if (opts.synchronise)
|
243
|
+
{
|
244
|
+
opts.synchronise = cf_getSynchArr(opts.synchronise);
|
245
|
+
}
|
246
|
+
|
247
|
+
|
248
|
+
// DEPRECATED
|
249
|
+
if (opts.auto.onPauseStart)
|
250
|
+
{
|
251
|
+
opts.auto.onTimeoutStart = opts.auto.onPauseStart;
|
252
|
+
deprecated('auto.onPauseStart', 'auto.onTimeoutStart');
|
253
|
+
}
|
254
|
+
if (opts.auto.onPausePause)
|
255
|
+
{
|
256
|
+
opts.auto.onTimeoutPause = opts.auto.onPausePause;
|
257
|
+
deprecated('auto.onPausePause', 'auto.onTimeoutPause');
|
258
|
+
}
|
259
|
+
if (opts.auto.onPauseEnd)
|
260
|
+
{
|
261
|
+
opts.auto.onTimeoutEnd = opts.auto.onPauseEnd;
|
262
|
+
deprecated('auto.onPauseEnd', 'auto.onTimeoutEnd');
|
263
|
+
}
|
264
|
+
if (opts.auto.pauseDuration)
|
265
|
+
{
|
266
|
+
opts.auto.timeoutDuration = opts.auto.pauseDuration;
|
267
|
+
deprecated('auto.pauseDuration', 'auto.timeoutDuration');
|
268
|
+
}
|
269
|
+
// /DEPRECATED
|
270
|
+
|
271
|
+
|
272
|
+
}; // /init
|
273
|
+
|
274
|
+
|
275
|
+
FN._build = function() {
|
276
|
+
$cfs.data('_cfs_isCarousel', true);
|
277
|
+
|
278
|
+
var a_itm = $cfs.children(),
|
279
|
+
orgCSS = in_mapCss($cfs, ['textAlign', 'float', 'position', 'top', 'right', 'bottom', 'left', 'zIndex', 'width', 'height', 'marginTop', 'marginRight', 'marginBottom', 'marginLeft']),
|
280
|
+
newPosition = 'relative';
|
281
|
+
|
282
|
+
switch (orgCSS.position)
|
283
|
+
{
|
284
|
+
case 'absolute':
|
285
|
+
case 'fixed':
|
286
|
+
newPosition = orgCSS.position;
|
287
|
+
break;
|
288
|
+
}
|
289
|
+
|
290
|
+
if (conf.wrapper == 'parent')
|
291
|
+
{
|
292
|
+
sz_storeOrigCss($wrp);
|
293
|
+
}
|
294
|
+
else
|
295
|
+
{
|
296
|
+
$wrp.css(orgCSS);
|
297
|
+
}
|
298
|
+
$wrp.css({
|
299
|
+
'overflow' : 'hidden',
|
300
|
+
'position' : newPosition
|
301
|
+
});
|
302
|
+
|
303
|
+
sz_storeOrigCss($cfs);
|
304
|
+
$cfs.data('_cfs_origCssZindex', orgCSS.zIndex);
|
305
|
+
$cfs.css({
|
306
|
+
'textAlign' : 'left',
|
307
|
+
'float' : 'none',
|
308
|
+
'position' : 'absolute',
|
309
|
+
'top' : 0,
|
310
|
+
'right' : 'auto',
|
311
|
+
'bottom' : 'auto',
|
312
|
+
'left' : 0,
|
313
|
+
'marginTop' : 0,
|
314
|
+
'marginRight' : 0,
|
315
|
+
'marginBottom' : 0,
|
316
|
+
'marginLeft' : 0
|
317
|
+
});
|
318
|
+
|
319
|
+
sz_storeMargin(a_itm, opts);
|
320
|
+
sz_storeOrigCss(a_itm);
|
321
|
+
if (opts.responsive)
|
322
|
+
{
|
323
|
+
sz_setResponsiveSizes(opts, a_itm);
|
324
|
+
}
|
325
|
+
|
326
|
+
}; // /build
|
327
|
+
|
328
|
+
|
329
|
+
FN._bind_events = function() {
|
330
|
+
FN._unbind_events();
|
331
|
+
|
332
|
+
|
333
|
+
// stop event
|
334
|
+
$cfs.bind(cf_e('stop', conf), function(e, imm) {
|
335
|
+
e.stopPropagation();
|
336
|
+
|
337
|
+
// button
|
338
|
+
if (!crsl.isStopped)
|
339
|
+
{
|
340
|
+
if (opts.auto.button)
|
341
|
+
{
|
342
|
+
opts.auto.button.addClass(cf_c('stopped', conf));
|
343
|
+
}
|
344
|
+
}
|
345
|
+
|
346
|
+
// set stopped
|
347
|
+
crsl.isStopped = true;
|
348
|
+
|
349
|
+
if (opts.auto.play)
|
350
|
+
{
|
351
|
+
opts.auto.play = false;
|
352
|
+
$cfs.trigger(cf_e('pause', conf), imm);
|
353
|
+
}
|
354
|
+
return true;
|
355
|
+
});
|
356
|
+
|
357
|
+
|
358
|
+
// finish event
|
359
|
+
$cfs.bind(cf_e('finish', conf), function(e) {
|
360
|
+
e.stopPropagation();
|
361
|
+
if (crsl.isScrolling)
|
362
|
+
{
|
363
|
+
sc_stopScroll(scrl);
|
364
|
+
}
|
365
|
+
return true;
|
366
|
+
});
|
367
|
+
|
368
|
+
|
369
|
+
// pause event
|
370
|
+
$cfs.bind(cf_e('pause', conf), function(e, imm, res) {
|
371
|
+
e.stopPropagation();
|
372
|
+
tmrs = sc_clearTimers(tmrs);
|
373
|
+
|
374
|
+
// immediately pause
|
375
|
+
if (imm && crsl.isScrolling)
|
376
|
+
{
|
377
|
+
scrl.isStopped = true;
|
378
|
+
var nst = getTime() - scrl.startTime;
|
379
|
+
scrl.duration -= nst;
|
380
|
+
if (scrl.pre)
|
381
|
+
{
|
382
|
+
scrl.pre.duration -= nst;
|
383
|
+
}
|
384
|
+
if (scrl.post)
|
385
|
+
{
|
386
|
+
scrl.post.duration -= nst;
|
387
|
+
}
|
388
|
+
sc_stopScroll(scrl, false);
|
389
|
+
}
|
390
|
+
|
391
|
+
// update remaining pause-time
|
392
|
+
if (!crsl.isPaused && !crsl.isScrolling)
|
393
|
+
{
|
394
|
+
if (res)
|
395
|
+
{
|
396
|
+
tmrs.timePassed += getTime() - tmrs.startTime;
|
397
|
+
}
|
398
|
+
}
|
399
|
+
|
400
|
+
// button
|
401
|
+
if (!crsl.isPaused)
|
402
|
+
{
|
403
|
+
if (opts.auto.button)
|
404
|
+
{
|
405
|
+
opts.auto.button.addClass(cf_c('paused', conf));
|
406
|
+
}
|
407
|
+
}
|
408
|
+
|
409
|
+
// set paused
|
410
|
+
crsl.isPaused = true;
|
411
|
+
|
412
|
+
// pause pause callback
|
413
|
+
if (opts.auto.onTimeoutPause)
|
414
|
+
{
|
415
|
+
var dur1 = opts.auto.timeoutDuration - tmrs.timePassed,
|
416
|
+
perc = 100 - Math.ceil( dur1 * 100 / opts.auto.timeoutDuration );
|
417
|
+
|
418
|
+
opts.auto.onTimeoutPause.call($tt0, perc, dur1);
|
419
|
+
}
|
420
|
+
return true;
|
421
|
+
});
|
422
|
+
|
423
|
+
|
424
|
+
// play event
|
425
|
+
$cfs.bind(cf_e('play', conf), function(e, dir, del, res) {
|
426
|
+
e.stopPropagation();
|
427
|
+
tmrs = sc_clearTimers(tmrs);
|
428
|
+
|
429
|
+
// sort params
|
430
|
+
var v = [dir, del, res],
|
431
|
+
t = ['string', 'number', 'boolean'],
|
432
|
+
a = cf_sortParams(v, t);
|
433
|
+
|
434
|
+
dir = a[0];
|
435
|
+
del = a[1];
|
436
|
+
res = a[2];
|
437
|
+
|
438
|
+
if (dir != 'prev' && dir != 'next')
|
439
|
+
{
|
440
|
+
dir = crsl.direction;
|
441
|
+
}
|
442
|
+
if (!is_number(del))
|
443
|
+
{
|
444
|
+
del = 0;
|
445
|
+
}
|
446
|
+
if (!is_boolean(res))
|
447
|
+
{
|
448
|
+
res = false;
|
449
|
+
}
|
450
|
+
|
451
|
+
// stopped?
|
452
|
+
if (res)
|
453
|
+
{
|
454
|
+
crsl.isStopped = false;
|
455
|
+
opts.auto.play = true;
|
456
|
+
}
|
457
|
+
if (!opts.auto.play)
|
458
|
+
{
|
459
|
+
e.stopImmediatePropagation();
|
460
|
+
return debug(conf, 'Carousel stopped: Not scrolling.');
|
461
|
+
}
|
462
|
+
|
463
|
+
// button
|
464
|
+
if (crsl.isPaused)
|
465
|
+
{
|
466
|
+
if (opts.auto.button)
|
467
|
+
{
|
468
|
+
opts.auto.button.removeClass(cf_c('stopped', conf));
|
469
|
+
opts.auto.button.removeClass(cf_c('paused', conf));
|
470
|
+
}
|
471
|
+
}
|
472
|
+
|
473
|
+
// set playing
|
474
|
+
crsl.isPaused = false;
|
475
|
+
tmrs.startTime = getTime();
|
476
|
+
|
477
|
+
// timeout the scrolling
|
478
|
+
var dur1 = opts.auto.timeoutDuration + del;
|
479
|
+
dur2 = dur1 - tmrs.timePassed;
|
480
|
+
perc = 100 - Math.ceil(dur2 * 100 / dur1);
|
481
|
+
|
482
|
+
if (opts.auto.progress)
|
483
|
+
{
|
484
|
+
tmrs.progress = setInterval(function() {
|
485
|
+
var pasd = getTime() - tmrs.startTime + tmrs.timePassed,
|
486
|
+
perc = Math.ceil(pasd * 100 / dur1);
|
487
|
+
opts.auto.progress.updater.call(opts.auto.progress.bar[0], perc);
|
488
|
+
}, opts.auto.progress.interval);
|
489
|
+
}
|
490
|
+
|
491
|
+
tmrs.auto = setTimeout(function() {
|
492
|
+
if (opts.auto.progress)
|
493
|
+
{
|
494
|
+
opts.auto.progress.updater.call(opts.auto.progress.bar[0], 100);
|
495
|
+
}
|
496
|
+
if (opts.auto.onTimeoutEnd)
|
497
|
+
{
|
498
|
+
opts.auto.onTimeoutEnd.call($tt0, perc, dur2);
|
499
|
+
}
|
500
|
+
if (crsl.isScrolling)
|
501
|
+
{
|
502
|
+
$cfs.trigger(cf_e('play', conf), dir);
|
503
|
+
}
|
504
|
+
else
|
505
|
+
{
|
506
|
+
$cfs.trigger(cf_e(dir, conf), opts.auto);
|
507
|
+
}
|
508
|
+
}, dur2);
|
509
|
+
|
510
|
+
// pause start callback
|
511
|
+
if (opts.auto.onTimeoutStart)
|
512
|
+
{
|
513
|
+
opts.auto.onTimeoutStart.call($tt0, perc, dur2);
|
514
|
+
}
|
515
|
+
|
516
|
+
return true;
|
517
|
+
});
|
518
|
+
|
519
|
+
|
520
|
+
// resume event
|
521
|
+
$cfs.bind(cf_e('resume', conf), function(e) {
|
522
|
+
e.stopPropagation();
|
523
|
+
if (scrl.isStopped)
|
524
|
+
{
|
525
|
+
scrl.isStopped = false;
|
526
|
+
crsl.isPaused = false;
|
527
|
+
crsl.isScrolling = true;
|
528
|
+
scrl.startTime = getTime();
|
529
|
+
sc_startScroll(scrl, conf);
|
530
|
+
}
|
531
|
+
else
|
532
|
+
{
|
533
|
+
$cfs.trigger(cf_e('play', conf));
|
534
|
+
}
|
535
|
+
return true;
|
536
|
+
});
|
537
|
+
|
538
|
+
|
539
|
+
// prev + next events
|
540
|
+
$cfs.bind(cf_e('prev', conf)+' '+cf_e('next', conf), function(e, obj, num, clb, que) {
|
541
|
+
e.stopPropagation();
|
542
|
+
|
543
|
+
// stopped or hidden carousel, don't scroll, don't queue
|
544
|
+
if (crsl.isStopped || $cfs.is(':hidden'))
|
545
|
+
{
|
546
|
+
e.stopImmediatePropagation();
|
547
|
+
return debug(conf, 'Carousel stopped or hidden: Not scrolling.');
|
548
|
+
}
|
549
|
+
|
550
|
+
// not enough items
|
551
|
+
var minimum = (is_number(opts.items.minimum)) ? opts.items.minimum : opts.items.visible + 1;
|
552
|
+
if (minimum > itms.total)
|
553
|
+
{
|
554
|
+
e.stopImmediatePropagation();
|
555
|
+
return debug(conf, 'Not enough items ('+itms.total+' total, '+minimum+' needed): Not scrolling.');
|
556
|
+
}
|
557
|
+
|
558
|
+
// get config
|
559
|
+
var v = [obj, num, clb, que],
|
560
|
+
t = ['object', 'number/string', 'function', 'boolean'],
|
561
|
+
a = cf_sortParams(v, t);
|
562
|
+
|
563
|
+
obj = a[0];
|
564
|
+
num = a[1];
|
565
|
+
clb = a[2];
|
566
|
+
que = a[3];
|
567
|
+
|
568
|
+
var eType = e.type.slice(conf.events.prefix.length);
|
569
|
+
|
570
|
+
if (!is_object(obj))
|
571
|
+
{
|
572
|
+
obj = {};
|
573
|
+
}
|
574
|
+
if (is_function(clb))
|
575
|
+
{
|
576
|
+
obj.onAfter = clb;
|
577
|
+
}
|
578
|
+
if (is_boolean(que))
|
579
|
+
{
|
580
|
+
obj.queue = que;
|
581
|
+
}
|
582
|
+
obj = $.extend(true, {}, opts[eType], obj);
|
583
|
+
|
584
|
+
// test conditions callback
|
585
|
+
if (obj.conditions && !obj.conditions.call($tt0, eType))
|
586
|
+
{
|
587
|
+
e.stopImmediatePropagation();
|
588
|
+
return debug(conf, 'Callback "conditions" returned false.');
|
589
|
+
}
|
590
|
+
|
591
|
+
if (!is_number(num))
|
592
|
+
{
|
593
|
+
if (opts.items.filter != '*')
|
594
|
+
{
|
595
|
+
num = 'visible';
|
596
|
+
}
|
597
|
+
else
|
598
|
+
{
|
599
|
+
var arr = [num, obj.items, opts[eType].items];
|
600
|
+
for (var a = 0, l = arr.length; a < l; a++)
|
601
|
+
{
|
602
|
+
if (is_number(arr[a]) || arr[a] == 'page' || arr[a] == 'visible') {
|
603
|
+
num = arr[a];
|
604
|
+
break;
|
605
|
+
}
|
606
|
+
}
|
607
|
+
}
|
608
|
+
switch(num) {
|
609
|
+
case 'page':
|
610
|
+
e.stopImmediatePropagation();
|
611
|
+
return $cfs.triggerHandler(cf_e(eType+'Page', conf), [obj, clb]);
|
612
|
+
break;
|
613
|
+
|
614
|
+
case 'visible':
|
615
|
+
if (!opts.items.visibleConf.variable && opts.items.filter == '*')
|
616
|
+
{
|
617
|
+
num = opts.items.visible;
|
618
|
+
}
|
619
|
+
break;
|
620
|
+
}
|
621
|
+
}
|
622
|
+
|
623
|
+
// resume animation, add current to queue
|
624
|
+
if (scrl.isStopped)
|
625
|
+
{
|
626
|
+
$cfs.trigger(cf_e('resume', conf));
|
627
|
+
$cfs.trigger(cf_e('queue', conf), [eType, [obj, num, clb]]);
|
628
|
+
e.stopImmediatePropagation();
|
629
|
+
return debug(conf, 'Carousel resumed scrolling.');
|
630
|
+
}
|
631
|
+
|
632
|
+
// queue if scrolling
|
633
|
+
if (obj.duration > 0)
|
634
|
+
{
|
635
|
+
if (crsl.isScrolling)
|
636
|
+
{
|
637
|
+
if (obj.queue)
|
638
|
+
{
|
639
|
+
if (obj.queue == 'last')
|
640
|
+
{
|
641
|
+
queu = [];
|
642
|
+
}
|
643
|
+
if (obj.queue != 'first' || queu.length == 0)
|
644
|
+
{
|
645
|
+
$cfs.trigger(cf_e('queue', conf), [eType, [obj, num, clb]]);
|
646
|
+
}
|
647
|
+
}
|
648
|
+
e.stopImmediatePropagation();
|
649
|
+
return debug(conf, 'Carousel currently scrolling.');
|
650
|
+
}
|
651
|
+
}
|
652
|
+
|
653
|
+
tmrs.timePassed = 0;
|
654
|
+
$cfs.trigger(cf_e('slide_'+eType, conf), [obj, num]);
|
655
|
+
|
656
|
+
// synchronise
|
657
|
+
if (opts.synchronise)
|
658
|
+
{
|
659
|
+
var s = opts.synchronise,
|
660
|
+
c = [obj, num];
|
661
|
+
|
662
|
+
for (var j = 0, l = s.length; j < l; j++) {
|
663
|
+
var d = eType;
|
664
|
+
if (!s[j][2])
|
665
|
+
{
|
666
|
+
d = (d == 'prev') ? 'next' : 'prev';
|
667
|
+
}
|
668
|
+
if (!s[j][1])
|
669
|
+
{
|
670
|
+
c[0] = s[j][0].triggerHandler('_cfs_triggerEvent', ['configuration', d]);
|
671
|
+
}
|
672
|
+
c[1] = num + s[j][3];
|
673
|
+
s[j][0].trigger('_cfs_triggerEvent', ['slide_'+d, c]);
|
674
|
+
}
|
675
|
+
}
|
676
|
+
return true;
|
677
|
+
});
|
678
|
+
|
679
|
+
|
680
|
+
// prev event
|
681
|
+
$cfs.bind(cf_e('slide_prev', conf), function(e, sO, nI) {
|
682
|
+
e.stopPropagation();
|
683
|
+
var a_itm = $cfs.children();
|
684
|
+
|
685
|
+
// non-circular at start, scroll to end
|
686
|
+
if (!opts.circular)
|
687
|
+
{
|
688
|
+
if (itms.first == 0)
|
689
|
+
{
|
690
|
+
if (opts.infinite)
|
691
|
+
{
|
692
|
+
$cfs.trigger(cf_e('next', conf), itms.total-1);
|
693
|
+
}
|
694
|
+
return e.stopImmediatePropagation();
|
695
|
+
}
|
696
|
+
}
|
697
|
+
|
698
|
+
sz_resetMargin(a_itm, opts);
|
699
|
+
|
700
|
+
// find number of items to scroll
|
701
|
+
if (!is_number(nI))
|
702
|
+
{
|
703
|
+
if (opts.items.visibleConf.variable)
|
704
|
+
{
|
705
|
+
nI = gn_getVisibleItemsPrev(a_itm, opts, itms.total-1);
|
706
|
+
}
|
707
|
+
else if (opts.items.filter != '*')
|
708
|
+
{
|
709
|
+
var xI = (is_number(sO.items)) ? sO.items : gn_getVisibleOrg($cfs, opts);
|
710
|
+
nI = gn_getScrollItemsPrevFilter(a_itm, opts, itms.total-1, xI);
|
711
|
+
}
|
712
|
+
else
|
713
|
+
{
|
714
|
+
nI = opts.items.visible;
|
715
|
+
}
|
716
|
+
nI = cf_getAdjust(nI, opts, sO.items, $tt0);
|
717
|
+
}
|
718
|
+
|
719
|
+
// prevent non-circular from scrolling to far
|
720
|
+
if (!opts.circular)
|
721
|
+
{
|
722
|
+
if (itms.total - nI < itms.first)
|
723
|
+
{
|
724
|
+
nI = itms.total - itms.first;
|
725
|
+
}
|
726
|
+
}
|
727
|
+
|
728
|
+
// set new number of visible items
|
729
|
+
opts.items.visibleConf.old = opts.items.visible;
|
730
|
+
if (opts.items.visibleConf.variable)
|
731
|
+
{
|
732
|
+
var vI = cf_getItemsAdjust(gn_getVisibleItemsNext(a_itm, opts, itms.total-nI), opts, opts.items.visibleConf.adjust, $tt0);
|
733
|
+
if (opts.items.visible+nI <= vI && nI < itms.total)
|
734
|
+
{
|
735
|
+
nI++;
|
736
|
+
vI = cf_getItemsAdjust(gn_getVisibleItemsNext(a_itm, opts, itms.total-nI), opts, opts.items.visibleConf.adjust, $tt0);
|
737
|
+
}
|
738
|
+
opts.items.visible = vI;
|
739
|
+
}
|
740
|
+
else if (opts.items.filter != '*')
|
741
|
+
{
|
742
|
+
var vI = gn_getVisibleItemsNextFilter(a_itm, opts, itms.total-nI);
|
743
|
+
opts.items.visible = cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0);
|
744
|
+
}
|
745
|
+
|
746
|
+
sz_resetMargin(a_itm, opts, true);
|
747
|
+
|
748
|
+
// scroll 0, don't scroll
|
749
|
+
if (nI == 0)
|
750
|
+
{
|
751
|
+
e.stopImmediatePropagation();
|
752
|
+
return debug(conf, '0 items to scroll: Not scrolling.');
|
753
|
+
}
|
754
|
+
debug(conf, 'Scrolling '+nI+' items backward.');
|
755
|
+
|
756
|
+
|
757
|
+
// save new config
|
758
|
+
itms.first += nI;
|
759
|
+
while (itms.first >= itms.total)
|
760
|
+
{
|
761
|
+
itms.first -= itms.total;
|
762
|
+
}
|
763
|
+
|
764
|
+
// non-circular callback
|
765
|
+
if (!opts.circular)
|
766
|
+
{
|
767
|
+
if (itms.first == 0 && sO.onEnd)
|
768
|
+
{
|
769
|
+
sO.onEnd.call($tt0, 'prev');
|
770
|
+
}
|
771
|
+
if (!opts.infinite)
|
772
|
+
{
|
773
|
+
nv_enableNavi(opts, itms.first, conf);
|
774
|
+
}
|
775
|
+
}
|
776
|
+
|
777
|
+
// rearrange items
|
778
|
+
$cfs.children().slice(itms.total-nI, itms.total).prependTo($cfs);
|
779
|
+
if (itms.total < opts.items.visible + nI)
|
780
|
+
{
|
781
|
+
$cfs.children().slice(0, (opts.items.visible+nI)-itms.total).clone(true).appendTo($cfs);
|
782
|
+
}
|
783
|
+
|
784
|
+
// the needed items
|
785
|
+
var a_itm = $cfs.children(),
|
786
|
+
i_old = gi_getOldItemsPrev(a_itm, opts, nI),
|
787
|
+
i_new = gi_getNewItemsPrev(a_itm, opts),
|
788
|
+
i_cur_l = a_itm.eq(nI-1),
|
789
|
+
i_old_l = i_old.last(),
|
790
|
+
i_new_l = i_new.last();
|
791
|
+
|
792
|
+
sz_resetMargin(a_itm, opts);
|
793
|
+
|
794
|
+
var pL = 0,
|
795
|
+
pR = 0;
|
796
|
+
|
797
|
+
if (opts.align)
|
798
|
+
{
|
799
|
+
var p = cf_getAlignPadding(i_new, opts);
|
800
|
+
pL = p[0];
|
801
|
+
pR = p[1];
|
802
|
+
}
|
803
|
+
var oL = (pL < 0) ? opts.padding[opts.d[3]] : 0;
|
804
|
+
|
805
|
+
// hide items for fx directscroll
|
806
|
+
var hiddenitems = false,
|
807
|
+
i_skp = $();
|
808
|
+
if (opts.items.visible < nI)
|
809
|
+
{
|
810
|
+
i_skp = a_itm.slice(opts.items.visibleConf.old, nI);
|
811
|
+
if (sO.fx == 'directscroll')
|
812
|
+
{
|
813
|
+
var orgW = opts.items[opts.d['width']];
|
814
|
+
hiddenitems = i_skp;
|
815
|
+
i_cur_l = i_new_l;
|
816
|
+
sc_hideHiddenItems(hiddenitems);
|
817
|
+
opts.items[opts.d['width']] = 'variable';
|
818
|
+
}
|
819
|
+
}
|
820
|
+
|
821
|
+
// save new sizes
|
822
|
+
var $cf2 = false,
|
823
|
+
i_siz = ms_getTotalSize(a_itm.slice(0, nI), opts, 'width'),
|
824
|
+
w_siz = cf_mapWrapperSizes(ms_getSizes(i_new, opts, true), opts, !opts.usePadding),
|
825
|
+
i_siz_vis = 0,
|
826
|
+
a_cfs = {},
|
827
|
+
a_wsz = {},
|
828
|
+
a_cur = {},
|
829
|
+
a_old = {},
|
830
|
+
a_new = {},
|
831
|
+
a_lef = {},
|
832
|
+
a_lef_vis = {},
|
833
|
+
a_dur = sc_getDuration(sO, opts, nI, i_siz);
|
834
|
+
|
835
|
+
switch(sO.fx)
|
836
|
+
{
|
837
|
+
case 'cover':
|
838
|
+
case 'cover-fade':
|
839
|
+
i_siz_vis = ms_getTotalSize(a_itm.slice(0, opts.items.visible), opts, 'width');
|
840
|
+
break;
|
841
|
+
}
|
842
|
+
|
843
|
+
if (hiddenitems)
|
844
|
+
{
|
845
|
+
opts.items[opts.d['width']] = orgW;
|
846
|
+
}
|
847
|
+
|
848
|
+
sz_resetMargin(a_itm, opts, true);
|
849
|
+
if (pR >= 0)
|
850
|
+
{
|
851
|
+
sz_resetMargin(i_old_l, opts, opts.padding[opts.d[1]]);
|
852
|
+
}
|
853
|
+
if (pL >= 0)
|
854
|
+
{
|
855
|
+
sz_resetMargin(i_cur_l, opts, opts.padding[opts.d[3]]);
|
856
|
+
}
|
857
|
+
|
858
|
+
if (opts.align)
|
859
|
+
{
|
860
|
+
opts.padding[opts.d[1]] = pR;
|
861
|
+
opts.padding[opts.d[3]] = pL;
|
862
|
+
}
|
863
|
+
|
864
|
+
a_lef[opts.d['left']] = -(i_siz - oL);
|
865
|
+
a_lef_vis[opts.d['left']] = -(i_siz_vis - oL);
|
866
|
+
a_wsz[opts.d['left']] = w_siz[opts.d['width']];
|
867
|
+
|
868
|
+
// scrolling functions
|
869
|
+
var _s_wrapper = function() {},
|
870
|
+
_a_wrapper = function() {},
|
871
|
+
_s_paddingold = function() {},
|
872
|
+
_a_paddingold = function() {},
|
873
|
+
_s_paddingnew = function() {},
|
874
|
+
_a_paddingnew = function() {},
|
875
|
+
_s_paddingcur = function() {},
|
876
|
+
_a_paddingcur = function() {},
|
877
|
+
_onafter = function() {},
|
878
|
+
_moveitems = function() {},
|
879
|
+
_position = function() {};
|
880
|
+
|
881
|
+
// clone carousel
|
882
|
+
switch(sO.fx)
|
883
|
+
{
|
884
|
+
case 'crossfade':
|
885
|
+
case 'cover':
|
886
|
+
case 'cover-fade':
|
887
|
+
case 'uncover':
|
888
|
+
case 'uncover-fade':
|
889
|
+
$cf2 = $cfs.clone(true).appendTo($wrp);
|
890
|
+
break;
|
891
|
+
}
|
892
|
+
switch(sO.fx)
|
893
|
+
{
|
894
|
+
case 'crossfade':
|
895
|
+
case 'uncover':
|
896
|
+
case 'uncover-fade':
|
897
|
+
$cf2.children().slice(0, nI).remove();
|
898
|
+
$cf2.children().slice(opts.items.visibleConf.old).remove();
|
899
|
+
break;
|
900
|
+
|
901
|
+
case 'cover':
|
902
|
+
case 'cover-fade':
|
903
|
+
$cf2.children().slice(opts.items.visible).remove();
|
904
|
+
$cf2.css(a_lef_vis);
|
905
|
+
break;
|
906
|
+
}
|
907
|
+
|
908
|
+
$cfs.css(a_lef);
|
909
|
+
|
910
|
+
// reset all scrolls
|
911
|
+
scrl = sc_setScroll(a_dur, sO.easing, conf);
|
912
|
+
|
913
|
+
// animate / set carousel
|
914
|
+
a_cfs[opts.d['left']] = (opts.usePadding) ? opts.padding[opts.d[3]] : 0;
|
915
|
+
|
916
|
+
// animate / set wrapper
|
917
|
+
if (opts[opts.d['width']] == 'variable' || opts[opts.d['height']] == 'variable')
|
918
|
+
{
|
919
|
+
_s_wrapper = function() {
|
920
|
+
$wrp.css(w_siz);
|
921
|
+
};
|
922
|
+
_a_wrapper = function() {
|
923
|
+
scrl.anims.push([$wrp, w_siz]);
|
924
|
+
};
|
925
|
+
}
|
926
|
+
|
927
|
+
// animate / set items
|
928
|
+
if (opts.usePadding)
|
929
|
+
{
|
930
|
+
if (i_new_l.not(i_cur_l).length)
|
931
|
+
{
|
932
|
+
a_cur[opts.d['marginRight']] = i_cur_l.data('_cfs_origCssMargin');
|
933
|
+
|
934
|
+
if (pL < 0)
|
935
|
+
{
|
936
|
+
i_cur_l.css(a_cur);
|
937
|
+
}
|
938
|
+
else
|
939
|
+
{
|
940
|
+
_s_paddingcur = function() {
|
941
|
+
i_cur_l.css(a_cur);
|
942
|
+
};
|
943
|
+
_a_paddingcur = function() {
|
944
|
+
scrl.anims.push([i_cur_l, a_cur]);
|
945
|
+
};
|
946
|
+
}
|
947
|
+
}
|
948
|
+
switch(sO.fx)
|
949
|
+
{
|
950
|
+
case 'cover':
|
951
|
+
case 'cover-fade':
|
952
|
+
$cf2.children().eq(nI-1).css(a_cur);
|
953
|
+
break;
|
954
|
+
}
|
955
|
+
|
956
|
+
if (i_new_l.not(i_old_l).length)
|
957
|
+
{
|
958
|
+
a_old[opts.d['marginRight']] = i_old_l.data('_cfs_origCssMargin');
|
959
|
+
_s_paddingold = function() {
|
960
|
+
i_old_l.css(a_old);
|
961
|
+
};
|
962
|
+
_a_paddingold = function() {
|
963
|
+
scrl.anims.push([i_old_l, a_old]);
|
964
|
+
};
|
965
|
+
}
|
966
|
+
|
967
|
+
if (pR >= 0)
|
968
|
+
{
|
969
|
+
a_new[opts.d['marginRight']] = i_new_l.data('_cfs_origCssMargin') + opts.padding[opts.d[1]];
|
970
|
+
_s_paddingnew = function() {
|
971
|
+
i_new_l.css(a_new);
|
972
|
+
};
|
973
|
+
_a_paddingnew = function() {
|
974
|
+
scrl.anims.push([i_new_l, a_new]);
|
975
|
+
};
|
976
|
+
}
|
977
|
+
}
|
978
|
+
|
979
|
+
// set position
|
980
|
+
_position = function() {
|
981
|
+
$cfs.css(a_cfs);
|
982
|
+
};
|
983
|
+
|
984
|
+
|
985
|
+
var overFill = opts.items.visible+nI-itms.total;
|
986
|
+
|
987
|
+
// rearrange items
|
988
|
+
_moveitems = function() {
|
989
|
+
if (overFill > 0)
|
990
|
+
{
|
991
|
+
$cfs.children().slice(itms.total).remove();
|
992
|
+
i_old = $( $cfs.children().slice(itms.total-(opts.items.visible-overFill)).get().concat( $cfs.children().slice(0, overFill).get() ) );
|
993
|
+
}
|
994
|
+
sc_showHiddenItems(hiddenitems);
|
995
|
+
|
996
|
+
if (opts.usePadding)
|
997
|
+
{
|
998
|
+
var l_itm = $cfs.children().eq(opts.items.visible+nI-1);
|
999
|
+
l_itm.css(opts.d['marginRight'], l_itm.data('_cfs_origCssMargin'));
|
1000
|
+
}
|
1001
|
+
};
|
1002
|
+
|
1003
|
+
|
1004
|
+
var cb_arguments = sc_mapCallbackArguments(i_old, i_skp, i_new, nI, 'prev', a_dur, w_siz);
|
1005
|
+
|
1006
|
+
// fire onAfter callbacks
|
1007
|
+
_onafter = function() {
|
1008
|
+
sc_afterScroll($cfs, $cf2, sO);
|
1009
|
+
crsl.isScrolling = false;
|
1010
|
+
clbk.onAfter = sc_fireCallbacks($tt0, sO, 'onAfter', cb_arguments, clbk);
|
1011
|
+
queu = sc_fireQueue($cfs, queu, conf);
|
1012
|
+
|
1013
|
+
if (!crsl.isPaused)
|
1014
|
+
{
|
1015
|
+
$cfs.trigger(cf_e('play', conf));
|
1016
|
+
}
|
1017
|
+
};
|
1018
|
+
|
1019
|
+
// fire onBefore callback
|
1020
|
+
crsl.isScrolling = true;
|
1021
|
+
tmrs = sc_clearTimers(tmrs);
|
1022
|
+
clbk.onBefore = sc_fireCallbacks($tt0, sO, 'onBefore', cb_arguments, clbk);
|
1023
|
+
|
1024
|
+
switch(sO.fx)
|
1025
|
+
{
|
1026
|
+
case 'none':
|
1027
|
+
$cfs.css(a_cfs);
|
1028
|
+
_s_wrapper();
|
1029
|
+
_s_paddingold();
|
1030
|
+
_s_paddingnew();
|
1031
|
+
_s_paddingcur();
|
1032
|
+
_position();
|
1033
|
+
_moveitems();
|
1034
|
+
_onafter();
|
1035
|
+
break;
|
1036
|
+
|
1037
|
+
case 'fade':
|
1038
|
+
scrl.anims.push([$cfs, { 'opacity': 0 }, function() {
|
1039
|
+
_s_wrapper();
|
1040
|
+
_s_paddingold();
|
1041
|
+
_s_paddingnew();
|
1042
|
+
_s_paddingcur();
|
1043
|
+
_position();
|
1044
|
+
_moveitems();
|
1045
|
+
scrl = sc_setScroll(a_dur, sO.easing, conf);
|
1046
|
+
scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]);
|
1047
|
+
sc_startScroll(scrl, conf);
|
1048
|
+
}]);
|
1049
|
+
break;
|
1050
|
+
|
1051
|
+
case 'crossfade':
|
1052
|
+
$cfs.css({ 'opacity': 0 });
|
1053
|
+
scrl.anims.push([$cf2, { 'opacity': 0 }]);
|
1054
|
+
scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]);
|
1055
|
+
_a_wrapper();
|
1056
|
+
_s_paddingold();
|
1057
|
+
_s_paddingnew();
|
1058
|
+
_s_paddingcur();
|
1059
|
+
_position();
|
1060
|
+
_moveitems();
|
1061
|
+
break;
|
1062
|
+
|
1063
|
+
case 'cover':
|
1064
|
+
scrl.anims.push([$cf2, a_cfs, function() {
|
1065
|
+
_s_paddingold();
|
1066
|
+
_s_paddingnew();
|
1067
|
+
_s_paddingcur();
|
1068
|
+
_position();
|
1069
|
+
_moveitems();
|
1070
|
+
_onafter();
|
1071
|
+
}]);
|
1072
|
+
_a_wrapper();
|
1073
|
+
break;
|
1074
|
+
|
1075
|
+
case 'cover-fade':
|
1076
|
+
scrl.anims.push([$cfs, { 'opacity': 0 }]);
|
1077
|
+
scrl.anims.push([$cf2, a_cfs, function() {
|
1078
|
+
_s_paddingold();
|
1079
|
+
_s_paddingnew();
|
1080
|
+
_s_paddingcur();
|
1081
|
+
_position();
|
1082
|
+
_moveitems();
|
1083
|
+
_onafter();
|
1084
|
+
}]);
|
1085
|
+
_a_wrapper();
|
1086
|
+
break;
|
1087
|
+
|
1088
|
+
case 'uncover':
|
1089
|
+
scrl.anims.push([$cf2, a_wsz, _onafter]);
|
1090
|
+
_a_wrapper();
|
1091
|
+
_s_paddingold();
|
1092
|
+
_s_paddingnew();
|
1093
|
+
_s_paddingcur();
|
1094
|
+
_position();
|
1095
|
+
_moveitems();
|
1096
|
+
break;
|
1097
|
+
|
1098
|
+
case 'uncover-fade':
|
1099
|
+
$cfs.css({ 'opacity': 0 });
|
1100
|
+
scrl.anims.push([$cfs, { 'opacity': 1 }]);
|
1101
|
+
scrl.anims.push([$cf2, a_wsz, _onafter]);
|
1102
|
+
_a_wrapper();
|
1103
|
+
_s_paddingold();
|
1104
|
+
_s_paddingnew();
|
1105
|
+
_s_paddingcur();
|
1106
|
+
_position();
|
1107
|
+
_moveitems();
|
1108
|
+
break;
|
1109
|
+
|
1110
|
+
default:
|
1111
|
+
scrl.anims.push([$cfs, a_cfs, function() {
|
1112
|
+
_moveitems();
|
1113
|
+
_onafter();
|
1114
|
+
}]);
|
1115
|
+
_a_wrapper();
|
1116
|
+
_a_paddingold();
|
1117
|
+
_a_paddingnew();
|
1118
|
+
_a_paddingcur();
|
1119
|
+
break;
|
1120
|
+
}
|
1121
|
+
|
1122
|
+
sc_startScroll(scrl, conf);
|
1123
|
+
cf_setCookie(opts.cookie, $cfs, conf);
|
1124
|
+
|
1125
|
+
$cfs.trigger(cf_e('updatePageStatus', conf), [false, w_siz]);
|
1126
|
+
|
1127
|
+
return true;
|
1128
|
+
});
|
1129
|
+
|
1130
|
+
|
1131
|
+
// next event
|
1132
|
+
$cfs.bind(cf_e('slide_next', conf), function(e, sO, nI) {
|
1133
|
+
e.stopPropagation();
|
1134
|
+
var a_itm = $cfs.children();
|
1135
|
+
|
1136
|
+
// non-circular at end, scroll to start
|
1137
|
+
if (!opts.circular)
|
1138
|
+
{
|
1139
|
+
if (itms.first == opts.items.visible)
|
1140
|
+
{
|
1141
|
+
if (opts.infinite)
|
1142
|
+
{
|
1143
|
+
$cfs.trigger(cf_e('prev', conf), itms.total-1);
|
1144
|
+
}
|
1145
|
+
return e.stopImmediatePropagation();
|
1146
|
+
}
|
1147
|
+
}
|
1148
|
+
|
1149
|
+
sz_resetMargin(a_itm, opts);
|
1150
|
+
|
1151
|
+
// find number of items to scroll
|
1152
|
+
if (!is_number(nI))
|
1153
|
+
{
|
1154
|
+
if (opts.items.filter != '*')
|
1155
|
+
{
|
1156
|
+
var xI = (is_number(sO.items)) ? sO.items : gn_getVisibleOrg($cfs, opts);
|
1157
|
+
nI = gn_getScrollItemsNextFilter(a_itm, opts, 0, xI);
|
1158
|
+
}
|
1159
|
+
else
|
1160
|
+
{
|
1161
|
+
nI = opts.items.visible;
|
1162
|
+
}
|
1163
|
+
nI = cf_getAdjust(nI, opts, sO.items, $tt0);
|
1164
|
+
}
|
1165
|
+
|
1166
|
+
var lastItemNr = (itms.first == 0) ? itms.total : itms.first;
|
1167
|
+
|
1168
|
+
// prevent non-circular from scrolling to far
|
1169
|
+
if (!opts.circular)
|
1170
|
+
{
|
1171
|
+
if (opts.items.visibleConf.variable)
|
1172
|
+
{
|
1173
|
+
var vI = gn_getVisibleItemsNext(a_itm, opts, nI),
|
1174
|
+
xI = gn_getVisibleItemsPrev(a_itm, opts, lastItemNr-1);
|
1175
|
+
}
|
1176
|
+
else
|
1177
|
+
{
|
1178
|
+
var vI = opts.items.visible,
|
1179
|
+
xI = opts.items.visible;
|
1180
|
+
}
|
1181
|
+
|
1182
|
+
if (nI + vI > lastItemNr)
|
1183
|
+
{
|
1184
|
+
nI = lastItemNr - xI;
|
1185
|
+
}
|
1186
|
+
}
|
1187
|
+
|
1188
|
+
// set new number of visible items
|
1189
|
+
opts.items.visibleConf.old = opts.items.visible;
|
1190
|
+
if (opts.items.visibleConf.variable)
|
1191
|
+
{
|
1192
|
+
var vI = cf_getItemsAdjust(gn_getVisibleItemsNextTestCircular(a_itm, opts, nI, lastItemNr), opts, opts.items.visibleConf.adjust, $tt0);
|
1193
|
+
while (opts.items.visible-nI >= vI && nI < itms.total)
|
1194
|
+
{
|
1195
|
+
nI++;
|
1196
|
+
vI = cf_getItemsAdjust(gn_getVisibleItemsNextTestCircular(a_itm, opts, nI, lastItemNr), opts, opts.items.visibleConf.adjust, $tt0);
|
1197
|
+
}
|
1198
|
+
opts.items.visible = vI;
|
1199
|
+
}
|
1200
|
+
else if (opts.items.filter != '*')
|
1201
|
+
{
|
1202
|
+
var vI = gn_getVisibleItemsNextFilter(a_itm, opts, nI);
|
1203
|
+
opts.items.visible = cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0);
|
1204
|
+
}
|
1205
|
+
|
1206
|
+
sz_resetMargin(a_itm, opts, true);
|
1207
|
+
|
1208
|
+
// scroll 0, don't scroll
|
1209
|
+
if (nI == 0)
|
1210
|
+
{
|
1211
|
+
e.stopImmediatePropagation();
|
1212
|
+
return debug(conf, '0 items to scroll: Not scrolling.');
|
1213
|
+
}
|
1214
|
+
debug(conf, 'Scrolling '+nI+' items forward.');
|
1215
|
+
|
1216
|
+
|
1217
|
+
// save new config
|
1218
|
+
itms.first -= nI;
|
1219
|
+
while (itms.first < 0)
|
1220
|
+
{
|
1221
|
+
itms.first += itms.total;
|
1222
|
+
}
|
1223
|
+
|
1224
|
+
// non-circular callback
|
1225
|
+
if (!opts.circular)
|
1226
|
+
{
|
1227
|
+
if (itms.first == opts.items.visible && sO.onEnd)
|
1228
|
+
{
|
1229
|
+
sO.onEnd.call($tt0, 'next');
|
1230
|
+
}
|
1231
|
+
if (!opts.infinite)
|
1232
|
+
{
|
1233
|
+
nv_enableNavi(opts, itms.first, conf);
|
1234
|
+
}
|
1235
|
+
}
|
1236
|
+
|
1237
|
+
// rearrange items
|
1238
|
+
if (itms.total < opts.items.visible+nI)
|
1239
|
+
{
|
1240
|
+
$cfs.children().slice(0, (opts.items.visible+nI)-itms.total).clone(true).appendTo($cfs);
|
1241
|
+
}
|
1242
|
+
|
1243
|
+
// the needed items
|
1244
|
+
var a_itm = $cfs.children(),
|
1245
|
+
i_old = gi_getOldItemsNext(a_itm, opts),
|
1246
|
+
i_new = gi_getNewItemsNext(a_itm, opts, nI),
|
1247
|
+
i_cur_l = a_itm.eq(nI-1),
|
1248
|
+
i_old_l = i_old.last(),
|
1249
|
+
i_new_l = i_new.last();
|
1250
|
+
|
1251
|
+
sz_resetMargin(a_itm, opts);
|
1252
|
+
|
1253
|
+
var pL = 0,
|
1254
|
+
pR = 0;
|
1255
|
+
|
1256
|
+
if (opts.align)
|
1257
|
+
{
|
1258
|
+
var p = cf_getAlignPadding(i_new, opts);
|
1259
|
+
pL = p[0];
|
1260
|
+
pR = p[1];
|
1261
|
+
}
|
1262
|
+
|
1263
|
+
// hide items for fx directscroll
|
1264
|
+
var hiddenitems = false,
|
1265
|
+
i_skp = $();
|
1266
|
+
if (opts.items.visibleConf.old < nI)
|
1267
|
+
{
|
1268
|
+
i_skp = a_itm.slice(opts.items.visibleConf.old, nI);
|
1269
|
+
if (sO.fx == 'directscroll')
|
1270
|
+
{
|
1271
|
+
var orgW = opts.items[opts.d['width']];
|
1272
|
+
hiddenitems = i_skp;
|
1273
|
+
i_cur_l = i_old_l;
|
1274
|
+
sc_hideHiddenItems(hiddenitems);
|
1275
|
+
opts.items[opts.d['width']] = 'variable';
|
1276
|
+
}
|
1277
|
+
}
|
1278
|
+
|
1279
|
+
// save new sizes
|
1280
|
+
var $cf2 = false,
|
1281
|
+
i_siz = ms_getTotalSize(a_itm.slice(0, nI), opts, 'width'),
|
1282
|
+
w_siz = cf_mapWrapperSizes(ms_getSizes(i_new, opts, true), opts, !opts.usePadding),
|
1283
|
+
i_siz_vis = 0,
|
1284
|
+
a_cfs = {},
|
1285
|
+
a_cfs_vis = {},
|
1286
|
+
a_cur = {},
|
1287
|
+
a_old = {},
|
1288
|
+
a_lef = {},
|
1289
|
+
a_dur = sc_getDuration(sO, opts, nI, i_siz);
|
1290
|
+
|
1291
|
+
switch(sO.fx)
|
1292
|
+
{
|
1293
|
+
case 'uncover':
|
1294
|
+
case 'uncover-fade':
|
1295
|
+
i_siz_vis = ms_getTotalSize(a_itm.slice(0, opts.items.visibleConf.old), opts, 'width');
|
1296
|
+
break;
|
1297
|
+
}
|
1298
|
+
|
1299
|
+
if (hiddenitems)
|
1300
|
+
{
|
1301
|
+
opts.items[opts.d['width']] = orgW;
|
1302
|
+
}
|
1303
|
+
|
1304
|
+
if (opts.align)
|
1305
|
+
{
|
1306
|
+
if (opts.padding[opts.d[1]] < 0)
|
1307
|
+
{
|
1308
|
+
opts.padding[opts.d[1]] = 0;
|
1309
|
+
}
|
1310
|
+
}
|
1311
|
+
sz_resetMargin(a_itm, opts, true);
|
1312
|
+
sz_resetMargin(i_old_l, opts, opts.padding[opts.d[1]]);
|
1313
|
+
|
1314
|
+
if (opts.align)
|
1315
|
+
{
|
1316
|
+
opts.padding[opts.d[1]] = pR;
|
1317
|
+
opts.padding[opts.d[3]] = pL;
|
1318
|
+
}
|
1319
|
+
|
1320
|
+
a_lef[opts.d['left']] = (opts.usePadding) ? opts.padding[opts.d[3]] : 0;
|
1321
|
+
|
1322
|
+
// scrolling functions
|
1323
|
+
var _s_wrapper = function() {},
|
1324
|
+
_a_wrapper = function() {},
|
1325
|
+
_s_paddingold = function() {},
|
1326
|
+
_a_paddingold = function() {},
|
1327
|
+
_s_paddingcur = function() {},
|
1328
|
+
_a_paddingcur = function() {},
|
1329
|
+
_onafter = function() {},
|
1330
|
+
_moveitems = function() {},
|
1331
|
+
_position = function() {};
|
1332
|
+
|
1333
|
+
// clone carousel
|
1334
|
+
switch(sO.fx)
|
1335
|
+
{
|
1336
|
+
case 'crossfade':
|
1337
|
+
case 'cover':
|
1338
|
+
case 'cover-fade':
|
1339
|
+
case 'uncover':
|
1340
|
+
case 'uncover-fade':
|
1341
|
+
$cf2 = $cfs.clone(true).appendTo($wrp);
|
1342
|
+
$cf2.children().slice(opts.items.visibleConf.old).remove();
|
1343
|
+
break;
|
1344
|
+
}
|
1345
|
+
switch(sO.fx)
|
1346
|
+
{
|
1347
|
+
case 'crossfade':
|
1348
|
+
case 'cover':
|
1349
|
+
case 'cover-fade':
|
1350
|
+
$cfs.css('zIndex', 1);
|
1351
|
+
$cf2.css('zIndex', 0);
|
1352
|
+
break;
|
1353
|
+
}
|
1354
|
+
|
1355
|
+
// reset all scrolls
|
1356
|
+
scrl = sc_setScroll(a_dur, sO.easing, conf);
|
1357
|
+
|
1358
|
+
// animate / set carousel
|
1359
|
+
a_cfs[opts.d['left']] = -i_siz;
|
1360
|
+
a_cfs_vis[opts.d['left']] = -i_siz_vis;
|
1361
|
+
|
1362
|
+
if (pL < 0)
|
1363
|
+
{
|
1364
|
+
a_cfs[opts.d['left']] += pL;
|
1365
|
+
}
|
1366
|
+
|
1367
|
+
// animate / set wrapper
|
1368
|
+
if (opts[opts.d['width']] == 'variable' || opts[opts.d['height']] == 'variable')
|
1369
|
+
{
|
1370
|
+
_s_wrapper = function() {
|
1371
|
+
$wrp.css(w_siz);
|
1372
|
+
};
|
1373
|
+
_a_wrapper = function() {
|
1374
|
+
scrl.anims.push([$wrp, w_siz]);
|
1375
|
+
};
|
1376
|
+
}
|
1377
|
+
|
1378
|
+
// animate / set items
|
1379
|
+
if (opts.usePadding)
|
1380
|
+
{
|
1381
|
+
var i_new_l_m = i_new_l.data('_cfs_origCssMargin');
|
1382
|
+
|
1383
|
+
if (pR >= 0)
|
1384
|
+
{
|
1385
|
+
i_new_l_m += opts.padding[opts.d[1]];
|
1386
|
+
}
|
1387
|
+
i_new_l.css(opts.d['marginRight'], i_new_l_m);
|
1388
|
+
|
1389
|
+
if (i_cur_l.not(i_old_l).length)
|
1390
|
+
{
|
1391
|
+
a_old[opts.d['marginRight']] = i_old_l.data('_cfs_origCssMargin');
|
1392
|
+
}
|
1393
|
+
_s_paddingold = function() {
|
1394
|
+
i_old_l.css(a_old);
|
1395
|
+
};
|
1396
|
+
_a_paddingold = function() {
|
1397
|
+
scrl.anims.push([i_old_l, a_old]);
|
1398
|
+
};
|
1399
|
+
|
1400
|
+
var i_cur_l_m = i_cur_l.data('_cfs_origCssMargin');
|
1401
|
+
if (pL > 0)
|
1402
|
+
{
|
1403
|
+
i_cur_l_m += opts.padding[opts.d[3]];
|
1404
|
+
}
|
1405
|
+
|
1406
|
+
a_cur[opts.d['marginRight']] = i_cur_l_m;
|
1407
|
+
|
1408
|
+
_s_paddingcur = function() {
|
1409
|
+
i_cur_l.css(a_cur);
|
1410
|
+
};
|
1411
|
+
_a_paddingcur = function() {
|
1412
|
+
scrl.anims.push([i_cur_l, a_cur]);
|
1413
|
+
};
|
1414
|
+
}
|
1415
|
+
|
1416
|
+
// set position
|
1417
|
+
_position = function() {
|
1418
|
+
$cfs.css(a_lef);
|
1419
|
+
};
|
1420
|
+
|
1421
|
+
|
1422
|
+
var overFill = opts.items.visible+nI-itms.total;
|
1423
|
+
|
1424
|
+
// rearrange items
|
1425
|
+
_moveitems = function() {
|
1426
|
+
if (overFill > 0)
|
1427
|
+
{
|
1428
|
+
$cfs.children().slice(itms.total).remove();
|
1429
|
+
}
|
1430
|
+
var l_itm = $cfs.children().slice(0, nI).appendTo($cfs).last();
|
1431
|
+
if (overFill > 0)
|
1432
|
+
{
|
1433
|
+
i_new = gi_getCurrentItems(a_itm, opts);
|
1434
|
+
}
|
1435
|
+
sc_showHiddenItems(hiddenitems);
|
1436
|
+
|
1437
|
+
if (opts.usePadding)
|
1438
|
+
{
|
1439
|
+
if (itms.total < opts.items.visible+nI) {
|
1440
|
+
var i_cur_l = $cfs.children().eq(opts.items.visible-1);
|
1441
|
+
i_cur_l.css(opts.d['marginRight'], i_cur_l.data('_cfs_origCssMargin') + opts.padding[opts.d[1]]);
|
1442
|
+
}
|
1443
|
+
l_itm.css(opts.d['marginRight'], l_itm.data('_cfs_origCssMargin'));
|
1444
|
+
}
|
1445
|
+
};
|
1446
|
+
|
1447
|
+
|
1448
|
+
var cb_arguments = sc_mapCallbackArguments(i_old, i_skp, i_new, nI, 'next', a_dur, w_siz);
|
1449
|
+
|
1450
|
+
// fire onAfter callbacks
|
1451
|
+
_onafter = function() {
|
1452
|
+
$cfs.css('zIndex', $cfs.data('_cfs_origCssZindex'));
|
1453
|
+
sc_afterScroll($cfs, $cf2, sO);
|
1454
|
+
crsl.isScrolling = false;
|
1455
|
+
clbk.onAfter = sc_fireCallbacks($tt0, sO, 'onAfter', cb_arguments, clbk);
|
1456
|
+
queu = sc_fireQueue($cfs, queu, conf);
|
1457
|
+
|
1458
|
+
if (!crsl.isPaused)
|
1459
|
+
{
|
1460
|
+
$cfs.trigger(cf_e('play', conf));
|
1461
|
+
}
|
1462
|
+
};
|
1463
|
+
|
1464
|
+
// fire onBefore callbacks
|
1465
|
+
crsl.isScrolling = true;
|
1466
|
+
tmrs = sc_clearTimers(tmrs);
|
1467
|
+
clbk.onBefore = sc_fireCallbacks($tt0, sO, 'onBefore', cb_arguments, clbk);
|
1468
|
+
|
1469
|
+
switch(sO.fx)
|
1470
|
+
{
|
1471
|
+
case 'none':
|
1472
|
+
$cfs.css(a_cfs);
|
1473
|
+
_s_wrapper();
|
1474
|
+
_s_paddingold();
|
1475
|
+
_s_paddingcur();
|
1476
|
+
_position();
|
1477
|
+
_moveitems();
|
1478
|
+
_onafter();
|
1479
|
+
break;
|
1480
|
+
|
1481
|
+
case 'fade':
|
1482
|
+
scrl.anims.push([$cfs, { 'opacity': 0 }, function() {
|
1483
|
+
_s_wrapper();
|
1484
|
+
_s_paddingold();
|
1485
|
+
_s_paddingcur();
|
1486
|
+
_position();
|
1487
|
+
_moveitems();
|
1488
|
+
scrl = sc_setScroll(a_dur, sO.easing, conf);
|
1489
|
+
scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]);
|
1490
|
+
sc_startScroll(scrl, conf);
|
1491
|
+
}]);
|
1492
|
+
break;
|
1493
|
+
|
1494
|
+
case 'crossfade':
|
1495
|
+
$cfs.css({ 'opacity': 0 });
|
1496
|
+
scrl.anims.push([$cf2, { 'opacity': 0 }]);
|
1497
|
+
scrl.anims.push([$cfs, { 'opacity': 1 }, _onafter]);
|
1498
|
+
_a_wrapper();
|
1499
|
+
_s_paddingold();
|
1500
|
+
_s_paddingcur();
|
1501
|
+
_position();
|
1502
|
+
_moveitems();
|
1503
|
+
break;
|
1504
|
+
|
1505
|
+
case 'cover':
|
1506
|
+
$cfs.css(opts.d['left'], $wrp[opts.d['width']]());
|
1507
|
+
scrl.anims.push([$cfs, a_lef, _onafter]);
|
1508
|
+
_a_wrapper();
|
1509
|
+
_s_paddingold();
|
1510
|
+
_s_paddingcur();
|
1511
|
+
_moveitems();
|
1512
|
+
break;
|
1513
|
+
|
1514
|
+
case 'cover-fade':
|
1515
|
+
$cfs.css(opts.d['left'], $wrp[opts.d['width']]());
|
1516
|
+
scrl.anims.push([$cf2, { 'opacity': 0 }]);
|
1517
|
+
scrl.anims.push([$cfs, a_lef, _onafter]);
|
1518
|
+
_a_wrapper();
|
1519
|
+
_s_paddingold();
|
1520
|
+
_s_paddingcur();
|
1521
|
+
_moveitems();
|
1522
|
+
break;
|
1523
|
+
|
1524
|
+
case 'uncover':
|
1525
|
+
scrl.anims.push([$cf2, a_cfs_vis, _onafter]);
|
1526
|
+
_a_wrapper();
|
1527
|
+
_s_paddingold();
|
1528
|
+
_s_paddingcur();
|
1529
|
+
_position();
|
1530
|
+
_moveitems();
|
1531
|
+
break;
|
1532
|
+
|
1533
|
+
case 'uncover-fade':
|
1534
|
+
$cfs.css({ 'opacity': 0 });
|
1535
|
+
scrl.anims.push([$cfs, { 'opacity': 1 }]);
|
1536
|
+
scrl.anims.push([$cf2, a_cfs_vis, _onafter]);
|
1537
|
+
_a_wrapper();
|
1538
|
+
_s_paddingold();
|
1539
|
+
_s_paddingcur();
|
1540
|
+
_position();
|
1541
|
+
_moveitems();
|
1542
|
+
break;
|
1543
|
+
|
1544
|
+
default:
|
1545
|
+
scrl.anims.push([$cfs, a_cfs, function() {
|
1546
|
+
_position();
|
1547
|
+
_moveitems();
|
1548
|
+
_onafter();
|
1549
|
+
}]);
|
1550
|
+
_a_wrapper();
|
1551
|
+
_a_paddingold();
|
1552
|
+
_a_paddingcur();
|
1553
|
+
break;
|
1554
|
+
}
|
1555
|
+
|
1556
|
+
sc_startScroll(scrl, conf);
|
1557
|
+
cf_setCookie(opts.cookie, $cfs, conf);
|
1558
|
+
|
1559
|
+
$cfs.trigger(cf_e('updatePageStatus', conf), [false, w_siz]);
|
1560
|
+
|
1561
|
+
return true;
|
1562
|
+
});
|
1563
|
+
|
1564
|
+
|
1565
|
+
// slideTo event
|
1566
|
+
$cfs.bind(cf_e('slideTo', conf), function(e, num, dev, org, obj, dir, clb) {
|
1567
|
+
e.stopPropagation();
|
1568
|
+
|
1569
|
+
var v = [num, dev, org, obj, dir, clb],
|
1570
|
+
t = ['string/number/object', 'number', 'boolean', 'object', 'string', 'function'],
|
1571
|
+
a = cf_sortParams(v, t);
|
1572
|
+
|
1573
|
+
obj = a[3];
|
1574
|
+
dir = a[4];
|
1575
|
+
clb = a[5];
|
1576
|
+
|
1577
|
+
num = gn_getItemIndex(a[0], a[1], a[2], itms, $cfs);
|
1578
|
+
|
1579
|
+
if (num == 0)
|
1580
|
+
{
|
1581
|
+
return false;
|
1582
|
+
}
|
1583
|
+
if (!is_object(obj))
|
1584
|
+
{
|
1585
|
+
obj = false;
|
1586
|
+
}
|
1587
|
+
|
1588
|
+
if (dir != 'prev' && dir != 'next')
|
1589
|
+
{
|
1590
|
+
if (opts.circular)
|
1591
|
+
{
|
1592
|
+
dir = (num <= itms.total / 2) ? 'next' : 'prev';
|
1593
|
+
}
|
1594
|
+
else
|
1595
|
+
{
|
1596
|
+
dir = (itms.first == 0 || itms.first > num) ? 'next' : 'prev';
|
1597
|
+
}
|
1598
|
+
}
|
1599
|
+
|
1600
|
+
if (dir == 'prev')
|
1601
|
+
{
|
1602
|
+
num = itms.total-num;
|
1603
|
+
}
|
1604
|
+
$cfs.trigger(cf_e(dir, conf), [obj, num, clb]);
|
1605
|
+
|
1606
|
+
return true;
|
1607
|
+
});
|
1608
|
+
|
1609
|
+
|
1610
|
+
// prevPage event
|
1611
|
+
$cfs.bind(cf_e('prevPage', conf), function(e, obj, clb) {
|
1612
|
+
e.stopPropagation();
|
1613
|
+
var cur = $cfs.triggerHandler(cf_e('currentPage', conf));
|
1614
|
+
return $cfs.triggerHandler(cf_e('slideToPage', conf), [cur-1, obj, 'prev', clb]);
|
1615
|
+
});
|
1616
|
+
|
1617
|
+
|
1618
|
+
// nextPage event
|
1619
|
+
$cfs.bind(cf_e('nextPage', conf), function(e, obj, clb) {
|
1620
|
+
e.stopPropagation();
|
1621
|
+
var cur = $cfs.triggerHandler(cf_e('currentPage', conf));
|
1622
|
+
return $cfs.triggerHandler(cf_e('slideToPage', conf), [cur+1, obj, 'next', clb]);
|
1623
|
+
});
|
1624
|
+
|
1625
|
+
|
1626
|
+
// slideToPage event
|
1627
|
+
$cfs.bind(cf_e('slideToPage', conf), function(e, pag, obj, dir, clb) {
|
1628
|
+
e.stopPropagation();
|
1629
|
+
if (!is_number(pag))
|
1630
|
+
{
|
1631
|
+
pag = $cfs.triggerHandler(cf_e('currentPage', conf));
|
1632
|
+
}
|
1633
|
+
var ipp = opts.pagination.items || opts.items.visible,
|
1634
|
+
max = Math.ceil(itms.total / ipp)-1;
|
1635
|
+
|
1636
|
+
if (pag < 0)
|
1637
|
+
{
|
1638
|
+
pag = max;
|
1639
|
+
}
|
1640
|
+
if (pag > max)
|
1641
|
+
{
|
1642
|
+
pag = 0;
|
1643
|
+
}
|
1644
|
+
return $cfs.triggerHandler(cf_e('slideTo', conf), [pag*ipp, 0, true, obj, dir, clb]);
|
1645
|
+
});
|
1646
|
+
|
1647
|
+
// jumpToStart event
|
1648
|
+
$cfs.bind(cf_e('jumpToStart', conf), function(e, s) {
|
1649
|
+
e.stopPropagation();
|
1650
|
+
if (s)
|
1651
|
+
{
|
1652
|
+
s = gn_getItemIndex(s, 0, true, itms, $cfs);
|
1653
|
+
}
|
1654
|
+
else
|
1655
|
+
{
|
1656
|
+
s = 0;
|
1657
|
+
}
|
1658
|
+
|
1659
|
+
s += itms.first;
|
1660
|
+
if (s != 0)
|
1661
|
+
{
|
1662
|
+
if (itms.total > 0)
|
1663
|
+
{
|
1664
|
+
while (s > itms.total)
|
1665
|
+
{
|
1666
|
+
s -= itms.total;
|
1667
|
+
}
|
1668
|
+
}
|
1669
|
+
$cfs.prepend($cfs.children().slice(s, itms.total));
|
1670
|
+
}
|
1671
|
+
return true;
|
1672
|
+
});
|
1673
|
+
|
1674
|
+
|
1675
|
+
// synchronise event
|
1676
|
+
$cfs.bind(cf_e('synchronise', conf), function(e, s) {
|
1677
|
+
e.stopPropagation();
|
1678
|
+
if (s)
|
1679
|
+
{
|
1680
|
+
s = cf_getSynchArr(s);
|
1681
|
+
}
|
1682
|
+
else if (opts.synchronise)
|
1683
|
+
{
|
1684
|
+
s = opts.synchronise;
|
1685
|
+
}
|
1686
|
+
else
|
1687
|
+
{
|
1688
|
+
return debug(conf, 'No carousel to synchronise.');
|
1689
|
+
}
|
1690
|
+
|
1691
|
+
var n = $cfs.triggerHandler(cf_e('currentPosition', conf)),
|
1692
|
+
x = true;
|
1693
|
+
|
1694
|
+
for (var j = 0, l = s.length; j < l; j++)
|
1695
|
+
{
|
1696
|
+
if (!s[j][0].triggerHandler(cf_e('slideTo', conf), [n, s[j][3], true]))
|
1697
|
+
{
|
1698
|
+
x = false;
|
1699
|
+
}
|
1700
|
+
}
|
1701
|
+
return x;
|
1702
|
+
});
|
1703
|
+
|
1704
|
+
|
1705
|
+
// queue event
|
1706
|
+
$cfs.bind(cf_e('queue', conf), function(e, dir, opt) {
|
1707
|
+
e.stopPropagation();
|
1708
|
+
if (is_function(dir))
|
1709
|
+
{
|
1710
|
+
dir.call($tt0, queu);
|
1711
|
+
}
|
1712
|
+
else if (is_array(dir))
|
1713
|
+
{
|
1714
|
+
queu = dir;
|
1715
|
+
}
|
1716
|
+
else if (!is_undefined(dir))
|
1717
|
+
{
|
1718
|
+
queu.push([dir, opt]);
|
1719
|
+
}
|
1720
|
+
return queu;
|
1721
|
+
});
|
1722
|
+
|
1723
|
+
|
1724
|
+
// insertItem event
|
1725
|
+
$cfs.bind(cf_e('insertItem', conf), function(e, itm, num, org, dev) {
|
1726
|
+
e.stopPropagation();
|
1727
|
+
|
1728
|
+
var v = [itm, num, org, dev],
|
1729
|
+
t = ['string/object', 'string/number/object', 'boolean', 'number'],
|
1730
|
+
a = cf_sortParams(v, t);
|
1731
|
+
|
1732
|
+
itm = a[0];
|
1733
|
+
num = a[1];
|
1734
|
+
org = a[2];
|
1735
|
+
dev = a[3];
|
1736
|
+
|
1737
|
+
if (is_object(itm) && !is_jquery(itm))
|
1738
|
+
{
|
1739
|
+
itm = $(itm);
|
1740
|
+
}
|
1741
|
+
else if (is_string(itm))
|
1742
|
+
{
|
1743
|
+
itm = $(itm);
|
1744
|
+
}
|
1745
|
+
if (!is_jquery(itm) || itm.length == 0)
|
1746
|
+
{
|
1747
|
+
return debug(conf, 'Not a valid object.');
|
1748
|
+
}
|
1749
|
+
|
1750
|
+
if (is_undefined(num))
|
1751
|
+
{
|
1752
|
+
num = 'end';
|
1753
|
+
}
|
1754
|
+
|
1755
|
+
sz_storeMargin(itm, opts);
|
1756
|
+
sz_storeOrigCss(itm);
|
1757
|
+
|
1758
|
+
var orgNum = num,
|
1759
|
+
before = 'before';
|
1760
|
+
|
1761
|
+
if (num == 'end')
|
1762
|
+
{
|
1763
|
+
if (org)
|
1764
|
+
{
|
1765
|
+
if (itms.first == 0)
|
1766
|
+
{
|
1767
|
+
num = itms.total-1;
|
1768
|
+
before = 'after';
|
1769
|
+
}
|
1770
|
+
else
|
1771
|
+
{
|
1772
|
+
num = itms.first;
|
1773
|
+
itms.first += itm.length;
|
1774
|
+
}
|
1775
|
+
if (num < 0)
|
1776
|
+
{
|
1777
|
+
num = 0;
|
1778
|
+
}
|
1779
|
+
}
|
1780
|
+
else
|
1781
|
+
{
|
1782
|
+
num = itms.total-1;
|
1783
|
+
before = 'after';
|
1784
|
+
}
|
1785
|
+
}
|
1786
|
+
else
|
1787
|
+
{
|
1788
|
+
num = gn_getItemIndex(num, dev, org, itms, $cfs);
|
1789
|
+
}
|
1790
|
+
|
1791
|
+
var $cit = $cfs.children().eq(num);
|
1792
|
+
if ($cit.length)
|
1793
|
+
{
|
1794
|
+
$cit[before](itm);
|
1795
|
+
}
|
1796
|
+
else
|
1797
|
+
{
|
1798
|
+
debug(conf, 'Correct insert-position not found! Appending item to the end.');
|
1799
|
+
$cfs.append(itm);
|
1800
|
+
}
|
1801
|
+
|
1802
|
+
if (orgNum != 'end' && !org)
|
1803
|
+
{
|
1804
|
+
if (num < itms.first)
|
1805
|
+
{
|
1806
|
+
itms.first += itm.length;
|
1807
|
+
}
|
1808
|
+
}
|
1809
|
+
itms.total = $cfs.children().length;
|
1810
|
+
if (itms.first >= itms.total)
|
1811
|
+
{
|
1812
|
+
itms.first -= itms.total;
|
1813
|
+
}
|
1814
|
+
|
1815
|
+
$cfs.trigger(cf_e('updateSizes', conf));
|
1816
|
+
$cfs.trigger(cf_e('linkAnchors', conf));
|
1817
|
+
|
1818
|
+
return true;
|
1819
|
+
});
|
1820
|
+
|
1821
|
+
|
1822
|
+
// removeItem event
|
1823
|
+
$cfs.bind(cf_e('removeItem', conf), function(e, num, org, dev) {
|
1824
|
+
e.stopPropagation();
|
1825
|
+
|
1826
|
+
var v = [num, org, dev],
|
1827
|
+
t = ['string/number/object', 'boolean', 'number'],
|
1828
|
+
a = cf_sortParams(v, t);
|
1829
|
+
|
1830
|
+
num = a[0];
|
1831
|
+
org = a[1];
|
1832
|
+
dev = a[2];
|
1833
|
+
|
1834
|
+
var removed = false;
|
1835
|
+
|
1836
|
+
if (num instanceof $ && num.length > 1)
|
1837
|
+
{
|
1838
|
+
$removed = $();
|
1839
|
+
num.each(function(i, el) {
|
1840
|
+
var $rem = $cfs.trigger(cf_e('removeItem', conf), [$(this), org, dev]);
|
1841
|
+
if ( $rem )
|
1842
|
+
{
|
1843
|
+
$removed = $removed.add($rem);
|
1844
|
+
}
|
1845
|
+
});
|
1846
|
+
return $removed;
|
1847
|
+
}
|
1848
|
+
|
1849
|
+
if (is_undefined(num) || num == 'end')
|
1850
|
+
{
|
1851
|
+
$removed = $cfs.children().last();
|
1852
|
+
}
|
1853
|
+
else
|
1854
|
+
{
|
1855
|
+
num = gn_getItemIndex(num, dev, org, itms, $cfs);
|
1856
|
+
var $removed = $cfs.children().eq(num);
|
1857
|
+
if ( $removed.length )
|
1858
|
+
{
|
1859
|
+
if (num < itms.first)
|
1860
|
+
{
|
1861
|
+
itms.first -= $removed.length;
|
1862
|
+
}
|
1863
|
+
}
|
1864
|
+
}
|
1865
|
+
if ( $removed && $removed.length )
|
1866
|
+
{
|
1867
|
+
$removed.detach();
|
1868
|
+
itms.total = $cfs.children().length;
|
1869
|
+
$cfs.trigger(cf_e('updateSizes', conf));
|
1870
|
+
}
|
1871
|
+
|
1872
|
+
return $removed;
|
1873
|
+
});
|
1874
|
+
|
1875
|
+
|
1876
|
+
// onBefore and onAfter event
|
1877
|
+
$cfs.bind(cf_e('onBefore', conf)+' '+cf_e('onAfter', conf), function(e, fn) {
|
1878
|
+
e.stopPropagation();
|
1879
|
+
var eType = e.type.slice(conf.events.prefix.length);
|
1880
|
+
if (is_array(fn))
|
1881
|
+
{
|
1882
|
+
clbk[eType] = fn;
|
1883
|
+
}
|
1884
|
+
if (is_function(fn))
|
1885
|
+
{
|
1886
|
+
clbk[eType].push(fn);
|
1887
|
+
}
|
1888
|
+
return clbk[eType];
|
1889
|
+
});
|
1890
|
+
|
1891
|
+
|
1892
|
+
// currentPosition event
|
1893
|
+
$cfs.bind(cf_e('currentPosition', conf), function(e, fn) {
|
1894
|
+
e.stopPropagation();
|
1895
|
+
if (itms.first == 0)
|
1896
|
+
{
|
1897
|
+
var val = 0;
|
1898
|
+
}
|
1899
|
+
else
|
1900
|
+
{
|
1901
|
+
var val = itms.total - itms.first;
|
1902
|
+
}
|
1903
|
+
if (is_function(fn))
|
1904
|
+
{
|
1905
|
+
fn.call($tt0, val);
|
1906
|
+
}
|
1907
|
+
return val;
|
1908
|
+
});
|
1909
|
+
|
1910
|
+
|
1911
|
+
// currentPage event
|
1912
|
+
$cfs.bind(cf_e('currentPage', conf), function(e, fn) {
|
1913
|
+
e.stopPropagation();
|
1914
|
+
var ipp = opts.pagination.items || opts.items.visible,
|
1915
|
+
max = Math.ceil(itms.total/ipp-1),
|
1916
|
+
nr;
|
1917
|
+
if (itms.first == 0)
|
1918
|
+
{
|
1919
|
+
nr = 0;
|
1920
|
+
}
|
1921
|
+
else if (itms.first < itms.total % ipp)
|
1922
|
+
{
|
1923
|
+
nr = 0;
|
1924
|
+
}
|
1925
|
+
else if (itms.first == ipp && !opts.circular)
|
1926
|
+
{
|
1927
|
+
nr = max;
|
1928
|
+
}
|
1929
|
+
else
|
1930
|
+
{
|
1931
|
+
nr = Math.round((itms.total-itms.first)/ipp);
|
1932
|
+
}
|
1933
|
+
if (nr < 0)
|
1934
|
+
{
|
1935
|
+
nr = 0;
|
1936
|
+
}
|
1937
|
+
if (nr > max)
|
1938
|
+
{
|
1939
|
+
nr = max;
|
1940
|
+
}
|
1941
|
+
if (is_function(fn))
|
1942
|
+
{
|
1943
|
+
fn.call($tt0, nr);
|
1944
|
+
}
|
1945
|
+
return nr;
|
1946
|
+
});
|
1947
|
+
|
1948
|
+
|
1949
|
+
// currentVisible event
|
1950
|
+
$cfs.bind(cf_e('currentVisible', conf), function(e, fn) {
|
1951
|
+
e.stopPropagation();
|
1952
|
+
var $i = gi_getCurrentItems($cfs.children(), opts);
|
1953
|
+
if (is_function(fn))
|
1954
|
+
{
|
1955
|
+
fn.call($tt0, $i);
|
1956
|
+
}
|
1957
|
+
return $i;
|
1958
|
+
});
|
1959
|
+
|
1960
|
+
|
1961
|
+
// slice event
|
1962
|
+
$cfs.bind(cf_e('slice', conf), function(e, f, l, fn) {
|
1963
|
+
e.stopPropagation();
|
1964
|
+
|
1965
|
+
if (itms.total == 0)
|
1966
|
+
{
|
1967
|
+
return false;
|
1968
|
+
}
|
1969
|
+
|
1970
|
+
var v = [f, l, fn],
|
1971
|
+
t = ['number', 'number', 'function'],
|
1972
|
+
a = cf_sortParams(v, t);
|
1973
|
+
|
1974
|
+
f = (is_number(a[0])) ? a[0] : 0;
|
1975
|
+
l = (is_number(a[1])) ? a[1] : itms.total;
|
1976
|
+
fn = a[2];
|
1977
|
+
|
1978
|
+
f += itms.first;
|
1979
|
+
l += itms.first;
|
1980
|
+
|
1981
|
+
if (items.total > 0)
|
1982
|
+
{
|
1983
|
+
while (f > itms.total)
|
1984
|
+
{
|
1985
|
+
f -= itms.total;
|
1986
|
+
}
|
1987
|
+
while (l > itms.total)
|
1988
|
+
{
|
1989
|
+
l -= itms.total;
|
1990
|
+
}
|
1991
|
+
while (f < 0)
|
1992
|
+
{
|
1993
|
+
f += itms.total;
|
1994
|
+
}
|
1995
|
+
while (l < 0)
|
1996
|
+
{
|
1997
|
+
l += itms.total;
|
1998
|
+
}
|
1999
|
+
}
|
2000
|
+
var $iA = $cfs.children(),
|
2001
|
+
$i;
|
2002
|
+
|
2003
|
+
if (l > f)
|
2004
|
+
{
|
2005
|
+
$i = $iA.slice(f, l);
|
2006
|
+
}
|
2007
|
+
else
|
2008
|
+
{
|
2009
|
+
$i = $( $iA.slice(f, itms.total).get().concat( $iA.slice(0, l).get() ) );
|
2010
|
+
}
|
2011
|
+
|
2012
|
+
if (is_function(fn))
|
2013
|
+
{
|
2014
|
+
fn.call($tt0, $i);
|
2015
|
+
}
|
2016
|
+
return $i;
|
2017
|
+
});
|
2018
|
+
|
2019
|
+
|
2020
|
+
// isPaused, isStopped and isScrolling events
|
2021
|
+
$cfs.bind(cf_e('isPaused', conf)+' '+cf_e('isStopped', conf)+' '+cf_e('isScrolling', conf), function(e, fn) {
|
2022
|
+
e.stopPropagation();
|
2023
|
+
var eType = e.type.slice(conf.events.prefix.length),
|
2024
|
+
value = crsl[eType];
|
2025
|
+
if (is_function(fn))
|
2026
|
+
{
|
2027
|
+
fn.call($tt0, value);
|
2028
|
+
}
|
2029
|
+
return value;
|
2030
|
+
});
|
2031
|
+
|
2032
|
+
|
2033
|
+
// configuration event
|
2034
|
+
$cfs.bind(cf_e('configuration', conf), function(e, a, b, c) {
|
2035
|
+
e.stopPropagation();
|
2036
|
+
var reInit = false;
|
2037
|
+
|
2038
|
+
// return entire configuration-object
|
2039
|
+
if (is_function(a))
|
2040
|
+
{
|
2041
|
+
a.call($tt0, opts);
|
2042
|
+
}
|
2043
|
+
// set multiple options via object
|
2044
|
+
else if (is_object(a))
|
2045
|
+
{
|
2046
|
+
opts_orig = $.extend(true, {}, opts_orig, a);
|
2047
|
+
if (b !== false) reInit = true;
|
2048
|
+
else opts = $.extend(true, {}, opts, a);
|
2049
|
+
|
2050
|
+
}
|
2051
|
+
else if (!is_undefined(a))
|
2052
|
+
{
|
2053
|
+
|
2054
|
+
// callback function for specific option
|
2055
|
+
if (is_function(b))
|
2056
|
+
{
|
2057
|
+
var val = eval('opts.'+a);
|
2058
|
+
if (is_undefined(val))
|
2059
|
+
{
|
2060
|
+
val = '';
|
2061
|
+
}
|
2062
|
+
b.call($tt0, val);
|
2063
|
+
}
|
2064
|
+
// set individual option
|
2065
|
+
else if (!is_undefined(b))
|
2066
|
+
{
|
2067
|
+
if (typeof c !== 'boolean') c = true;
|
2068
|
+
eval('opts_orig.'+a+' = b');
|
2069
|
+
if (c !== false) reInit = true;
|
2070
|
+
else eval('opts.'+a+' = b');
|
2071
|
+
}
|
2072
|
+
// return value for specific option
|
2073
|
+
else
|
2074
|
+
{
|
2075
|
+
return eval('opts.'+a);
|
2076
|
+
}
|
2077
|
+
}
|
2078
|
+
if (reInit)
|
2079
|
+
{
|
2080
|
+
sz_resetMargin($cfs.children(), opts);
|
2081
|
+
FN._init(opts_orig);
|
2082
|
+
FN._bind_buttons();
|
2083
|
+
var sz = sz_setSizes($cfs, opts);
|
2084
|
+
$cfs.trigger(cf_e('updatePageStatus', conf), [true, sz]);
|
2085
|
+
}
|
2086
|
+
return opts;
|
2087
|
+
});
|
2088
|
+
|
2089
|
+
|
2090
|
+
// linkAnchors event
|
2091
|
+
$cfs.bind(cf_e('linkAnchors', conf), function(e, $con, sel) {
|
2092
|
+
e.stopPropagation();
|
2093
|
+
|
2094
|
+
if (is_undefined($con))
|
2095
|
+
{
|
2096
|
+
$con = $('body');
|
2097
|
+
}
|
2098
|
+
else if (is_string($con))
|
2099
|
+
{
|
2100
|
+
$con = $($con);
|
2101
|
+
}
|
2102
|
+
if (!is_jquery($con) || $con.length == 0)
|
2103
|
+
{
|
2104
|
+
return debug(conf, 'Not a valid object.');
|
2105
|
+
}
|
2106
|
+
if (!is_string(sel))
|
2107
|
+
{
|
2108
|
+
sel = 'a.caroufredsel';
|
2109
|
+
}
|
2110
|
+
|
2111
|
+
$con.find(sel).each(function() {
|
2112
|
+
var h = this.hash || '';
|
2113
|
+
if (h.length > 0 && $cfs.children().index($(h)) != -1)
|
2114
|
+
{
|
2115
|
+
$(this).unbind('click').click(function(e) {
|
2116
|
+
e.preventDefault();
|
2117
|
+
$cfs.trigger(cf_e('slideTo', conf), h);
|
2118
|
+
});
|
2119
|
+
}
|
2120
|
+
});
|
2121
|
+
return true;
|
2122
|
+
});
|
2123
|
+
|
2124
|
+
|
2125
|
+
// updatePageStatus event
|
2126
|
+
$cfs.bind(cf_e('updatePageStatus', conf), function(e, build, sizes) {
|
2127
|
+
e.stopPropagation();
|
2128
|
+
if (!opts.pagination.container)
|
2129
|
+
{
|
2130
|
+
return;
|
2131
|
+
}
|
2132
|
+
|
2133
|
+
var ipp = opts.pagination.items || opts.items.visible,
|
2134
|
+
pgs = Math.ceil(itms.total/ipp);
|
2135
|
+
|
2136
|
+
if (build)
|
2137
|
+
{
|
2138
|
+
if (opts.pagination.anchorBuilder)
|
2139
|
+
{
|
2140
|
+
opts.pagination.container.children().remove();
|
2141
|
+
opts.pagination.container.each(function() {
|
2142
|
+
for (var a = 0; a < pgs; a++)
|
2143
|
+
{
|
2144
|
+
var i = $cfs.children().eq( gn_getItemIndex(a*ipp, 0, true, itms, $cfs) );
|
2145
|
+
$(this).append(opts.pagination.anchorBuilder.call(i[0], a+1));
|
2146
|
+
}
|
2147
|
+
});
|
2148
|
+
}
|
2149
|
+
opts.pagination.container.each(function() {
|
2150
|
+
$(this).children().unbind(opts.pagination.event).each(function(a) {
|
2151
|
+
$(this).bind(opts.pagination.event, function(e) {
|
2152
|
+
e.preventDefault();
|
2153
|
+
$cfs.trigger(cf_e('slideTo', conf), [a*ipp, -opts.pagination.deviation, true, opts.pagination]);
|
2154
|
+
});
|
2155
|
+
});
|
2156
|
+
});
|
2157
|
+
}
|
2158
|
+
|
2159
|
+
var selected = $cfs.triggerHandler(cf_e('currentPage', conf)) + opts.pagination.deviation;
|
2160
|
+
if (selected >= pgs)
|
2161
|
+
{
|
2162
|
+
selected = 0;
|
2163
|
+
}
|
2164
|
+
if (selected < 0)
|
2165
|
+
{
|
2166
|
+
selected = pgs-1;
|
2167
|
+
}
|
2168
|
+
opts.pagination.container.each(function() {
|
2169
|
+
$(this).children().removeClass(cf_c('selected', conf)).eq(selected).addClass(cf_c('selected', conf));
|
2170
|
+
});
|
2171
|
+
return true;
|
2172
|
+
});
|
2173
|
+
|
2174
|
+
|
2175
|
+
// updateSizes event
|
2176
|
+
$cfs.bind(cf_e('updateSizes', conf), function(e) {
|
2177
|
+
var vI = opts.items.visible,
|
2178
|
+
a_itm = $cfs.children(),
|
2179
|
+
avail_primary = ms_getParentSize($wrp, opts, 'width');
|
2180
|
+
|
2181
|
+
itms.total = a_itm.length;
|
2182
|
+
|
2183
|
+
if (crsl.primarySizePercentage)
|
2184
|
+
{
|
2185
|
+
opts.maxDimension = avail_primary;
|
2186
|
+
opts[opts.d['width']] = ms_getPercentage(avail_primary, crsl.primarySizePercentage);
|
2187
|
+
}
|
2188
|
+
else
|
2189
|
+
{
|
2190
|
+
opts.maxDimension = ms_getMaxDimension(opts, avail_primary);
|
2191
|
+
}
|
2192
|
+
|
2193
|
+
if (opts.responsive)
|
2194
|
+
{
|
2195
|
+
opts.items.width = opts.items.sizesConf.width;
|
2196
|
+
opts.items.height = opts.items.sizesConf.height;
|
2197
|
+
opts = in_getResponsiveValues(opts, a_itm, avail_primary);
|
2198
|
+
vI = opts.items.visible;
|
2199
|
+
sz_setResponsiveSizes(opts, a_itm);
|
2200
|
+
}
|
2201
|
+
else if (opts.items.visibleConf.variable)
|
2202
|
+
{
|
2203
|
+
vI = gn_getVisibleItemsNext(a_itm, opts, 0);
|
2204
|
+
}
|
2205
|
+
else if (opts.items.filter != '*')
|
2206
|
+
{
|
2207
|
+
vI = gn_getVisibleItemsNextFilter(a_itm, opts, 0);
|
2208
|
+
}
|
2209
|
+
|
2210
|
+
if (!opts.circular && itms.first != 0 && vI > itms.first) {
|
2211
|
+
if (opts.items.visibleConf.variable)
|
2212
|
+
{
|
2213
|
+
var nI = gn_getVisibleItemsPrev(a_itm, opts, itms.first) - itms.first;
|
2214
|
+
}
|
2215
|
+
else if (opts.items.filter != '*')
|
2216
|
+
{
|
2217
|
+
var nI = gn_getVisibleItemsPrevFilter(a_itm, opts, itms.first) - itms.first;
|
2218
|
+
}
|
2219
|
+
else
|
2220
|
+
{
|
2221
|
+
var nI = opts.items.visible - itms.first;
|
2222
|
+
}
|
2223
|
+
debug(conf, 'Preventing non-circular: sliding '+nI+' items backward.');
|
2224
|
+
$cfs.trigger(cf_e('prev', conf), nI);
|
2225
|
+
}
|
2226
|
+
|
2227
|
+
opts.items.visible = cf_getItemsAdjust(vI, opts, opts.items.visibleConf.adjust, $tt0);
|
2228
|
+
opts.items.visibleConf.old = opts.items.visible;
|
2229
|
+
opts = in_getAlignPadding(opts, a_itm);
|
2230
|
+
|
2231
|
+
var sz = sz_setSizes($cfs, opts);
|
2232
|
+
$cfs.trigger(cf_e('updatePageStatus', conf), [true, sz]);
|
2233
|
+
nv_showNavi(opts, itms.total, conf);
|
2234
|
+
nv_enableNavi(opts, itms.first, conf);
|
2235
|
+
|
2236
|
+
return sz;
|
2237
|
+
});
|
2238
|
+
|
2239
|
+
|
2240
|
+
// destroy event
|
2241
|
+
$cfs.bind(cf_e('destroy', conf), function(e, orgOrder) {
|
2242
|
+
e.stopPropagation();
|
2243
|
+
tmrs = sc_clearTimers(tmrs);
|
2244
|
+
|
2245
|
+
$cfs.data('_cfs_isCarousel', false);
|
2246
|
+
$cfs.trigger(cf_e('finish', conf));
|
2247
|
+
if (orgOrder)
|
2248
|
+
{
|
2249
|
+
$cfs.trigger(cf_e('jumpToStart', conf));
|
2250
|
+
}
|
2251
|
+
sz_restoreOrigCss($cfs.children());
|
2252
|
+
sz_restoreOrigCss($cfs);
|
2253
|
+
FN._unbind_events();
|
2254
|
+
FN._unbind_buttons();
|
2255
|
+
if (conf.wrapper == 'parent')
|
2256
|
+
{
|
2257
|
+
sz_restoreOrigCss($wrp);
|
2258
|
+
}
|
2259
|
+
else
|
2260
|
+
{
|
2261
|
+
$wrp.replaceWith($cfs);
|
2262
|
+
}
|
2263
|
+
|
2264
|
+
return true;
|
2265
|
+
});
|
2266
|
+
|
2267
|
+
|
2268
|
+
// debug event
|
2269
|
+
$cfs.bind(cf_e('debug', conf), function(e) {
|
2270
|
+
debug(conf, 'Carousel width: ' + opts.width);
|
2271
|
+
debug(conf, 'Carousel height: ' + opts.height);
|
2272
|
+
debug(conf, 'Item widths: ' + opts.items.width);
|
2273
|
+
debug(conf, 'Item heights: ' + opts.items.height);
|
2274
|
+
debug(conf, 'Number of items visible: ' + opts.items.visible);
|
2275
|
+
if (opts.auto.play)
|
2276
|
+
{
|
2277
|
+
debug(conf, 'Number of items scrolled automatically: ' + opts.auto.items);
|
2278
|
+
}
|
2279
|
+
if (opts.prev.button)
|
2280
|
+
{
|
2281
|
+
debug(conf, 'Number of items scrolled backward: ' + opts.prev.items);
|
2282
|
+
}
|
2283
|
+
if (opts.next.button)
|
2284
|
+
{
|
2285
|
+
debug(conf, 'Number of items scrolled forward: ' + opts.next.items);
|
2286
|
+
}
|
2287
|
+
return conf.debug;
|
2288
|
+
});
|
2289
|
+
|
2290
|
+
|
2291
|
+
// triggerEvent, making prefixed and namespaced events accessible from outside
|
2292
|
+
$cfs.bind('_cfs_triggerEvent', function(e, n, o) {
|
2293
|
+
e.stopPropagation();
|
2294
|
+
return $cfs.triggerHandler(cf_e(n, conf), o);
|
2295
|
+
});
|
2296
|
+
}; // /bind_events
|
2297
|
+
|
2298
|
+
|
2299
|
+
FN._unbind_events = function() {
|
2300
|
+
$cfs.unbind(cf_e('', conf));
|
2301
|
+
$cfs.unbind(cf_e('', conf, false));
|
2302
|
+
$cfs.unbind('_cfs_triggerEvent');
|
2303
|
+
}; // /unbind_events
|
2304
|
+
|
2305
|
+
|
2306
|
+
FN._bind_buttons = function() {
|
2307
|
+
FN._unbind_buttons();
|
2308
|
+
nv_showNavi(opts, itms.total, conf);
|
2309
|
+
nv_enableNavi(opts, itms.first, conf);
|
2310
|
+
|
2311
|
+
if (opts.auto.pauseOnHover)
|
2312
|
+
{
|
2313
|
+
var pC = bt_pauseOnHoverConfig(opts.auto.pauseOnHover);
|
2314
|
+
$wrp.bind(cf_e('mouseenter', conf, false), function() { $cfs.trigger(cf_e('pause', conf), pC); })
|
2315
|
+
.bind(cf_e('mouseleave', conf, false), function() { $cfs.trigger(cf_e('resume', conf)); });
|
2316
|
+
}
|
2317
|
+
|
2318
|
+
// play button
|
2319
|
+
if (opts.auto.button)
|
2320
|
+
{
|
2321
|
+
opts.auto.button.bind(cf_e(opts.auto.event, conf, false), function(e) {
|
2322
|
+
e.preventDefault();
|
2323
|
+
var ev = false,
|
2324
|
+
pC = null;
|
2325
|
+
|
2326
|
+
if (crsl.isPaused)
|
2327
|
+
{
|
2328
|
+
ev = 'play';
|
2329
|
+
}
|
2330
|
+
else if (opts.auto.pauseOnEvent)
|
2331
|
+
{
|
2332
|
+
ev = 'pause';
|
2333
|
+
pC = bt_pauseOnHoverConfig(opts.auto.pauseOnEvent);
|
2334
|
+
}
|
2335
|
+
if (ev)
|
2336
|
+
{
|
2337
|
+
$cfs.trigger(cf_e(ev, conf), pC);
|
2338
|
+
}
|
2339
|
+
});
|
2340
|
+
}
|
2341
|
+
|
2342
|
+
// prev button
|
2343
|
+
if (opts.prev.button)
|
2344
|
+
{
|
2345
|
+
opts.prev.button.bind(cf_e(opts.prev.event, conf, false), function(e) {
|
2346
|
+
e.preventDefault();
|
2347
|
+
$cfs.trigger(cf_e('prev', conf));
|
2348
|
+
});
|
2349
|
+
if (opts.prev.pauseOnHover)
|
2350
|
+
{
|
2351
|
+
var pC = bt_pauseOnHoverConfig(opts.prev.pauseOnHover);
|
2352
|
+
opts.prev.button.bind(cf_e('mouseenter', conf, false), function() { $cfs.trigger(cf_e('pause', conf), pC); })
|
2353
|
+
.bind(cf_e('mouseleave', conf, false), function() { $cfs.trigger(cf_e('resume', conf)); });
|
2354
|
+
}
|
2355
|
+
}
|
2356
|
+
|
2357
|
+
// next butotn
|
2358
|
+
if (opts.next.button)
|
2359
|
+
{
|
2360
|
+
opts.next.button.bind(cf_e(opts.next.event, conf, false), function(e) {
|
2361
|
+
e.preventDefault();
|
2362
|
+
$cfs.trigger(cf_e('next', conf));
|
2363
|
+
});
|
2364
|
+
if (opts.next.pauseOnHover)
|
2365
|
+
{
|
2366
|
+
var pC = bt_pauseOnHoverConfig(opts.next.pauseOnHover);
|
2367
|
+
opts.next.button.bind(cf_e('mouseenter', conf, false), function() { $cfs.trigger(cf_e('pause', conf), pC); })
|
2368
|
+
.bind(cf_e('mouseleave', conf, false), function() { $cfs.trigger(cf_e('resume', conf)); });
|
2369
|
+
}
|
2370
|
+
}
|
2371
|
+
|
2372
|
+
// pagination
|
2373
|
+
if (opts.pagination.container)
|
2374
|
+
{
|
2375
|
+
if (opts.pagination.pauseOnHover)
|
2376
|
+
{
|
2377
|
+
var pC = bt_pauseOnHoverConfig(opts.pagination.pauseOnHover);
|
2378
|
+
opts.pagination.container.bind(cf_e('mouseenter', conf, false), function() { $cfs.trigger(cf_e('pause', conf), pC); })
|
2379
|
+
.bind(cf_e('mouseleave', conf, false), function() { $cfs.trigger(cf_e('resume', conf)); });
|
2380
|
+
}
|
2381
|
+
}
|
2382
|
+
|
2383
|
+
// prev/next keys
|
2384
|
+
if (opts.prev.key || opts.next.key)
|
2385
|
+
{
|
2386
|
+
$(document).bind(cf_e('keyup', conf, false, true, true), function(e) {
|
2387
|
+
var k = e.keyCode;
|
2388
|
+
if (k == opts.next.key)
|
2389
|
+
{
|
2390
|
+
e.preventDefault();
|
2391
|
+
$cfs.trigger(cf_e('next', conf));
|
2392
|
+
}
|
2393
|
+
if (k == opts.prev.key)
|
2394
|
+
{
|
2395
|
+
e.preventDefault();
|
2396
|
+
$cfs.trigger(cf_e('prev', conf));
|
2397
|
+
}
|
2398
|
+
});
|
2399
|
+
}
|
2400
|
+
|
2401
|
+
// pagination keys
|
2402
|
+
if (opts.pagination.keys)
|
2403
|
+
{
|
2404
|
+
$(document).bind(cf_e('keyup', conf, false, true, true), function(e) {
|
2405
|
+
var k = e.keyCode;
|
2406
|
+
if (k >= 49 && k < 58)
|
2407
|
+
{
|
2408
|
+
k = (k-49) * opts.items.visible;
|
2409
|
+
if (k <= itms.total)
|
2410
|
+
{
|
2411
|
+
e.preventDefault();
|
2412
|
+
$cfs.trigger(cf_e('slideTo', conf), [k, 0, true, opts.pagination]);
|
2413
|
+
}
|
2414
|
+
}
|
2415
|
+
});
|
2416
|
+
}
|
2417
|
+
|
2418
|
+
// swipe
|
2419
|
+
if ($.fn.swipe)
|
2420
|
+
{
|
2421
|
+
var isTouch = 'ontouchstart' in window;
|
2422
|
+
if ((isTouch && opts.swipe.onTouch) || (!isTouch && opts.swipe.onMouse))
|
2423
|
+
{
|
2424
|
+
var scP = $.extend(true, {}, opts.prev, opts.swipe),
|
2425
|
+
scN = $.extend(true, {}, opts.next, opts.swipe),
|
2426
|
+
swP = function() { $cfs.trigger(cf_e('prev', conf), [scP]) },
|
2427
|
+
swN = function() { $cfs.trigger(cf_e('next', conf), [scN]) };
|
2428
|
+
|
2429
|
+
switch (opts.direction)
|
2430
|
+
{
|
2431
|
+
case 'up':
|
2432
|
+
case 'down':
|
2433
|
+
opts.swipe.options.swipeUp = swN;
|
2434
|
+
opts.swipe.options.swipeDown = swP;
|
2435
|
+
break;
|
2436
|
+
default:
|
2437
|
+
opts.swipe.options.swipeLeft = swN;
|
2438
|
+
opts.swipe.options.swipeRight = swP;
|
2439
|
+
}
|
2440
|
+
if (crsl.swipe)
|
2441
|
+
{
|
2442
|
+
$cfs.swipe('destroy');
|
2443
|
+
}
|
2444
|
+
$wrp.swipe(opts.swipe.options);
|
2445
|
+
$wrp.css('cursor', 'move');
|
2446
|
+
crsl.swipe = true;
|
2447
|
+
}
|
2448
|
+
}
|
2449
|
+
|
2450
|
+
// mousewheel
|
2451
|
+
if ($.fn.mousewheel)
|
2452
|
+
{
|
2453
|
+
|
2454
|
+
if (opts.mousewheel)
|
2455
|
+
{
|
2456
|
+
var mcP = $.extend(true, {}, opts.prev, opts.mousewheel),
|
2457
|
+
mcN = $.extend(true, {}, opts.next, opts.mousewheel);
|
2458
|
+
|
2459
|
+
if (crsl.mousewheel)
|
2460
|
+
{
|
2461
|
+
$wrp.unbind(cf_e('mousewheel', conf, false));
|
2462
|
+
}
|
2463
|
+
$wrp.bind(cf_e('mousewheel', conf, false), function(e, delta) {
|
2464
|
+
e.preventDefault();
|
2465
|
+
if (delta > 0)
|
2466
|
+
{
|
2467
|
+
$cfs.trigger(cf_e('prev', conf), [mcP]);
|
2468
|
+
}
|
2469
|
+
else
|
2470
|
+
{
|
2471
|
+
$cfs.trigger(cf_e('next', conf), [mcN]);
|
2472
|
+
}
|
2473
|
+
});
|
2474
|
+
crsl.mousewheel = true;
|
2475
|
+
}
|
2476
|
+
}
|
2477
|
+
|
2478
|
+
if (opts.auto.play)
|
2479
|
+
{
|
2480
|
+
$cfs.trigger(cf_e('play', conf), opts.auto.delay);
|
2481
|
+
}
|
2482
|
+
|
2483
|
+
if (crsl.upDateOnWindowResize)
|
2484
|
+
{
|
2485
|
+
var resizeFn = function(e) {
|
2486
|
+
$cfs.trigger(cf_e('finish', conf));
|
2487
|
+
if (opts.auto.pauseOnResize && !crsl.isPaused)
|
2488
|
+
{
|
2489
|
+
$cfs.trigger(cf_e('play', conf));
|
2490
|
+
}
|
2491
|
+
sz_resetMargin($cfs.children(), opts);
|
2492
|
+
$cfs.trigger(cf_e('updateSizes', conf));
|
2493
|
+
};
|
2494
|
+
|
2495
|
+
var $w = $(window),
|
2496
|
+
onResize = null;
|
2497
|
+
|
2498
|
+
if ($.debounce && conf.onWindowResize == 'debounce')
|
2499
|
+
{
|
2500
|
+
onResize = $.debounce(200, resizeFn);
|
2501
|
+
}
|
2502
|
+
else if ($.throttle && conf.onWindowResize == 'throttle')
|
2503
|
+
{
|
2504
|
+
onResize = $.throttle(300, resizeFn);
|
2505
|
+
}
|
2506
|
+
else
|
2507
|
+
{
|
2508
|
+
var _windowWidth = 0,
|
2509
|
+
_windowHeight = 0;
|
2510
|
+
|
2511
|
+
onResize = function() {
|
2512
|
+
var nw = $w.width(),
|
2513
|
+
nh = $w.height();
|
2514
|
+
|
2515
|
+
if (nw != _windowWidth || nh != _windowHeight)
|
2516
|
+
{
|
2517
|
+
resizeFn();
|
2518
|
+
_windowWidth = nw;
|
2519
|
+
_windowHeight = nh;
|
2520
|
+
}
|
2521
|
+
};
|
2522
|
+
}
|
2523
|
+
$w.bind(cf_e('resize', conf, false, true, true), onResize);
|
2524
|
+
}
|
2525
|
+
}; // /bind_buttons
|
2526
|
+
|
2527
|
+
|
2528
|
+
FN._unbind_buttons = function() {
|
2529
|
+
var ns1 = cf_e('', conf),
|
2530
|
+
ns2 = cf_e('', conf, false);
|
2531
|
+
ns3 = cf_e('', conf, false, true, true);
|
2532
|
+
|
2533
|
+
$(document).unbind(ns3);
|
2534
|
+
$(window).unbind(ns3);
|
2535
|
+
$wrp.unbind(ns2);
|
2536
|
+
|
2537
|
+
if (opts.auto.button)
|
2538
|
+
{
|
2539
|
+
opts.auto.button.unbind(ns2);
|
2540
|
+
}
|
2541
|
+
if (opts.prev.button)
|
2542
|
+
{
|
2543
|
+
opts.prev.button.unbind(ns2);
|
2544
|
+
}
|
2545
|
+
if (opts.next.button)
|
2546
|
+
{
|
2547
|
+
opts.next.button.unbind(ns2);
|
2548
|
+
}
|
2549
|
+
if (opts.pagination.container)
|
2550
|
+
{
|
2551
|
+
opts.pagination.container.unbind(ns2);
|
2552
|
+
if (opts.pagination.anchorBuilder)
|
2553
|
+
{
|
2554
|
+
opts.pagination.container.children().remove();
|
2555
|
+
}
|
2556
|
+
}
|
2557
|
+
if (crsl.swipe)
|
2558
|
+
{
|
2559
|
+
$cfs.swipe('destroy');
|
2560
|
+
$wrp.css('cursor', 'default');
|
2561
|
+
crsl.swipe = false;
|
2562
|
+
}
|
2563
|
+
if (crsl.mousewheel)
|
2564
|
+
{
|
2565
|
+
crsl.mousewheel = false;
|
2566
|
+
}
|
2567
|
+
|
2568
|
+
nv_showNavi(opts, 'hide', conf);
|
2569
|
+
nv_enableNavi(opts, 'removeClass', conf);
|
2570
|
+
|
2571
|
+
}; // /unbind_buttons
|
2572
|
+
|
2573
|
+
|
2574
|
+
|
2575
|
+
// START
|
2576
|
+
|
2577
|
+
if (is_boolean(configs))
|
2578
|
+
{
|
2579
|
+
configs = {
|
2580
|
+
'debug': configs
|
2581
|
+
};
|
2582
|
+
}
|
2583
|
+
|
2584
|
+
// set vars
|
2585
|
+
var crsl = {
|
2586
|
+
'direction' : 'next',
|
2587
|
+
'isPaused' : true,
|
2588
|
+
'isScrolling' : false,
|
2589
|
+
'isStopped' : false,
|
2590
|
+
'mousewheel' : false,
|
2591
|
+
'swipe' : false
|
2592
|
+
},
|
2593
|
+
itms = {
|
2594
|
+
'total' : $cfs.children().length,
|
2595
|
+
'first' : 0
|
2596
|
+
},
|
2597
|
+
tmrs = {
|
2598
|
+
'auto' : null,
|
2599
|
+
'progress' : null,
|
2600
|
+
'startTime' : getTime(),
|
2601
|
+
'timePassed' : 0
|
2602
|
+
},
|
2603
|
+
scrl = {
|
2604
|
+
'isStopped' : false,
|
2605
|
+
'duration' : 0,
|
2606
|
+
'startTime' : 0,
|
2607
|
+
'easing' : '',
|
2608
|
+
'anims' : []
|
2609
|
+
},
|
2610
|
+
clbk = {
|
2611
|
+
'onBefore' : [],
|
2612
|
+
'onAfter' : []
|
2613
|
+
},
|
2614
|
+
queu = [],
|
2615
|
+
conf = $.extend(true, {}, $.fn.carouFredSel.configs, configs),
|
2616
|
+
opts = {},
|
2617
|
+
opts_orig = $.extend(true, {}, options),
|
2618
|
+
$wrp = (conf.wrapper == 'parent')
|
2619
|
+
? $cfs.parent()
|
2620
|
+
: $cfs.wrap('<'+conf.wrapper.element+' class="'+conf.wrapper.classname+'" />').parent();
|
2621
|
+
|
2622
|
+
|
2623
|
+
conf.selector = $cfs.selector;
|
2624
|
+
conf.serialNumber = $.fn.carouFredSel.serialNumber++;
|
2625
|
+
|
2626
|
+
conf.transition = (conf.transition && $.fn.transition) ? 'transition' : 'animate';
|
2627
|
+
|
2628
|
+
// create carousel
|
2629
|
+
FN._init(opts_orig, true, starting_position);
|
2630
|
+
FN._build();
|
2631
|
+
FN._bind_events();
|
2632
|
+
FN._bind_buttons();
|
2633
|
+
|
2634
|
+
// find item to start
|
2635
|
+
if (is_array(opts.items.start))
|
2636
|
+
{
|
2637
|
+
var start_arr = opts.items.start;
|
2638
|
+
}
|
2639
|
+
else
|
2640
|
+
{
|
2641
|
+
var start_arr = [];
|
2642
|
+
if (opts.items.start != 0)
|
2643
|
+
{
|
2644
|
+
start_arr.push(opts.items.start);
|
2645
|
+
}
|
2646
|
+
}
|
2647
|
+
if (opts.cookie)
|
2648
|
+
{
|
2649
|
+
start_arr.unshift(parseInt(cf_getCookie(opts.cookie), 10));
|
2650
|
+
}
|
2651
|
+
|
2652
|
+
if (start_arr.length > 0)
|
2653
|
+
{
|
2654
|
+
for (var a = 0, l = start_arr.length; a < l; a++)
|
2655
|
+
{
|
2656
|
+
var s = start_arr[a];
|
2657
|
+
if (s == 0)
|
2658
|
+
{
|
2659
|
+
continue;
|
2660
|
+
}
|
2661
|
+
if (s === true)
|
2662
|
+
{
|
2663
|
+
s = window.location.hash;
|
2664
|
+
if (s.length < 1)
|
2665
|
+
{
|
2666
|
+
continue;
|
2667
|
+
}
|
2668
|
+
}
|
2669
|
+
else if (s === 'random')
|
2670
|
+
{
|
2671
|
+
s = Math.floor(Math.random()*itms.total);
|
2672
|
+
}
|
2673
|
+
if ($cfs.triggerHandler(cf_e('slideTo', conf), [s, 0, true, { fx: 'none' }]))
|
2674
|
+
{
|
2675
|
+
break;
|
2676
|
+
}
|
2677
|
+
}
|
2678
|
+
}
|
2679
|
+
var siz = sz_setSizes($cfs, opts),
|
2680
|
+
itm = gi_getCurrentItems($cfs.children(), opts);
|
2681
|
+
|
2682
|
+
if (opts.onCreate)
|
2683
|
+
{
|
2684
|
+
opts.onCreate.call($tt0, {
|
2685
|
+
'width': siz.width,
|
2686
|
+
'height': siz.height,
|
2687
|
+
'items': itm
|
2688
|
+
});
|
2689
|
+
}
|
2690
|
+
|
2691
|
+
$cfs.trigger(cf_e('updatePageStatus', conf), [true, siz]);
|
2692
|
+
$cfs.trigger(cf_e('linkAnchors', conf));
|
2693
|
+
|
2694
|
+
if (conf.debug)
|
2695
|
+
{
|
2696
|
+
$cfs.trigger(cf_e('debug', conf));
|
2697
|
+
}
|
2698
|
+
|
2699
|
+
return $cfs;
|
2700
|
+
};
|
2701
|
+
|
2702
|
+
|
2703
|
+
|
2704
|
+
// GLOBAL PUBLIC
|
2705
|
+
|
2706
|
+
$.fn.carouFredSel.serialNumber = 1;
|
2707
|
+
$.fn.carouFredSel.defaults = {
|
2708
|
+
'synchronise' : false,
|
2709
|
+
'infinite' : true,
|
2710
|
+
'circular' : true,
|
2711
|
+
'responsive' : false,
|
2712
|
+
'direction' : 'left',
|
2713
|
+
'items' : {
|
2714
|
+
'start' : 0
|
2715
|
+
},
|
2716
|
+
'scroll' : {
|
2717
|
+
'easing' : 'swing',
|
2718
|
+
'duration' : 500,
|
2719
|
+
'pauseOnHover' : false,
|
2720
|
+
'event' : 'click',
|
2721
|
+
'queue' : false
|
2722
|
+
}
|
2723
|
+
};
|
2724
|
+
$.fn.carouFredSel.configs = {
|
2725
|
+
'debug' : false,
|
2726
|
+
'transition' : false,
|
2727
|
+
'onWindowResize': 'throttle',
|
2728
|
+
'events' : {
|
2729
|
+
'prefix' : '',
|
2730
|
+
'namespace' : 'cfs'
|
2731
|
+
},
|
2732
|
+
'wrapper' : {
|
2733
|
+
'element' : 'div',
|
2734
|
+
'classname' : 'caroufredsel_wrapper'
|
2735
|
+
},
|
2736
|
+
'classnames' : {}
|
2737
|
+
};
|
2738
|
+
$.fn.carouFredSel.pageAnchorBuilder = function(nr) {
|
2739
|
+
return '<a href="#"><span>'+nr+'</span></a>';
|
2740
|
+
};
|
2741
|
+
$.fn.carouFredSel.progressbarUpdater = function(perc) {
|
2742
|
+
$(this).css('width', perc+'%');
|
2743
|
+
};
|
2744
|
+
|
2745
|
+
$.fn.carouFredSel.cookie = {
|
2746
|
+
get: function(n) {
|
2747
|
+
n += '=';
|
2748
|
+
var ca = document.cookie.split(';');
|
2749
|
+
for (var a = 0, l = ca.length; a < l; a++)
|
2750
|
+
{
|
2751
|
+
var c = ca[a];
|
2752
|
+
while (c.charAt(0) == ' ')
|
2753
|
+
{
|
2754
|
+
c = c.slice(1);
|
2755
|
+
}
|
2756
|
+
if (c.indexOf(n) == 0)
|
2757
|
+
{
|
2758
|
+
return c.slice(n.length);
|
2759
|
+
}
|
2760
|
+
}
|
2761
|
+
return 0;
|
2762
|
+
},
|
2763
|
+
set: function(n, v, d) {
|
2764
|
+
var e = "";
|
2765
|
+
if (d)
|
2766
|
+
{
|
2767
|
+
var date = new Date();
|
2768
|
+
date.setTime(date.getTime() + (d * 24 * 60 * 60 * 1000));
|
2769
|
+
e = "; expires=" + date.toGMTString();
|
2770
|
+
}
|
2771
|
+
document.cookie = n + '=' + v + e + '; path=/';
|
2772
|
+
},
|
2773
|
+
remove: function(n) {
|
2774
|
+
$.fn.carouFredSel.cookie.set(n, "", -1);
|
2775
|
+
}
|
2776
|
+
};
|
2777
|
+
|
2778
|
+
|
2779
|
+
// GLOBAL PRIVATE
|
2780
|
+
|
2781
|
+
// scrolling functions
|
2782
|
+
function sc_setScroll(d, e, c) {
|
2783
|
+
if (c.transition == 'transition')
|
2784
|
+
{
|
2785
|
+
if (e == 'swing')
|
2786
|
+
{
|
2787
|
+
e = 'ease';
|
2788
|
+
}
|
2789
|
+
}
|
2790
|
+
return {
|
2791
|
+
anims: [],
|
2792
|
+
duration: d,
|
2793
|
+
orgDuration: d,
|
2794
|
+
easing: e,
|
2795
|
+
startTime: getTime()
|
2796
|
+
};
|
2797
|
+
}
|
2798
|
+
function sc_startScroll(s, c) {
|
2799
|
+
for (var a = 0, l = s.anims.length; a < l; a++)
|
2800
|
+
{
|
2801
|
+
var b = s.anims[a];
|
2802
|
+
if (!b)
|
2803
|
+
{
|
2804
|
+
continue;
|
2805
|
+
}
|
2806
|
+
b[0][c.transition](b[1], s.duration, s.easing, b[2]);
|
2807
|
+
}
|
2808
|
+
}
|
2809
|
+
function sc_stopScroll(s, finish) {
|
2810
|
+
if (!is_boolean(finish))
|
2811
|
+
{
|
2812
|
+
finish = true;
|
2813
|
+
}
|
2814
|
+
if (is_object(s.pre))
|
2815
|
+
{
|
2816
|
+
sc_stopScroll(s.pre, finish);
|
2817
|
+
}
|
2818
|
+
for (var a = 0, l = s.anims.length; a < l; a++)
|
2819
|
+
{
|
2820
|
+
var b = s.anims[a];
|
2821
|
+
b[0].stop(true);
|
2822
|
+
if (finish)
|
2823
|
+
{
|
2824
|
+
b[0].css(b[1]);
|
2825
|
+
if (is_function(b[2]))
|
2826
|
+
{
|
2827
|
+
b[2]();
|
2828
|
+
}
|
2829
|
+
}
|
2830
|
+
}
|
2831
|
+
if (is_object(s.post))
|
2832
|
+
{
|
2833
|
+
sc_stopScroll(s.post, finish);
|
2834
|
+
}
|
2835
|
+
}
|
2836
|
+
function sc_afterScroll( $c, $c2, o ) {
|
2837
|
+
if ($c2)
|
2838
|
+
{
|
2839
|
+
$c2.remove();
|
2840
|
+
}
|
2841
|
+
|
2842
|
+
switch(o.fx) {
|
2843
|
+
case 'fade':
|
2844
|
+
case 'crossfade':
|
2845
|
+
case 'cover-fade':
|
2846
|
+
case 'uncover-fade':
|
2847
|
+
$c.css('opacity', 1);
|
2848
|
+
$c.css('filter', '');
|
2849
|
+
break;
|
2850
|
+
}
|
2851
|
+
}
|
2852
|
+
function sc_fireCallbacks($t, o, b, a, c) {
|
2853
|
+
if (o[b])
|
2854
|
+
{
|
2855
|
+
o[b].call($t, a);
|
2856
|
+
}
|
2857
|
+
if (c[b].length)
|
2858
|
+
{
|
2859
|
+
for (var i = 0, l = c[b].length; i < l; i++)
|
2860
|
+
{
|
2861
|
+
c[b][i].call($t, a);
|
2862
|
+
}
|
2863
|
+
}
|
2864
|
+
return [];
|
2865
|
+
}
|
2866
|
+
function sc_fireQueue($c, q, c) {
|
2867
|
+
|
2868
|
+
if (q.length)
|
2869
|
+
{
|
2870
|
+
$c.trigger(cf_e(q[0][0], c), q[0][1]);
|
2871
|
+
q.shift();
|
2872
|
+
}
|
2873
|
+
return q;
|
2874
|
+
}
|
2875
|
+
function sc_hideHiddenItems(hiddenitems) {
|
2876
|
+
hiddenitems.each(function() {
|
2877
|
+
var hi = $(this);
|
2878
|
+
hi.data('_cfs_isHidden', hi.is(':hidden')).hide();
|
2879
|
+
});
|
2880
|
+
}
|
2881
|
+
function sc_showHiddenItems(hiddenitems) {
|
2882
|
+
if (hiddenitems)
|
2883
|
+
{
|
2884
|
+
hiddenitems.each(function() {
|
2885
|
+
var hi = $(this);
|
2886
|
+
if (!hi.data('_cfs_isHidden'))
|
2887
|
+
{
|
2888
|
+
hi.show();
|
2889
|
+
}
|
2890
|
+
});
|
2891
|
+
}
|
2892
|
+
}
|
2893
|
+
function sc_clearTimers(t) {
|
2894
|
+
if (t.auto)
|
2895
|
+
{
|
2896
|
+
clearTimeout(t.auto);
|
2897
|
+
}
|
2898
|
+
if (t.progress)
|
2899
|
+
{
|
2900
|
+
clearInterval(t.progress);
|
2901
|
+
}
|
2902
|
+
return t;
|
2903
|
+
}
|
2904
|
+
function sc_mapCallbackArguments(i_old, i_skp, i_new, s_itm, s_dir, s_dur, w_siz) {
|
2905
|
+
return {
|
2906
|
+
'width': w_siz.width,
|
2907
|
+
'height': w_siz.height,
|
2908
|
+
'items': {
|
2909
|
+
'old': i_old,
|
2910
|
+
'skipped': i_skp,
|
2911
|
+
'visible': i_new
|
2912
|
+
},
|
2913
|
+
'scroll': {
|
2914
|
+
'items': s_itm,
|
2915
|
+
'direction': s_dir,
|
2916
|
+
'duration': s_dur
|
2917
|
+
}
|
2918
|
+
};
|
2919
|
+
}
|
2920
|
+
function sc_getDuration( sO, o, nI, siz ) {
|
2921
|
+
var dur = sO.duration;
|
2922
|
+
if (sO.fx == 'none')
|
2923
|
+
{
|
2924
|
+
return 0;
|
2925
|
+
}
|
2926
|
+
if (dur == 'auto')
|
2927
|
+
{
|
2928
|
+
dur = o.scroll.duration / o.scroll.items * nI;
|
2929
|
+
}
|
2930
|
+
else if (dur < 10)
|
2931
|
+
{
|
2932
|
+
dur = siz / dur;
|
2933
|
+
}
|
2934
|
+
if (dur < 1)
|
2935
|
+
{
|
2936
|
+
return 0;
|
2937
|
+
}
|
2938
|
+
if (sO.fx == 'fade')
|
2939
|
+
{
|
2940
|
+
dur = dur / 2;
|
2941
|
+
}
|
2942
|
+
return Math.round(dur);
|
2943
|
+
}
|
2944
|
+
|
2945
|
+
// navigation functions
|
2946
|
+
function nv_showNavi(o, t, c) {
|
2947
|
+
var minimum = (is_number(o.items.minimum)) ? o.items.minimum : o.items.visible + 1;
|
2948
|
+
if (t == 'show' || t == 'hide')
|
2949
|
+
{
|
2950
|
+
var f = t;
|
2951
|
+
}
|
2952
|
+
else if (minimum > t)
|
2953
|
+
{
|
2954
|
+
debug(c, 'Not enough items ('+t+' total, '+minimum+' needed): Hiding navigation.');
|
2955
|
+
var f = 'hide';
|
2956
|
+
}
|
2957
|
+
else
|
2958
|
+
{
|
2959
|
+
var f = 'show';
|
2960
|
+
}
|
2961
|
+
var s = (f == 'show') ? 'removeClass' : 'addClass',
|
2962
|
+
h = cf_c('hidden', c);
|
2963
|
+
|
2964
|
+
if (o.auto.button)
|
2965
|
+
{
|
2966
|
+
o.auto.button[f]()[s](h);
|
2967
|
+
}
|
2968
|
+
if (o.prev.button)
|
2969
|
+
{
|
2970
|
+
o.prev.button[f]()[s](h);
|
2971
|
+
}
|
2972
|
+
if (o.next.button)
|
2973
|
+
{
|
2974
|
+
o.next.button[f]()[s](h);
|
2975
|
+
}
|
2976
|
+
if (o.pagination.container)
|
2977
|
+
{
|
2978
|
+
o.pagination.container[f]()[s](h);
|
2979
|
+
}
|
2980
|
+
}
|
2981
|
+
function nv_enableNavi(o, f, c) {
|
2982
|
+
if (o.circular || o.infinite) return;
|
2983
|
+
var fx = (f == 'removeClass' || f == 'addClass') ? f : false,
|
2984
|
+
di = cf_c('disabled', c);
|
2985
|
+
|
2986
|
+
if (o.auto.button && fx)
|
2987
|
+
{
|
2988
|
+
o.auto.button[fx](di);
|
2989
|
+
}
|
2990
|
+
if (o.prev.button)
|
2991
|
+
{
|
2992
|
+
var fn = fx || (f == 0) ? 'addClass' : 'removeClass';
|
2993
|
+
o.prev.button[fn](di);
|
2994
|
+
}
|
2995
|
+
if (o.next.button)
|
2996
|
+
{
|
2997
|
+
var fn = fx || (f == o.items.visible) ? 'addClass' : 'removeClass';
|
2998
|
+
o.next.button[fn](di);
|
2999
|
+
}
|
3000
|
+
}
|
3001
|
+
|
3002
|
+
// get object functions
|
3003
|
+
function go_getObject($tt, obj) {
|
3004
|
+
if (is_function(obj))
|
3005
|
+
{
|
3006
|
+
obj = obj.call($tt);
|
3007
|
+
}
|
3008
|
+
else if (is_undefined(obj))
|
3009
|
+
{
|
3010
|
+
obj = {};
|
3011
|
+
}
|
3012
|
+
return obj;
|
3013
|
+
}
|
3014
|
+
function go_getItemsObject($tt, obj) {
|
3015
|
+
obj = go_getObject($tt, obj);
|
3016
|
+
if (is_number(obj))
|
3017
|
+
{
|
3018
|
+
obj = {
|
3019
|
+
'visible': obj
|
3020
|
+
};
|
3021
|
+
}
|
3022
|
+
else if (obj == 'variable')
|
3023
|
+
{
|
3024
|
+
obj = {
|
3025
|
+
'visible': obj,
|
3026
|
+
'width': obj,
|
3027
|
+
'height': obj
|
3028
|
+
};
|
3029
|
+
}
|
3030
|
+
else if (!is_object(obj))
|
3031
|
+
{
|
3032
|
+
obj = {};
|
3033
|
+
}
|
3034
|
+
return obj;
|
3035
|
+
}
|
3036
|
+
function go_getScrollObject($tt, obj) {
|
3037
|
+
obj = go_getObject($tt, obj);
|
3038
|
+
if (is_number(obj))
|
3039
|
+
{
|
3040
|
+
if (obj <= 50)
|
3041
|
+
{
|
3042
|
+
obj = {
|
3043
|
+
'items': obj
|
3044
|
+
};
|
3045
|
+
}
|
3046
|
+
else
|
3047
|
+
{
|
3048
|
+
obj = {
|
3049
|
+
'duration': obj
|
3050
|
+
};
|
3051
|
+
}
|
3052
|
+
}
|
3053
|
+
else if (is_string(obj))
|
3054
|
+
{
|
3055
|
+
obj = {
|
3056
|
+
'easing': obj
|
3057
|
+
};
|
3058
|
+
}
|
3059
|
+
else if (!is_object(obj))
|
3060
|
+
{
|
3061
|
+
obj = {};
|
3062
|
+
}
|
3063
|
+
return obj;
|
3064
|
+
}
|
3065
|
+
function go_getNaviObject($tt, obj) {
|
3066
|
+
obj = go_getObject($tt, obj);
|
3067
|
+
if (is_string(obj))
|
3068
|
+
{
|
3069
|
+
var temp = cf_getKeyCode(obj);
|
3070
|
+
if (temp == -1)
|
3071
|
+
{
|
3072
|
+
obj = $(obj);
|
3073
|
+
}
|
3074
|
+
else
|
3075
|
+
{
|
3076
|
+
obj = temp;
|
3077
|
+
}
|
3078
|
+
}
|
3079
|
+
return obj;
|
3080
|
+
}
|
3081
|
+
|
3082
|
+
function go_getAutoObject($tt, obj) {
|
3083
|
+
obj = go_getNaviObject($tt, obj);
|
3084
|
+
if (is_jquery(obj))
|
3085
|
+
{
|
3086
|
+
obj = {
|
3087
|
+
'button': obj
|
3088
|
+
};
|
3089
|
+
}
|
3090
|
+
else if (is_boolean(obj))
|
3091
|
+
{
|
3092
|
+
obj = {
|
3093
|
+
'play': obj
|
3094
|
+
};
|
3095
|
+
}
|
3096
|
+
else if (is_number(obj))
|
3097
|
+
{
|
3098
|
+
obj = {
|
3099
|
+
'timeoutDuration': obj
|
3100
|
+
};
|
3101
|
+
}
|
3102
|
+
if (obj.progress)
|
3103
|
+
{
|
3104
|
+
if (is_string(obj.progress) || is_jquery(obj.progress))
|
3105
|
+
{
|
3106
|
+
obj.progress = {
|
3107
|
+
'bar': obj.progress
|
3108
|
+
};
|
3109
|
+
}
|
3110
|
+
}
|
3111
|
+
return obj;
|
3112
|
+
}
|
3113
|
+
function go_complementAutoObject($tt, obj) {
|
3114
|
+
if (is_function(obj.button))
|
3115
|
+
{
|
3116
|
+
obj.button = obj.button.call($tt);
|
3117
|
+
}
|
3118
|
+
if (is_string(obj.button))
|
3119
|
+
{
|
3120
|
+
obj.button = $(obj.button);
|
3121
|
+
}
|
3122
|
+
if (!is_boolean(obj.play))
|
3123
|
+
{
|
3124
|
+
obj.play = true;
|
3125
|
+
}
|
3126
|
+
if (!is_number(obj.delay))
|
3127
|
+
{
|
3128
|
+
obj.delay = 0;
|
3129
|
+
}
|
3130
|
+
if (is_undefined(obj.pauseOnEvent))
|
3131
|
+
{
|
3132
|
+
obj.pauseOnEvent = true;
|
3133
|
+
}
|
3134
|
+
if (!is_boolean(obj.pauseOnResize))
|
3135
|
+
{
|
3136
|
+
obj.pauseOnResize = true;
|
3137
|
+
}
|
3138
|
+
if (!is_number(obj.timeoutDuration))
|
3139
|
+
{
|
3140
|
+
obj.timeoutDuration = (obj.duration < 10)
|
3141
|
+
? 2500
|
3142
|
+
: obj.duration * 5;
|
3143
|
+
}
|
3144
|
+
if (obj.progress)
|
3145
|
+
{
|
3146
|
+
if (is_function(obj.progress.bar))
|
3147
|
+
{
|
3148
|
+
obj.progress.bar = obj.progress.bar.call($tt);
|
3149
|
+
}
|
3150
|
+
if (is_string(obj.progress.bar))
|
3151
|
+
{
|
3152
|
+
obj.progress.bar = $(obj.progress.bar);
|
3153
|
+
}
|
3154
|
+
if (obj.progress.bar)
|
3155
|
+
{
|
3156
|
+
if (!is_function(obj.progress.updater))
|
3157
|
+
{
|
3158
|
+
obj.progress.updater = $.fn.carouFredSel.progressbarUpdater;
|
3159
|
+
}
|
3160
|
+
if (!is_number(obj.progress.interval))
|
3161
|
+
{
|
3162
|
+
obj.progress.interval = 50;
|
3163
|
+
}
|
3164
|
+
}
|
3165
|
+
else
|
3166
|
+
{
|
3167
|
+
obj.progress = false;
|
3168
|
+
}
|
3169
|
+
}
|
3170
|
+
return obj;
|
3171
|
+
}
|
3172
|
+
|
3173
|
+
function go_getPrevNextObject($tt, obj) {
|
3174
|
+
obj = go_getNaviObject($tt, obj);
|
3175
|
+
if (is_jquery(obj))
|
3176
|
+
{
|
3177
|
+
obj = {
|
3178
|
+
'button': obj
|
3179
|
+
};
|
3180
|
+
}
|
3181
|
+
else if (is_number(obj))
|
3182
|
+
{
|
3183
|
+
obj = {
|
3184
|
+
'key': obj
|
3185
|
+
};
|
3186
|
+
}
|
3187
|
+
return obj;
|
3188
|
+
}
|
3189
|
+
function go_complementPrevNextObject($tt, obj) {
|
3190
|
+
if (is_function(obj.button))
|
3191
|
+
{
|
3192
|
+
obj.button = obj.button.call($tt);
|
3193
|
+
}
|
3194
|
+
if (is_string(obj.button))
|
3195
|
+
{
|
3196
|
+
obj.button = $(obj.button);
|
3197
|
+
}
|
3198
|
+
if (is_string(obj.key))
|
3199
|
+
{
|
3200
|
+
obj.key = cf_getKeyCode(obj.key);
|
3201
|
+
}
|
3202
|
+
return obj;
|
3203
|
+
}
|
3204
|
+
|
3205
|
+
function go_getPaginationObject($tt, obj) {
|
3206
|
+
obj = go_getNaviObject($tt, obj);
|
3207
|
+
if (is_jquery(obj))
|
3208
|
+
{
|
3209
|
+
obj = {
|
3210
|
+
'container': obj
|
3211
|
+
};
|
3212
|
+
}
|
3213
|
+
else if (is_boolean(obj))
|
3214
|
+
{
|
3215
|
+
obj = {
|
3216
|
+
'keys': obj
|
3217
|
+
};
|
3218
|
+
}
|
3219
|
+
return obj;
|
3220
|
+
}
|
3221
|
+
function go_complementPaginationObject($tt, obj) {
|
3222
|
+
if (is_function(obj.container))
|
3223
|
+
{
|
3224
|
+
obj.container = obj.container.call($tt);
|
3225
|
+
}
|
3226
|
+
if (is_string(obj.container))
|
3227
|
+
{
|
3228
|
+
obj.container = $(obj.container);
|
3229
|
+
}
|
3230
|
+
if (!is_number(obj.items))
|
3231
|
+
{
|
3232
|
+
obj.items = false;
|
3233
|
+
}
|
3234
|
+
if (!is_boolean(obj.keys))
|
3235
|
+
{
|
3236
|
+
obj.keys = false;
|
3237
|
+
}
|
3238
|
+
if (!is_function(obj.anchorBuilder) && !is_false(obj.anchorBuilder))
|
3239
|
+
{
|
3240
|
+
obj.anchorBuilder = $.fn.carouFredSel.pageAnchorBuilder;
|
3241
|
+
}
|
3242
|
+
if (!is_number(obj.deviation))
|
3243
|
+
{
|
3244
|
+
obj.deviation = 0;
|
3245
|
+
}
|
3246
|
+
return obj;
|
3247
|
+
}
|
3248
|
+
|
3249
|
+
function go_getSwipeObject($tt, obj) {
|
3250
|
+
if (is_function(obj))
|
3251
|
+
{
|
3252
|
+
obj = obj.call($tt);
|
3253
|
+
}
|
3254
|
+
if (is_undefined(obj))
|
3255
|
+
{
|
3256
|
+
obj = {
|
3257
|
+
'onTouch': false
|
3258
|
+
};
|
3259
|
+
}
|
3260
|
+
if (is_true(obj))
|
3261
|
+
{
|
3262
|
+
obj = {
|
3263
|
+
'onTouch': obj
|
3264
|
+
};
|
3265
|
+
}
|
3266
|
+
else if (is_number(obj))
|
3267
|
+
{
|
3268
|
+
obj = {
|
3269
|
+
'items': obj
|
3270
|
+
};
|
3271
|
+
}
|
3272
|
+
return obj;
|
3273
|
+
}
|
3274
|
+
function go_complementSwipeObject($tt, obj) {
|
3275
|
+
if (!is_boolean(obj.onTouch))
|
3276
|
+
{
|
3277
|
+
obj.onTouch = true;
|
3278
|
+
}
|
3279
|
+
if (!is_boolean(obj.onMouse))
|
3280
|
+
{
|
3281
|
+
obj.onMouse = false;
|
3282
|
+
}
|
3283
|
+
if (!is_object(obj.options))
|
3284
|
+
{
|
3285
|
+
obj.options = {};
|
3286
|
+
}
|
3287
|
+
if (!is_boolean(obj.options.triggerOnTouchEnd))
|
3288
|
+
{
|
3289
|
+
obj.options.triggerOnTouchEnd = false;
|
3290
|
+
}
|
3291
|
+
return obj;
|
3292
|
+
}
|
3293
|
+
function go_getMousewheelObject($tt, obj) {
|
3294
|
+
if (is_function(obj))
|
3295
|
+
{
|
3296
|
+
obj = obj.call($tt);
|
3297
|
+
}
|
3298
|
+
if (is_true(obj))
|
3299
|
+
{
|
3300
|
+
obj = {};
|
3301
|
+
}
|
3302
|
+
else if (is_number(obj))
|
3303
|
+
{
|
3304
|
+
obj = {
|
3305
|
+
'items': obj
|
3306
|
+
};
|
3307
|
+
}
|
3308
|
+
else if (is_undefined(obj))
|
3309
|
+
{
|
3310
|
+
obj = false;
|
3311
|
+
}
|
3312
|
+
return obj;
|
3313
|
+
}
|
3314
|
+
function go_complementMousewheelObject($tt, obj) {
|
3315
|
+
return obj;
|
3316
|
+
}
|
3317
|
+
|
3318
|
+
// get number functions
|
3319
|
+
function gn_getItemIndex(num, dev, org, items, $cfs) {
|
3320
|
+
if (is_string(num))
|
3321
|
+
{
|
3322
|
+
num = $(num, $cfs);
|
3323
|
+
}
|
3324
|
+
|
3325
|
+
if (is_object(num))
|
3326
|
+
{
|
3327
|
+
num = $(num, $cfs);
|
3328
|
+
}
|
3329
|
+
if (is_jquery(num))
|
3330
|
+
{
|
3331
|
+
num = $cfs.children().index(num);
|
3332
|
+
if (!is_boolean(org))
|
3333
|
+
{
|
3334
|
+
org = false;
|
3335
|
+
}
|
3336
|
+
}
|
3337
|
+
else
|
3338
|
+
{
|
3339
|
+
if (!is_boolean(org))
|
3340
|
+
{
|
3341
|
+
org = true;
|
3342
|
+
}
|
3343
|
+
}
|
3344
|
+
if (!is_number(num))
|
3345
|
+
{
|
3346
|
+
num = 0;
|
3347
|
+
}
|
3348
|
+
if (!is_number(dev))
|
3349
|
+
{
|
3350
|
+
dev = 0;
|
3351
|
+
}
|
3352
|
+
|
3353
|
+
if (org)
|
3354
|
+
{
|
3355
|
+
num += items.first;
|
3356
|
+
}
|
3357
|
+
num += dev;
|
3358
|
+
if (items.total > 0)
|
3359
|
+
{
|
3360
|
+
while (num >= items.total)
|
3361
|
+
{
|
3362
|
+
num -= items.total;
|
3363
|
+
}
|
3364
|
+
while (num < 0)
|
3365
|
+
{
|
3366
|
+
num += items.total;
|
3367
|
+
}
|
3368
|
+
}
|
3369
|
+
return num;
|
3370
|
+
}
|
3371
|
+
|
3372
|
+
// items prev
|
3373
|
+
function gn_getVisibleItemsPrev(i, o, s) {
|
3374
|
+
var t = 0,
|
3375
|
+
x = 0;
|
3376
|
+
|
3377
|
+
for (var a = s; a >= 0; a--)
|
3378
|
+
{
|
3379
|
+
var j = i.eq(a);
|
3380
|
+
t += (j.is(':visible')) ? j[o.d['outerWidth']](true) : 0;
|
3381
|
+
if (t > o.maxDimension)
|
3382
|
+
{
|
3383
|
+
return x;
|
3384
|
+
}
|
3385
|
+
if (a == 0)
|
3386
|
+
{
|
3387
|
+
a = i.length;
|
3388
|
+
}
|
3389
|
+
x++;
|
3390
|
+
}
|
3391
|
+
}
|
3392
|
+
function gn_getVisibleItemsPrevFilter(i, o, s) {
|
3393
|
+
return gn_getItemsPrevFilter(i, o.items.filter, o.items.visibleConf.org, s);
|
3394
|
+
}
|
3395
|
+
function gn_getScrollItemsPrevFilter(i, o, s, m) {
|
3396
|
+
return gn_getItemsPrevFilter(i, o.items.filter, m, s);
|
3397
|
+
}
|
3398
|
+
function gn_getItemsPrevFilter(i, f, m, s) {
|
3399
|
+
var t = 0,
|
3400
|
+
x = 0;
|
3401
|
+
|
3402
|
+
for (var a = s, l = i.length; a >= 0; a--)
|
3403
|
+
{
|
3404
|
+
x++;
|
3405
|
+
if (x == l)
|
3406
|
+
{
|
3407
|
+
return x;
|
3408
|
+
}
|
3409
|
+
|
3410
|
+
var j = i.eq(a);
|
3411
|
+
if (j.is(f))
|
3412
|
+
{
|
3413
|
+
t++;
|
3414
|
+
if (t == m)
|
3415
|
+
{
|
3416
|
+
return x;
|
3417
|
+
}
|
3418
|
+
}
|
3419
|
+
if (a == 0)
|
3420
|
+
{
|
3421
|
+
a = l;
|
3422
|
+
}
|
3423
|
+
}
|
3424
|
+
}
|
3425
|
+
|
3426
|
+
function gn_getVisibleOrg($c, o) {
|
3427
|
+
return o.items.visibleConf.org || $c.children().slice(0, o.items.visible).filter(o.items.filter).length;
|
3428
|
+
}
|
3429
|
+
|
3430
|
+
// items next
|
3431
|
+
function gn_getVisibleItemsNext(i, o, s) {
|
3432
|
+
var t = 0,
|
3433
|
+
x = 0;
|
3434
|
+
|
3435
|
+
for (var a = s, l = i.length-1; a <= l; a++)
|
3436
|
+
{
|
3437
|
+
var j = i.eq(a);
|
3438
|
+
|
3439
|
+
t += (j.is(':visible')) ? j[o.d['outerWidth']](true) : 0;
|
3440
|
+
if (t > o.maxDimension)
|
3441
|
+
{
|
3442
|
+
return x;
|
3443
|
+
}
|
3444
|
+
|
3445
|
+
x++;
|
3446
|
+
if (x == l+1)
|
3447
|
+
{
|
3448
|
+
return x;
|
3449
|
+
}
|
3450
|
+
if (a == l)
|
3451
|
+
{
|
3452
|
+
a = -1;
|
3453
|
+
}
|
3454
|
+
}
|
3455
|
+
}
|
3456
|
+
function gn_getVisibleItemsNextTestCircular(i, o, s, l) {
|
3457
|
+
var v = gn_getVisibleItemsNext(i, o, s);
|
3458
|
+
if (!o.circular)
|
3459
|
+
{
|
3460
|
+
if (s + v > l)
|
3461
|
+
{
|
3462
|
+
v = l - s;
|
3463
|
+
}
|
3464
|
+
}
|
3465
|
+
return v;
|
3466
|
+
}
|
3467
|
+
function gn_getVisibleItemsNextFilter(i, o, s) {
|
3468
|
+
return gn_getItemsNextFilter(i, o.items.filter, o.items.visibleConf.org, s, o.circular);
|
3469
|
+
}
|
3470
|
+
function gn_getScrollItemsNextFilter(i, o, s, m) {
|
3471
|
+
return gn_getItemsNextFilter(i, o.items.filter, m+1, s, o.circular) - 1;
|
3472
|
+
}
|
3473
|
+
function gn_getItemsNextFilter(i, f, m, s, c) {
|
3474
|
+
var t = 0,
|
3475
|
+
x = 0;
|
3476
|
+
|
3477
|
+
for (var a = s, l = i.length-1; a <= l; a++)
|
3478
|
+
{
|
3479
|
+
x++;
|
3480
|
+
if (x >= l)
|
3481
|
+
{
|
3482
|
+
return x;
|
3483
|
+
}
|
3484
|
+
|
3485
|
+
var j = i.eq(a);
|
3486
|
+
if (j.is(f))
|
3487
|
+
{
|
3488
|
+
t++;
|
3489
|
+
if (t == m)
|
3490
|
+
{
|
3491
|
+
return x;
|
3492
|
+
}
|
3493
|
+
}
|
3494
|
+
if (a == l)
|
3495
|
+
{
|
3496
|
+
a = -1;
|
3497
|
+
}
|
3498
|
+
}
|
3499
|
+
}
|
3500
|
+
|
3501
|
+
// get items functions
|
3502
|
+
function gi_getCurrentItems(i, o) {
|
3503
|
+
return i.slice(0, o.items.visible);
|
3504
|
+
}
|
3505
|
+
function gi_getOldItemsPrev(i, o, n) {
|
3506
|
+
return i.slice(n, o.items.visibleConf.old+n);
|
3507
|
+
}
|
3508
|
+
function gi_getNewItemsPrev(i, o) {
|
3509
|
+
return i.slice(0, o.items.visible);
|
3510
|
+
}
|
3511
|
+
function gi_getOldItemsNext(i, o) {
|
3512
|
+
return i.slice(0, o.items.visibleConf.old);
|
3513
|
+
}
|
3514
|
+
function gi_getNewItemsNext(i, o, n) {
|
3515
|
+
return i.slice(n, o.items.visible+n);
|
3516
|
+
}
|
3517
|
+
|
3518
|
+
// sizes functions
|
3519
|
+
function sz_storeMargin(i, o, d) {
|
3520
|
+
if (o.usePadding)
|
3521
|
+
{
|
3522
|
+
if (!is_string(d))
|
3523
|
+
{
|
3524
|
+
d = '_cfs_origCssMargin';
|
3525
|
+
}
|
3526
|
+
i.each(function() {
|
3527
|
+
var j = $(this),
|
3528
|
+
m = parseInt(j.css(o.d['marginRight']), 10);
|
3529
|
+
if (!is_number(m))
|
3530
|
+
{
|
3531
|
+
m = 0;
|
3532
|
+
}
|
3533
|
+
j.data(d, m);
|
3534
|
+
});
|
3535
|
+
}
|
3536
|
+
}
|
3537
|
+
function sz_resetMargin(i, o, m) {
|
3538
|
+
if (o.usePadding)
|
3539
|
+
{
|
3540
|
+
var x = (is_boolean(m)) ? m : false;
|
3541
|
+
if (!is_number(m))
|
3542
|
+
{
|
3543
|
+
m = 0;
|
3544
|
+
}
|
3545
|
+
sz_storeMargin(i, o, '_cfs_tempCssMargin');
|
3546
|
+
i.each(function() {
|
3547
|
+
var j = $(this);
|
3548
|
+
j.css(o.d['marginRight'], ((x) ? j.data('_cfs_tempCssMargin') : m + j.data('_cfs_origCssMargin')));
|
3549
|
+
});
|
3550
|
+
}
|
3551
|
+
}
|
3552
|
+
function sz_storeOrigCss(i) {
|
3553
|
+
i.each(function() {
|
3554
|
+
var j = $(this);
|
3555
|
+
j.data('_cfs_origCss', j.attr('style') || '');
|
3556
|
+
});
|
3557
|
+
}
|
3558
|
+
function sz_restoreOrigCss(i) {
|
3559
|
+
i.each(function() {
|
3560
|
+
var j = $(this);
|
3561
|
+
j.attr('style', j.data('_cfs_origCss') || '');
|
3562
|
+
});
|
3563
|
+
}
|
3564
|
+
function sz_setResponsiveSizes(o, all) {
|
3565
|
+
var visb = o.items.visible,
|
3566
|
+
newS = o.items[o.d['width']],
|
3567
|
+
seco = o[o.d['height']],
|
3568
|
+
secp = is_percentage(seco);
|
3569
|
+
|
3570
|
+
all.each(function() {
|
3571
|
+
var $t = $(this),
|
3572
|
+
nw = newS - ms_getPaddingBorderMargin($t, o, 'Width');
|
3573
|
+
|
3574
|
+
$t[o.d['width']](nw);
|
3575
|
+
if (secp)
|
3576
|
+
{
|
3577
|
+
$t[o.d['height']](ms_getPercentage(nw, seco));
|
3578
|
+
}
|
3579
|
+
});
|
3580
|
+
}
|
3581
|
+
function sz_setSizes($c, o) {
|
3582
|
+
var $w = $c.parent(),
|
3583
|
+
$i = $c.children(),
|
3584
|
+
$v = gi_getCurrentItems($i, o),
|
3585
|
+
sz = cf_mapWrapperSizes(ms_getSizes($v, o, true), o, false);
|
3586
|
+
|
3587
|
+
$w.css(sz);
|
3588
|
+
|
3589
|
+
if (o.usePadding)
|
3590
|
+
{
|
3591
|
+
var p = o.padding,
|
3592
|
+
r = p[o.d[1]];
|
3593
|
+
|
3594
|
+
if (o.align && r < 0)
|
3595
|
+
{
|
3596
|
+
r = 0;
|
3597
|
+
}
|
3598
|
+
var $l = $v.last();
|
3599
|
+
$l.css(o.d['marginRight'], $l.data('_cfs_origCssMargin') + r);
|
3600
|
+
$c.css(o.d['top'], p[o.d[0]]);
|
3601
|
+
$c.css(o.d['left'], p[o.d[3]]);
|
3602
|
+
}
|
3603
|
+
|
3604
|
+
$c.css(o.d['width'], sz[o.d['width']]+(ms_getTotalSize($i, o, 'width')*2));
|
3605
|
+
$c.css(o.d['height'], ms_getLargestSize($i, o, 'height'));
|
3606
|
+
return sz;
|
3607
|
+
}
|
3608
|
+
|
3609
|
+
// measuring functions
|
3610
|
+
function ms_getSizes(i, o, wrapper) {
|
3611
|
+
return [ms_getTotalSize(i, o, 'width', wrapper), ms_getLargestSize(i, o, 'height', wrapper)];
|
3612
|
+
}
|
3613
|
+
function ms_getLargestSize(i, o, dim, wrapper) {
|
3614
|
+
if (!is_boolean(wrapper))
|
3615
|
+
{
|
3616
|
+
wrapper = false;
|
3617
|
+
}
|
3618
|
+
if (is_number(o[o.d[dim]]) && wrapper)
|
3619
|
+
{
|
3620
|
+
return o[o.d[dim]];
|
3621
|
+
}
|
3622
|
+
if (is_number(o.items[o.d[dim]]))
|
3623
|
+
{
|
3624
|
+
return o.items[o.d[dim]];
|
3625
|
+
}
|
3626
|
+
dim = (dim.toLowerCase().indexOf('width') > -1) ? 'outerWidth' : 'outerHeight';
|
3627
|
+
return ms_getTrueLargestSize(i, o, dim);
|
3628
|
+
}
|
3629
|
+
function ms_getTrueLargestSize(i, o, dim) {
|
3630
|
+
var s = 0;
|
3631
|
+
|
3632
|
+
for (var a = 0, l = i.length; a < l; a++)
|
3633
|
+
{
|
3634
|
+
var j = i.eq(a);
|
3635
|
+
|
3636
|
+
var m = (j.is(':visible')) ? j[o.d[dim]](true) : 0;
|
3637
|
+
if (s < m)
|
3638
|
+
{
|
3639
|
+
s = m;
|
3640
|
+
}
|
3641
|
+
}
|
3642
|
+
return s;
|
3643
|
+
}
|
3644
|
+
|
3645
|
+
function ms_getTotalSize(i, o, dim, wrapper) {
|
3646
|
+
if (!is_boolean(wrapper))
|
3647
|
+
{
|
3648
|
+
wrapper = false;
|
3649
|
+
}
|
3650
|
+
if (is_number(o[o.d[dim]]) && wrapper)
|
3651
|
+
{
|
3652
|
+
return o[o.d[dim]];
|
3653
|
+
}
|
3654
|
+
if (is_number(o.items[o.d[dim]]))
|
3655
|
+
{
|
3656
|
+
return o.items[o.d[dim]] * i.length;
|
3657
|
+
}
|
3658
|
+
|
3659
|
+
var d = (dim.toLowerCase().indexOf('width') > -1) ? 'outerWidth' : 'outerHeight',
|
3660
|
+
s = 0;
|
3661
|
+
|
3662
|
+
for (var a = 0, l = i.length; a < l; a++)
|
3663
|
+
{
|
3664
|
+
var j = i.eq(a);
|
3665
|
+
s += (j.is(':visible')) ? j[o.d[d]](true) : 0;
|
3666
|
+
}
|
3667
|
+
return s;
|
3668
|
+
}
|
3669
|
+
function ms_getParentSize($w, o, d) {
|
3670
|
+
var isVisible = $w.is(':visible');
|
3671
|
+
if (isVisible)
|
3672
|
+
{
|
3673
|
+
$w.hide();
|
3674
|
+
}
|
3675
|
+
var s = $w.parent()[o.d[d]]();
|
3676
|
+
if (isVisible)
|
3677
|
+
{
|
3678
|
+
$w.show();
|
3679
|
+
}
|
3680
|
+
return s;
|
3681
|
+
}
|
3682
|
+
function ms_getMaxDimension(o, a) {
|
3683
|
+
return (is_number(o[o.d['width']])) ? o[o.d['width']] : a;
|
3684
|
+
}
|
3685
|
+
function ms_hasVariableSizes(i, o, dim) {
|
3686
|
+
var s = false,
|
3687
|
+
v = false;
|
3688
|
+
|
3689
|
+
for (var a = 0, l = i.length; a < l; a++)
|
3690
|
+
{
|
3691
|
+
var j = i.eq(a);
|
3692
|
+
|
3693
|
+
var c = (j.is(':visible')) ? j[o.d[dim]](true) : 0;
|
3694
|
+
if (s === false)
|
3695
|
+
{
|
3696
|
+
s = c;
|
3697
|
+
}
|
3698
|
+
else if (s != c)
|
3699
|
+
{
|
3700
|
+
v = true;
|
3701
|
+
}
|
3702
|
+
if (s == 0)
|
3703
|
+
{
|
3704
|
+
v = true;
|
3705
|
+
}
|
3706
|
+
}
|
3707
|
+
return v;
|
3708
|
+
}
|
3709
|
+
function ms_getPaddingBorderMargin(i, o, d) {
|
3710
|
+
return i[o.d['outer'+d]](true) - i[o.d[d.toLowerCase()]]();
|
3711
|
+
}
|
3712
|
+
function ms_getPercentage(s, o) {
|
3713
|
+
if (is_percentage(o))
|
3714
|
+
{
|
3715
|
+
o = parseInt( o.slice(0, -1), 10 );
|
3716
|
+
if (!is_number(o))
|
3717
|
+
{
|
3718
|
+
return s;
|
3719
|
+
}
|
3720
|
+
s *= o/100;
|
3721
|
+
}
|
3722
|
+
return s;
|
3723
|
+
}
|
3724
|
+
|
3725
|
+
// config functions
|
3726
|
+
function cf_e(n, c, pf, ns, rd) {
|
3727
|
+
if (!is_boolean(pf))
|
3728
|
+
{
|
3729
|
+
pf = true;
|
3730
|
+
}
|
3731
|
+
if (!is_boolean(ns))
|
3732
|
+
{
|
3733
|
+
ns = true;
|
3734
|
+
}
|
3735
|
+
if (!is_boolean(rd))
|
3736
|
+
{
|
3737
|
+
rd = false;
|
3738
|
+
}
|
3739
|
+
|
3740
|
+
if (pf)
|
3741
|
+
{
|
3742
|
+
n = c.events.prefix + n;
|
3743
|
+
}
|
3744
|
+
if (ns)
|
3745
|
+
{
|
3746
|
+
n = n +'.'+ c.events.namespace;
|
3747
|
+
}
|
3748
|
+
if (ns && rd)
|
3749
|
+
{
|
3750
|
+
n += c.serialNumber;
|
3751
|
+
}
|
3752
|
+
|
3753
|
+
return n;
|
3754
|
+
}
|
3755
|
+
function cf_c(n, c) {
|
3756
|
+
return (is_string(c.classnames[n])) ? c.classnames[n] : n;
|
3757
|
+
}
|
3758
|
+
function cf_mapWrapperSizes(ws, o, p) {
|
3759
|
+
if (!is_boolean(p))
|
3760
|
+
{
|
3761
|
+
p = true;
|
3762
|
+
}
|
3763
|
+
var pad = (o.usePadding && p) ? o.padding : [0, 0, 0, 0];
|
3764
|
+
var wra = {};
|
3765
|
+
|
3766
|
+
wra[o.d['width']] = ws[0] + pad[1] + pad[3];
|
3767
|
+
wra[o.d['height']] = ws[1] + pad[0] + pad[2];
|
3768
|
+
|
3769
|
+
return wra;
|
3770
|
+
}
|
3771
|
+
function cf_sortParams(vals, typs) {
|
3772
|
+
var arr = [];
|
3773
|
+
for (var a = 0, l1 = vals.length; a < l1; a++)
|
3774
|
+
{
|
3775
|
+
for (var b = 0, l2 = typs.length; b < l2; b++)
|
3776
|
+
{
|
3777
|
+
if (typs[b].indexOf(typeof vals[a]) > -1 && is_undefined(arr[b]))
|
3778
|
+
{
|
3779
|
+
arr[b] = vals[a];
|
3780
|
+
break;
|
3781
|
+
}
|
3782
|
+
}
|
3783
|
+
}
|
3784
|
+
return arr;
|
3785
|
+
}
|
3786
|
+
function cf_getPadding(p) {
|
3787
|
+
if (is_undefined(p))
|
3788
|
+
{
|
3789
|
+
return [0, 0, 0, 0];
|
3790
|
+
}
|
3791
|
+
if (is_number(p))
|
3792
|
+
{
|
3793
|
+
return [p, p, p, p];
|
3794
|
+
}
|
3795
|
+
if (is_string(p))
|
3796
|
+
{
|
3797
|
+
p = p.split('px').join('').split('em').join('').split(' ');
|
3798
|
+
}
|
3799
|
+
|
3800
|
+
if (!is_array(p))
|
3801
|
+
{
|
3802
|
+
return [0, 0, 0, 0];
|
3803
|
+
}
|
3804
|
+
for (var i = 0; i < 4; i++)
|
3805
|
+
{
|
3806
|
+
p[i] = parseInt(p[i], 10);
|
3807
|
+
}
|
3808
|
+
switch (p.length)
|
3809
|
+
{
|
3810
|
+
case 0:
|
3811
|
+
return [0, 0, 0, 0];
|
3812
|
+
case 1:
|
3813
|
+
return [p[0], p[0], p[0], p[0]];
|
3814
|
+
case 2:
|
3815
|
+
return [p[0], p[1], p[0], p[1]];
|
3816
|
+
case 3:
|
3817
|
+
return [p[0], p[1], p[2], p[1]];
|
3818
|
+
default:
|
3819
|
+
return [p[0], p[1], p[2], p[3]];
|
3820
|
+
}
|
3821
|
+
}
|
3822
|
+
function cf_getAlignPadding(itm, o) {
|
3823
|
+
var x = (is_number(o[o.d['width']])) ? Math.ceil(o[o.d['width']] - ms_getTotalSize(itm, o, 'width')) : 0;
|
3824
|
+
switch (o.align)
|
3825
|
+
{
|
3826
|
+
case 'left':
|
3827
|
+
return [0, x];
|
3828
|
+
case 'right':
|
3829
|
+
return [x, 0];
|
3830
|
+
case 'center':
|
3831
|
+
default:
|
3832
|
+
return [Math.ceil(x/2), Math.floor(x/2)];
|
3833
|
+
}
|
3834
|
+
}
|
3835
|
+
function cf_getDimensions(o) {
|
3836
|
+
var dm = [
|
3837
|
+
['width' , 'innerWidth' , 'outerWidth' , 'height' , 'innerHeight' , 'outerHeight' , 'left', 'top' , 'marginRight' , 0, 1, 2, 3],
|
3838
|
+
['height' , 'innerHeight' , 'outerHeight' , 'width' , 'innerWidth' , 'outerWidth' , 'top' , 'left', 'marginBottom', 3, 2, 1, 0]
|
3839
|
+
];
|
3840
|
+
|
3841
|
+
var dl = dm[0].length,
|
3842
|
+
dx = (o.direction == 'right' || o.direction == 'left') ? 0 : 1;
|
3843
|
+
|
3844
|
+
var dimensions = {};
|
3845
|
+
for (var d = 0; d < dl; d++)
|
3846
|
+
{
|
3847
|
+
dimensions[dm[0][d]] = dm[dx][d];
|
3848
|
+
}
|
3849
|
+
return dimensions;
|
3850
|
+
}
|
3851
|
+
function cf_getAdjust(x, o, a, $t) {
|
3852
|
+
var v = x;
|
3853
|
+
if (is_function(a))
|
3854
|
+
{
|
3855
|
+
v = a.call($t, v);
|
3856
|
+
|
3857
|
+
}
|
3858
|
+
else if (is_string(a))
|
3859
|
+
{
|
3860
|
+
var p = a.split('+'),
|
3861
|
+
m = a.split('-');
|
3862
|
+
|
3863
|
+
if (m.length > p.length)
|
3864
|
+
{
|
3865
|
+
var neg = true,
|
3866
|
+
sta = m[0],
|
3867
|
+
adj = m[1];
|
3868
|
+
}
|
3869
|
+
else
|
3870
|
+
{
|
3871
|
+
var neg = false,
|
3872
|
+
sta = p[0],
|
3873
|
+
adj = p[1];
|
3874
|
+
}
|
3875
|
+
|
3876
|
+
switch(sta)
|
3877
|
+
{
|
3878
|
+
case 'even':
|
3879
|
+
v = (x % 2 == 1) ? x-1 : x;
|
3880
|
+
break;
|
3881
|
+
case 'odd':
|
3882
|
+
v = (x % 2 == 0) ? x-1 : x;
|
3883
|
+
break;
|
3884
|
+
default:
|
3885
|
+
v = x;
|
3886
|
+
break;
|
3887
|
+
}
|
3888
|
+
adj = parseInt(adj, 10);
|
3889
|
+
if (is_number(adj))
|
3890
|
+
{
|
3891
|
+
if (neg)
|
3892
|
+
{
|
3893
|
+
adj = -adj;
|
3894
|
+
}
|
3895
|
+
v += adj;
|
3896
|
+
}
|
3897
|
+
}
|
3898
|
+
if (!is_number(v) || v < 1)
|
3899
|
+
{
|
3900
|
+
v = 1;
|
3901
|
+
}
|
3902
|
+
return v;
|
3903
|
+
}
|
3904
|
+
function cf_getItemsAdjust(x, o, a, $t) {
|
3905
|
+
return cf_getItemAdjustMinMax(cf_getAdjust(x, o, a, $t), o.items.visibleConf);
|
3906
|
+
}
|
3907
|
+
function cf_getItemAdjustMinMax(v, i) {
|
3908
|
+
if (is_number(i.min) && v < i.min)
|
3909
|
+
{
|
3910
|
+
v = i.min;
|
3911
|
+
}
|
3912
|
+
if (is_number(i.max) && v > i.max)
|
3913
|
+
{
|
3914
|
+
v = i.max;
|
3915
|
+
}
|
3916
|
+
if (v < 1)
|
3917
|
+
{
|
3918
|
+
v = 1;
|
3919
|
+
}
|
3920
|
+
return v;
|
3921
|
+
}
|
3922
|
+
function cf_getSynchArr(s) {
|
3923
|
+
if (!is_array(s))
|
3924
|
+
{
|
3925
|
+
s = [[s]];
|
3926
|
+
}
|
3927
|
+
if (!is_array(s[0]))
|
3928
|
+
{
|
3929
|
+
s = [s];
|
3930
|
+
}
|
3931
|
+
for (var j = 0, l = s.length; j < l; j++)
|
3932
|
+
{
|
3933
|
+
if (is_string(s[j][0]))
|
3934
|
+
{
|
3935
|
+
s[j][0] = $(s[j][0]);
|
3936
|
+
}
|
3937
|
+
if (!is_boolean(s[j][1]))
|
3938
|
+
{
|
3939
|
+
s[j][1] = true;
|
3940
|
+
}
|
3941
|
+
if (!is_boolean(s[j][2]))
|
3942
|
+
{
|
3943
|
+
s[j][2] = true;
|
3944
|
+
}
|
3945
|
+
if (!is_number(s[j][3]))
|
3946
|
+
{
|
3947
|
+
s[j][3] = 0;
|
3948
|
+
}
|
3949
|
+
}
|
3950
|
+
return s;
|
3951
|
+
}
|
3952
|
+
function cf_getKeyCode(k) {
|
3953
|
+
if (k == 'right')
|
3954
|
+
{
|
3955
|
+
return 39;
|
3956
|
+
}
|
3957
|
+
if (k == 'left')
|
3958
|
+
{
|
3959
|
+
return 37;
|
3960
|
+
}
|
3961
|
+
if (k == 'up')
|
3962
|
+
{
|
3963
|
+
return 38;
|
3964
|
+
}
|
3965
|
+
if (k == 'down')
|
3966
|
+
{
|
3967
|
+
return 40;
|
3968
|
+
}
|
3969
|
+
return -1;
|
3970
|
+
}
|
3971
|
+
function cf_setCookie(n, $c, c) {
|
3972
|
+
if (n)
|
3973
|
+
{
|
3974
|
+
var v = $c.triggerHandler(cf_e('currentPosition', c));
|
3975
|
+
$.fn.carouFredSel.cookie.set(n, v);
|
3976
|
+
}
|
3977
|
+
}
|
3978
|
+
function cf_getCookie(n) {
|
3979
|
+
var c = $.fn.carouFredSel.cookie.get(n);
|
3980
|
+
return (c == '') ? 0 : c;
|
3981
|
+
}
|
3982
|
+
|
3983
|
+
// init function
|
3984
|
+
function in_mapCss($elem, props) {
|
3985
|
+
var css = {};
|
3986
|
+
for (var p = 0, l = props.length; p < l; p++)
|
3987
|
+
{
|
3988
|
+
css[props[p]] = $elem.css(props[p]);
|
3989
|
+
}
|
3990
|
+
return css;
|
3991
|
+
}
|
3992
|
+
function in_complementItems(obj, opt, itm, sta) {
|
3993
|
+
if (!is_object(obj.visibleConf))
|
3994
|
+
{
|
3995
|
+
obj.visibleConf = {};
|
3996
|
+
}
|
3997
|
+
if (!is_object(obj.sizesConf))
|
3998
|
+
{
|
3999
|
+
obj.sizesConf = {};
|
4000
|
+
}
|
4001
|
+
|
4002
|
+
if (obj.start == 0 && is_number(sta))
|
4003
|
+
{
|
4004
|
+
obj.start = sta;
|
4005
|
+
}
|
4006
|
+
|
4007
|
+
// visible items
|
4008
|
+
if (is_object(obj.visible))
|
4009
|
+
{
|
4010
|
+
obj.visibleConf.min = obj.visible.min;
|
4011
|
+
obj.visibleConf.max = obj.visible.max;
|
4012
|
+
obj.visible = false;
|
4013
|
+
}
|
4014
|
+
else if (is_string(obj.visible))
|
4015
|
+
{
|
4016
|
+
// variable visible items
|
4017
|
+
if (obj.visible == 'variable')
|
4018
|
+
{
|
4019
|
+
obj.visibleConf.variable = true;
|
4020
|
+
}
|
4021
|
+
// adjust string visible items
|
4022
|
+
else
|
4023
|
+
{
|
4024
|
+
obj.visibleConf.adjust = obj.visible;
|
4025
|
+
}
|
4026
|
+
obj.visible = false;
|
4027
|
+
}
|
4028
|
+
else if (is_function(obj.visible))
|
4029
|
+
{
|
4030
|
+
obj.visibleConf.adjust = obj.visible;
|
4031
|
+
obj.visible = false;
|
4032
|
+
}
|
4033
|
+
|
4034
|
+
// set items filter
|
4035
|
+
if (!is_string(obj.filter))
|
4036
|
+
{
|
4037
|
+
obj.filter = (itm.filter(':hidden').length > 0) ? ':visible' : '*';
|
4038
|
+
}
|
4039
|
+
|
4040
|
+
// primary item-size not set
|
4041
|
+
if (!obj[opt.d['width']])
|
4042
|
+
{
|
4043
|
+
// responsive carousel -> set to largest
|
4044
|
+
if (opt.responsive)
|
4045
|
+
{
|
4046
|
+
debug(true, 'Set a '+opt.d['width']+' for the items!');
|
4047
|
+
obj[opt.d['width']] = ms_getTrueLargestSize(itm, opt, 'outerWidth');
|
4048
|
+
}
|
4049
|
+
// non-responsive -> measure it or set to "variable"
|
4050
|
+
else
|
4051
|
+
{
|
4052
|
+
obj[opt.d['width']] = (ms_hasVariableSizes(itm, opt, 'outerWidth'))
|
4053
|
+
? 'variable'
|
4054
|
+
: itm[opt.d['outerWidth']](true);
|
4055
|
+
}
|
4056
|
+
}
|
4057
|
+
|
4058
|
+
// secondary item-size not set -> measure it or set to "variable"
|
4059
|
+
if (!obj[opt.d['height']])
|
4060
|
+
{
|
4061
|
+
obj[opt.d['height']] = (ms_hasVariableSizes(itm, opt, 'outerHeight'))
|
4062
|
+
? 'variable'
|
4063
|
+
: itm[opt.d['outerHeight']](true);
|
4064
|
+
}
|
4065
|
+
|
4066
|
+
obj.sizesConf.width = obj.width;
|
4067
|
+
obj.sizesConf.height = obj.height;
|
4068
|
+
return obj;
|
4069
|
+
}
|
4070
|
+
function in_complementVisibleItems(opt, avl) {
|
4071
|
+
// primary item-size variable -> set visible items variable
|
4072
|
+
if (opt.items[opt.d['width']] == 'variable')
|
4073
|
+
{
|
4074
|
+
opt.items.visibleConf.variable = true;
|
4075
|
+
}
|
4076
|
+
if (!opt.items.visibleConf.variable) {
|
4077
|
+
// primary size is number -> calculate visible-items
|
4078
|
+
if (is_number(opt[opt.d['width']]))
|
4079
|
+
{
|
4080
|
+
opt.items.visible = Math.floor(opt[opt.d['width']] / opt.items[opt.d['width']]);
|
4081
|
+
}
|
4082
|
+
// measure and calculate primary size and visible-items
|
4083
|
+
else
|
4084
|
+
{
|
4085
|
+
opt.items.visible = Math.floor(avl / opt.items[opt.d['width']]);
|
4086
|
+
opt[opt.d['width']] = opt.items.visible * opt.items[opt.d['width']];
|
4087
|
+
if (!opt.items.visibleConf.adjust)
|
4088
|
+
{
|
4089
|
+
opt.align = false;
|
4090
|
+
}
|
4091
|
+
}
|
4092
|
+
if (opt.items.visible == 'Infinity' || opt.items.visible < 1)
|
4093
|
+
{
|
4094
|
+
debug(true, 'Not a valid number of visible items: Set to "variable".');
|
4095
|
+
opt.items.visibleConf.variable = true;
|
4096
|
+
}
|
4097
|
+
}
|
4098
|
+
return opt;
|
4099
|
+
}
|
4100
|
+
function in_complementPrimarySize(obj, opt, all) {
|
4101
|
+
// primary size set to auto -> measure largest item-size and set it
|
4102
|
+
if (obj == 'auto')
|
4103
|
+
{
|
4104
|
+
obj = ms_getTrueLargestSize(all, opt, 'outerWidth');
|
4105
|
+
}
|
4106
|
+
return obj;
|
4107
|
+
}
|
4108
|
+
function in_complementSecondarySize(obj, opt, all) {
|
4109
|
+
// secondary size set to auto -> measure largest item-size and set it
|
4110
|
+
if (obj == 'auto')
|
4111
|
+
{
|
4112
|
+
obj = ms_getTrueLargestSize(all, opt, 'outerHeight');
|
4113
|
+
}
|
4114
|
+
// secondary size not set -> set to secondary item-size
|
4115
|
+
if (!obj)
|
4116
|
+
{
|
4117
|
+
obj = opt.items[opt.d['height']];
|
4118
|
+
}
|
4119
|
+
return obj;
|
4120
|
+
}
|
4121
|
+
function in_getAlignPadding(o, all) {
|
4122
|
+
var p = cf_getAlignPadding(gi_getCurrentItems(all, o), o);
|
4123
|
+
o.padding[o.d[1]] = p[1];
|
4124
|
+
o.padding[o.d[3]] = p[0];
|
4125
|
+
return o;
|
4126
|
+
}
|
4127
|
+
function in_getResponsiveValues(o, all, avl) {
|
4128
|
+
|
4129
|
+
var visb = cf_getItemAdjustMinMax(Math.ceil(o[o.d['width']] / o.items[o.d['width']]), o.items.visibleConf);
|
4130
|
+
if (visb > all.length)
|
4131
|
+
{
|
4132
|
+
visb = all.length;
|
4133
|
+
}
|
4134
|
+
|
4135
|
+
var newS = Math.floor(o[o.d['width']]/visb);
|
4136
|
+
|
4137
|
+
o.items.visible = visb;
|
4138
|
+
o.items[o.d['width']] = newS;
|
4139
|
+
o[o.d['width']] = visb * newS;
|
4140
|
+
return o;
|
4141
|
+
}
|
4142
|
+
|
4143
|
+
|
4144
|
+
// buttons functions
|
4145
|
+
function bt_pauseOnHoverConfig(p) {
|
4146
|
+
if (is_string(p))
|
4147
|
+
{
|
4148
|
+
var i = (p.indexOf('immediate') > -1) ? true : false,
|
4149
|
+
r = (p.indexOf('resume') > -1) ? true : false;
|
4150
|
+
}
|
4151
|
+
else
|
4152
|
+
{
|
4153
|
+
var i = r = false;
|
4154
|
+
}
|
4155
|
+
return [i, r];
|
4156
|
+
}
|
4157
|
+
function bt_mousesheelNumber(mw) {
|
4158
|
+
return (is_number(mw)) ? mw : null
|
4159
|
+
}
|
4160
|
+
|
4161
|
+
// helper functions
|
4162
|
+
function is_null(a) {
|
4163
|
+
return (a === null);
|
4164
|
+
}
|
4165
|
+
function is_undefined(a) {
|
4166
|
+
return (is_null(a) || typeof a == 'undefined' || a === '' || a === 'undefined');
|
4167
|
+
}
|
4168
|
+
function is_array(a) {
|
4169
|
+
return (a instanceof Array);
|
4170
|
+
}
|
4171
|
+
function is_jquery(a) {
|
4172
|
+
return (a instanceof jQuery);
|
4173
|
+
}
|
4174
|
+
function is_object(a) {
|
4175
|
+
return ((a instanceof Object || typeof a == 'object') && !is_null(a) && !is_jquery(a) && !is_array(a) && !is_function(a));
|
4176
|
+
}
|
4177
|
+
function is_number(a) {
|
4178
|
+
return ((a instanceof Number || typeof a == 'number') && !isNaN(a));
|
4179
|
+
}
|
4180
|
+
function is_string(a) {
|
4181
|
+
return ((a instanceof String || typeof a == 'string') && !is_undefined(a) && !is_true(a) && !is_false(a));
|
4182
|
+
}
|
4183
|
+
function is_function(a) {
|
4184
|
+
return (a instanceof Function || typeof a == 'function');
|
4185
|
+
}
|
4186
|
+
function is_boolean(a) {
|
4187
|
+
return (a instanceof Boolean || typeof a == 'boolean' || is_true(a) || is_false(a));
|
4188
|
+
}
|
4189
|
+
function is_true(a) {
|
4190
|
+
return (a === true || a === 'true');
|
4191
|
+
}
|
4192
|
+
function is_false(a) {
|
4193
|
+
return (a === false || a === 'false');
|
4194
|
+
}
|
4195
|
+
function is_percentage(x) {
|
4196
|
+
return (is_string(x) && x.slice(-1) == '%');
|
4197
|
+
}
|
4198
|
+
|
4199
|
+
|
4200
|
+
function getTime() {
|
4201
|
+
return new Date().getTime();
|
4202
|
+
}
|
4203
|
+
|
4204
|
+
function deprecated( o, n ) {
|
4205
|
+
debug(true, o+' is DEPRECATED, support for it will be removed. Use '+n+' instead.');
|
4206
|
+
}
|
4207
|
+
function debug(d, m) {
|
4208
|
+
if (!is_undefined(window.console) && !is_undefined(window.console.log))
|
4209
|
+
{
|
4210
|
+
if (is_object(d))
|
4211
|
+
{
|
4212
|
+
var s = ' ('+d.selector+')';
|
4213
|
+
d = d.debug;
|
4214
|
+
}
|
4215
|
+
else
|
4216
|
+
{
|
4217
|
+
var s = '';
|
4218
|
+
}
|
4219
|
+
if (!d)
|
4220
|
+
{
|
4221
|
+
return false;
|
4222
|
+
}
|
4223
|
+
|
4224
|
+
if (is_string(m))
|
4225
|
+
{
|
4226
|
+
m = 'carouFredSel'+s+': ' + m;
|
4227
|
+
}
|
4228
|
+
else
|
4229
|
+
{
|
4230
|
+
m = ['carouFredSel'+s+':', m];
|
4231
|
+
}
|
4232
|
+
window.console.log(m);
|
4233
|
+
}
|
4234
|
+
return false;
|
4235
|
+
}
|
4236
|
+
|
4237
|
+
|
4238
|
+
|
4239
|
+
// EASING FUNCTIONS
|
4240
|
+
$.extend($.easing, {
|
4241
|
+
'quadratic': function(t) {
|
4242
|
+
var t2 = t * t;
|
4243
|
+
return t * (-t2 * t + 4 * t2 - 6 * t + 4);
|
4244
|
+
},
|
4245
|
+
'cubic': function(t) {
|
4246
|
+
return t * (4 * t * t - 9 * t + 6);
|
4247
|
+
},
|
4248
|
+
'elastic': function(t) {
|
4249
|
+
var t2 = t * t;
|
4250
|
+
return t * (33 * t2 * t2 - 106 * t2 * t + 126 * t2 - 67 * t + 15);
|
4251
|
+
}
|
4252
|
+
});
|
4253
|
+
|
4254
|
+
|
4255
|
+
})(jQuery);
|