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