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