(function($) { if ($.fn.caroufredsel) { return } $.fn.caroufredsel = $.fn.caroufredsel = function(u, w) { if (this.length == 0) { debug(true, 'no element found for "' + this.selector + '".'); return this } if (this.length > 1) { return this.each(function() { $(this).caroufredsel(u, w) }) } var y = this, $tt0 = this[0], starting_position = false; if (y.data('_cfs_iscarousel')) { starting_position = y.triggerhandler('_cfs_triggerevent', 'currentposition'); y.trigger('_cfs_triggerevent', ['destroy', true]) } y._cfs_init = function(o, a, b) { o = go_getobject($tt0, o); o.items = go_getitemsobject($tt0, o.items); o.scroll = go_getscrollobject($tt0, o.scroll); o.auto = go_getautoobject($tt0, o.auto); o.prev = go_getprevnextobject($tt0, o.prev); o.next = go_getprevnextobject($tt0, o.next); o.pagination = go_getpaginationobject($tt0, o.pagination); o.swipe = go_getswipeobject($tt0, o.swipe); o.mousewheel = go_getmousewheelobject($tt0, o.mousewheel); if (a) { opts_orig = $.extend(true, {}, $.fn.caroufredsel.defaults, o) } opts = $.extend(true, {}, $.fn.caroufredsel.defaults, o); opts.d = cf_getdimensions(opts); z.direction = (opts.direction == 'up' || opts.direction == 'left') ? 'next' : 'prev'; var c = y.children(), avail_primary = ms_getparentsize($wrp, opts, 'width'); if (is_true(opts.cookie)) { opts.cookie = 'caroufredsel_cookie_' + conf.serialnumber } opts.maxdimension = ms_getmaxdimension(opts, avail_primary); opts.items = in_complementitems(opts.items, opts, c, b); opts[opts.d['width']] = in_complementprimarysize(opts[opts.d['width']], opts, c); opts[opts.d['height']] = in_complementsecondarysize(opts[opts.d['height']], opts, c); if (opts.responsive) { if (!is_percentage(opts[opts.d['width']])) { opts[opts.d['width']] = '100%' } } if (is_percentage(opts[opts.d['width']])) { z.updateonwindowresize = true; z.primarysizepercentage = opts[opts.d['width']]; opts[opts.d['width']] = ms_getpercentage(avail_primary, z.primarysizepercentage); if (!opts.items.visible) { opts.items.visibleconf.variable = true } } if (opts.responsive) { opts.usepadding = false; opts.padding = [0, 0, 0, 0]; opts.align = false; opts.items.visibleconf.variable = false } else { if (!opts.items.visible) { opts = in_complementvisibleitems(opts, avail_primary) } if (!opts[opts.d['width']]) { if (!opts.items.visibleconf.variable && is_number(opts.items[opts.d['width']]) && opts.items.filter == '*') { opts[opts.d['width']] = opts.items.visible * opts.items[opts.d['width']]; opts.align = false } else { opts[opts.d['width']] = 'variable' } } if (is_undefined(opts.align)) { opts.align = (is_number(opts[opts.d['width']])) ? 'center' : false } if (opts.items.visibleconf.variable) { opts.items.visible = gn_getvisibleitemsnext(c, opts, 0) } } if (opts.items.filter != '*' && !opts.items.visibleconf.variable) { opts.items.visibleconf.org = opts.items.visible; opts.items.visible = gn_getvisibleitemsnextfilter(c, opts, 0) } opts.items.visible = cf_getitemsadjust(opts.items.visible, opts, opts.items.visibleconf.adjust, $tt0); opts.items.visibleconf.old = opts.items.visible; if (opts.responsive) { if (!opts.items.visibleconf.min) { opts.items.visibleconf.min = opts.items.visible } if (!opts.items.visibleconf.max) { opts.items.visibleconf.max = opts.items.visible } opts = in_getresponsivevalues(opts, c, avail_primary) } else { opts.padding = cf_getpadding(opts.padding); if (opts.align == 'top') { opts.align = 'left' } else if (opts.align == 'bottom') { opts.align = 'right' } switch (opts.align) { case 'center': case 'left': case 'right': if (opts[opts.d['width']] != 'variable') { opts = in_getalignpadding(opts, c); opts.usepadding = true } break; default: opts.align = false; opts.usepadding = (opts.padding[0] == 0 && opts.padding[1] == 0 && opts.padding[2] == 0 && opts.padding[3] == 0) ? false : true; break } } if (!is_number(opts.scroll.duration)) { opts.scroll.duration = 500 } if (is_undefined(opts.scroll.items)) { opts.scroll.items = (opts.responsive || opts.items.visibleconf.variable || opts.items.filter != '*') ? 'visible' : opts.items.visible } opts.auto = $.extend(true, {}, opts.scroll, opts.auto); opts.prev = $.extend(true, {}, opts.scroll, opts.prev); opts.next = $.extend(true, {}, opts.scroll, opts.next); opts.pagination = $.extend(true, {}, opts.scroll, opts.pagination); opts.auto = go_complementautoobject($tt0, opts.auto); opts.prev = go_complementprevnextobject($tt0, opts.prev); opts.next = go_complementprevnextobject($tt0, opts.next); opts.pagination = go_complementpaginationobject($tt0, opts.pagination); opts.swipe = go_complementswipeobject($tt0, opts.swipe); opts.mousewheel = go_complementmousewheelobject($tt0, opts.mousewheel); if (opts.synchronise) { opts.synchronise = cf_getsyncharr(opts.synchronise) } if (opts.auto.onpausestart) { opts.auto.ontimeoutstart = opts.auto.onpausestart; deprecated('auto.onpausestart', 'auto.ontimeoutstart') } if (opts.auto.onpausepause) { opts.auto.ontimeoutpause = opts.auto.onpausepause; deprecated('auto.onpausepause', 'auto.ontimeoutpause') } if (opts.auto.onpauseend) { opts.auto.ontimeoutend = opts.auto.onpauseend; deprecated('auto.onpauseend', 'auto.ontimeoutend') } if (opts.auto.pauseduration) { opts.auto.timeoutduration = opts.auto.pauseduration; deprecated('auto.pauseduration', 'auto.timeoutduration') } }; y._cfs_build = function() { y.data('_cfs_iscarousel', true); var a = y.children(), orgcss = in_mapcss(y, ['textalign', 'float', 'position', 'top', 'right', 'bottom', 'left', 'zindex', 'width', 'height', 'margintop', 'marginright', 'marginbottom', 'marginleft']), newposition = 'relative'; switch (orgcss.position) { case 'absolute': case 'fixed': newposition = orgcss.position; break } $wrp.css(orgcss).css({ 'overflow': 'hidden', 'position': newposition }); y.data('_cfs_origcss', orgcss).css({ 'textalign': 'left', 'float': 'none', 'position': 'absolute', 'top': 0, 'right': 'auto', 'bottom': 'auto', 'left': 0, 'margintop': 0, 'marginright': 0, 'marginbottom': 0, 'marginleft': 0 }); sz_storemargin(a, opts); sz_storesizes(a, opts); if (opts.responsive) { sz_setresponsivesizes(opts, a) } }; y._cfs_bind_events = function() { y._cfs_unbind_events(); y.bind(cf_e('stop', conf), function(e, a) { e.stoppropagation(); if (!z.isstopped) { if (opts.auto.button) { opts.auto.button.addclass(cf_c('stopped', conf)) } } z.isstopped = true; if (opts.auto.play) { opts.auto.play = false; y.trigger(cf_e('pause', conf), a) } return true }); y.bind(cf_e('finish', conf), function(e) { e.stoppropagation(); if (z.isscrolling) { sc_stopscroll(scrl) } return true }); y.bind(cf_e('pause', conf), function(e, a, b) { e.stoppropagation(); tmrs = sc_cleartimers(tmrs); if (a && z.isscrolling) { scrl.isstopped = true; var c = gettime() - scrl.starttime; scrl.duration -= c; if (scrl.pre) { scrl.pre.duration -= c } if (scrl.post) { scrl.post.duration -= c } sc_stopscroll(scrl, false) } if (!z.ispaused && !z.isscrolling) { if (b) { tmrs.timepassed += gettime() - tmrs.starttime } } if (!z.ispaused) { if (opts.auto.button) { opts.auto.button.addclass(cf_c('paused', conf)) } } z.ispaused = true; if (opts.auto.ontimeoutpause) { var d = opts.auto.timeoutduration - tmrs.timepassed, perc = 100 - math.ceil(d * 100 / opts.auto.timeoutduration); opts.auto.ontimeoutpause.call($tt0, perc, d) } return true }); y.bind(cf_e('play', conf), function(e, b, c, d) { e.stoppropagation(); tmrs = sc_cleartimers(tmrs); var v = [b, c, d], t = ['string', 'number', 'boolean'], a = cf_sortparams(v, t); b = a[0]; c = a[1]; d = a[2]; if (b != 'prev' && b != 'next') { b = z.direction } if (!is_number(c)) { c = 0 } if (!is_boolean(d)) { d = false } if (d) { z.isstopped = false; opts.auto.play = true } if (!opts.auto.play) { e.stopimmediatepropagation(); return debug(conf, 'carousel stopped: not scrolling.') } if (z.ispaused) { if (opts.auto.button) { opts.auto.button.removeclass(cf_c('stopped', conf)); opts.auto.button.removeclass(cf_c('paused', conf)) } } z.ispaused = false; tmrs.starttime = gettime(); var f = opts.auto.timeoutduration + c; dur2 = f - tmrs.timepassed; perc = 100 - math.ceil(dur2 * 100 / f); if (opts.auto.progress) { tmrs.progress = setinterval(function() { var a = gettime() - tmrs.starttime + tmrs.timepassed, perc = math.ceil(a * 100 / f); opts.auto.progress.updater.call(opts.auto.progress.bar[0], perc) }, opts.auto.progress.interval) } tmrs.auto = settimeout(function() { if (opts.auto.progress) { opts.auto.progress.updater.call(opts.auto.progress.bar[0], 100) } if (opts.auto.ontimeoutend) { opts.auto.ontimeoutend.call($tt0, perc, dur2) } if (z.isscrolling) { y.trigger(cf_e('play', conf), b) } else { y.trigger(cf_e(b, conf), opts.auto) } }, dur2); if (opts.auto.ontimeoutstart) { opts.auto.ontimeoutstart.call($tt0, perc, dur2) } return true }); y.bind(cf_e('resume', conf), function(e) { e.stoppropagation(); if (scrl.isstopped) { scrl.isstopped = false; z.ispaused = false; z.isscrolling = true; scrl.starttime = gettime(); sc_startscroll(scrl) } else { y.trigger(cf_e('play', conf)) } return true }); y.bind(cf_e('prev', conf) + ' ' + cf_e('next', conf), function(e, b, f, g, h) { e.stoppropagation(); if (z.isstopped || y.is(':hidden')) { e.stopimmediatepropagation(); return debug(conf, 'carousel stopped or hidden: not scrolling.') } var i = (is_number(opts.items.minimum)) ? opts.items.minimum : opts.items.visible + 1; if (i > itms.total) { e.stopimmediatepropagation(); return debug(conf, 'not enough items (' + itms.total + ' total, ' + i + ' needed): not scrolling.') } var v = [b, f, g, h], t = ['object', 'number/string', 'function', 'boolean'], a = cf_sortparams(v, t); b = a[0]; f = a[1]; g = a[2]; h = a[3]; var k = e.type.slice(conf.events.prefix.length); if (!is_object(b)) { b = {} } if (is_function(g)) { b.onafter = g } if (is_boolean(h)) { b.queue = h } b = $.extend(true, {}, opts[k], b); if (b.conditions && !b.conditions.call($tt0, k)) { e.stopimmediatepropagation(); return debug(conf, 'callback "conditions" returned false.') } if (!is_number(f)) { if (opts.items.filter != '*') { f = 'visible' } else { var m = [f, b.items, opts[k].items]; for (var a = 0, l = m.length; a < l; a++) { if (is_number(m[a]) || m[a] == 'page' || m[a] == 'visible') { f = m[a]; break } } } switch (f) { case 'page': e.stopimmediatepropagation(); return y.triggerhandler(cf_e(k + 'page', conf), [b, g]); break; case 'visible': if (!opts.items.visibleconf.variable && opts.items.filter == '*') { f = opts.items.visible } break } } if (scrl.isstopped) { y.trigger(cf_e('resume', conf)); y.trigger(cf_e('queue', conf), [k, [b, f, g]]); e.stopimmediatepropagation(); return debug(conf, 'carousel resumed scrolling.') } if (b.duration > 0) { if (z.isscrolling) { if (b.queue) { if (b.queue == 'last') { queu = [] } if (b.queue != 'first' || queu.length == 0) { y.trigger(cf_e('queue', conf), [k, [b, f, g]]) } } e.stopimmediatepropagation(); return debug(conf, 'carousel currently scrolling.') } } tmrs.timepassed = 0; y.trigger(cf_e('slide_' + k, conf), [b, f]); if (opts.synchronise) { var s = opts.synchronise, c = [b, f]; for (var j = 0, l = s.length; j < l; j++) { var d = k; if (!s[j][2]) { d = (d == 'prev') ? 'next' : 'prev' } if (!s[j][1]) { c[0] = s[j][0].triggerhandler('_cfs_triggerevent', ['configuration', d]) } c[1] = f + s[j][3]; s[j][0].trigger('_cfs_triggerevent', ['slide_' + d, c]) } } return true }); y.bind(cf_e('slide_prev', conf), function(e, b, c) { e.stoppropagation(); var d = y.children(); if (!opts.circular) { if (itms.first == 0) { if (opts.infinite) { y.trigger(cf_e('next', conf), itms.total - 1) } return e.stopimmediatepropagation() } } sz_resetmargin(d, opts); if (!is_number(c)) { if (opts.items.visibleconf.variable) { c = gn_getvisibleitemsprev(d, opts, itms.total - 1) } else if (opts.items.filter != '*') { var f = (is_number(b.items)) ? b.items : gn_getvisibleorg(y, opts); c = gn_getscrollitemsprevfilter(d, opts, itms.total - 1, f) } else { c = opts.items.visible } c = cf_getadjust(c, opts, b.items, $tt0) } if (!opts.circular) { if (itms.total - c < itms.first) { c = itms.total - itms.first } } opts.items.visibleconf.old = opts.items.visible; if (opts.items.visibleconf.variable) { var g = cf_getitemsadjust(gn_getvisibleitemsnext(d, opts, itms.total - c), opts, opts.items.visibleconf.adjust, $tt0); if (opts.items.visible + c <= g && c < itms.total) { c++; g = cf_getitemsadjust(gn_getvisibleitemsnext(d, opts, itms.total - c), opts, opts.items.visibleconf.adjust, $tt0) } opts.items.visible = g } else if (opts.items.filter != '*') { var g = gn_getvisibleitemsnextfilter(d, opts, itms.total - c); opts.items.visible = cf_getitemsadjust(g, opts, opts.items.visibleconf.adjust, $tt0) } sz_resetmargin(d, opts, true); if (c == 0) { e.stopimmediatepropagation(); return debug(conf, '0 items to scroll: not scrolling.') } debug(conf, 'scrolling ' + c + ' items backward.'); itms.first += c; while (itms.first >= itms.total) { itms.first -= itms.total } if (!opts.circular) { if (itms.first == 0 && b.onend) { b.onend.call($tt0, 'prev') } if (!opts.infinite) { nv_enablenavi(opts, itms.first, conf) } } y.children().slice(itms.total - c, itms.total).prependto(y); if (itms.total < opts.items.visible + c) { y.children().slice(0, (opts.items.visible + c) - itms.total).clone(true).appendto(y) } var d = y.children(), i_old = gi_getolditemsprev(d, opts, c), i_new = gi_getnewitemsprev(d, opts), i_cur_l = d.eq(c - 1), i_old_l = i_old.last(), i_new_l = i_new.last(); sz_resetmargin(d, opts); var h = 0, pr = 0; if (opts.align) { var p = cf_getalignpadding(i_new, opts); h = p[0]; pr = p[1] } var i = (h < 0) ? opts.padding[opts.d[3]] : 0; var j = false, i_skp = $(); if (opts.items.visible < c) { i_skp = d.slice(opts.items.visibleconf.old, c); if (b.fx == 'directscroll') { var k = opts.items[opts.d['width']]; j = i_skp; i_cur_l = i_new_l; sc_hidehiddenitems(j); opts.items[opts.d['width']] = 'variable' } } var l = false, i_siz = ms_gettotalsize(d.slice(0, c), opts, 'width'), w_siz = cf_mapwrappersizes(ms_getsizes(i_new, opts, true), opts, !opts.usepadding), i_siz_vis = 0, a_cfs = {}, a_wsz = {}, a_cur = {}, a_old = {}, a_new = {}, a_lef = {}, a_lef_vis = {}, a_dur = sc_getduration(b, opts, c, i_siz); switch (b.fx) { case 'cover': case 'cover-fade': i_siz_vis = ms_gettotalsize(d.slice(0, opts.items.visible), opts, 'width'); break } if (j) { opts.items[opts.d['width']] = k } sz_resetmargin(d, opts, true); if (pr >= 0) { sz_resetmargin(i_old_l, opts, opts.padding[opts.d[1]]) } if (h >= 0) { sz_resetmargin(i_cur_l, opts, opts.padding[opts.d[3]]) } if (opts.align) { opts.padding[opts.d[1]] = pr; opts.padding[opts.d[3]] = h } a_lef[opts.d['left']] = -(i_siz - i); a_lef_vis[opts.d['left']] = -(i_siz_vis - i); a_wsz[opts.d['left']] = w_siz[opts.d['width']]; var m = function() {}, _a_wrapper = function() {}, _s_paddingold = function() {}, _a_paddingold = function() {}, _s_paddingnew = function() {}, _a_paddingnew = function() {}, _s_paddingcur = function() {}, _a_paddingcur = function() {}, _onafter = function() {}, _moveitems = function() {}, _position = function() {}; switch (b.fx) { case 'crossfade': case 'cover': case 'cover-fade': case 'uncover': case 'uncover-fade': l = y.clone(true).appendto($wrp); break } switch (b.fx) { case 'crossfade': case 'uncover': case 'uncover-fade': l.children().slice(0, c).remove(); l.children().slice(opts.items.visibleconf.old).remove(); break; case 'cover': case 'cover-fade': l.children().slice(opts.items.visible).remove(); l.css(a_lef_vis); break } y.css(a_lef); scrl = sc_setscroll(a_dur, b.easing); a_cfs[opts.d['left']] = (opts.usepadding) ? opts.padding[opts.d[3]] : 0; if (opts[opts.d['width']] == 'variable' || opts[opts.d['height']] == 'variable') { m = function() { $wrp.css(w_siz) }; _a_wrapper = function() { scrl.anims.push([$wrp, w_siz]) } } if (opts.usepadding) { if (i_new_l.not(i_cur_l).length) { a_cur[opts.d['marginright']] = i_cur_l.data('_cfs_origcssmargin'); if (h < 0) { i_cur_l.css(a_cur) } else { _s_paddingcur = function() { i_cur_l.css(a_cur) }; _a_paddingcur = function() { scrl.anims.push([i_cur_l, a_cur]) } } } switch (b.fx) { case 'cover': case 'cover-fade': l.children().eq(c - 1).css(a_cur); break } if (i_new_l.not(i_old_l).length) { a_old[opts.d['marginright']] = i_old_l.data('_cfs_origcssmargin'); _s_paddingold = function() { i_old_l.css(a_old) }; _a_paddingold = function() { scrl.anims.push([i_old_l, a_old]) } } if (pr >= 0) { a_new[opts.d['marginright']] = i_new_l.data('_cfs_origcssmargin') + opts.padding[opts.d[1]]; _s_paddingnew = function() { i_new_l.css(a_new) }; _a_paddingnew = function() { scrl.anims.push([i_new_l, a_new]) } } } _position = function() { y.css(a_cfs) }; var n = opts.items.visible + c - itms.total; _moveitems = function() { if (n > 0) { y.children().slice(itms.total).remove(); i_old = $(y.children().slice(itms.total - (opts.items.visible - n)).get().concat(y.children().slice(0, n).get())) } sc_showhiddenitems(j); if (opts.usepadding) { var a = y.children().eq(opts.items.visible + c - 1); a.css(opts.d['marginright'], a.data('_cfs_origcssmargin')) } }; var o = sc_mapcallbackarguments(i_old, i_skp, i_new, c, 'prev', a_dur, w_siz); _onafter = function() { sc_afterscroll(y, l, b); z.isscrolling = false; clbk.onafter = sc_firecallbacks($tt0, b, 'onafter', o, clbk); queu = sc_firequeue(y, queu, conf); if (!z.ispaused) { y.trigger(cf_e('play', conf)) } }; z.isscrolling = true; tmrs = sc_cleartimers(tmrs); clbk.onbefore = sc_firecallbacks($tt0, b, 'onbefore', o, clbk); switch (b.fx) { case 'none': y.css(a_cfs); m(); _s_paddingold(); _s_paddingnew(); _s_paddingcur(); _position(); _moveitems(); _onafter(); break; case 'fade': scrl.anims.push([y, { 'opacity': 0 }, function() { m(); _s_paddingold(); _s_paddingnew(); _s_paddingcur(); _position(); _moveitems(); scrl = sc_setscroll(a_dur, b.easing); scrl.anims.push([y, { 'opacity': 1 }, _onafter]); sc_startscroll(scrl) }]); break; case 'crossfade': y.css({ 'opacity': 0 }); scrl.anims.push([l, { 'opacity': 0 }]); scrl.anims.push([y, { 'opacity': 1 }, _onafter]); _a_wrapper(); _s_paddingold(); _s_paddingnew(); _s_paddingcur(); _position(); _moveitems(); break; case 'cover': scrl.anims.push([l, a_cfs, function() { _s_paddingold(); _s_paddingnew(); _s_paddingcur(); _position(); _moveitems(); _onafter() }]); _a_wrapper(); break; case 'cover-fade': scrl.anims.push([y, { 'opacity': 0 }]); scrl.anims.push([l, a_cfs, function() { y.css({ 'opacity': 1 }); _s_paddingold(); _s_paddingnew(); _s_paddingcur(); _position(); _moveitems(); _onafter() }]); _a_wrapper(); break; case 'uncover': scrl.anims.push([l, a_wsz, _onafter]); _a_wrapper(); _s_paddingold(); _s_paddingnew(); _s_paddingcur(); _position(); _moveitems(); break; case 'uncover-fade': y.css({ 'opacity': 0 }); scrl.anims.push([y, { 'opacity': 1 }]); scrl.anims.push([l, a_wsz, _onafter]); _a_wrapper(); _s_paddingold(); _s_paddingnew(); _s_paddingcur(); _position(); _moveitems(); break; default: scrl.anims.push([y, a_cfs, function() { _moveitems(); _onafter() }]); _a_wrapper(); _a_paddingold(); _a_paddingnew(); _a_paddingcur(); break } sc_startscroll(scrl); cf_setcookie(opts.cookie, y, conf); y.trigger(cf_e('updatepagestatus', conf), [false, w_siz]); return true }); y.bind(cf_e('slide_next', conf), function(e, c, d) { e.stoppropagation(); var f = y.children(); if (!opts.circular) { if (itms.first == opts.items.visible) { if (opts.infinite) { y.trigger(cf_e('prev', conf), itms.total - 1) } return e.stopimmediatepropagation() } } sz_resetmargin(f, opts); if (!is_number(d)) { if (opts.items.filter != '*') { var g = (is_number(c.items)) ? c.items : gn_getvisibleorg(y, opts); d = gn_getscrollitemsnextfilter(f, opts, 0, g) } else { d = opts.items.visible } d = cf_getadjust(d, opts, c.items, $tt0) } var h = (itms.first == 0) ? itms.total : itms.first; if (!opts.circular) { if (opts.items.visibleconf.variable) { var i = gn_getvisibleitemsnext(f, opts, d), g = gn_getvisibleitemsprev(f, opts, h - 1) } else { var i = opts.items.visible, g = opts.items.visible } if (d + i > h) { d = h - g } } opts.items.visibleconf.old = opts.items.visible; if (opts.items.visibleconf.variable) { var i = cf_getitemsadjust(gn_getvisibleitemsnexttestcircular(f, opts, d, h), opts, opts.items.visibleconf.adjust, $tt0); while (opts.items.visible - d >= i && d < itms.total) { d++; i = cf_getitemsadjust(gn_getvisibleitemsnexttestcircular(f, opts, d, h), opts, opts.items.visibleconf.adjust, $tt0) } opts.items.visible = i } else if (opts.items.filter != '*') { var i = gn_getvisibleitemsnextfilter(f, opts, d); opts.items.visible = cf_getitemsadjust(i, opts, opts.items.visibleconf.adjust, $tt0) } sz_resetmargin(f, opts, true); if (d == 0) { e.stopimmediatepropagation(); return debug(conf, '0 items to scroll: not scrolling.') } debug(conf, 'scrolling ' + d + ' items forward.'); itms.first -= d; while (itms.first < 0) { itms.first += itms.total } if (!opts.circular) { if (itms.first == opts.items.visible && c.onend) { c.onend.call($tt0, 'next') } if (!opts.infinite) { nv_enablenavi(opts, itms.first, conf) } } if (itms.total < opts.items.visible + d) { y.children().slice(0, (opts.items.visible + d) - itms.total).clone(true).appendto(y) } var f = y.children(), i_old = gi_getolditemsnext(f, opts), i_new = gi_getnewitemsnext(f, opts, d), i_cur_l = f.eq(d - 1), i_old_l = i_old.last(), i_new_l = i_new.last(); sz_resetmargin(f, opts); var j = 0, pr = 0; if (opts.align) { var p = cf_getalignpadding(i_new, opts); j = p[0]; pr = p[1] } var k = false, i_skp = $(); if (opts.items.visibleconf.old < d) { i_skp = f.slice(opts.items.visibleconf.old, d); if (c.fx == 'directscroll') { var l = opts.items[opts.d['width']]; k = i_skp; i_cur_l = i_old_l; sc_hidehiddenitems(k); opts.items[opts.d['width']] = 'variable' } } var m = false, i_siz = ms_gettotalsize(f.slice(0, d), opts, 'width'), w_siz = cf_mapwrappersizes(ms_getsizes(i_new, opts, true), opts, !opts.usepadding), i_siz_vis = 0, a_cfs = {}, a_cfs_vis = {}, a_cur = {}, a_old = {}, a_lef = {}, a_dur = sc_getduration(c, opts, d, i_siz); switch (c.fx) { case 'uncover': case 'uncover-fade': i_siz_vis = ms_gettotalsize(f.slice(0, opts.items.visibleconf.old), opts, 'width'); break } if (k) { opts.items[opts.d['width']] = l } if (opts.align) { if (opts.padding[opts.d[1]] < 0) { opts.padding[opts.d[1]] = 0 } } sz_resetmargin(f, opts, true); sz_resetmargin(i_old_l, opts, opts.padding[opts.d[1]]); if (opts.align) { opts.padding[opts.d[1]] = pr; opts.padding[opts.d[3]] = j } a_lef[opts.d['left']] = (opts.usepadding) ? opts.padding[opts.d[3]] : 0; var n = function() {}, _a_wrapper = function() {}, _s_paddingold = function() {}, _a_paddingold = function() {}, _s_paddingcur = function() {}, _a_paddingcur = function() {}, _onafter = function() {}, _moveitems = function() {}, _position = function() {}; switch (c.fx) { case 'crossfade': case 'cover': case 'cover-fade': case 'uncover': case 'uncover-fade': m = y.clone(true).appendto($wrp); m.children().slice(opts.items.visibleconf.old).remove(); break } switch (c.fx) { case 'crossfade': case 'cover': case 'cover-fade': y.css('zindex', 1); m.css('zindex', 0); break } scrl = sc_setscroll(a_dur, c.easing); a_cfs[opts.d['left']] = -i_siz; a_cfs_vis[opts.d['left']] = -i_siz_vis; if (j < 0) { a_cfs[opts.d['left']] += j } if (opts[opts.d['width']] == 'variable' || opts[opts.d['height']] == 'variable') { n = function() { $wrp.css(w_siz) }; _a_wrapper = function() { scrl.anims.push([$wrp, w_siz]) } } if (opts.usepadding) { var o = i_new_l.data('_cfs_origcssmargin'); if (pr >= 0) { o += opts.padding[opts.d[1]] } i_new_l.css(opts.d['marginright'], o); if (i_cur_l.not(i_old_l).length) { a_old[opts.d['marginright']] = i_old_l.data('_cfs_origcssmargin') } _s_paddingold = function() { i_old_l.css(a_old) }; _a_paddingold = function() { scrl.anims.push([i_old_l, a_old]) }; var q = i_cur_l.data('_cfs_origcssmargin'); if (j > 0) { q += opts.padding[opts.d[3]] } a_cur[opts.d['marginright']] = q; _s_paddingcur = function() { i_cur_l.css(a_cur) }; _a_paddingcur = function() { scrl.anims.push([i_cur_l, a_cur]) } } _position = function() { y.css(a_lef) }; var r = opts.items.visible + d - itms.total; _moveitems = function() { if (r > 0) { y.children().slice(itms.total).remove() } var a = y.children().slice(0, d).appendto(y).last(); if (r > 0) { i_new = gi_getcurrentitems(f, opts) } sc_showhiddenitems(k); if (opts.usepadding) { if (itms.total < opts.items.visible + d) { var b = y.children().eq(opts.items.visible - 1); b.css(opts.d['marginright'], b.data('_cfs_origcssmargin') + opts.padding[opts.d[3]]) } a.css(opts.d['marginright'], a.data('_cfs_origcssmargin')) } }; var s = sc_mapcallbackarguments(i_old, i_skp, i_new, d, 'next', a_dur, w_siz); _onafter = function() { y.css('zindex', y.data('_cfs_origcss').zindex); sc_afterscroll(y, m, c); z.isscrolling = false; clbk.onafter = sc_firecallbacks($tt0, c, 'onafter', s, clbk); queu = sc_firequeue(y, queu, conf); if (!z.ispaused) { y.trigger(cf_e('play', conf)) } }; z.isscrolling = true; tmrs = sc_cleartimers(tmrs); clbk.onbefore = sc_firecallbacks($tt0, c, 'onbefore', s, clbk); switch (c.fx) { case 'none': y.css(a_cfs); n(); _s_paddingold(); _s_paddingcur(); _position(); _moveitems(); _onafter(); break; case 'fade': scrl.anims.push([y, { 'opacity': 0 }, function() { n(); _s_paddingold(); _s_paddingcur(); _position(); _moveitems(); scrl = sc_setscroll(a_dur, c.easing); scrl.anims.push([y, { 'opacity': 1 }, _onafter]); sc_startscroll(scrl) }]); break; case 'crossfade': y.css({ 'opacity': 0 }); scrl.anims.push([m, { 'opacity': 0 }]); scrl.anims.push([y, { 'opacity': 1 }, _onafter]); _a_wrapper(); _s_paddingold(); _s_paddingcur(); _position(); _moveitems(); break; case 'cover': y.css(opts.d['left'], $wrp[opts.d['width']]()); scrl.anims.push([y, a_lef, _onafter]); _a_wrapper(); _s_paddingold(); _s_paddingcur(); _moveitems(); break; case 'cover-fade': y.css(opts.d['left'], $wrp[opts.d['width']]()); scrl.anims.push([m, { 'opacity': 0 }]); scrl.anims.push([y, a_lef, _onafter]); _a_wrapper(); _s_paddingold(); _s_paddingcur(); _moveitems(); break; case 'uncover': scrl.anims.push([m, a_cfs_vis, _onafter]); _a_wrapper(); _s_paddingold(); _s_paddingcur(); _position(); _moveitems(); break; case 'uncover-fade': y.css({ 'opacity': 0 }); scrl.anims.push([y, { 'opacity': 1 }]); scrl.anims.push([m, a_cfs_vis, _onafter]); _a_wrapper(); _s_paddingold(); _s_paddingcur(); _position(); _moveitems(); break; default: scrl.anims.push([y, a_cfs, function() { _position(); _moveitems(); _onafter() }]); _a_wrapper(); _a_paddingold(); _a_paddingcur(); break } sc_startscroll(scrl); cf_setcookie(opts.cookie, y, conf); y.trigger(cf_e('updatepagestatus', conf), [false, w_siz]); return true }); y.bind(cf_e('slideto', conf), function(e, b, c, d, f, g, h) { e.stoppropagation(); var v = [b, c, d, f, g, h], t = ['string/number/object', 'number', 'boolean', 'object', 'string', 'function'], a = cf_sortparams(v, t); f = a[3]; g = a[4]; h = a[5]; b = gn_getitemindex(a[0], a[1], a[2], itms, y); if (b == 0) { return false } if (!is_object(f)) { f = false } if (g != 'prev' && g != 'next') { if (opts.circular) { g = (b <= itms.total / 2) ? 'next' : 'prev' } else { g = (itms.first == 0 || itms.first > b) ? 'next' : 'prev' } } if (g == 'prev') { b = itms.total - b } y.trigger(cf_e(g, conf), [f, b, h]); return true }); y.bind(cf_e('prevpage', conf), function(e, a, b) { e.stoppropagation(); var c = y.triggerhandler(cf_e('currentpage', conf)); return y.triggerhandler(cf_e('slidetopage', conf), [c - 1, a, 'prev', b]) }); y.bind(cf_e('nextpage', conf), function(e, a, b) { e.stoppropagation(); var c = y.triggerhandler(cf_e('currentpage', conf)); return y.triggerhandler(cf_e('slidetopage', conf), [c + 1, a, 'next', b]) }); y.bind(cf_e('slidetopage', conf), function(e, a, b, c, d) { e.stoppropagation(); if (!is_number(a)) { a = y.triggerhandler(cf_e('currentpage', conf)) } var f = opts.pagination.items || opts.items.visible, max = math.ceil(itms.total / f) - 1; if (a < 0) { a = max } if (a > max) { a = 0 } return y.triggerhandler(cf_e('slideto', conf), [a * f, 0, true, b, c, d]) }); y.bind(cf_e('jumptostart', conf), function(e, s) { e.stoppropagation(); if (s) { s = gn_getitemindex(s, 0, true, itms, y) } else { s = 0 } s += itms.first; if (s != 0) { if (itms.total > 0) { while (s > itms.total) { s -= itms.total } } y.prepend(y.children().slice(s, itms.total)) } return true }); y.bind(cf_e('synchronise', conf), function(e, s) { e.stoppropagation(); if (s) { s = cf_getsyncharr(s) } else if (opts.synchronise) { s = opts.synchronise } else { return debug(conf, 'no carousel to synchronise.') } var n = y.triggerhandler(cf_e('currentposition', conf)), x = true; for (var j = 0, l = s.length; j < l; j++) { if (!s[j][0].triggerhandler(cf_e('slideto', conf), [n, s[j][3], true])) { x = false } } return x }); y.bind(cf_e('queue', conf), function(e, a, b) { e.stoppropagation(); if (is_function(a)) { a.call($tt0, queu) } else if (is_array(a)) { queu = a } else if (!is_undefined(a)) { queu.push([a, b]) } return queu }); y.bind(cf_e('insertitem', conf), function(e, b, c, d, f) { e.stoppropagation(); var v = [b, c, d, f], t = ['string/object', 'string/number/object', 'boolean', 'number'], a = cf_sortparams(v, t); b = a[0]; c = a[1]; d = a[2]; f = a[3]; if (is_object(b) && !is_jquery(b)) { b = $(b) } else if (is_string(b)) { b = $(b) } if (!is_jquery(b) || b.length == 0) { return debug(conf, 'not a valid object.') } if (is_undefined(c)) { c = 'end' } sz_storemargin(b, opts); sz_storesizes(b, opts); var g = c, before = 'before'; if (c == 'end') { if (d) { if (itms.first == 0) { c = itms.total - 1; before = 'after' } else { c = itms.first; itms.first += b.length } if (c < 0) { c = 0 } } else { c = itms.total - 1; before = 'after' } } else { c = gn_getitemindex(c, f, d, itms, y) } var h = y.children().eq(c); if (h.length) { h[before](b) } else { debug(conf, 'correct insert-position not found! appending item to the end.'); y.append(b) } if (g != 'end' && !d) { if (c < itms.first) { itms.first += b.length } } itms.total = y.children().length; if (itms.first >= itms.total) { itms.first -= itms.total } y.trigger(cf_e('updatesizes', conf)); y.trigger(cf_e('linkanchors', conf)); return true }); y.bind(cf_e('removeitem', conf), function(e, c, d, f) { e.stoppropagation(); var v = [c, d, f], t = ['string/number/object', 'boolean', 'number'], a = cf_sortparams(v, t); c = a[0]; d = a[1]; f = a[2]; var g = false; if (c instanceof $ && c.length > 1) { h = $(); c.each(function(i, a) { var b = y.trigger(cf_e('removeitem', conf), [$(this), d, f]); if (b) h = h.add(b) }); return h } if (is_undefined(c) || c == 'end') { h = y.children().last() } else { c = gn_getitemindex(c, f, d, itms, y); var h = y.children().eq(c); if (h.length) { if (c < itms.first) itms.first -= h.length } } if (h && h.length) { h.detach(); itms.total = y.children().length; y.trigger(cf_e('updatesizes', conf)) } return h }); y.bind(cf_e('onbefore', conf) + ' ' + cf_e('onafter', conf), function(e, a) { e.stoppropagation(); var b = e.type.slice(conf.events.prefix.length); if (is_array(a)) { clbk[b] = a } if (is_function(a)) { clbk[b].push(a) } return clbk[b] }); y.bind(cf_e('currentposition', conf), function(e, a) { e.stoppropagation(); if (itms.first == 0) { var b = 0 } else { var b = itms.total - itms.first } if (is_function(a)) { a.call($tt0, b) } return b }); y.bind(cf_e('currentpage', conf), function(e, a) { e.stoppropagation(); var b = opts.pagination.items || opts.items.visible, max = math.ceil(itms.total / b - 1), nr; if (itms.first == 0) { nr = 0 } else if (itms.first < itms.total % b) { nr = 0 } else if (itms.first == b && !opts.circular) { nr = max } else { nr = math.round((itms.total - itms.first) / b) } if (nr < 0) { nr = 0 } if (nr > max) { nr = max } if (is_function(a)) { a.call($tt0, nr) } return nr }); y.bind(cf_e('currentvisible', conf), function(e, a) { e.stoppropagation(); var b = gi_getcurrentitems(y.children(), opts); if (is_function(a)) { a.call($tt0, b) } return b }); y.bind(cf_e('slice', conf), function(e, f, l, b) { e.stoppropagation(); if (itms.total == 0) { return false } var v = [f, l, b], t = ['number', 'number', 'function'], a = cf_sortparams(v, t); f = (is_number(a[0])) ? a[0] : 0; l = (is_number(a[1])) ? a[1] : itms.total; b = a[2]; f += itms.first; l += itms.first; if (items.total > 0) { while (f > itms.total) { f -= itms.total } while (l > itms.total) { l -= itms.total } while (f < 0) { f += itms.total } while (l < 0) { l += itms.total } } var c = y.children(), $i; if (l > f) { $i = c.slice(f, l) } else { $i = $(c.slice(f, itms.total).get().concat(c.slice(0, l).get())) } if (is_function(b)) { b.call($tt0, $i) } return $i }); y.bind(cf_e('ispaused', conf) + ' ' + cf_e('isstopped', conf) + ' ' + cf_e('isscrolling', conf), function(e, a) { e.stoppropagation(); var b = e.type.slice(conf.events.prefix.length), value = z[b]; if (is_function(a)) { a.call($tt0, value) } return value }); y.bind(cf_e('configuration', conf), function(e, a, b, c) { e.stoppropagation(); var d = false; if (is_function(a)) { a.call($tt0, opts) } else if (is_object(a)) { opts_orig = $.extend(true, {}, opts_orig, a); if (b !== false) d = true; else opts = $.extend(true, {}, opts, a) } else if (!is_undefined(a)) { if (is_function(b)) { var f = eval('opts.' + a); if (is_undefined(f)) { f = '' } b.call($tt0, f) } else if (!is_undefined(b)) { if (typeof c !== 'boolean') c = true; eval('opts_orig.' + a + ' = b'); if (c !== false) d = true; else eval('opts.' + a + ' = b') } else { return eval('opts.' + a) } } if (d) { sz_resetmargin(y.children(), opts); y._cfs_init(opts_orig); y._cfs_bind_buttons(); var g = sz_setsizes(y, opts); y.trigger(cf_e('updatepagestatus', conf), [true, g]) } return opts }); y.bind(cf_e('linkanchors', conf), function(e, a, b) { e.stoppropagation(); if (is_undefined(a)) { a = $('body') } else if (is_string(a)) { a = $(a) } if (!is_jquery(a) || a.length == 0) { return debug(conf, 'not a valid object.') } if (!is_string(b)) { b = 'a.caroufredsel' } a.find(b).each(function() { var h = this.hash || ''; if (h.length > 0 && y.children().index($(h)) != -1) { $(this).unbind('click').click(function(e) { e.preventdefault(); y.trigger(cf_e('slideto', conf), h) }) } }); return true }); y.bind(cf_e('updatepagestatus', conf), function(e, b, c) { e.stoppropagation(); if (!opts.pagination.container) { return } var d = opts.pagination.items || opts.items.visible, pgs = math.ceil(itms.total / d); if (b) { if (opts.pagination.anchorbuilder) { opts.pagination.container.children().remove(); opts.pagination.container.each(function() { for (var a = 0; a < pgs; a++) { var i = y.children().eq(gn_getitemindex(a * d, 0, true, itms, y)); $(this).append(opts.pagination.anchorbuilder.call(i[0], a + 1)) } }) } opts.pagination.container.each(function() { $(this).children().unbind(opts.pagination.event).each(function(a) { $(this).bind(opts.pagination.event, function(e) { e.preventdefault(); y.trigger(cf_e('slideto', conf), [a * d, -opts.pagination.deviation, true, opts.pagination]) }) }) }) } var f = y.triggerhandler(cf_e('currentpage', conf)) + opts.pagination.deviation; if (f >= pgs) { f = 0 } if (f < 0) { f = pgs - 1 } opts.pagination.container.each(function() { $(this).children().removeclass(cf_c('z-hov', conf)).eq(f).addclass(cf_c('z-hov', conf)) }); return true }); y.bind(cf_e('updatesizes', conf), function(e) { var a = opts.items.visible, a_itm = y.children(), avail_primary = ms_getparentsize($wrp, opts, 'width'); itms.total = a_itm.length; if (z.primarysizepercentage) { opts.maxdimension = avail_primary; opts[opts.d['width']] = ms_getpercentage(avail_primary, z.primarysizepercentage) } else { opts.maxdimension = ms_getmaxdimension(opts, avail_primary) } if (opts.responsive) { opts.items.width = opts.items.sizesconf.width; opts.items.height = opts.items.sizesconf.height; opts = in_getresponsivevalues(opts, a_itm, avail_primary); a = opts.items.visible; sz_setresponsivesizes(opts, a_itm) } else if (opts.items.visibleconf.variable) { a = gn_getvisibleitemsnext(a_itm, opts, 0) } else if (opts.items.filter != '*') { a = gn_getvisibleitemsnextfilter(a_itm, opts, 0) } if (!opts.circular && itms.first != 0 && a > itms.first) { if (opts.items.visibleconf.variable) { var b = gn_getvisibleitemsprev(a_itm, opts, itms.first) - itms.first } else if (opts.items.filter != '*') { var b = gn_getvisibleitemsprevfilter(a_itm, opts, itms.first) - itms.first } else { var b = opts.items.visible - itms.first } debug(conf, 'preventing non-circular: sliding ' + b + ' items backward.'); y.trigger(cf_e('prev', conf), b) } opts.items.visible = cf_getitemsadjust(a, opts, opts.items.visibleconf.adjust, $tt0); opts.items.visibleconf.old = opts.items.visible; opts = in_getalignpadding(opts, a_itm); var c = sz_setsizes(y, opts); y.trigger(cf_e('updatepagestatus', conf), [true, c]); nv_shownavi(opts, itms.total, conf); nv_enablenavi(opts, itms.first, conf); return c }); y.bind(cf_e('destroy', conf), function(e, a) { e.stoppropagation(); tmrs = sc_cleartimers(tmrs); y.data('_cfs_iscarousel', false); y.trigger(cf_e('finish', conf)); if (a) { y.trigger(cf_e('jumptostart', conf)) } sz_resetmargin(y.children(), opts); if (opts.responsive) { y.children().each(function() { $(this).css($(this).data('_cfs_origcsssizes')) }) } y.css(y.data('_cfs_origcss')); y._cfs_unbind_events(); y._cfs_unbind_buttons(); $wrp.replacewith(y); return true }); y.bind(cf_e('debug', conf), function(e) { debug(conf, 'carousel width: ' + opts.width); debug(conf, 'carousel height: ' + opts.height); debug(conf, 'item widths: ' + opts.items.width); debug(conf, 'item heights: ' + opts.items.height); debug(conf, 'number of items visible: ' + opts.items.visible); if (opts.auto.play) { debug(conf, 'number of items scrolled automatically: ' + opts.auto.items) } if (opts.prev.button) { debug(conf, 'number of items scrolled backward: ' + opts.prev.items) } if (opts.next.button) { debug(conf, 'number of items scrolled forward: ' + opts.next.items) } return conf.debug }); y.bind('_cfs_triggerevent', function(e, n, o) { e.stoppropagation(); return y.triggerhandler(cf_e(n, conf), o) }) }; y._cfs_unbind_events = function() { y.unbind(cf_e('', conf)); y.unbind(cf_e('', conf, false)); y.unbind('_cfs_triggerevent') }; y._cfs_bind_buttons = function() { y._cfs_unbind_buttons(); nv_shownavi(opts, itms.total, conf); nv_enablenavi(opts, itms.first, conf); if (opts.auto.pauseonhover) { var b = bt_pauseonhoverconfig(opts.auto.pauseonhover); $wrp.bind(cf_e('mouseenter', conf, false), function() { y.trigger(cf_e('pause', conf), b) }).bind(cf_e('mouseleave', conf, false), function() { y.trigger(cf_e('resume', conf)) }) } if (opts.auto.button) { opts.auto.button.bind(cf_e(opts.auto.event, conf, false), function(e) { e.preventdefault(); var a = false, b = null; if (z.ispaused) { a = 'play' } else if (opts.auto.pauseonevent) { a = 'pause'; b = bt_pauseonhoverconfig(opts.auto.pauseonevent) } if (a) { y.trigger(cf_e(a, conf), b) } }) } if (opts.prev.button) { opts.prev.button.bind(cf_e(opts.prev.event, conf, false), function(e) { e.preventdefault(); y.trigger(cf_e('prev', conf)) }); if (opts.prev.pauseonhover) { var b = bt_pauseonhoverconfig(opts.prev.pauseonhover); opts.prev.button.bind(cf_e('mouseenter', conf, false), function() { y.trigger(cf_e('pause', conf), b) }).bind(cf_e('mouseleave', conf, false), function() { y.trigger(cf_e('resume', conf)) }) } } if (opts.next.button) { opts.next.button.bind(cf_e(opts.next.event, conf, false), function(e) { e.preventdefault(); y.trigger(cf_e('next', conf)) }); if (opts.next.pauseonhover) { var b = bt_pauseonhoverconfig(opts.next.pauseonhover); opts.next.button.bind(cf_e('mouseenter', conf, false), function() { y.trigger(cf_e('pause', conf), b) }).bind(cf_e('mouseleave', conf, false), function() { y.trigger(cf_e('resume', conf)) }) } } if (opts.pagination.container) { if (opts.pagination.pauseonhover) { var b = bt_pauseonhoverconfig(opts.pagination.pauseonhover); opts.pagination.container.bind(cf_e('mouseenter', conf, false), function() { y.trigger(cf_e('pause', conf), b) }).bind(cf_e('mouseleave', conf, false), function() { y.trigger(cf_e('resume', conf)) }) } } if (opts.prev.key || opts.next.key) { $(document).bind(cf_e('keyup', conf, false, true, true), function(e) { var k = e.keycode; if (k == opts.next.key) { e.preventdefault(); y.trigger(cf_e('next', conf)) } if (k == opts.prev.key) { e.preventdefault(); y.trigger(cf_e('prev', conf)) } }) } if (opts.pagination.keys) { $(document).bind(cf_e('keyup', conf, false, true, true), function(e) { var k = e.keycode; if (k >= 49 && k < 58) { k = (k - 49) * opts.items.visible; if (k <= itms.total) { e.preventdefault(); y.trigger(cf_e('slideto', conf), [k, 0, true, opts.pagination]) } } }) } if (opts.prev.wipe || opts.next.wipe) { deprecated('the touchwipe-plugin', 'the touchswipe-plugin'); if ($.fn.touchwipe) { var c = (opts.prev.wipe) ? function() { y.trigger(cf_e('prev', conf)) } : null, wn = (opts.next.wipe) ? function() { y.trigger(cf_e('next', conf)) } : null; if (wn || wn) { if (!z.touchwipe) { z.touchwipe = true; var d = { 'min_move_x': 30, 'min_move_y': 30, 'preventdefaultevents': true }; switch (opts.direction) { case 'up': case 'down': d.wipeup = c; d.wipedown = wn; break; default: d.wipeleft = wn; d.wiperight = c } $wrp.touchwipe(d) } } } } if ($.fn.swipe) { var f = 'ontouchstart' in window; if ((f && opts.swipe.ontouch) || (!f && opts.swipe.onmouse)) { var g = $.extend(true, {}, opts.prev, opts.swipe), scn = $.extend(true, {}, opts.next, opts.swipe), swp = function() { y.trigger(cf_e('prev', conf), [g]) }, swn = function() { y.trigger(cf_e('next', conf), [scn]) }; switch (opts.direction) { case 'up': case 'down': opts.swipe.options.swipeup = swn; opts.swipe.options.swipedown = swp; break; default: opts.swipe.options.swipeleft = swn; opts.swipe.options.swiperight = swp } if (z.swipe) { y.swipe('destroy') } $wrp.swipe(opts.swipe.options); $wrp.css('cursor', 'move'); z.swipe = true } } if ($.fn.mousewheel) { if (opts.prev.mousewheel) { deprecated('the prev.mousewheel option', 'the mousewheel configuration object'); opts.prev.mousewheel = null; opts.mousewheel = { items: bt_mousesheelnumber(opts.prev.mousewheel) } } if (opts.next.mousewheel) { deprecated('the next.mousewheel option', 'the mousewheel configuration object'); opts.next.mousewheel = null; opts.mousewheel = { items: bt_mousesheelnumber(opts.next.mousewheel) } } if (opts.mousewheel) { var h = $.extend(true, {}, opts.prev, opts.mousewheel), mcn = $.extend(true, {}, opts.next, opts.mousewheel); if (z.mousewheel) { $wrp.unbind(cf_e('mousewheel', conf, false)) } $wrp.bind(cf_e('mousewheel', conf, false), function(e, a) { e.preventdefault(); if (a > 0) { y.trigger(cf_e('prev', conf), [h]) } else { y.trigger(cf_e('next', conf), [mcn]) } }); z.mousewheel = true } } if (opts.auto.play) { y.trigger(cf_e('play', conf), opts.auto.delay) } if (z.updateonwindowresize) { var i = function(e) { y.trigger(cf_e('finish', conf)); if (opts.auto.pauseonresize && !z.ispaused) { y.trigger(cf_e('play', conf)) } sz_resetmargin(y.children(), opts); y.trigger(cf_e('updatesizes', conf)) }; var j = $(window), onresize = null; if ($.debounce && conf.onwindowresize == 'debounce') { onresize = $.debounce(200, i) } else if ($.throttle && conf.onwindowresize == 'throttle') { onresize = $.throttle(300, i) } else { var l = 0, _windowheight = 0; onresize = function() { var a = j.width(), nh = j.height(); if (a != l || nh != _windowheight) { i(); l = a; _windowheight = nh } } } j.bind(cf_e('resize', conf, false, true, true), onresize) } }; y._cfs_unbind_buttons = function() { var a = cf_e('', conf), ns2 = cf_e('', conf, false); ns3 = cf_e('', conf, false, true, true); $(document).unbind(ns3); $(window).unbind(ns3); $wrp.unbind(ns2); if (opts.auto.button) { opts.auto.button.unbind(ns2) } if (opts.prev.button) { opts.prev.button.unbind(ns2) } if (opts.next.button) { opts.next.button.unbind(ns2) } if (opts.pagination.container) { opts.pagination.container.unbind(ns2); if (opts.pagination.anchorbuilder) { opts.pagination.container.children().remove() } } if (z.swipe) { y.swipe('destroy'); $wrp.css('cursor', 'default'); z.swipe = false } if (z.mousewheel) { z.mousewheel = false } nv_shownavi(opts, 'hide', conf); nv_enablenavi(opts, 'removeclass', conf) }; if (is_boolean(w)) { w = { 'debug': w } } var z = { 'direction': 'next', 'ispaused': true, 'isscrolling': false, 'isstopped': false, 'mousewheel': false, 'swipe': false }, itms = { 'total': y.children().length, 'first': 0 }, tmrs = { 'auto': null, 'progress': null, 'starttime': gettime(), 'timepassed': 0 }, scrl = { 'isstopped': false, 'duration': 0, 'starttime': 0, 'easing': '', 'anims': [] }, clbk = { 'onbefore': [], 'onafter': [] }, queu = [], conf = $.extend(true, {}, $.fn.caroufredsel.configs, w), opts = {}, opts_orig = $.extend(true, {}, u), $wrp = y.wrap('<' + conf.wrapper.element + ' class="' + conf.wrapper.classname + '" />').parent(); conf.selector = y.selector; conf.serialnumber = $.fn.caroufredsel.serialnumber++; y._cfs_init(opts_orig, true, starting_position); y._cfs_build(); y._cfs_bind_events(); y._cfs_bind_buttons(); if (is_array(opts.items.start)) { var a = opts.items.start } else { var a = []; if (opts.items.start != 0) { a.push(opts.items.start) } } if (opts.cookie) { a.unshift(parseint(cf_getcookie(opts.cookie), 10)) } if (a.length > 0) { for (var a = 0, l = a.length; a < l; a++) { var s = a[a]; if (s == 0) { continue } if (s === true) { s = window.location.hash; if (s.length < 1) { continue } } else if (s === 'random') { s = math.floor(math.random() * itms.total) } if (y.triggerhandler(cf_e('slideto', conf), [s, 0, true, { fx: 'none' }])) { break } } } var b = sz_setsizes(y, opts), itm = gi_getcurrentitems(y.children(), opts); if (opts.oncreate) { opts.oncreate.call($tt0, { 'width': b.width, 'height': b.height, 'items': itm }) } y.trigger(cf_e('updatepagestatus', conf), [true, b]); y.trigger(cf_e('linkanchors', conf)); if (conf.debug) { y.trigger(cf_e('debug', conf)) } return y }; $.fn.caroufredsel.serialnumber = 1; $.fn.caroufredsel.defaults = { 'synchronise': false, 'infinite': true, 'circular': true, 'responsive': false, 'direction': 'left', 'items': { 'start': 0 }, 'scroll': { 'easing': 'swing', 'duration': 500, 'pauseonhover': false, 'event': 'click', 'queue': false } }; $.fn.caroufredsel.configs = { 'debug': false, 'onwindowresize': 'throttle', 'events': { 'prefix': '', 'namespace': 'cfs' }, 'wrapper': { 'element': 'div', 'classname': 'caroufredsel_wrapper' }, 'classnames': {} }; $.fn.caroufredsel.pageanchorbuilder = function(a) { return '' + a + '' }; $.fn.caroufredsel.progressbarupdater = function(a) { $(this).css('width', a + '%') }; $.fn.caroufredsel.cookie = { get: function(n) { n += '='; var b = document.cookie.split(';'); for (var a = 0, l = b.length; a < l; a++) { var c = b[a]; while (c.charat(0) == ' ') { c = c.slice(1) } if (c.indexof(n) == 0) { return c.slice(n.length) } } return 0 }, set: function(n, v, d) { var e = ""; if (d) { var a = new date(); a.settime(a.gettime() + (d * 24 * 60 * 60 * 1000)); e = "; expires=" + a.togmtstring() } document.cookie = n + '=' + v + e + '; path=/' }, remove: function(n) { $.fn.caroufredsel.cookie.set(n, "", -1) } }; function sc_setscroll(d, e) { return { anims: [], duration: d, orgduration: d, easing: e, starttime: gettime() } } function sc_startscroll(s) { if (is_object(s.pre)) { sc_startscroll(s.pre) } for (var a = 0, l = s.anims.length; a < l; a++) { var b = s.anims[a]; if (!b) { continue } if (b[3]) { b[0].stop() } b[0].animate(b[1], { complete: b[2], duration: s.duration, easing: s.easing }) } if (is_object(s.post)) { sc_startscroll(s.post) } } function sc_stopscroll(s, c) { if (!is_boolean(c)) { c = true } if (is_object(s.pre)) { sc_stopscroll(s.pre, c) } for (var a = 0, l = s.anims.length; a < l; a++) { var b = s.anims[a]; b[0].stop(true); if (c) { b[0].css(b[1]); if (is_function(b[2])) { b[2]() } } } if (is_object(s.post)) { sc_stopscroll(s.post, c) } } function sc_afterscroll(a, b, o) { if (b) { b.remove() } switch (o.fx) { case 'fade': case 'crossfade': case 'cover-fade': case 'uncover-fade': a.css('filter', ''); break } } function sc_firecallbacks(d, o, b, a, c) { if (o[b]) { o[b].call(d, a) } if (c[b].length) { for (var i = 0, l = c[b].length; i < l; i++) { c[b][i].call(d, a) } } return [] } function sc_firequeue(a, q, c) { if (q.length) { a.trigger(cf_e(q[0][0], c), q[0][1]); q.shift() } return q } function sc_hidehiddenitems(b) { b.each(function() { var a = $(this); a.data('_cfs_ishidden', a.is(':hidden')).hide() }) } function sc_showhiddenitems(b) { if (b) { b.each(function() { var a = $(this); if (!a.data('_cfs_ishidden')) { a.show() } }) } } function sc_cleartimers(t) { if (t.auto) { cleartimeout(t.auto) } if (t.progress) { clearinterval(t.progress) } return t } function sc_mapcallbackarguments(a, b, c, d, e, f, g) { return { 'width': g.width, 'height': g.height, 'items': { 'old': a, 'skipped': b, 'visible': c, 'new': c }, 'scroll': { 'items': d, 'direction': e, 'duration': f } } } function sc_getduration(a, o, b, c) { var d = a.duration; if (a.fx == 'none') { return 0 } if (d == 'auto') { d = o.scroll.duration / o.scroll.items * b } else if (d < 10) { d = c / d } if (d < 1) { return 0 } if (a.fx == 'fade') { d = d / 2 } return math.round(d) } function nv_shownavi(o, t, c) { var a = (is_number(o.items.minimum)) ? o.items.minimum : o.items.visible + 1; if (t == 'show' || t == 'hide') { var f = t } else if (a > t) { debug(c, 'not enough items (' + t + ' total, ' + a + ' needed): hiding navigation.'); var f = 'hide' } else { var f = 'show' } var s = (f == 'show') ? 'removeclass' : 'addclass', h = cf_c('hidden', c); if (o.auto.button) { o.auto.button[f]()[s](h) } if (o.prev.button) { o.prev.button[f]()[s](h) } if (o.next.button) { o.next.button[f]()[s](h) } if (o.pagination.container) { o.pagination.container[f]()[s](h) } } function nv_enablenavi(o, f, c) { if (o.circular || o.infinite) return; var a = (f == 'removeclass' || f == 'addclass') ? f : false, di = cf_c('disabled', c); if (o.auto.button && a) { o.auto.button[a](di) } if (o.prev.button) { var b = a || (f == 0) ? 'addclass' : 'removeclass'; o.prev.button[b](di) } if (o.next.button) { var b = a || (f == o.items.visible) ? 'addclass' : 'removeclass'; o.next.button[b](di) } } function go_getobject(a, b) { if (is_function(b)) { b = b.call(a) } else if (is_undefined(b)) { b = {} } return b } function go_getitemsobject(a, b) { b = go_getobject(a, b); if (is_number(b)) { b = { 'visible': b } } else if (b == 'variable') { b = { 'visible': b, 'width': b, 'height': b } } else if (!is_object(b)) { b = {} } return b } function go_getscrollobject(a, b) { b = go_getobject(a, b); if (is_number(b)) { if (b <= 50) { b = { 'items': b } } else { b = { 'duration': b } } } else if (is_string(b)) { b = { 'easing': b } } else if (!is_object(b)) { b = {} } return b } function go_getnaviobject(a, b) { b = go_getobject(a, b); if (is_string(b)) { var c = cf_getkeycode(b); if (c == -1) { b = $(b) } else { b = c } } return b } function go_getautoobject(a, b) { b = go_getnaviobject(a, b); if (is_jquery(b)) { b = { 'button': b } } else if (is_boolean(b)) { b = { 'play': b } } else if (is_number(b)) { b = { 'timeoutduration': b } } if (b.progress) { if (is_string(b.progress) || is_jquery(b.progress)) { b.progress = { 'bar': b.progress } } } return b } function go_complementautoobject(a, b) { if (is_function(b.button)) { b.button = b.button.call(a) } if (is_string(b.button)) { b.button = $(b.button) } if (!is_boolean(b.play)) { b.play = true } if (!is_number(b.delay)) { b.delay = 0 } if (is_undefined(b.pauseonevent)) { b.pauseonevent = true } if (!is_boolean(b.pauseonresize)) { b.pauseonresize = true } if (!is_number(b.timeoutduration)) { b.timeoutduration = (b.duration < 10) ? 2500 : b.duration * 5 } if (b.progress) { if (is_function(b.progress.bar)) { b.progress.bar = b.progress.bar.call(a) } if (is_string(b.progress.bar)) { b.progress.bar = $(b.progress.bar) } if (b.progress.bar) { if (!is_function(b.progress.updater)) { b.progress.updater = $.fn.caroufredsel.progressbarupdater } if (!is_number(b.progress.interval)) { b.progress.interval = 50 } } else { b.progress = false } } return b } function go_getprevnextobject(a, b) { b = go_getnaviobject(a, b); if (is_jquery(b)) { b = { 'button': b } } else if (is_number(b)) { b = { 'key': b } } return b } function go_complementprevnextobject(a, b) { if (is_function(b.button)) { b.button = b.button.call(a) } if (is_string(b.button)) { b.button = $(b.button) } if (is_string(b.key)) { b.key = cf_getkeycode(b.key) } return b } function go_getpaginationobject(a, b) { b = go_getnaviobject(a, b); if (is_jquery(b)) { b = { 'container': b } } else if (is_boolean(b)) { b = { 'keys': b } } return b } function go_complementpaginationobject(a, b) { if (is_function(b.container)) { b.container = b.container.call(a) } if (is_string(b.container)) { b.container = $(b.container) } if (!is_number(b.items)) { b.items = false } if (!is_boolean(b.keys)) { b.keys = false } if (!is_function(b.anchorbuilder) && !is_false(b.anchorbuilder)) { b.anchorbuilder = $.fn.caroufredsel.pageanchorbuilder } if (!is_number(b.deviation)) { b.deviation = 0 } return b } function go_getswipeobject(a, b) { if (is_function(b)) { b = b.call(a) } if (is_undefined(b)) { b = { 'ontouch': false } } if (is_true(b)) { b = { 'ontouch': b } } else if (is_number(b)) { b = { 'items': b } } return b } function go_complementswipeobject(a, b) { if (!is_boolean(b.ontouch)) { b.ontouch = true } if (!is_boolean(b.onmouse)) { b.onmouse = false } if (!is_object(b.options)) { b.options = {} } if (!is_boolean(b.options.triggerontouchend)) { b.options.triggerontouchend = false } return b } function go_getmousewheelobject(a, b) { if (is_function(b)) { b = b.call(a) } if (is_true(b)) { b = {} } else if (is_number(b)) { b = { 'items': b } } else if (is_undefined(b)) { b = false } return b } function go_complementmousewheelobject(a, b) { return b } function gn_getitemindex(a, b, c, d, e) { if (is_string(a)) { a = $(a, e) } if (is_object(a)) { a = $(a, e) } if (is_jquery(a)) { a = e.children().index(a); if (!is_boolean(c)) { c = false } } else { if (!is_boolean(c)) { c = true } } if (!is_number(a)) { a = 0 } if (!is_number(b)) { b = 0 } if (c) { a += d.first } a += b; if (d.total > 0) { while (a >= d.total) { a -= d.total } while (a < 0) { a += d.total } } return a } function gn_getvisibleitemsprev(i, o, s) { var t = 0, x = 0; for (var a = s; a >= 0; a--) { var j = i.eq(a); t += (j.is(':visible')) ? j[o.d['outerwidth']](true) : 0; if (t > o.maxdimension) { return x } if (a == 0) { a = i.length } x++ } } function gn_getvisibleitemsprevfilter(i, o, s) { return gn_getitemsprevfilter(i, o.items.filter, o.items.visibleconf.org, s) } function gn_getscrollitemsprevfilter(i, o, s, m) { return gn_getitemsprevfilter(i, o.items.filter, m, s) } function gn_getitemsprevfilter(i, f, m, s) { var t = 0, x = 0; for (var a = s, l = i.length; a >= 0; a--) { x++; if (x == l) { return x } var j = i.eq(a); if (j.is(f)) { t++; if (t == m) { return x } } if (a == 0) { a = l } } } function gn_getvisibleorg(a, o) { return o.items.visibleconf.org || a.children().slice(0, o.items.visible).filter(o.items.filter).length } function gn_getvisibleitemsnext(i, o, s) { var t = 0, x = 0; for (var a = s, l = i.length - 1; a <= l; a++) { var j = i.eq(a); t += (j.is(':visible')) ? j[o.d['outerwidth']](true) : 0; if (t > o.maxdimension) { return x } x++; if (x == l + 1) { return x } if (a == l) { a = -1 } } } function gn_getvisibleitemsnexttestcircular(i, o, s, l) { var v = gn_getvisibleitemsnext(i, o, s); if (!o.circular) { if (s + v > l) { v = l - s } } return v } function gn_getvisibleitemsnextfilter(i, o, s) { return gn_getitemsnextfilter(i, o.items.filter, o.items.visibleconf.org, s, o.circular) } function gn_getscrollitemsnextfilter(i, o, s, m) { return gn_getitemsnextfilter(i, o.items.filter, m + 1, s, o.circular) - 1 } function gn_getitemsnextfilter(i, f, m, s, c) { var t = 0, x = 0; for (var a = s, l = i.length - 1; a <= l; a++) { x++; if (x >= l) { return x } var j = i.eq(a); if (j.is(f)) { t++; if (t == m) { return x } } if (a == l) { a = -1 } } } function gi_getcurrentitems(i, o) { return i.slice(0, o.items.visible) } function gi_getolditemsprev(i, o, n) { return i.slice(n, o.items.visibleconf.old + n) } function gi_getnewitemsprev(i, o) { return i.slice(0, o.items.visible) } function gi_getolditemsnext(i, o) { return i.slice(0, o.items.visibleconf.old) } function gi_getnewitemsnext(i, o, n) { return i.slice(n, o.items.visible + n) } function sz_storemargin(i, o, d) { if (o.usepadding) { if (!is_string(d)) { d = '_cfs_origcssmargin' } i.each(function() { var j = $(this), m = parseint(j.css(o.d['marginright']), 10); if (!is_number(m)) { m = 0 } j.data(d, m) }) } } function sz_resetmargin(i, o, m) { if (o.usepadding) { var x = (is_boolean(m)) ? m : false; if (!is_number(m)) { m = 0 } sz_storemargin(i, o, '_cfs_tempcssmargin'); i.each(function() { var j = $(this); j.css(o.d['marginright'], ((x) ? j.data('_cfs_tempcssmargin') : m + j.data('_cfs_origcssmargin'))) }) } } function sz_storesizes(i, o) { if (o.responsive) { i.each(function() { var j = $(this), s = in_mapcss(j, ['width', 'height']); j.data('_cfs_origcsssizes', s) }) } } function sz_setresponsivesizes(o, b) { var c = o.items.visible, news = o.items[o.d['width']], seco = o[o.d['height']], secp = is_percentage(seco); b.each(function() { var a = $(this), nw = news - ms_getpaddingbordermargin(a, o, 'width'); a[o.d['width']](nw); if (secp) { a[o.d['height']](ms_getpercentage(nw, seco)) } }) } function sz_setsizes(a, o) { var b = a.parent(), $i = a.children(), $v = gi_getcurrentitems($i, o), sz = cf_mapwrappersizes(ms_getsizes($v, o, true), o, false); b.css(sz); if (o.usepadding) { var p = o.padding, r = p[o.d[1]]; if (o.align && r < 0) { r = 0 } var c = $v.last(); c.css(o.d['marginright'], c.data('_cfs_origcssmargin') + r); a.css(o.d['top'], p[o.d[0]]); a.css(o.d['left'], p[o.d[3]]) } a.css(o.d['width'], sz[o.d['width']] + (ms_gettotalsize($i, o, 'width') * 2)); a.css(o.d['height'], ms_getlargestsize($i, o, 'height')); return sz } function ms_getsizes(i, o, a) { return [ms_gettotalsize(i, o, 'width', a), ms_getlargestsize(i, o, 'height', a)] } function ms_getlargestsize(i, o, a, b) { if (!is_boolean(b)) { b = false } if (is_number(o[o.d[a]]) && b) { return o[o.d[a]] } if (is_number(o.items[o.d[a]])) { return o.items[o.d[a]] } a = (a.tolowercase().indexof('width') > -1) ? 'outerwidth' : 'outerheight'; return ms_gettruelargestsize(i, o, a) } function ms_gettruelargestsize(i, o, b) { var s = 0; for (var a = 0, l = i.length; a < l; a++) { var j = i.eq(a); var m = (j.is(':visible')) ? j[o.d[b]](true) : 0; if (s < m) { s = m } } return s } function ms_gettotalsize(i, o, b, c) { if (!is_boolean(c)) { c = false } if (is_number(o[o.d[b]]) && c) { return o[o.d[b]] } if (is_number(o.items[o.d[b]])) { return o.items[o.d[b]] * i.length } var d = (b.tolowercase().indexof('width') > -1) ? 'outerwidth' : 'outerheight', s = 0; for (var a = 0, l = i.length; a < l; a++) { var j = i.eq(a); s += (j.is(':visible')) ? j[o.d[d]](true) : 0 } return s } function ms_getparentsize(a, o, d) { var b = a.is(':visible'); if (b) { a.hide() } var s = a.parent()[o.d[d]](); if (b) { a.show() } return s } function ms_getmaxdimension(o, a) { return (is_number(o[o.d['width']])) ? o[o.d['width']] : a } function ms_hasvariablesizes(i, o, b) { var s = false, v = false; for (var a = 0, l = i.length; a < l; a++) { var j = i.eq(a); var c = (j.is(':visible')) ? j[o.d[b]](true) : 0; if (s === false) { s = c } else if (s != c) { v = true } if (s == 0) { v = true } } return v } function ms_getpaddingbordermargin(i, o, d) { return i[o.d['outer' + d]](true) - i[o.d[d.tolowercase()]]() } function ms_getpercentage(s, o) { if (is_percentage(o)) { o = parseint(o.slice(0, -1), 10); if (!is_number(o)) { return s } s *= o / 100 } return s } function cf_e(n, c, a, b, d) { if (!is_boolean(a)) { a = true } if (!is_boolean(b)) { b = true } if (!is_boolean(d)) { d = false } if (a) { n = c.events.prefix + n } if (b) { n = n + '.' + c.events.namespace } if (b && d) { n += c.serialnumber } return n } function cf_c(n, c) { return (is_string(c.classnames[n])) ? c.classnames[n] : n } function cf_mapwrappersizes(a, o, p) { if (!is_boolean(p)) { p = true } var b = (o.usepadding && p) ? o.padding : [0, 0, 0, 0]; var c = {}; c[o.d['width']] = a[0] + b[1] + b[3]; c[o.d['height']] = a[1] + b[0] + b[2]; return c } function cf_sortparams(c, d) { var e = []; for (var a = 0, l1 = c.length; a < l1; a++) { for (var b = 0, l2 = d.length; b < l2; b++) { if (d[b].indexof(typeof c[a]) > -1 && is_undefined(e[b])) { e[b] = c[a]; break } } } return e } function cf_getpadding(p) { if (is_undefined(p)) { return [0, 0, 0, 0] } if (is_number(p)) { return [p, p, p, p] } if (is_string(p)) { p = p.split('px').join('').split('em').join('').split(' ') } if (!is_array(p)) { return [0, 0, 0, 0] } for (var i = 0; i < 4; i++) { p[i] = parseint(p[i], 10) } switch (p.length) { case 0: return [0, 0, 0, 0]; case 1: return [p[0], p[0], p[0], p[0]]; case 2: return [p[0], p[1], p[0], p[1]]; case 3: return [p[0], p[1], p[2], p[1]]; default: return [p[0], p[1], p[2], p[3]] } } function cf_getalignpadding(a, o) { var x = (is_number(o[o.d['width']])) ? math.ceil(o[o.d['width']] - ms_gettotalsize(a, o, 'width')) : 0; switch (o.align) { case 'left': return [0, x]; case 'right': return [x, 0]; case 'center': default: return [math.ceil(x / 2), math.floor(x / 2)] } } function cf_getdimensions(o) { var a = [ ['width', 'innerwidth', 'outerwidth', 'height', 'innerheight', 'outerheight', 'left', 'top', 'marginright', 0, 1, 2, 3], ['height', 'innerheight', 'outerheight', 'width', 'innerwidth', 'outerwidth', 'top', 'left', 'marginbottom', 3, 2, 1, 0] ]; var b = a[0].length, dx = (o.direction == 'right' || o.direction == 'left') ? 0 : 1; var c = {}; for (var d = 0; d < b; d++) { c[a[0][d]] = a[dx][d] } return c } function cf_getadjust(x, o, a, b) { var v = x; if (is_function(a)) { v = a.call(b, v) } else if (is_string(a)) { var p = a.split('+'), m = a.split('-'); if (m.length > p.length) { var c = true, sta = m[0], adj = m[1] } else { var c = false, sta = p[0], adj = p[1] } switch (sta) { case 'even': v = (x % 2 == 1) ? x - 1 : x; break; case 'odd': v = (x % 2 == 0) ? x - 1 : x; break; default: v = x; break } adj = parseint(adj, 10); if (is_number(adj)) { if (c) { adj = -adj } v += adj } } if (!is_number(v) || v < 1) { v = 1 } return v } function cf_getitemsadjust(x, o, a, b) { return cf_getitemadjustminmax(cf_getadjust(x, o, a, b), o.items.visibleconf) } function cf_getitemadjustminmax(v, i) { if (is_number(i.min) && v < i.min) { v = i.min } if (is_number(i.max) && v > i.max) { v = i.max } if (v < 1) { v = 1 } return v } function cf_getsyncharr(s) { if (!is_array(s)) { s = [ [s] ] } if (!is_array(s[0])) { s = [s] } for (var j = 0, l = s.length; j < l; j++) { if (is_string(s[j][0])) { s[j][0] = $(s[j][0]) } if (!is_boolean(s[j][1])) { s[j][1] = true } if (!is_boolean(s[j][2])) { s[j][2] = true } if (!is_number(s[j][3])) { s[j][3] = 0 } } return s } function cf_getkeycode(k) { if (k == 'right') { return 39 } if (k == 'left') { return 37 } if (k == 'up') { return 38 } if (k == 'down') { return 40 } return -1 } function cf_setcookie(n, a, c) { if (n) { var v = a.triggerhandler(cf_e('currentposition', c)); $.fn.caroufredsel.cookie.set(n, v) } } function cf_getcookie(n) { var c = $.fn.caroufredsel.cookie.get(n); return (c == '') ? 0 : c } function in_mapcss(a, b) { var c = {}, prop; for (var p = 0, l = b.length; p < l; p++) { prop = b[p]; c[prop] = a.css(prop) } return c } function in_complementitems(a, b, c, d) { if (!is_object(a.visibleconf)) { a.visibleconf = {} } if (!is_object(a.sizesconf)) { a.sizesconf = {} } if (a.start == 0 && is_number(d)) { a.start = d } if (is_object(a.visible)) { a.visibleconf.min = a.visible.min; a.visibleconf.max = a.visible.max; a.visible = false } else if (is_string(a.visible)) { if (a.visible == 'variable') { a.visibleconf.variable = true } else { a.visibleconf.adjust = a.visible } a.visible = false } else if (is_function(a.visible)) { a.visibleconf.adjust = a.visible; a.visible = false } if (!is_string(a.filter)) { a.filter = (c.filter(':hidden').length > 0) ? ':visible' : '*' } if (!a[b.d['width']]) { if (b.responsive) { debug(true, 'set a ' + b.d['width'] + ' for the items!'); a[b.d['width']] = ms_gettruelargestsize(c, b, 'outerwidth') } else { a[b.d['width']] = (ms_hasvariablesizes(c, b, 'outerwidth')) ? 'variable' : c[b.d['outerwidth']](true) } } if (!a[b.d['height']]) { a[b.d['height']] = (ms_hasvariablesizes(c, b, 'outerheight')) ? 'variable' : c[b.d['outerheight']](true) } a.sizesconf.width = a.width; a.sizesconf.height = a.height; return a } function in_complementvisibleitems(a, b) { if (a.items[a.d['width']] == 'variable') { a.items.visibleconf.variable = true } if (!a.items.visibleconf.variable) { if (is_number(a[a.d['width']])) { a.items.visible = math.floor(a[a.d['width']] / a.items[a.d['width']]) } else { a.items.visible = math.floor(b / a.items[a.d['width']]); a[a.d['width']] = a.items.visible * a.items[a.d['width']]; if (!a.items.visibleconf.adjust) { a.align = false } } if (a.items.visible == 'infinity' || a.items.visible < 1) { debug(true, 'not a valid number of visible items: set to "variable".'); a.items.visibleconf.variable = true } } return a } function in_complementprimarysize(a, b, c) { if (a == 'auto') { a = ms_gettruelargestsize(c, b, 'outerwidth') } return a } function in_complementsecondarysize(a, b, c) { if (a == 'auto') { a = ms_gettruelargestsize(c, b, 'outerheight') } if (!a) { a = b.items[b.d['height']] } return a } function in_getalignpadding(o, a) { var p = cf_getalignpadding(gi_getcurrentitems(a, o), o); o.padding[o.d[1]] = p[1]; o.padding[o.d[3]] = p[0]; return o } function in_getresponsivevalues(o, a, b) { var c = cf_getitemadjustminmax(math.ceil(o[o.d['width']] / o.items[o.d['width']]), o.items.visibleconf); if (c > a.length) { c = a.length } var d = math.floor(o[o.d['width']] / c); o.items.visible = c; o.items[o.d['width']] = d; o[o.d['width']] = c * d; return o } function bt_pauseonhoverconfig(p) { if (is_string(p)) { var i = (p.indexof('immediate') > -1) ? true : false, r = (p.indexof('resume') > -1) ? true : false } else { var i = r = false } return [i, r] } function bt_mousesheelnumber(a) { return (is_number(a)) ? a : null } function is_null(a) { return (a === null) } function is_undefined(a) { return (is_null(a) || typeof a == 'undefined' || a === '' || a === 'undefined') } function is_array(a) { return (a instanceof array) } function is_jquery(a) { return (a instanceof jquery) } function is_object(a) { return ((a instanceof object || typeof a == 'object') && !is_null(a) && !is_jquery(a) && !is_array(a)) } function is_number(a) { return ((a instanceof number || typeof a == 'number') && !isnan(a)) } function is_string(a) { return ((a instanceof string || typeof a == 'string') && !is_undefined(a) && !is_true(a) && !is_false(a)) } function is_function(a) { return (a instanceof function || typeof a == 'function') } function is_boolean(a) { return (a instanceof boolean || typeof a == 'boolean' || is_true(a) || is_false(a)) } function is_true(a) { return (a === true || a === 'true') } function is_false(a) { return (a === false || a === 'false') } function is_percentage(x) { return (is_string(x) && x.slice(-1) == '%') } function gettime() { return new date().gettime() } function deprecated(o, n) { debug(true, o + ' is deprecated, support for it will be removed. use ' + n + ' instead.') } function debug(d, m) { if (is_object(d)) { var s = ' (' + d.selector + ')'; d = d.debug } else { var s = '' } if (!d) { return false } if (is_string(m)) { m = 'caroufredsel' + s + ': ' + m } else { m = ['caroufredsel' + s + ':', m] } if (window.console && window.console.log) { window.console.log(m) } return false } $.extend($.easing, { 'quadratic': function(t) { var a = t * t; return t * (-a * t + 4 * a - 6 * t + 4) }, 'cubic': function(t) { return t * (4 * t * t - 9 * t + 6) }, 'elastic': function(t) { var a = t * t; return t * (33 * a * a - 106 * a * t + 126 * a - 67 * t + 15) } }) })(jquery);