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