1 2 3/************************************************************************** 4 * jquery.themepunch.revolution.js - jQuery Plugin for Revolution Slider 5 * @version: 4.2.5 (12.03.2013) 6 * @requires jQuery v1.7 or later (tested on 1.9) 7 * @author ThemePunch 8**************************************************************************/ 9 10(function(jQuery,undefined){ 11 12 13 //////////////////////////////////////// 14 // THE REVOLUTION PLUGIN STARTS HERE // 15 /////////////////////////////////////// 16 17 jQuery.fn.extend({ 18 19 // OUR PLUGIN HERE :) 20 revolution: function(options) { 21 22 23 24 //////////////////////////////// 25 // SET DEFAULT VALUES OF ITEM // 26 //////////////////////////////// 27 jQuery.fn.revolution.defaults = { 28 delay:9000, 29 startheight:500, 30 startwidth:960, 31 fullScreenAlignForce:"off", 32 autoHeight:"off", 33 34 hideThumbs:200, 35 36 thumbWidth:100, // Thumb With and Height and Amount (only if navigation Tyope set to thumb !) 37 thumbHeight:50, 38 thumbAmount:3, 39 40 navigationType:"bullet", // bullet, thumb, none 41 navigationArrows:"solo", // nextto, solo, none 42 43 hideThumbsOnMobile:"off", 44 hideBulletsOnMobile:"off", 45 hideArrowsOnMobile:"off", 46 hideThumbsUnderResoluition:0, 47 48 navigationStyle:"round", // round,square,navbar,round-old,square-old,navbar-old, or any from the list in the docu (choose between 50+ different item), 49 50 navigationHAlign:"center", // Vertical Align top,center,bottom 51 navigationVAlign:"bottom", // Horizontal Align left,center,right 52 navigationHOffset:0, 53 navigationVOffset:20, 54 55 soloArrowLeftHalign:"left", 56 soloArrowLeftValign:"center", 57 soloArrowLeftHOffset:20, 58 soloArrowLeftVOffset:0, 59 60 soloArrowRightHalign:"right", 61 soloArrowRightValign:"center", 62 soloArrowRightHOffset:20, 63 soloArrowRightVOffset:0, 64 65 keyboardNavigation:"on", 66 67 touchenabled:"on", // Enable Swipe Function : on/off 68 onHoverStop:"on", // Stop Banner Timet at Hover on Slide on/off 69 70 71 stopAtSlide:-1, // Stop Timer if Slide "x" has been Reached. If stopAfterLoops set to 0, then it stops already in the first Loop at slide X which defined. -1 means do not stop at any slide. stopAfterLoops has no sinn in this case. 72 stopAfterLoops:-1, // Stop Timer if All slides has been played "x" times. IT will stop at THe slide which is defined via stopAtSlide:x, if set to -1 slide never stop automatic 73 74 hideCaptionAtLimit:0, // It Defines if a caption should be shown under a Screen Resolution ( Basod on The Width of Browser) 75 hideAllCaptionAtLimit:0, // Hide all The Captions if Width of Browser is less then this value 76 hideSliderAtLimit:0, // Hide the whole slider, and stop also functions if Width of Browser is less than this value 77 78 shadow:0, //0 = no Shadow, 1,2,3 = 3 Different Art of Shadows (No Shadow in Fullwidth Version !) 79 fullWidth:"off", // Turns On or Off the Fullwidth Image Centering in FullWidth Modus 80 fullScreen:"off", 81 minFullScreenHeight:0, // The Minimum FullScreen Height 82 fullScreenOffsetContainer:"", 83 dottedOverlay:"none", //twoxtwo, threexthree, twoxtwowhite, threexthreewhite 84 85 forceFullWidth:"off", // Force The FullWidth 86 87 spinner:"spinner0" 88 89 90 }; 91 92 options = jQuery.extend({}, jQuery.fn.revolution.defaults, options); 93 94 95 96 97 98 return this.each(function() { 99 100 var opt=options; 101 102 if (opt.fullWidth!="on" && opt.fullScreen!="on") opt.autoHeight = "off"; 103 if (opt.fullScreen=="on") opt.autoHeight = "on"; 104 if (opt.fullWidth!="on" && opt.fullScreen!="on") forceFulWidth="off"; 105 106 var container=jQuery(this); 107 108 if (opt.fullWidth=="on" && opt.autoHeight=="off") 109 container.css({maxHeight:opt.startheight+"px"}); 110 111 if (is_mobile() && opt.hideThumbsOnMobile=="on" && opt.navigationType=="thumb") 112 opt.navigationType = "none" 113 114 if (is_mobile() && opt.hideBulletsOnMobile=="on" && opt.navigationType=="bullet") 115 opt.navigationType = "none" 116 117 if (is_mobile() && opt.hideBulletsOnMobile=="on" && opt.navigationType=="both") 118 opt.navigationType = "none" 119 120 if (is_mobile() && opt.hideArrowsOnMobile=="on") 121 opt.navigationArrows = "none" 122 123 if (opt.forceFullWidth=="on") { 124 125 var loff = container.parent().offset().left; 126 var mb = container.parent().css('marginBottom'); 127 var mt = container.parent().css('marginTop'); 128 if (mb==undefined) mb=0; 129 if (mt==undefined) mt=0; 130 131 container.parent().wrap('<div style="position:relative;width:100%;height:auto;margin-top:'+mt+';margin-bottom:'+mb+'" class="forcefullwidth_wrapper_tp_banner"></div>'); 132 container.closest('.forcefullwidth_wrapper_tp_banner').append('<div class="tp-fullwidth-forcer" style="width:100%;height:'+container.height()+'px"></div>'); 133 container.css({'backgroundColor':container.parent().css('backgroundColor'),'backgroundImage':container.parent().css('backgroundImage')}); 134 //container.parent().css({'position':'absolute','width':jQuery(window).width()}); 135 container.parent().css({'left':(0-loff)+"px",position:'absolute','width':jQuery(window).width()}); 136 opt.width=jQuery(window).width(); 137 } 138 139 // HIDE THUMBS UNDER RESOLUTION 140 try{ 141 if (opt.hideThumbsUnderResolution>jQuery(window).width() && opt.hideThumbsUnderResolution!=0) { 142 container.parent().find('.tp-bullets.tp-thumbs').css({display:"none"}); 143 } else { 144 container.parent().find('.tp-bullets.tp-thumbs').css({display:"block"}); 145 } 146 } catch(e) {} 147 148 if (!container.hasClass("revslider-initialised")) { 149 150 container.addClass("revslider-initialised");
151 if (container.attr('id')==undefined) container.attr('id',"revslider-"+Math.round(Math.random()*1000+5)); 152 153 // CHECK IF FIREFOX 13 IS ON WAY.. IT HAS A STRANGE BUG, CSS ANIMATE SHOULD NOT BE USED 154 155 156 157 opt.firefox13 = false; 158 opt.ie = !jQuery.support.opacity; 159 opt.ie9 = (document.documentMode == 9); 160 161 opt.origcd=opt.delay; 162 163 // CHECK THE jQUERY VERSION 164 var version = jQuery.fn.jquery.split('.'), 165 versionTop = parseFloat(version[0]), 166 versionMinor = parseFloat(version[1]), 167 versionIncrement = parseFloat(version[2] || '0'); 168 169 if (versionTop==1 && versionMinor < 7) { 170 container.html('<div style="text-align:center; padding:40px 0px; font-size:20px; color:#992222;"> The Current Version of jQuery:'+version+' <br>Please update your jQuery Version to min. 1.7 in Case you wish to use the Revolution Slider Plugin</div>'); 171 } 172 173 if (versionTop>1) opt.ie=false; 174 175 176 // Delegate .transition() calls to .animate() 177 // if the browser can't do CSS transitions. 178 if (!jQuery.support.transition) 179 jQuery.fn.transition = jQuery.fn.animate; 180 181 // CATCH THE CONTAINER 182 183 184 // LOAD THE YOUTUBE API IF NECESSARY 185 186 container.find('.caption').each(function() { jQuery(this).addClass('tp-caption')}); 187 188 if (is_mobile()) { 189 container.find('.tp-caption').each(function() { 190 if (jQuery(this).data('autoplay')==true) 191 jQuery(this).data('autoplay',false); 192 // && jQuery(this).data('forcecover')!=1) 193 }) 194 } 195 196 197 var addedyt=0; 198 var addedvim=0; 199 var addedvid=0; 200 var httpprefix = "http"; 201 202 if (location.protocol === 'https:') { 203 httpprefix = "https"; 204 } 205 container.find('.tp-caption iframe').each(function(i) { 206 try { 207 208 if (jQuery(this).attr('src').indexOf('you')>0 && addedyt==0) { 209 addedyt=1; 210 var s = document.createElement("script"); 211 var httpprefix2 = "https"; 212 s.src = httpprefix2+"://www.youtube.com/iframe_api"; /* Load Player API*/ 213 214 var before = document.getElementsByTagName("script")[0]; 215 var loadit = true; 216 jQuery('head').find('*').each(function(){ 217 if (jQuery(this).attr('src') == httpprefix2+"://www.youtube.com/iframe_api") 218 loadit = false; 219 }); 220 if (loadit) { 221 before.parentNode.insertBefore(s, before); 222 /*var tag = document.createElement('script'); 223 tag.src = httpprefix+"://www.youtube.com/iframe_api"; 224 var firstScriptTag = document.getElementsByTagName('script')[0]; 225 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 226 */ 227 228 } 229 } 230 } catch(e) {} 231 }); 232 233 234 235 // LOAD THE VIMEO API 236 container.find('.tp-caption iframe').each(function(i) { 237 try{ 238 if (jQuery(this).attr('src').indexOf('vim')>0 && addedvim==0) { 239 addedvim=1; 240 var f = document.createElement("script"); 241 f.src = httpprefix+"://a.vimeocdn.com/js/froogaloop2.min.js"; /* Load Player API*/ 242 var before = document.getElementsByTagName("script")[0]; 243 244 var loadit = true; 245 jQuery('head').find('*').each(function(){ 246 if (jQuery(this).attr('src') == httpprefix+"://a.vimeocdn.com/js/froogaloop2.min.js") 247 loadit = false; 248 }); 249 if (loadit) 250 before.parentNode.insertBefore(f, before); 251 } 252 } catch(e) {} 253 }); 254 255 256 257 258 259 // LOAD THE VIDEO.JS API IF NEEDED 260 container.find('.tp-caption video').each(function(i) { 261 try{ 262 if (jQuery(this).hasClass('video-js') && addedvid==0) { 263 addedvid=1; 264 var f = document.createElement("script"); 265 f.src = opt.videoJsPath+"video.js"; /* Load Player API*/ 266 var before = document.getElementsByTagName("script")[0]; 267 268 var loadit = true; 269 jQuery('head').find('*').each(function(){ 270 if (jQuery(this).attr('src') == opt.videoJsPath+"video.js") 271 loadit = false; 272 });
273 if (loadit) { 274 before.parentNode.insertBefore(f, before); 275 jQuery('head').append('<link rel="stylesheet" type="text/css" href="'+opt.videoJsPath+'video-js.min.css" media="screen" />'); 276 jQuery('head').append('<script> videojs.options.flash.swf = "'+opt.videoJsPath+'video-js.swf";</script>'); 277 } 278 } 279 } catch(e) {} 280 }); 281 282 // SHUFFLE MODE 283 if (opt.shuffle=="on") { 284 for (var u=0;u<container.find('>ul:first-child >li').length;u++) { 285 var it = Math.round(Math.random()*container.find('>ul:first-child >li').length); 286 container.find('>ul:first-child >li:eq('+it+')').prependTo(container.find('>ul:first-child')); 287 } 288 } 289 290 291 // CREATE SOME DEFAULT OPTIONS FOR LATER 292 opt.slots=4; 293 opt.act=-1; 294 opt.next=0; 295 296 // IF START SLIDE IS SET 297 if (opt.startWithSlide !=undefined) opt.next=opt.startWithSlide; 298 299 // IF DEEPLINK HAS BEEN SET 300 var deeplink = getUrlVars("#")[0]; 301 if (deeplink.length<9) { 302 if (deeplink.split('slide').length>1) { 303 var dslide=parseInt(deeplink.split('slide')[1],0); 304 if (dslide<1) dslide=1; 305 if (dslide>container.find('>ul:first >li').length) dslide=container.find('>ul:first >li').length; 306 opt.next=dslide-1; 307 } 308 } 309 310 311 opt.firststart=1; 312 313 // BASIC OFFSET POSITIONS OF THE BULLETS 314 if (opt.navigationHOffset==undefined) opt.navOffsetHorizontal=0; 315 if (opt.navigationVOffset==undefined) opt.navOffsetVertical=0; 316 317 318 container.append('<div class="tp-loader '+opt.spinner+'">'+ 319 '<div class="dot1"></div>'+ 320 '<div class="dot2"></div>'+ 321 '<div class="bounce1"></div>'+ 322 '<div class="bounce2"></div>'+ 323 '<div class="bounce3"></div>'+ 324 '</div>'); 325 326 // RESET THE TIMER 327 if (container.find('.tp-bannertimer').length==0) container.append('<div class="tp-bannertimer" style="visibility:hidden"></div>'); 328 var bt=container.find('.tp-bannertimer'); 329 if (bt.length>0) { 330 bt.css({'width':'0%'}); 331 }; 332 333 334 // WE NEED TO ADD A BASIC CLASS FOR SETTINGS.CSS 335 container.addClass("tp-simpleresponsive"); 336 opt.container=container; 337 338 //if (container.height()==0) container.height(opt.startheight); 339 340 // AMOUNT OF THE SLIDES 341 opt.slideamount = container.find('>ul:first >li').length; 342 343 344 // A BASIC GRID MUST BE DEFINED. IF NO DEFAULT GRID EXIST THAN WE NEED A DEFAULT VALUE, ACTUAL SIZE OF CONAINER 345 if (container.height()==0) container.height(opt.startheight); 346 if (opt.startwidth==undefined || opt.startwidth==0) opt.startwidth=container.width(); 347 if (opt.startheight==undefined || opt.startheight==0) opt.startheight=container.height(); 348 349 // OPT WIDTH && HEIGHT SHOULD BE SET 350 opt.width=container.width(); 351 opt.height=container.height(); 352 353 354 // DEFAULT DEPENDECIES 355 opt.bw= opt.startwidth / container.width(); 356 opt.bh = opt.startheight / container.height(); 357 358 // IF THE ITEM ALREADY IN A RESIZED FORM 359 if (opt.width!=opt.startwidth) { 360 361 opt.height = Math.round(opt.startheight * (opt.width/opt.startwidth)); 362 363 container.height(opt.height); 364 365 } 366 367 // LETS SEE IF THERE IS ANY SHADOW 368 if (opt.shadow!=0) { 369 container.parent().append('<div class="tp-bannershadow tp-shadow'+opt.shadow+'"></div>'); 370 var loff=0; 371 if (opt.forceFullWidth=="on") 372 loff = 0-opt.container.parent().offset().left; 373 container.parent().find('.tp-bannershadow').css({'width':opt.width,'left':loff}); 374 } 375 376 377 container.find('ul').css({'display':'none'}); 378 379 var fliparent = container; 380 381 382 // PREPARE THE SLIDES 383 container.find('ul').css({'display':'block'});
384 prepareSlides(container,opt); 385 386 // CREATE BULLETS 387 if (opt.slideamount >1) createBullets(container,opt); 388 if (opt.slideamount >1) createThumbs(container,opt); 389 if (opt.slideamount >1) createArrows(container,opt); 390 if (opt.keyboardNavigation=="on") createKeyboard(container,opt); 391 392 swipeAction(container,opt); 393 394 if (opt.hideThumbs>0) hideThumbs(container,opt); 395 396 swapSlide(container,opt); 397 // START COUNTDOWN 398 if (opt.slideamount >1) countDown(container,opt); 399 setTimeout(function() { 400 container.trigger('revolution.slide.onloaded'); 401 },500); 402 403 404 405 // IF RESIZED, NEED TO STOP ACTUAL TRANSITION AND RESIZE ACTUAL IMAGES 406 jQuery(window).resize(function() { 407 if (jQuery('body').find(container)!=0) 408 if (opt.forceFullWidth=="on" ) { 409 410 var loff = opt.container.closest('.forcefullwidth_wrapper_tp_banner').offset().left; 411 //opt.container.parent().css({'width':jQuery(window).width()}); 412 opt.container.parent().css({'left':(0-loff)+"px",'width':jQuery(window).width()}); 413 } 414 415 if (container.outerWidth(true)!=opt.width) { 416 containerResized(container,opt); 417 } 418 419 420 421 }); 422 423 // HIDE THUMBS UNDER SIZE... 424 try{ 425 if (opt.hideThumbsUnderResoluition!=0 && opt.navigationType=="thumb") { 426 if (opt.hideThumbsUnderResoluition>jQuery(window).width()) 427 jQuery('.tp-bullets').css({display:"none"}); 428 else 429 jQuery('.tp-bullets').css({display:"block"}); 430 } 431 } catch(e) {} 432 433 434 435 // CHECK IF THE CAPTION IS A "SCROLL ME TO POSITION" CAPTION IS 436 //if (opt.fullScreen=="on") { 437 container.find('.tp-scrollbelowslider').on('click',function() { 438 var off=0; 439 try{ 440 off = jQuery('body').find(opt.fullScreenOffsetContainer).height(); 441 } catch(e) {} 442 try{ 443 off = off - jQuery(this).data('scrolloffset'); 444 } catch(e) {} 445 446 jQuery('body,html').animate( 447 {scrollTop:(container.offset().top+(container.find('>ul >li').height())-off)+"px"},{duration:400}); 448 }); 449 //} 450 } 451 452 }) 453 }, 454 455 456 // METHODE PAUSE 457 revscroll: function(oy) { 458 return this.each(function() { 459 var container=jQuery(this); 460 jQuery('body,html').animate( 461 {scrollTop:(container.offset().top+(container.find('>ul >li').height())-oy)+"px"},{duration:400}); 462 }) 463 }, 464 465 // METHODE PAUSE 466 revredraw: function(oy) { 467 return this.each(function() { 468 var container=jQuery(this); 469 var bt = container.parent().find('.tp-bannertimer'); 470 var opt = bt.data('opt'); 471 containerResized(container,opt); 472 473 }) 474 }, 475 476 // METHODE PAUSE 477 revpause: function(options) { 478 479 return this.each(function() { 480 var container=jQuery(this); 481 container.data('conthover',1); 482 container.data('conthover-changed',1); 483 container.trigger('revolution.slide.onpause'); 484 var bt = container.parent().find('.tp-bannertimer'); 485 var opt = bt.data('opt'); 486 opt.bannertimeronpause = true; 487 container.trigger('stoptimer'); 488 489 }) 490 491 492 }, 493 494 // METHODE RESUME 495 revresume: function(options) { 496 return this.each(function() { 497 var container=jQuery(this); 498 container.data('conthover',0); 499 container.data('conthover-changed',1); 500 container.trigger('revolution.slide.onresume'); 501 var bt = container.parent().find('.tp-bannertimer'); 502 var opt = bt.data('opt'); 503 opt.bannertimeronpause = false; 504 container.trigger('starttimer'); 505 506 }) 507 508 }, 509 510 // METHODE NEXT 511 revnext: function(options) { 512 return this.each(function() { 513 // CATCH THE CONTAINER 514 var container=jQuery(this); 515 container.parent().find('.tp-rightarrow').click(); 516 517 518 }) 519 520 }, 521 522 // METHODE RESUME 523 revprev: function(options) { 524 return this.each(function() { 525 // CATCH THE CONTAINER 526 var container=jQuery(this); 527 container.parent().find('.tp-leftarrow').click(); 528 }) 529 530 }, 531 532 // METHODE LENGTH 533 revmaxslide: function(options) { 534 // CATCH THE CONTAINER 535 return jQuery(this).find('>ul:first-child >li').length; 536 }, 537 538 539 // METHODE CURRENT 540 revcurrentslide: function(options) { 541 // CATCH THE CONTAINER 542 var container=jQuery(this); 543 var bt = container.parent().find('.tp-bannertimer'); 544 var opt = bt.data('opt'); 545 return opt.act; 546 }, 547 548 // METHODE CURRENT 549 revlastslide: function(options) { 550 // CATCH THE CONTAINER 551 var container=jQuery(this); 552 var bt = container.parent().find('.tp-bannertimer'); 553 var opt = bt.data('opt'); 554 return opt.lastslide; 555 }, 556 557 558 // METHODE JUMP TO SLIDE 559 revshowslide: function(slide) { 560 return this.each(function() { 561 // CATCH THE CONTAINER 562 var container=jQuery(this); 563 container.data('showus',slide); 564 container.parent().find('.tp-rightarrow').click(); 565 }) 566 567 } 568 569 570}) 571 572 573 /////////////////////////// 574 // GET THE URL PARAMETER // 575 /////////////////////////// 576 function getUrlVars(hashdivider) { 577 var vars = [], hash; 578 var hashes = window.location.href.slice(window.location.href.indexOf(hashdivider) + 1).split('_'); 579 for(var i = 0; i < hashes.length; i++) 580 { 581 hashes[i] = hashes[i].replace('%3D',"="); 582 hash = hashes[i].split('='); 583 vars.push(hash[0]); 584 vars[hash[0]] = hash[1]; 585 } 586 return vars; 587 } 588 589 ////////////////////////// 590 // CONTAINER RESIZED // 591 ///////////////////////// 592 function containerResized(container,opt) { 593 594 // HIDE THUMBS UNDER SIZE... 595 try{ 596 if (opt.hideThumbsUnderResoluition!=0 && opt.navigationType=="thumb") { 597 if (opt.hideThumbsUnderResoluition>jQuery(window).width()) 598 jQuery('.tp-bullets').css({display:"none"}); 599 else 600 jQuery('.tp-bullets').css({display:"block"}); 601 } 602 } catch(e) {} 603 604 605 if (opt.fullWidth!="on") 606 if (opt.width>opt.hideSliderAtLimit){ 607 container.parent().removeClass("tp-hide-revslider"); 608 } 609 else { 610 container.parent().addClass("tp-hide-revslider"); 611 } 612 613 614 container.find('.defaultimg').each(function(i) { 615 setSize(jQuery(this),opt); 616 }); 617 618 var loff=0; 619 if (opt.forceFullWidth=="on") 620 loff = 0-opt.container.parent().offset().left; 621 try{ 622 container.parent().find('.tp-bannershadow').css({'width':opt.width,'left':loff}); 623 } catch(e) {} 624 625 var actsh = container.find('>ul >li:eq('+opt.act+') .slotholder'); 626 var nextsh = container.find('>ul >li:eq('+opt.next+') .slotholder'); 627 removeSlots(container,opt); 628 nextsh.find('.defaultimg').css({'opacity':0}); 629 actsh.find('.defaultimg').css({'opacity':1}); 630 631 nextsh.find('.defaultimg').each(function() { 632 var dimg = jQuery(this); 633 if (dimg.data('kenburn')!=undefined) 634 dimg.data('kenburn').restart(); 635 }); 636 637 var nextli = container.find('>ul >li:eq('+opt.next+')'); 638 639 animateTheCaptions(nextli, opt,true); 640 //restartBannerTimer(opt,container); 641 setBulPos(container,opt); 642 643 } 644 645 646 ////////////////// 647 // IS MOBILE ?? // 648 ////////////////// 649 function is_mobile() { 650 var agents = ['android', 'webos', 'iphone', 'ipad', 'blackberry','Android', 'webos', ,'iPod', 'iPhone', 'iPad', 'Blackberry', 'BlackBerry']; 651 var ismobile=false; 652 for(i in agents) { 653
654 if (navigator.userAgent.split(agents[i]).length>1) { 655 ismobile = true; 656 657 } 658 } 659 return ismobile; 660 } 661 662 /********************************* 663 - CHECK IF BROWSER IS IE - 664 ********************************/ 665 function isIE( version, comparison ){ 666 var $div = jQuery('<div style="display:none;"/>').appendTo(jQuery('body')); 667 $div.html('<!--[if '+(comparison||'')+' IE '+(version||'')+']><a> </a><![endif]-->'); 668 var ieTest = $div.find('a').length; 669 $div.remove(); 670 return ieTest; 671 } 672 673 674 function callingNewSlide(opt,container) { 675 676 swapSlide(container,opt); 677 678 } 679 680 681 //////////////////////////////// 682 // - CREATE THE BULLETS - // 683 //////////////////////////////// 684 function createThumbs(container,opt) { 685 686 var cap=container.parent(); 687 688 if (opt.navigationType=="thumb" || opt.navsecond=="both") { 689 cap.append('<div class="tp-bullets tp-thumbs '+opt.navigationStyle+'"><div class="tp-mask"><div class="tp-thumbcontainer"></div></div></div>'); 690 } 691 var bullets = cap.find('.tp-bullets.tp-thumbs .tp-mask .tp-thumbcontainer'); 692 var bup = bullets.parent(); 693 694 bup.width(opt.thumbWidth*opt.thumbAmount); 695 bup.height(opt.thumbHeight); 696 bup.parent().width(opt.thumbWidth*opt.thumbAmount); 697 bup.parent().height(opt.thumbHeight); 698 699 container.find('>ul:first >li').each(function(i) { 700 var li= container.find(">ul:first >li:eq("+i+")"); 701 var bgcolor = li.find(".defaultimg").css("backgroundColor"); 702 if (li.data('thumb') !=undefined) 703 var src= li.data('thumb') 704 else 705 var src=li.find("img:first").attr('src'); 706 707 708 bullets.append('<div class="bullet thumb" style="background-color:'+bgcolor+';position:relative;width:'+opt.thumbWidth+'px;height:'+opt.thumbHeight+'px;background-image:url('+src+') !important;background-size:cover;background-position:center center;"></div>'); 709 var bullet= bullets.find('.bullet:first'); 710 }); 711 //bullets.append('<div style="clear:both"></div>'); 712 var minwidth=10; 713 714 715 // ADD THE BULLET CLICK FUNCTION HERE 716 bullets.find('.bullet').each(function(i) { 717 var bul = jQuery(this); 718 719 if (i==opt.slideamount-1) bul.addClass('last'); 720 if (i==0) bul.addClass('first'); 721 bul.width(opt.thumbWidth); 722 bul.height(opt.thumbHeight); 723 724 if (minwidth<bul.outerWidth(true)) minwidth=bul.outerWidth(true); 725 bul.click(function() { 726 if (opt.transition==0 && bul.index() != opt.act) { 727 opt.next = bul.index(); 728 callingNewSlide(opt,container); 729 } 730 }); 731 }); 732 733 734 var max=minwidth*container.find('>ul:first >li').length; 735 736 var thumbconwidth=bullets.parent().width(); 737 opt.thumbWidth = minwidth; 738 739 740 741 //////////////////////// 742 // SLIDE TO POSITION // 743 //////////////////////// 744 if (thumbconwidth<max) { 745 jQuery(document).mousemove(function(e) { 746 jQuery('body').data('mousex',e.pageX); 747 }); 748 749 750 751 // ON MOUSE MOVE ON THE THUMBNAILS EVERYTHING SHOULD MOVE :) 752 753 bullets.parent().mouseenter(function() { 754 var $this=jQuery(this); 755 $this.addClass("over"); 756 var offset = $this.offset(); 757 var x = jQuery('body').data('mousex')-offset.left; 758 var thumbconwidth=$this.width(); 759 var minwidth=$this.find('.bullet:first').outerWidth(true); 760 var max=minwidth*container.find('>ul:first >li').length; 761 var diff=(max- thumbconwidth)+15; 762 var steps = diff / thumbconwidth; 763 x=x-30; 764 //if (x<30) x=0; 765 //if (x>thumbconwidth-30) x=thumbconwidth; 766 767 //ANIMATE TO POSITION 768 var pos=(0-((x)*steps)); 769 if (pos>0) pos =0; 770 if (pos<0-max+thumbconwidth) pos=0-max+thumbconwidth; 771 moveThumbSliderToPosition($this,pos,200); 772 }); 773 774 bullets.parent().mousemove(function() { 775 776 var $this=jQuery(this); 777 778 //if (!$this.hasClass("over")) { 779 var offset = $this.offset(); 780 var x = jQuery('body').data('mousex')-offset.left; 781 var thumbconwidth=$this.width(); 782 var minwidth=$this.find('.bullet:first').outerWidth(true); 783 var max=minwidth*container.find('>ul:first >li').length-1; 784 var diff=(max- thumbconwidth)+15; 785 var steps = diff / thumbconwidth; 786 x=x-3; 787 if (x<6) x=0; 788 if (x+3>thumbconwidth-6) x=thumbconwidth; 789 790 //ANIMATE TO POSITION 791 var pos=(0-((x)*steps)); 792 if (pos>0) pos =0; 793 if (pos<0-max+thumbconwidth) pos=0-max+thumbconwidth; 794 moveThumbSliderToPosition($this,pos,0); 795 //} else { 796 //$this.removeClass("over"); 797 //} 798 799 });
800 801 bullets.parent().mouseleave(function() { 802 var $this=jQuery(this); 803 $this.removeClass("over"); 804 moveSelectedThumb(container); 805 }); 806 } 807 808 809 } 810 811 812 /////////////////////////////// 813 // SelectedThumbInPosition // 814 ////////////////////////////// 815 function moveSelectedThumb(container) { 816 817 var bullets=container.parent().find('.tp-bullets.tp-thumbs .tp-mask .tp-thumbcontainer'); 818 var $this=bullets.parent(); 819 var offset = $this.offset(); 820 var minwidth=$this.find('.bullet:first').outerWidth(true); 821 822 var x = $this.find('.bullet.selected').index() * minwidth; 823 var thumbconwidth=$this.width(); 824 var minwidth=$this.find('.bullet:first').outerWidth(true); 825 var max=minwidth*container.find('>ul:first >li').length; 826 var diff=(max- thumbconwidth); 827 var steps = diff / thumbconwidth; 828 829 //ANIMATE TO POSITION 830 var pos=0-x; 831 832 if (pos>0) pos =0; 833 if (pos<0-max+thumbconwidth) pos=0-max+thumbconwidth; 834 if (!$this.hasClass("over")) { 835 moveThumbSliderToPosition($this,pos,200); 836 } 837 } 838 839 840 //////////////////////////////////// 841 // MOVE THUMB SLIDER TO POSITION // 842 /////////////////////////////////// 843 function moveThumbSliderToPosition($this,pos,speed) { 844 //$this.stop(); 845 //$this.find('.tp-thumbcontainer').animate({'left':pos+'px'},{duration:speed,queue:false}); 846 TweenLite.to($this.find('.tp-thumbcontainer'),0.2,{left:pos,ease:Power3.easeOut,overwrite:"auto"}); 847 } 848 849 850 851 //////////////////////////////// 852 // - CREATE THE BULLETS - // 853 //////////////////////////////// 854 function createBullets(container,opt) { 855 856 if (opt.navigationType=="bullet" || opt.navigationType=="both") { 857 container.parent().append('<div class="tp-bullets simplebullets '+opt.navigationStyle+'"></div>'); 858 } 859 860 861 var bullets = container.parent().find('.tp-bullets'); 862 863 container.find('>ul:first >li').each(function(i) { 864 var src=container.find(">ul:first >li:eq("+i+") img:first").attr('src'); 865 bullets.append('<div class="bullet"></div>'); 866 var bullet= bullets.find('.bullet:first'); 867 868 869 }); 870 871 // ADD THE BULLET CLICK FUNCTION HERE 872 bullets.find('.bullet').each(function(i) { 873 var bul = jQuery(this); 874 if (i==opt.slideamount-1) bul.addClass('last'); 875 if (i==0) bul.addClass('first'); 876 877 bul.click(function() { 878 var sameslide = false; 879 if (opt.navigationArrows=="withbullet" || opt.navigationArrows=="nexttobullets") { 880 if (bul.index()-1 == opt.act) sameslide=true; 881 } else { 882 if (bul.index() == opt.act) sameslide=true; 883 } 884 885 if (opt.transition==0 && !sameslide) { 886 887 if (opt.navigationArrows=="withbullet" || opt.navigationArrows=="nexttobullets") { 888 opt.next = bul.index()-1; 889 } else { 890 opt.next = bul.index(); 891 } 892 893 callingNewSlide(opt,container); 894 } 895 }); 896 897 }); 898 899 bullets.append('<div class="tpclear"></div>'); 900 901 902 903 setBulPos(container,opt); 904 905 906 907 908 909 } 910 911 ////////////////////// 912 // CREATE ARROWS // 913 ///////////////////// 914 function createArrows(container,opt) { 915 916 var bullets = container.find('.tp-bullets'); 917 918 var hidden=""; 919 var arst= opt.navigationStyle; 920 if (opt.navigationArrows=="none") hidden="visibility:hidden;display:none"; 921 opt.soloArrowStyle = "default"; 922 923 if (opt.navigationArrows!="none" && opt.navigationArrows!="nexttobullets") arst = opt.soloArrowStyle; 924 925 container.parent().append('<div style="'+hidden+'" class="tp-leftarrow tparrows '+arst+'"></div>'); 926 container.parent().append('<div style="'+hidden+'" class="tp-rightarrow tparrows '+arst+'"></div>'); 927 928 // THE LEFT / RIGHT BUTTON CLICK ! // 929 container.parent().find('.tp-rightarrow').click(function() { 930 931 if (opt.transition==0) { 932 if (container.data('showus') !=undefined && container.data('showus') != -1) 933 opt.next = container.data('showus')-1; 934 else 935 opt.next = opt.next+1; 936 container.data('showus',-1); 937 if (opt.next >= opt.slideamount) opt.next=0; 938 if (opt.next<0) opt.next=0; 939 940 if (opt.act !=opt.next) 941 callingNewSlide(opt,container); 942 } 943 });
944 945 container.parent().find('.tp-leftarrow').click(function() { 946 if (opt.transition==0) { 947 opt.next = opt.next-1; 948 opt.leftarrowpressed=1; 949 if (opt.next < 0) opt.next=opt.slideamount-1; 950 callingNewSlide(opt,container); 951 } 952 }); 953 954 setBulPos(container,opt); 955 956 } 957 958 ////////////////////// 959 // CREATE ARROWS // 960 ///////////////////// 961 function createKeyboard(container,opt) { 962 963 964 // THE LEFT / RIGHT BUTTON CLICK ! // 965 jQuery(document).keydown(function(e){ 966 if (opt.transition==0 && e.keyCode == 39) { 967 if (container.data('showus') !=undefined && container.data('showus') != -1) 968 opt.next = container.data('showus')-1; 969 else 970 opt.next = opt.next+1; 971 container.data('showus',-1); 972 if (opt.next >= opt.slideamount) opt.next=0; 973 if (opt.next<0) opt.next=0; 974 975 if (opt.act !=opt.next) 976 callingNewSlide(opt,container); 977 } 978 979 if (opt.transition==0 && e.keyCode == 37) { 980 opt.next = opt.next-1; 981 opt.leftarrowpressed=1; 982 if (opt.next < 0) opt.next=opt.slideamount-1; 983 callingNewSlide(opt,container); 984 } 985 }); 986 987 setBulPos(container,opt); 988 989 } 990 991 //////////////////////////// 992 // SET THE SWIPE FUNCTION // 993 //////////////////////////// 994 function swipeAction(container,opt) { 995 // TOUCH ENABLED SCROLL 996 997 if (opt.touchenabled=="on") 998 999 Hammer(container).on("swipeleft", function() { 1000 if (opt.transition==0) { 1001 opt.next = opt.next+1; 1002 if (opt.next == opt.slideamount) opt.next=0; 1003 callingNewSlide(opt,container); 1004 } 1005 }); 1006 Hammer(container).on("swiperight", function() { 1007 if (opt.transition==0) { 1008 opt.next = opt.next-1; 1009 opt.leftarrowpressed=1; 1010 if (opt.next < 0) opt.next=opt.slideamount-1; 1011 callingNewSlide(opt,container); 1012 } 1013 }); 1014 1015 } 1016 1017 1018 1019 1020 //////////////////////////////////////////////////////////////// 1021 // SHOW AND HIDE THE THUMBS IF MOUE GOES OUT OF THE BANNER /// 1022 ////////////////////////////////////////////////////////////// 1023 function hideThumbs(container,opt) { 1024 1025 var bullets = container.parent().find('.tp-bullets'); 1026 var ca = container.parent().find('.tparrows'); 1027 1028 if (bullets==null) { 1029 container.append('<div class=".tp-bullets"></div>'); 1030 var bullets = container.parent().find('.tp-bullets'); 1031 } 1032 1033 if (ca==null) { 1034 container.append('<div class=".tparrows"></div>'); 1035 var ca = container.parent().find('.tparrows'); 1036 } 1037 1038 1039 //var bp = (thumbs.parent().outerHeight(true) - opt.height)/2; 1040 1041 // ADD THUMBNAIL IMAGES FOR THE BULLETS // 1042 container.data('hidethumbs',opt.hideThumbs); 1043 1044 bullets.addClass("hidebullets"); 1045 ca.addClass("hidearrows"); 1046 1047 bullets.hover(function() { 1048 opt.overnav = true; 1049 container.trigger('stoptimer'); 1050 bullets.addClass("hovered"); 1051 clearTimeout(container.data('hidethumbs')); 1052 bullets.removeClass("hidebullets"); 1053 ca.removeClass("hidearrows"); 1054 }, 1055 function() { 1056 opt.overnav = false; 1057 container.trigger('playtimer'); 1058 bullets.removeClass("hovered"); 1059 if (!container.hasClass("hovered") && !bullets.hasClass("hovered")) 1060 container.data('hidethumbs', setTimeout(function() { 1061 bullets.addClass("hidebullets"); 1062 ca.addClass("hidearrows"); 1063 },opt.hideThumbs)); 1064 }); 1065 1066 1067 ca.hover(function() { 1068 opt.overnav = true; 1069 container.trigger('stoptimer'); 1070 bullets.addClass("hovered"); 1071 clearTimeout(container.data('hidethumbs')); 1072 bullets.removeClass("hidebullets"); 1073 ca.removeClass("hidearrows"); 1074 1075 }, 1076 function() { 1077 opt.overnav = false; 1078 container.trigger('playtimer'); 1079 bullets.removeClass("hovered"); 1080 }); 1081 1082 1083 1084 container.on('mouseenter', function() { 1085 container.addClass("hovered"); 1086 container.trigger('stoptimer'); 1087 clearTimeout(container.data('hidethumbs')); 1088 bullets.removeClass("hidebullets"); 1089 ca.removeClass("hidearrows"); 1090 }); 1091 1092 container.on('mouseleave', function() { 1093 container.removeClass("hovered"); 1094 container.trigger('playtimer'); 1095 if (!container.hasClass("hovered") && !bullets.hasClass("hovered")) 1096 container.data('hidethumbs', setTimeout(function() { 1097 bullets.addClass("hidebullets"); 1098 ca.addClass("hidearrows"); 1099 },opt.hideThumbs)); 1100 }); 1101 1102 } 1103 1104 1105 1106 1107 1108 1109 1110 ////////////////////////////// 1111 // SET POSITION OF BULLETS // 1112 ////////////////////////////// 1113 function setBulPos(container,opt) { 1114 var topcont=container.parent(); 1115 var bullets=topcont.find('.tp-bullets'); 1116 1117 if (opt.navigationType=="thumb") { 1118 bullets.find('.thumb').each(function(i) { 1119 var thumb = jQuery(this); 1120 1121 thumb.css({'width':opt.thumbWidth * opt.bw+"px", 'height':opt.thumbHeight*opt.bh+"px"}); 1122 1123 }) 1124 var bup = bullets.find('.tp-mask'); 1125 1126 bup.width(opt.thumbWidth*opt.thumbAmount * opt.bw); 1127 bup.height(opt.thumbHeight * opt.bh); 1128 bup.parent().width(opt.thumbWidth*opt.thumbAmount * opt.bw); 1129 bup.parent().height(opt.thumbHeight * opt.bh); 1130 } 1131 1132 1133 var tl = topcont.find('.tp-leftarrow'); 1134 var tr = topcont.find('.tp-rightarrow'); 1135 1136 if (opt.navigationType=="thumb" && opt.navigationArrows=="nexttobullets") opt.navigationArrows="solo"; 1137 // IM CASE WE HAVE NAVIGATION BULLETS TOGETHER WITH ARROWS 1138 if (opt.navigationArrows=="nexttobullets") {
1139 tl.prependTo(bullets).css({'float':'left'}); 1140 tr.insertBefore(bullets.find('.tpclear')).css({'float':'left'}); 1141 } 1142 var loff=0; 1143 if (opt.forceFullWidth=="on") 1144 loff = 0-opt.container.parent().offset().left; 1145 1146 if (opt.navigationArrows!="none" && opt.navigationArrows!="nexttobullets") { 1147 1148 tl.css({'position':'absolute'}); 1149 tr.css({'position':'absolute'}); 1150 1151 1152 if (opt.soloArrowLeftValign=="center") tl.css({'top':'50%','marginTop':(opt.soloArrowLeftVOffset-Math.round(tl.innerHeight()/2))+"px"}); 1153 if (opt.soloArrowLeftValign=="bottom") tl.css({'top':'auto','bottom':(0+opt.soloArrowLeftVOffset)+"px"}); 1154 if (opt.soloArrowLeftValign=="top") tl.css({'bottom':'auto','top':(0+opt.soloArrowLeftVOffset)+"px"}); 1155 if (opt.soloArrowLeftHalign=="center") tl.css({'left':'50%','marginLeft':(loff+opt.soloArrowLeftHOffset-Math.round(tl.innerWidth()/2))+"px"}); 1156 if (opt.soloArrowLeftHalign=="left") tl.css({'left':(0+opt.soloArrowLeftHOffset+loff)+"px"}); 1157 if (opt.soloArrowLeftHalign=="right") tl.css({'right':(0+opt.soloArrowLeftHOffset-loff)+"px"}); 1158 1159 if (opt.soloArrowRightValign=="center") tr.css({'top':'50%','marginTop':(opt.soloArrowRightVOffset-Math.round(tr.innerHeight()/2))+"px"}); 1160 if (opt.soloArrowRightValign=="bottom") tr.css({'top':'auto','bottom':(0+opt.soloArrowRightVOffset)+"px"}); 1161 if (opt.soloArrowRightValign=="top") tr.css({'bottom':'auto','top':(0+opt.soloArrowRightVOffset)+"px"}); 1162 if (opt.soloArrowRightHalign=="center") tr.css({'left':'50%','marginLeft':(loff+opt.soloArrowRightHOffset-Math.round(tr.innerWidth()/2))+"px"}); 1163 if (opt.soloArrowRightHalign=="left") tr.css({'left':(0+opt.soloArrowRightHOffset+loff)+"px"}); 1164 if (opt.soloArrowRightHalign=="right") tr.css({'right':(0+opt.soloArrowRightHOffset-loff)+"px"}); 1165 1166 1167 if (tl.position()!=null) 1168 tl.css({'top':Math.round(parseInt(tl.position().top,0))+"px"}); 1169 1170 if (tr.position()!=null) 1171 tr.css({'top':Math.round(parseInt(tr.position().top,0))+"px"}); 1172 } 1173 1174 if (opt.navigationArrows=="none") { 1175 tl.css({'visibility':'hidden'}); 1176 tr.css({'visibility':'hidden'}); 1177 } 1178 1179 // SET THE POSITIONS OF THE BULLETS // THUMBNAILS 1180 1181 1182 if (opt.navigationVAlign=="center") bullets.css({'top':'50%','marginTop':(opt.navigationVOffset-Math.round(bullets.innerHeight()/2))+"px"}); 1183 if (opt.navigationVAlign=="bottom") bullets.css({'bottom':(0+opt.navigationVOffset)+"px"}); 1184 if (opt.navigationVAlign=="top") bullets.css({'top':(0+opt.navigationVOffset)+"px"}); 1185 1186 1187 1188 if (opt.navigationHAlign=="center") bullets.css({'left':'50%','marginLeft':(loff+opt.navigationHOffset-Math.round(bullets.innerWidth()/2))+"px"}); 1189 if (opt.navigationHAlign=="left") bullets.css({'left':(0+opt.navigationHOffset+loff)+"px"}); 1190 if (opt.navigationHAlign=="right") bullets.css({'right':(0+opt.navigationHOffset-loff)+"px"}); 1191 1192 1193 1194 } 1195 1196 1197 1198 ////////////////////////////////////////////////////////// 1199 // - SET THE IMAGE SIZE TO FIT INTO THE CONTIANER - // 1200 //////////////////////////////////////////////////////// 1201 function setSize(img,opt) { 1202 1203 1204 opt.container.closest('.forcefullwidth_wrapper_tp_banner').find('.tp-fullwidth-forcer').css({'height':opt.container.height()}); 1205 opt.container.closest('.rev_slider_wrapper').css({'height':opt.container.height()}); 1206 1207 1208 opt.width=parseInt(opt.container.width(),0); 1209 opt.height=parseInt(opt.container.height(),0); 1210 1211 1212 1213 opt.bw= (opt.width / opt.startwidth); 1214 opt.bh = (opt.height / opt.startheight); 1215 1216 if (opt.bh>opt.bw) opt.bh=opt.bw; 1217 if (opt.bh<opt.bw) opt.bw = opt.bh; 1218 if (opt.bw<opt.bh) opt.bh = opt.bw; 1219 if (opt.bh>1) { opt.bw=1; opt.bh=1; } 1220 if (opt.bw>1) {opt.bw=1; opt.bh=1; } 1221 1222 1223 //opt.height= opt.startheight * opt.bh; 1224 opt.height = Math.round(opt.startheight * (opt.width/opt.startwidth)); 1225 1226 1227 1228 1229 1230 if (opt.height>opt.startheight && opt.autoHeight!="on") opt.height=opt.startheight; 1231 1232 1233 1234 if (opt.fullScreen=="on") { 1235 opt.height = opt.bw * opt.startheight; 1236 var cow = opt.container.parent().width(); 1237 var coh = jQuery(window).height(); 1238 if (opt.fullScreenOffsetContainer!=undefined) { 1239 try{ 1240 var offcontainers = opt.fullScreenOffsetContainer.split(","); 1241 jQuery.each(offcontainers,function(index,searchedcont) { 1242 coh = coh - jQuery(searchedcont).outerHeight(true); 1243 if (coh<opt.minFullScreenHeight) coh=opt.minFullScreenHeight; 1244 });
1245 } catch(e) {} 1246 } 1247 1248 opt.container.parent().height(coh); 1249 opt.container.css({'height':'100%'}); 1250 1251 opt.height=coh; 1252 1253 } else { 1254 opt.container.height(opt.height); 1255 } 1256 1257 1258 opt.slotw=Math.ceil(opt.width/opt.slots); 1259 1260 if (opt.fullSreen=="on") 1261 opt.sloth=Math.ceil(jQuery(window).height()/opt.slots); 1262 else 1263 opt.sloth=Math.ceil(opt.height/opt.slots); 1264 1265 if (opt.autoHeight=="on") 1266 opt.sloth=Math.ceil(img.height()/opt.slots); 1267 1268 1269 1270 1271 } 1272 1273 1274 1275 1276 ///////////////////////////////////////// 1277 // - PREPARE THE SLIDES / SLOTS - // 1278 /////////////////////////////////////// 1279 function prepareSlides(container,opt) { 1280 1281 container.find('.tp-caption').each(function() { jQuery(this).addClass(jQuery(this).data('transition')); jQuery(this).addClass('start') }); 1282 1283 // PREPARE THE UL CONTAINER TO HAVEING MAX HEIGHT AND HEIGHT FOR ANY SITUATION 1284 container.find('>ul:first').css({overflow:'hidden',width:'100%',height:'100%',maxHeight:container.parent().css('maxHeight')}); 1285 if (opt.autoHeight=="on") { 1286 container.find('>ul:first').css({overflow:'hidden',width:'100%',height:'100%',maxHeight:"none"}); 1287 container.css({'maxHeight':'none'}); 1288 container.parent().css({'maxHeight':'none'}); 1289 } 1290 1291 container.find('>ul:first >li').each(function(j) { 1292 var li=jQuery(this); 1293 1294 // MAKE LI OVERFLOW HIDDEN FOR FURTHER ISSUES 1295 li.css({'width':'100%','height':'100%','overflow':'hidden'}); 1296 1297 if (li.data('link')!=undefined) { 1298 var link = li.data('link'); 1299 var target="_self"; 1300 var zindex=60; 1301 if (li.data('slideindex')=="back") zindex=0; 1302 1303 var linktoslide=li.data('linktoslide'); 1304 if (li.data('target')!=undefined) target=li.data('target'); 1305 1306 if (link=="slide") { 1307 li.append('<div class="tp-caption sft slidelink" style="width:100%;height:100%;z-index:'+zindex+';" data-x="0" data-y="0" data-linktoslide="'+linktoslide+'" data-start="0"><a style="width:100%;height:100%;display:block"><span style="width:100%;height:100%;display:block"></span></a></div>'); 1308 } else { 1309 linktoslide="no"; 1310 li.append('<div class="tp-caption sft slidelink" style="width:100%;height:100%;z-index:'+zindex+';" data-x="0" data-y="0" data-linktoslide="'+linktoslide+'" data-start="0"><a style="width:100%;height:100%;display:block" target="'+target+'" href="'+link+'"><span style="width:100%;height:100%;display:block"></span></a></div>'); 1311 } 1312 1313 } 1314 }); 1315 1316 // RESOLVE OVERFLOW HIDDEN OF MAIN CONTAINER 1317 container.parent().css({'overflow':'visible'}); 1318 1319 1320 container.find('>ul:first >li >img').each(function(j) { 1321 1322 var img=jQuery(this); 1323 1324 img.addClass('defaultimg'); 1325 if (img.data('lazyload')!=undefined && img.data('lazydone') != 1) { 1326 1327 } else { 1328 setSize(img,opt); 1329 } 1330 1331 1332 1333 img.wrap('<div class="slotholder" style="width:100%;height:100%;"'+ 1334 'data-duration="'+img.data('duration')+'"'+ 1335 'data-zoomstart="'+img.data("zoomstart")+'"'+ 1336 'data-zoomend="'+img.data("zoomend")+'"'+ 1337 'data-rotationstart="'+img.data("rotationstart")+'"'+ 1338 'data-rotationend="'+img.data("rotationend")+'"'+ 1339 'data-ease="'+img.data("ease")+'"'+ 1340 'data-duration="'+img.data("duration")+'"'+ 1341 'data-bgpositionend="'+img.data("bgpositionend")+'"'+ 1342 'data-bgposition="'+img.data("bgposition")+'"'+ 1343 'data-duration="'+img.data("duration")+'"'+ 1344 'data-kenburns="'+img.data("kenburns")+'"'+ 1345 'data-easeme="'+img.data("ease")+'"'+ 1346 'data-bgfit="'+img.data("bgfit")+'"'+ 1347 'data-bgfitend="'+img.data("bgfitend")+'"'+ 1348 'data-owidth="'+img.data("owidth")+'"'+ 1349 'data-oheight="'+img.data("oheight")+'"'+ 1350 '></div>'); 1351 1352 if (opt.dottedOverlay!="none" && opt.dottedOverlay!=undefined) 1353 img.closest('.slotholder').append('<div class="tp-dottedoverlay '+opt.dottedOverlay+'"></div>'); 1354 1355 var src=img.attr('src'); 1356 var datasrcadaptive = img.attr('data-src-adaptive'); 1357 1358 1359 var ll = img.data('lazyload'); 1360 var bgfit = img.data('bgfit'); 1361 var bgrepeat = img.data('bgrepeat'); 1362 var bgposition = img.data('bgposition'); 1363 1364
1365 if (bgfit==undefined) bgfit="cover"; 1366 if (bgrepeat==undefined) bgrepeat="no-repeat"; 1367 if (bgposition==undefined) bgposition="center center" 1368 1369 1370 var pari = img.closest('.slotholder'); 1371 1372 ////////////////////////////////////// 1373 // MODIFICA PER IMMAGINI ADAPTIVE /// 1374 //////////////////////////////////// 1375 //img.replaceWith('<div class="tp-bgimg defaultimg" data-lazyload="'+img.data('lazyload')+'" data-bgfit="'+bgfit+'"data-bgposition="'+bgposition+'" data-bgrepeat="'+bgrepeat+'" data-lazydone="'+img.data('lazydone')+'" src="'+src+'" data-src="'+src+'" style="background-color:'+img.css("backgroundColor")+';background-repeat:'+bgrepeat+';background-image:url('+src+');background-size:'+bgfit+';background-position:'+bgposition+';width:100%;height:100%;"></div>'); 1376 1377 img.replaceWith('<div class="tp-bgimg defaultimg adaptative-image" data-lazyload="'+img.data('lazyload')+'" data-bgfit="'+bgfit+'"data-bgposition="'+bgposition+'" data-bgrepeat="'+bgrepeat+'" data-lazydone="'+img.data('lazydone')+'" src="'+src+'" data-src="'+src+'" data-src-adaptive="'+datasrcadaptive+'" style="background-color:'+img.css("backgroundColor")+';background-repeat:'+bgrepeat+';background-image:url('+src+');background-size:'+bgfit+';background-position:'+bgposition+';width:100%;height:100%;"></div>'); 1378 1379 if (isIE(8)) { 1380 pari.find('.tp-bgimg').css({backgroundImage:"none",'background-image':'none'}); 1381 1382 //pari.find('.tp-bgimg').append('<img class="ieeightfallbackimage defaultimg" src="'+src+'" style="width:100%">'); 1383 pari.find('.tp-bgimg').append('<img class="ieeightfallbackimage defaultimg" src="'+src+'" data-src-adaptive="'+datasrcadaptive+'" style="width:100%">'); 1384 1385 } 1386 1387 1388 1389 1390 img.css({'opacity':0}); 1391 img.data('li-id',j); 1392 1393 }); 1394 } 1395 1396 1397 1398 1399 1400 /////////////////////// 1401 // PREPARE THE SLIDE // 1402 ////////////////////// 1403 function prepareOneSlideSlot(slotholder,opt,visible,vorh) { 1404 1405 1406 var sh=slotholder; 1407 var img = sh.find('.defaultimg') 1408 1409 var scalestart = sh.data('zoomstart'); 1410 var rotatestart = sh.data('rotationstart'); 1411 1412 if (img.data('currotate')!=undefined) 1413 rotatestart = img.data('currotate'); 1414 if (img.data('curscale')!=undefined) 1415 scalestart = img.data('curscale'); 1416 1417 1418 setSize(img,opt) 1419 var src = img.data('src'); 1420 1421 var bgcolor=img.css('background-color'); 1422 1423 var w = opt.width; 1424 var h = opt.height; 1425 if (opt.autoHeight=="on") 1426 h = opt.container.height(); 1427 1428 var fulloff = img.data("fxof"); 1429 if (fulloff==undefined) fulloff=0; 1430 1431 fullyoff=0; 1432 1433 var off=0; 1434 1435 var bgfit = img.data('bgfit'); 1436 var bgrepeat = img.data('bgrepeat'); 1437 var bgposition = img.data('bgposition'); 1438 1439 if (bgfit==undefined) bgfit="cover"; 1440 if (bgrepeat==undefined) bgrepeat="no-repeat"; 1441 if (bgposition==undefined) bgposition="center center"; 1442 1443 1444 1445 if (sh.data('kenburns')=="on") { 1446 bgfit=scalestart; 1447 if (bgfit.toString().length<4) 1448 bgfit = calculateKenBurnScales(bgfit,sh,opt); 1449 } 1450 1451 if (isIE(8)) { 1452 var imgsrc=src; 1453 src=""; 1454 } 1455 1456 if (vorh == "horizontal") { 1457 1458 if (!visible) var off=0-opt.slotw; 1459 1460 for (var i=0;i<opt.slots;i++) { 1461 sh.append('<div class="slot" style="position:absolute;'+ 1462 'top:'+(0+fullyoff)+'px;'+ 1463 'left:'+(fulloff+i*opt.slotw)+'px;'+ 1464 'overflow:hidden;width:'+opt.slotw+'px;'+ 1465 'height:'+h+'px">'+ 1466 '<div class="slotslide" style="position:absolute;'+ 1467 'top:0px;left:'+off+'px;'+ 1468 'width:'+opt.slotw+'px;'+ 1469 'height:'+h+'px;overflow:hidden;">'+ 1470 '<div style="background-color:'+bgcolor+';'+ 1471 'position:absolute;top:0px;'+ 1472 'left:'+(0-(i*opt.slotw))+'px;'+ 1473 'width:'+w+'px;height:'+h+'px;'+ 1474 'background-image:url('+src+');'+ 1475 'background-repeat:'+bgrepeat+';'+ 1476 'background-size:'+bgfit+';background-position:'+bgposition+';">'+ 1477 '</div></div></div>'); 1478 if (scalestart!=undefined && rotatestart!=undefined) 1479 TweenLite.set(sh.find('.slot').last(),{rotationZ:rotatestart}); 1480 if (isIE(8)) { 1481 sh.find('.slot ').last().find('.slotslide').append('<img class="ieeightfallbackimage" src="'+imgsrc+'" style="width:100%">'); 1482 ieimgposition(sh,opt); 1483 1484 } 1485 } 1486 } else { 1487 1488 if (!visible) var off=0-opt.sloth; 1489 1490 for (var i=0;i<opt.slots+2;i++) { 1491 sh.append('<div class="slot" style="position:absolute;'+
1492 'top:'+(fullyoff+(i*opt.sloth))+'px;'+ 1493 'left:'+(fulloff)+'px;'+ 1494 'overflow:hidden;'+ 1495 'width:'+w+'px;'+ 1496 'height:'+(opt.sloth)+'px">'+ 1497 1498 '<div class="slotslide" style="position:absolute;'+ 1499 'top:'+(off)+'px;'+ 1500 'left:0px;width:'+w+'px;'+ 1501 'height:'+opt.sloth+'px;'+ 1502 'overflow:hidden;">'+ 1503 '<div style="background-color:'+bgcolor+';'+ 1504 'position:absolute;'+ 1505 'top:'+(0-(i*opt.sloth))+'px;'+ 1506 'left:0px;'+ 1507 'width:'+w+'px;height:'+h+'px;'+ 1508 'background-image:url('+src+');'+ 1509 'background-repeat:'+bgrepeat+';'+ 1510 'background-size:'+bgfit+';background-position:'+bgposition+';">'+ 1511 1512 '</div></div></div>'); 1513 if (scalestart!=undefined && rotatestart!=undefined) 1514 TweenLite.set(sh.find('.slot').last(),{rotationZ:rotatestart}); 1515 if (isIE(8)) { 1516 sh.find('.slot ').last().find('.slotslide').append('<img class="ieeightfallbackimage" src="'+imgsrc+'" style="width:100%">'); 1517 ieimgposition(sh,opt); 1518 } 1519 } 1520 } 1521 1522 1523 1524 1525 } 1526 1527 1528 1529 /////////////////////// 1530 // PREPARE THE SLIDE // 1531 ////////////////////// 1532 function prepareOneSlideBox(slotholder,opt,visible) { 1533 1534 var sh=slotholder; 1535 var img = sh.find('.defaultimg'); 1536 1537 var scalestart = sh.data('zoomstart'); 1538 var rotatestart = sh.data('rotationstart'); 1539 1540 if (img.data('currotate')!=undefined) 1541 rotatestart = img.data('currotate'); 1542 if (img.data('curscale')!=undefined) 1543 scalestart = img.data('curscale')*100; 1544 1545 1546 1547 1548 setSize(img,opt) 1549 var src = img.data('src'); 1550 var bgcolor=img.css('backgroundColor'); 1551 1552 var w = opt.width; 1553 var h = opt.height; 1554 if (opt.autoHeight=="on") 1555 h = opt.container.height(); 1556 1557 var fulloff = img.data("fxof"); 1558 if (fulloff==undefined) fulloff=0; 1559 1560 fullyoff=0; 1561 1562 1563 1564 var off=0; 1565 1566 1567 if (isIE(8)) { 1568 var imgsrc=src; 1569 src=""; 1570 } 1571 1572 // SET THE MINIMAL SIZE OF A BOX 1573 var basicsize = 0; 1574 if (opt.sloth>opt.slotw) 1575 basicsize=opt.sloth 1576 else 1577 basicsize=opt.slotw; 1578 1579 1580 if (!visible) { 1581 var off=0-basicsize; 1582 } 1583 1584 opt.slotw = basicsize; 1585 opt.sloth = basicsize; 1586 var x=0; 1587 var y=0; 1588 1589 var bgfit = img.data('bgfit'); 1590 var bgrepeat = img.data('bgrepeat'); 1591 var bgposition = img.data('bgposition'); 1592 1593 if (bgfit==undefined) bgfit="cover"; 1594 if (bgrepeat==undefined) bgrepeat="no-repeat"; 1595 if (bgposition==undefined) bgposition="center center"; 1596 1597 if (sh.data('kenburns')=="on") { 1598 bgfit=scalestart; 1599 if (bgfit.toString().length<4) 1600 bgfit = calculateKenBurnScales(bgfit,sh,opt); 1601 } 1602 1603 for (var j=0;j<opt.slots;j++) { 1604 1605 y=0; 1606 for (var i=0;i<opt.slots;i++) { 1607 1608 1609 sh.append('<div class="slot" '+ 1610 'style="position:absolute;'+ 1611 'top:'+(fullyoff+y)+'px;'+ 1612 'left:'+(fulloff+x)+'px;'+ 1613 'width:'+basicsize+'px;'+ 1614 'height:'+basicsize+'px;'+ 1615 'overflow:hidden;">'+ 1616 1617 '<div class="slotslide" data-x="'+x+'" data-y="'+y+'" '+ 1618 'style="position:absolute;'+ 1619 'top:'+(0)+'px;'+ 1620 'left:'+(0)+'px;'+ 1621 'width:'+basicsize+'px;'+ 1622 'height:'+basicsize+'px;'+ 1623 'overflow:hidden;">'+ 1624 1625 '<div style="position:absolute;'+ 1626 'top:'+(0-y)+'px;'+ 1627 'left:'+(0-x)+'px;'+ 1628 'width:'+w+'px;'+ 1629 'height:'+h+'px;'+ 1630 'background-color:'+bgcolor+';'+ 1631 'background-image:url('+src+');'+ 1632 'background-repeat:'+bgrepeat+';'+ 1633 'background-size:'+bgfit+';background-position:'+bgposition+';">'+ 1634 '</div></div></div>'); 1635 y=y+basicsize; 1636 1637 if (isIE(8)) { 1638 1639 sh.find('.slot ').last().find('.slotslide').append('<img src="'+imgsrc+'">'); 1640 ieimgposition(sh,opt); 1641 } 1642 1643 if (scalestart!=undefined && rotatestart!=undefined) 1644 TweenLite.set(sh.find('.slot').last(),{rotationZ:rotatestart}); 1645 } 1646 x=x+basicsize; 1647 } 1648 } 1649 1650 /*********************************************** 1651 - MOVE IE8 IMAGE IN RIGHT POSITION - 1652 ***********************************************/ 1653 1654 function ieimgposition(nextsh,opt) { 1655 1656 if (isIE(8)) { 1657 var ie8img = nextsh.find('.ieeightfallbackimage');
1658 if (opt.startwidth/opt.startheight <nextsh.data('owidth')/nextsh.data('oheight')) 1659 ie8img.css({width:"auto",height:"100%"}) 1660 else 1661 ie8img.css({width:"100%",height:"auto"}) 1662 1663 1664 1665 var ie8w = ie8img.width(), 1666 ie8h = ie8img.height(); 1667 1668 if (nextsh.data('bgposition')=="center center") 1669 ie8img.css({position:"absolute",top:opt.height/2 - ie8h/2+"px", left:opt.width/2-ie8w/2+"px"}); 1670 1671 if (nextsh.data('bgposition')=="center top" || nextsh.data('bgposition')=="top center") 1672 ie8img.css({position:"absolute",top:"0px", left:opt.width/2-ie8w/2+"px"}); 1673 1674 if (nextsh.data('bgposition')=="center bottom" || nextsh.data('bgposition')=="bottom center") 1675 ie8img.css({position:"absolute",bottom:"0px", left:opt.width/2-ie8w/2+"px"}); 1676 1677 1678 if (nextsh.data('bgposition')=="right top" || nextsh.data('bgposition')=="top right") 1679 ie8img.css({position:"absolute",top:"0px", right:"0px"}); 1680 1681 if (nextsh.data('bgposition')=="right bottom" || nextsh.data('bgposition')=="bottom right") 1682 ie8img.css({position:"absolute",bottom:"0px", right:"0px"}); 1683 1684 if (nextsh.data('bgposition')=="right center" || nextsh.data('bgposition')=="center right") 1685 ie8img.css({position:"absolute",top:opt.height/2 - ie8h/2+"px", right:"0px"}); 1686 1687 if (nextsh.data('bgposition')=="left bottom" || nextsh.data('bgposition')=="bottom left") 1688 ie8img.css({position:"absolute",bottom:"0px", left:"0px"}); 1689 1690 if (nextsh.data('bgposition')=="left center" || nextsh.data('bgposition')=="center left") 1691 ie8img.css({position:"absolute",top:opt.height/2 - ie8h/2+"px", left:"0px"}); 1692 } 1693 } 1694 1695 1696 1697 1698 /////////////////////// 1699 // REMOVE SLOTS // 1700 ///////////////////// 1701 function removeSlots(container,opt,time) { 1702 if (time==undefined) 1703 time==80 1704 1705 setTimeout(function() { 1706 container.find('.slotholder .slot').each(function() { 1707 clearTimeout(jQuery(this).data('tout')); 1708 jQuery(this).remove(); 1709 }); 1710 opt.transition = 0; 1711 },time); 1712 } 1713 1714 1715 /******************************************* 1716 - PREPARE LOADING OF IMAGES - 1717 ********************************************/ 1718 function loadAllPrepared(container,alreadyinload) { 1719 1720 container.find('img, .defaultimg').each(function(i) { 1721 var img = jQuery(this); 1722 1723 if (img.data('lazyload')!=img.attr('src') && alreadyinload<3 && img.data('lazyload')!=undefined && img.data('lazyload')!='undefined') { 1724 1725 if (img.data('lazyload') !=undefined && img.data('lazyload') !='undefined') { 1726 img.attr('src',img.data('lazyload')); 1727 1728 var limg = new Image(); 1729 1730 limg.onload = function(i) { 1731 img.data('lazydone',1); 1732 if (img.hasClass("defaultimg")) setDefImg(img,limg); 1733 } 1734 limg.error = function() { 1735 img.data('lazydone',1); 1736 } 1737 1738 limg.src=img.attr('src'); 1739 if (limg.complete) { 1740 if (img.hasClass("defaultimg")) setDefImg(img,limg); 1741 img.data('lazydone',1); 1742 } 1743 1744 } 1745 } else { 1746 1747 if ((img.data('lazyload') === undefined || img.data('lazyload') === 'undefined') && img.data('lazydone')!=1) { 1748 var limg = new Image(); 1749 limg.onload = function() { 1750 if (img.hasClass("defaultimg")) setDefImg(img,limg); 1751 img.data('lazydone',1); 1752 } 1753 limg.error = function() { 1754 img.data('lazydone',1); 1755 } 1756 1757 1758 if (img.attr('src')!=undefined && img.attr('src')!='undefined') { 1759 limg.src = img.attr('src'); 1760 } else 1761 limg.src = img.data('src'); 1762 1763 if (limg.complete) { 1764 if (img.hasClass("defaultimg")) { 1765 setDefImg(img,limg); 1766 } 1767 img.data('lazydone',1); 1768 } 1769 } 1770 } 1771 }) 1772 } 1773 1774 function setDefImg(img,limg) { 1775 var nextli = img.closest('li'); 1776 var ww = limg.width; 1777 var hh = limg.height; 1778 nextli.data('owidth',ww); 1779 nextli.data('oheight',hh); 1780 nextli.find('.slotholder').data('owidth',ww); 1781 nextli.find('.slotholder').data('oheight',hh); 1782 nextli.data('loadeddone',1); 1783 } 1784 1785 var waitForLoads = function(element,call,opt) { 1786 1787 loadAllPrepared(element,0) 1788 var inter = setInterval(function() { 1789 opt.bannertimeronpause = true; 1790 opt.container.trigger('stoptimer'); 1791 opt.cd=0; 1792 var found = 0; 1793 element.find('img, .defaultimg').each(function(i) { 1794 if (jQuery(this).data('lazydone')!=1) { 1795 found++; 1796 1797 } 1798 }); 1799 1800 if (found>0) 1801 loadAllPrepared(element,found); 1802 else { 1803 clearInterval(inter); 1804 if (call!=undefined) call(); 1805 } 1806 1807 },100) 1808 } 1809 1810 1811 ////////////////////////////// 1812 // // 1813 // - SWAP THE SLIDES - // 1814 // // 1815 //////////////////////////// 1816 function swapSlide(container,opt) { 1817 try{ 1818 var actli = container.find('>ul:first-child >li:eq('+opt.act+')'); 1819 } catch(e) { 1820 var actli=container.find('>ul:first-child >li:eq(1)'); 1821 } 1822 opt.lastslide=opt.act; 1823 var nextli = container.find('>ul:first-child >li:eq('+opt.next+')'); 1824 1825 var defimg= nextli.find('.defaultimg'); 1826 1827 1828 opt.bannertimeronpause = true; 1829 container.trigger('stoptimer'); 1830 opt.cd=0; 1831
1832 if (defimg.data('lazyload') !=undefined && defimg.data('lazyload') !="undefined" && defimg.data('lazydone') !=1 ) { 1833 1834 defimg.css({backgroundImage:'url("'+nextli.find('.defaultimg').data('lazyload')+'")'}); 1835 1836 defimg.data('src',nextli.find('.defaultimg').data('lazyload')); 1837 defimg.data('lazydone',1); 1838 defimg.data('orgw',0); 1839 nextli.data('loadeddone',1); 1840 1841 TweenLite.set(container.find('.tp-loader'),{display:"block",opacity:0}); 1842 TweenLite.to(container.find('.tp-loader'),0.3,{autoAlpha:1}); 1843 1844 waitForLoads(nextli,function() { 1845 swapSlideCall(opt,defimg,container) 1846 },opt); 1847 1848 } else { 1849 1850 if (nextli.data('loadeddone')===undefined) { 1851 nextli.data('loadeddone',1); 1852 waitForLoads(nextli,function() { 1853 swapSlideCall(opt,defimg,container) 1854 },opt); 1855 } else 1856 1857 swapSlideCall(opt,defimg,container) 1858 } 1859 } 1860 1861 function swapSlideCall(opt,defimg,container) { 1862 opt.bannertimeronpause = false; 1863 1864 opt.cd=0; 1865 container.trigger('nulltimer'); console.log("hey"); 1866 TweenLite.to(container.find('.tp-loader'),0.3,{autoAlpha:0}); 1867 setSize(defimg,opt); 1868 setBulPos(container,opt); 1869 setSize(defimg,opt); 1870 swapSlideProgress(container,opt); 1871 1872 } 1873 1874 /****************************** 1875 - SWAP SLIDE PROGRESS - 1876 ********************************/ 1877 /*!SWAP SLIDE*/ 1878 function swapSlideProgress(container,opt) { 1879 1880 1881 container.trigger('revolution.slide.onbeforeswap'); 1882 1883 opt.transition = 1; 1884 opt.videoplaying = false; 1885 //konsole.log("VideoPlay set to False due swapSlideProgress"); 1886 1887 try{ 1888 var actli = container.find('>ul:first-child >li:eq('+opt.act+')'); 1889 } catch(e) { 1890 var actli=container.find('>ul:first-child >li:eq(1)'); 1891 } 1892 1893 opt.lastslide=opt.act; 1894 1895 var nextli = container.find('>ul:first-child >li:eq('+opt.next+')'); 1896 1897 1898 var actsh = actli.find('.slotholder'); 1899 var nextsh = nextli.find('.slotholder'); 1900 actli.css({'visibility':'visible'}); 1901 nextli.css({'visibility':'visible'}); 1902 1903 if (nextsh.data('kenburns')=="on") 1904 stopKenBurn(container,opt); 1905 1906 1907 if (opt.ie) { 1908 if (comingtransition=="boxfade") comingtransition = "boxslide"; 1909 if (comingtransition=="slotfade-vertical") comingtransition = "slotzoom-vertical"; 1910 if (comingtransition=="slotfade-horizontal") comingtransition = "slotzoom-horizontal"; 1911 } 1912 1913 1914 // IF DELAY HAS BEEN SET VIA THE SLIDE, WE TAKE THE NEW VALUE, OTHER WAY THE OLD ONE... 1915 if (nextli.data('delay')!=undefined) { 1916 opt.cd=0; 1917 opt.delay=nextli.data('delay'); 1918 } else { 1919 opt.delay=opt.origcd; 1920 } 1921 1922 container.trigger('restarttimer'); 1923 1924 // RESET POSITION AND FADES OF LI'S 1925 actli.css({'left':'0px','top':'0px'}); 1926 nextli.css({'left':'0px','top':'0px'}); 1927 1928 1929 // IF THERE IS AN OTHER FIRST SLIDE START HAS BEED SELECTED 1930 if (nextli.data('differentissplayed') =='prepared') { 1931 nextli.data('differentissplayed','done'); 1932 nextli.data('transition',nextli.data('savedtransition')); 1933 nextli.data('slotamount',nextli.data('savedslotamount')); 1934 nextli.data('masterspeed',nextli.data('savedmasterspeed')); 1935 } 1936 1937 1938 if (nextli.data('fstransition') != undefined && nextli.data('differentissplayed') !="done") { 1939 nextli.data('savedtransition',nextli.data('transition')); 1940 nextli.data('savedslotamount',nextli.data('slotamount')); 1941 nextli.data('savedmasterspeed',nextli.data('masterspeed')); 1942 1943 nextli.data('transition',nextli.data('fstransition')); 1944 nextli.data('slotamount',nextli.data('fsslotamount')); 1945 nextli.data('masterspeed',nextli.data('fsmasterspeed')); 1946 1947 nextli.data('differentissplayed','prepared'); 1948 } 1949 1950 /////////////////////////////////////// 1951 // TRANSITION CHOOSE - RANDOM EFFECTS// 1952 /////////////////////////////////////// 1953 var nexttrans = 0; 1954 1955 1956 var transtext = nextli.data('transition').split(","); 1957 var curtransid = nextli.data('nexttransid'); 1958 if (curtransid == undefined) { 1959 curtransid=0; 1960 nextli.data('nexttransid',curtransid); 1961 } else { 1962 curtransid=curtransid+1; 1963 if (curtransid==transtext.length) curtransid=0; 1964 nextli.data('nexttransid',curtransid); 1965 1966 } 1967 1968 1969 1970 var comingtransition = transtext[curtransid]; 1971 var specials = 0; 1972 1973 /*if (opt.ffnn == undefined) opt.ffnn=0;
1974 comingtransition=opt.ffnn; 1975 opt.ffnn=opt.ffnn+1; 1976 if (opt.ffnn>46) opt.ffnn=0;*/ 1977 1978 1979 /* Transition Name , 1980 Transition Code, 1981 Transition Sub Code, 1982 Max Slots, 1983 MasterSpeed Delays, 1984 Preparing Slots (box,slideh, slidev), 1985 Call on nextsh (null = no, true/false for visibility first preparing), 1986 Call on actsh (null = no, true/false for visibility first preparing), 1987 */ 1988 1989 if (comingtransition=="slidehorizontal") { 1990 comingtransition = "slideleft" 1991 if (opt.leftarrowpressed==1) 1992 comingtransition = "slideright" 1993 } 1994 1995 if (comingtransition=="slidevertical") { 1996 comingtransition = "slideup" 1997 if (opt.leftarrowpressed==1) 1998 comingtransition = "slidedown" 1999 } 2000 2001 2002 var transitionsArray = [ ['boxslide' , 0, 1, 10, 0,'box',false,null,0], 2003 ['boxfade', 1, 0, 10, 0,'box',false,null,1], 2004 ['slotslide-horizontal', 2, 0, 0, 200,'horizontal',true,false,2], 2005 ['slotslide-vertical', 3, 0,0,200,'vertical',true,false,3], 2006 ['curtain-1', 4, 3,0,0,'horizontal',true,true,4], 2007 ['curtain-2', 5, 3,0,0,'horizontal',true,true,5], 2008 ['curtain-3', 6, 3,25,0,'horizontal',true,true,6], 2009 ['slotzoom-horizontal', 7, 0,0,400,'horizontal',true,true,7], 2010 ['slotzoom-vertical', 8, 0,0,0,'vertical',true,true,8], 2011 ['slotfade-horizontal', 9, 0,0,500,'horizontal',true,null,9], 2012 ['slotfade-vertical', 10, 0,0 ,500,'vertical',true,null,10], 2013 ['fade', 11, 0, 1 ,300,'horizontal',true,null,11], 2014 ['slideleft', 12, 0,1,0,'horizontal',true,true,12], 2015 ['slideup', 13, 0,1,0,'horizontal',true,true,13], 2016 ['slidedown', 14, 0,1,0,'horizontal',true,true,14], 2017 ['slideright', 15, 0,1,0,'horizontal',true,true,15], 2018 ['papercut', 16, 0,0,600,'',null,null,16], 2019 ['3dcurtain-horizontal', 17, 0,20,100,'vertical',false,true,17], 2020 ['3dcurtain-vertical', 18, 0,10,100,'horizontal',false,true,18], 2021 ['cubic', 19, 0,20,600,'horizontal',false,true,19], 2022 ['cube',19,0,20,600,'horizontal',false,true,20], 2023 ['flyin', 20, 0,4,600,'vertical',false,true,21], 2024 ['turnoff', 21, 0,1,1600,'horizontal',false,true,22], 2025 ['incube', 22, 0,20,600,'horizontal',false,true,23], 2026 ['cubic-horizontal', 23, 0,20,500,'vertical',false,true,24], 2027 ['cube-horizontal', 23, 0,20,500,'vertical',false,true,25], 2028 ['incube-horizontal', 24, 0,20,500,'vertical',false,true,26], 2029 ['turnoff-vertical', 25, 0,1,1600,'horizontal',false,true,27], 2030 ['fadefromright', 12, 1,1,0,'horizontal',true,true,28], 2031 ['fadefromleft', 15, 1,1,0,'horizontal',true,true,29], 2032 ['fadefromtop', 14, 1,1,0,'horizontal',true,true,30], 2033 ['fadefrombottom', 13, 1,1,0,'horizontal',true,true,31], 2034 ['fadetoleftfadefromright', 12, 2,1,0,'horizontal',true,true,32], 2035 ['fadetorightfadetoleft', 15, 2,1,0,'horizontal',true,true,33], 2036 ['fadetobottomfadefromtop', 14, 2,1,0,'horizontal',true,true,34], 2037 ['fadetotopfadefrombottom', 13, 2,1,0,'horizontal',true,true,35], 2038 ['parallaxtoright', 12, 3,1,0,'horizontal',true,true,36], 2039 ['parallaxtoleft', 15, 3,1,0,'horizontal',true,true,37], 2040 ['parallaxtotop', 14, 3,1,0,'horizontal',true,true,38], 2041 ['parallaxtobottom', 13, 3,1,0,'horizontal',true,true,39], 2042 ['scaledownfromright', 12, 4,1,0,'horizontal',true,true,40], 2043 ['scaledownfromleft', 15, 4,1,0,'horizontal',true,true,41], 2044 ['scaledownfromtop', 14, 4,1,0,'horizontal',true,true,42], 2045 ['scaledownfrombottom', 13, 4,1,0,'horizontal',true,true,43], 2046 ['zoomout', 13, 5,1,0,'horizontal',true,true,44], 2047 ['zoomin', 13, 6,1,0,'horizontal',true,true,45], 2048 ['notransition',26,0,1,0,'horizontal',true,null,46] 2049 ]; 2050 2051 2052 var flatTransitions = [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45]; 2053 var premiumTransitions = [16,17,18,19,20,21,22,23,24,25,26,27] 2054 2055 var nexttrans =0; 2056 var specials = 1; 2057 var STAindex = 0; 2058 var indexcounter =0; 2059 var STA = new Array; 2060 2061 2062 // RANDOM TRANSITIONS 2063 if (comingtransition == "random") { 2064 comingtransition = Math.round(Math.random()*transitionsArray.length-1); 2065 if (comingtransition>transitionsArray.length-1) comingtransition=transitionsArray.length-1; 2066 } 2067 2068 // RANDOM FLAT TRANSITIONS 2069 if (comingtransition == "random-static") { 2070 comingtransition = Math.round(Math.random()*flatTransitions.length-1); 2071 if (comingtransition>flatTransitions.length-1) comingtransition=flatTransitions.length-1; 2072 comingtransition = flatTransitions[comingtransition]; 2073 } 2074 2075 // RANDOM PREMIUM TRANSITIONS 2076 if (comingtransition == "random-premium") { 2077 comingtransition = Math.round(Math.random()*premiumTransitions.length-1); 2078 if (comingtransition>premiumTransitions.length-1) comingtransition=premiumTransitions.length-1; 2079 comingtransition = premiumTransitions[comingtransition]; 2080 } 2081 2082 findTransition(); 2083
2084 // CHECK IF WE HAVE IE8 AND THAN FALL BACK ON FLAT TRANSITIONS 2085 if (isIE(8) && nexttrans>15 && nexttrans<28) { 2086 comingtransition = Math.round(Math.random()*flatTransitions.length-1); 2087 if (comingtransition>flatTransitions.length-1) comingtransition=flatTransitions.length-1; 2088 comingtransition = flatTransitions[comingtransition]; 2089 indexcounter =0; 2090 findTransition(); 2091 } 2092 2093 function findTransition() { 2094 // FIND THE RIGHT TRANSITION PARAMETERS HERE 2095 jQuery.each(transitionsArray,function(inde,trans) { 2096 if (trans[0] == comingtransition || trans[8] == comingtransition) { 2097 nexttrans = trans[1]; 2098 specials = trans[2]; 2099 STAindex = indexcounter; 2100 } 2101 indexcounter = indexcounter+1; 2102 }) 2103 } 2104 2105 2106 2107 var direction=-1; 2108 if (opt.leftarrowpressed==1 || opt.act>opt.next) direction=1; 2109 2110 2111 2112 opt.leftarrowpressed=0; 2113 2114 if (nexttrans>26) nexttrans = 26; 2115 if (nexttrans<0) nexttrans = 0; 2116 2117 2118 // DEFINE THE MASTERSPEED FOR THE SLIDE // 2119 var masterspeed=300; 2120 if (nextli.data('masterspeed')!=undefined && nextli.data('masterspeed')>99 && nextli.data('masterspeed')<4001) 2121 masterspeed = nextli.data('masterspeed'); 2122 2123 // PREPARED DEFAULT SETTINGS PER TRANSITION 2124 STA = transitionsArray[STAindex]; 2125 2126 2127 2128 2129 2130 ///////////////////////////////////////////// 2131 // SET THE BULLETS SELECTED OR UNSELECTED // 2132 ///////////////////////////////////////////// 2133 2134 2135 container.parent().find(".bullet").each(function() { 2136 var bul = jQuery(this); 2137 bul.removeClass("selected"); 2138 2139 if (opt.navigationArrows=="withbullet" || opt.navigationArrows=="nexttobullets") { 2140 if (bul.index()-1 == opt.next) bul.addClass('selected'); 2141 2142 } else { 2143 2144 if (bul.index() == opt.next) bul.addClass('selected'); 2145 2146 } 2147 }); 2148 2149 2150 2151 ////////////////////////////////////////////////////////////////// 2152 // SET THE NEXT CAPTION AND REMOVE THE LAST CAPTION // 2153 ////////////////////////////////////////////////////////////////// 2154 2155 container.find('>li').each(function() { 2156 var li = jQuery(this); 2157 if (li.index!=opt.act && li.index!=opt.next) li.css({'z-index':16}); 2158 }); 2159 2160 actli.css({'z-index':18}); 2161 nextli.css({'z-index':20}); 2162 nextli.css({'opacity':0}); 2163 2164 2165 /////////////////////////// 2166 // ANIMATE THE CAPTIONS // 2167 /////////////////////////// 2168 2169 if (actli.index() != nextli.index() && opt.firststart!=1) { 2170 removeTheCaptions(actli,opt); 2171 2172 } 2173 animateTheCaptions(nextli, opt); 2174 2175 2176 2177 2178 ///////////////////////////////////////////// 2179 // SET THE ACTUAL AMOUNT OF SLIDES !! // 2180 // SET A RANDOM AMOUNT OF SLOTS // 2181 /////////////////////////////////////////// 2182 if (nextli.data('slotamount')==undefined || nextli.data('slotamount')<1) { 2183 opt.slots=Math.round(Math.random()*12+4); 2184 if (comingtransition=="boxslide") 2185 opt.slots=Math.round(Math.random()*6+3); 2186 else 2187 if (comingtransition=="flyin") 2188 opt.slots=Math.round(Math.random()*4+1); 2189 } else { 2190 opt.slots=nextli.data('slotamount'); 2191 2192 } 2193 2194 ///////////////////////////////////////////// 2195 // SET THE ACTUAL AMOUNT OF SLIDES !! // 2196 // SET A RANDOM AMOUNT OF SLOTS // 2197 /////////////////////////////////////////// 2198 if (nextli.data('rotate')==undefined) 2199 opt.rotate = 0 2200 else 2201 if (nextli.data('rotate')==999) 2202 opt.rotate=Math.round(Math.random()*360); 2203 else 2204 opt.rotate=nextli.data('rotate'); 2205 if (!jQuery.support.transition || opt.ie || opt.ie9) opt.rotate=0; 2206 2207 2208 2209 ////////////////////////////// 2210 // FIRST START // 2211 ////////////////////////////// 2212 2213 if (opt.firststart==1) { 2214 actli.css({'opacity':0}); 2215 opt.firststart=0; 2216 } 2217 2218 2219 // HERE COMES THE TRANSITION ENGINE 2220 2221 // ADJUST MASTERSPEED 2222 masterspeed = masterspeed + STA[4]; 2223 2224 if ((nexttrans==4 || nexttrans==5 || nexttrans==6) && opt.slots<3 ) opt.slots=3; 2225 2226 // ADJUST SLOTS 2227 if (STA[3] != 0) opt.slots = Math.min(opt.slots,STA[3]); 2228 if (nexttrans==9) opt.slots = opt.width/20; 2229 if (nexttrans==10) opt.slots = opt.height/20; 2230 2231 2232 2233 2234 // PREPAREONESLIDEBOX 2235 if (STA[5] == "box") { 2236 if (STA[7] !=null) prepareOneSlideBox(actsh,opt,STA[7]); 2237 if (STA[6] !=null) prepareOneSlideBox(nextsh,opt,STA[6]); 2238 } else 2239 2240 if (STA[5] == "vertical" || STA[5] == "horizontal") { 2241 if (STA[7] !=null) prepareOneSlideSlot(actsh,opt,STA[7],STA[5]); 2242 if (STA[6] !=null) prepareOneSlideSlot(nextsh,opt,STA[6],STA[5]); 2243 } 2244 2245 // SHOW FIRST LI 2246 if (nexttrans<12 || nexttrans>16) nextli.css({'opacity':1}); 2247 2248
2249 ///////////////////////////////////// 2250 // THE SLOTSLIDE - TRANSITION I. // 2251 //////////////////////////////////// 2252 if (nexttrans==0) { // BOXSLIDE 2253 //SET DEFAULT IMG UNVISIBLE 2254 nextsh.find('.defaultimg').css({'opacity':0}); 2255 2256 // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT 2257 2258 var maxz = Math.ceil(opt.height/opt.sloth); 2259 var curz = 0; 2260 nextsh.find('.slotslide').each(function(j) { 2261 var ss=jQuery(this); 2262 curz=curz+1; 2263 if (curz==maxz) curz=0; 2264 2265 TweenLite.fromTo(ss,(masterspeed)/600, 2266 {opacity:0,top:(0-opt.sloth),left:(0-opt.slotw),rotation:opt.rotate}, 2267 {opacity:1,transformPerspective:600,top:0,left:0,scale:1,rotation:0,delay:((j)*15 + (curz)*30)/1500, ease:Power2.easeOut,onComplete:function() { 2268 if (j==(opt.slots*opt.slots)-1) { 2269 letItFree(container,opt,nextsh,actsh,nextli,actli) 2270 } 2271 2272 }}); 2273 }); 2274 } 2275 ///////////////////////////////////// 2276 // THE SLOTSLIDE - TRANSITION I. // 2277 //////////////////////////////////// 2278 if (nexttrans==1) { 2279 2280 2281 //SET DEFAULT IMG UNVISIBLE 2282 nextsh.find('.defaultimg').css({'opacity':0}); 2283 2284 // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT 2285 2286 var maxtime; 2287 2288 nextsh.find('.slotslide').each(function(j) { 2289 var ss=jQuery(this); 2290 2291 rand=Math.random()*masterspeed+300; 2292 rand2=Math.random()*500+200; 2293 2294 if (rand+rand2>maxtime) maxtime = rand2+rand2; 2295 2296 2297 TweenLite.fromTo(ss,rand/1000, 2298 {opacity:0,transformPerspective:600,rotation:opt.rotate}, 2299 {opacity:1, ease:Power2.easeInOut,rotation:0,delay:rand2/1000}) 2300 2301 2302 2303 }); 2304 2305 setTimeout(function() { 2306 letItFree(container,opt,nextsh,actsh,nextli,actli) 2307 },masterspeed+300); 2308 2309 } 2310 2311 2312 ///////////////////////////////////// 2313 // THE SLOTSLIDE - TRANSITION I. // 2314 //////////////////////////////////// 2315 if (nexttrans==2) { 2316 2317 2318 //SET DEFAULT IMG UNVISIBLE 2319 nextsh.find('.defaultimg').css({'opacity':0}); 2320 2321 // ALL OLD SLOTS SHOULD BE SLIDED TO THE RIGHT 2322 actsh.find('.slotslide').each(function() { 2323 var ss=jQuery(this); 2324 2325 TweenLite.to(ss,masterspeed/1000,{left:opt.slotw, rotation:(0-opt.rotate),onComplete:function() { 2326 letItFree(container,opt,nextsh,actsh,nextli,actli) 2327 2328 }}); 2329 2330 }); 2331 2332 // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT 2333 nextsh.find('.slotslide').each(function() { 2334 var ss=jQuery(this); 2335 2336 TweenLite.fromTo(ss,masterspeed/1000, 2337 {left:0-opt.slotw, rotation:opt.rotate,transformPerspective:600}, 2338 {left:0, rotation:0,ease:Power2.easeOut,onComplete:function() { 2339 letItFree(container,opt,nextsh,actsh,nextli,actli) 2340 } 2341 }); 2342 2343 }); 2344 } 2345 2346 2347 2348 ///////////////////////////////////// 2349 // THE SLOTSLIDE - TRANSITION I. // 2350 //////////////////////////////////// 2351 if (nexttrans==3) { 2352 2353 2354 //SET DEFAULT IMG UNVISIBLE 2355 nextsh.find('.defaultimg').css({'opacity':0}); 2356 2357 // ALL OLD SLOTS SHOULD BE SLIDED TO THE RIGHT 2358 actsh.find('.slotslide').each(function() { 2359 var ss=jQuery(this); 2360 TweenLite.to(ss,masterspeed/1000,{top:opt.sloth,rotation:opt.rotate,transformPerspective:600,onComplete:function() { 2361 letItFree(container,opt,nextsh,actsh,nextli,actli) 2362 }}); 2363 2364 }); 2365 2366 // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT 2367 nextsh.find('.slotslide').each(function() { 2368 var ss=jQuery(this); 2369 2370 TweenLite.fromTo(ss,masterspeed/1000, 2371 {top:0-opt.sloth,rotation:opt.rotate,transformPerspective:600}, 2372 {top:0,rotation:0,ease:Power2.easeOut,onComplete:function() { 2373 letItFree(container,opt,nextsh,actsh,nextli,actli) 2374 }}); 2375 2376 }); 2377 } 2378 2379 2380 2381 ///////////////////////////////////// 2382 // THE SLOTSLIDE - TRANSITION I. //
2383 //////////////////////////////////// 2384 if (nexttrans==4 || nexttrans==5) { 2385 2386 //SET DEFAULT IMG UNVISIBLE 2387 2388 2389 2390 2391 nextsh.find('.defaultimg').css({'opacity':0}); 2392 setTimeout(function() { 2393 actsh.find('.defaultimg').css({opacity:0}); 2394 },100); 2395 2396 2397 2398 // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT 2399 var cspeed = (masterspeed)/1000; 2400 var ticker = cspeed; 2401 2402 2403 2404 actsh.find('.slotslide').each(function(i) { 2405 var ss=jQuery(this); 2406 var del = (i*cspeed)/opt.slots; 2407 if (nexttrans==5) del = ((opt.slots-i-1)*cspeed)/(opt.slots)/1.5; 2408 TweenLite.to(ss,cspeed*3,{transformPerspective:600,top:0+opt.height,opacity:0.5,rotation:opt.rotate,ease:Power2.easeInOut,delay:del}); 2409 }); 2410 2411 // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT 2412 nextsh.find('.slotslide').each(function(i) { 2413 var ss=jQuery(this); 2414 var del = (i*cspeed)/opt.slots; 2415 if (nexttrans==5) del = ((opt.slots-i-1)*cspeed)/(opt.slots)/1.5; 2416 TweenLite.fromTo(ss,cspeed*3, 2417 {top:(0-opt.height),opacity:0.5,rotation:opt.rotate,transformPerspective:600}, 2418 {top:0,opacity:1,rotation:0,ease:Power2.easeInOut,delay:del,onComplete:function() { 2419 if (i==opt.slots-1) { 2420 letItFree(container,opt,nextsh,actsh,nextli,actli) 2421 } 2422 }}); 2423 2424 }); 2425 2426 2427 } 2428 2429 2430 2431 2432 ///////////////////////////////////// 2433 // THE SLOTSLIDE - TRANSITION I. // 2434 //////////////////////////////////// 2435 if (nexttrans==6) { 2436 2437 2438 if (opt.slots<2) opt.slots=2; 2439 2440 //SET DEFAULT IMG UNVISIBLE 2441 nextsh.find('.defaultimg').css({'opacity':0}); 2442 setTimeout(function() { 2443 actsh.find('.defaultimg').css({opacity:0}); 2444 },100); 2445 2446 actsh.find('.slotslide').each(function(i) { 2447 var ss=jQuery(this); 2448 2449 if (i<opt.slots/2) 2450 var tempo = (i+2)*60; 2451 else 2452 var tempo = (2+opt.slots-i)*60; 2453 2454 TweenLite.to(ss,(masterspeed+tempo)/1000,{top:0+opt.height,opacity:1,rotation:opt.rotate,transformPerspective:600,ease:Power2.easeInOut}); 2455 2456 2457 }); 2458 2459 // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT 2460 nextsh.find('.slotslide').each(function(i) { 2461 var ss=jQuery(this); 2462 2463 if (i<opt.slots/2) 2464 var tempo = (i+2)*60; 2465 else 2466 var tempo = (2+opt.slots-i)*60; 2467 2468 TweenLite.fromTo(ss,(masterspeed+tempo)/1000, 2469 {top:(0-opt.height),opacity:1,rotation:opt.rotate,transformPerspective:600}, 2470 {top:(0),opacity:1,rotation:0,ease:Power2.easeInOut,onComplete:function() { 2471 if (i==Math.round(opt.slots/2)) { 2472 letItFree(container,opt,nextsh,actsh,nextli,actli) 2473 } 2474 }}); 2475 2476 2477 2478 2479 }); 2480 } 2481 2482 2483 //////////////////////////////////// 2484 // THE SLOTSZOOM - TRANSITION II. // 2485 //////////////////////////////////// 2486 if (nexttrans==7) { 2487 2488 masterspeed = masterspeed *2; 2489 2490 //SET DEFAULT IMG UNVISIBLE 2491 nextsh.find('.defaultimg').css({'opacity':0}); 2492 setTimeout(function() { 2493 actsh.find('.defaultimg').css({opacity:0}); 2494 },100); 2495 // ALL OLD SLOTS SHOULD BE SLIDED TO THE RIGHT 2496 actsh.find('.slotslide').each(function() { 2497 var ss=jQuery(this).find('div'); 2498 TweenLite.to(ss,masterspeed/1000,{ 2499 left:(0-opt.slotw/2)+'px', 2500 top:(0-opt.height/2)+'px', 2501 width:(opt.slotw*2)+"px", 2502 height:(opt.height*2)+"px", 2503 opacity:0, 2504 rotation:opt.rotate, 2505 transformPerspective:600, 2506 ease:Power2.easeOut}); 2507 2508 }); 2509 2510 ////////////////////////////////////////////////////////////// 2511 // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT // 2512 /////////////////////////////////////////////////////////////// 2513 nextsh.find('.slotslide').each(function(i) { 2514 var ss=jQuery(this).find('div'); 2515 2516 TweenLite.fromTo(ss,masterspeed/1000, 2517 {left:0,top:0,opacity:0,transformPerspective:600}, 2518 {left:(0-i*opt.slotw)+'px', 2519 ease:Power2.easeOut, 2520 top:(0)+'px', 2521 width:opt.width, 2522 height:opt.height, 2523 opacity:1,rotation:0, 2524 delay:0.1, 2525 onComplete:function() { 2526 letItFree(container,opt,nextsh,actsh,nextli,actli) 2527 } 2528 });
2529 }); 2530 } 2531 2532 2533 2534 2535 //////////////////////////////////// 2536 // THE SLOTSZOOM - TRANSITION II. // 2537 //////////////////////////////////// 2538 if (nexttrans==8) { 2539 2540 masterspeed = masterspeed * 3; 2541 2542 //SET DEFAULT IMG UNVISIBLE 2543 nextsh.find('.defaultimg').css({'opacity':0}); 2544 2545 2546 // ALL OLD SLOTS SHOULD BE SLIDED TO THE RIGHT 2547 actsh.find('.slotslide').each(function() { 2548 var ss=jQuery(this).find('div'); 2549 2550 TweenLite.to(ss,masterspeed/1000, 2551 {left:(0-opt.width/2)+'px', 2552 top:(0-opt.sloth/2)+'px', 2553 width:(opt.width*2)+"px", 2554 height:(opt.sloth*2)+"px", 2555 transformPerspective:600, 2556 opacity:0,rotation:opt.rotate 2557 2558 }); 2559 2560 }); 2561 2562 2563 // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT // 2564 /////////////////////////////////////////////////////////////// 2565 nextsh.find('.slotslide').each(function(i) { 2566 var ss=jQuery(this).find('div'); 2567 2568 TweenLite.fromTo(ss,masterspeed/1000, 2569 {left:0, top:0,opacity:0,transformPerspective:600}, 2570 {'left':(0)+'px', 2571 'top':(0-i*opt.sloth)+'px', 2572 'width':(nextsh.find('.defaultimg').data('neww'))+"px", 2573 'height':(nextsh.find('.defaultimg').data('newh'))+"px", 2574 opacity:1,rotation:0, 2575 onComplete:function() { 2576 letItFree(container,opt,nextsh,actsh,nextli,actli) 2577 }}); 2578 2579 }); 2580 } 2581 2582 2583 //////////////////////////////////////// 2584 // THE SLOTSFADE - TRANSITION III. // 2585 ////////////////////////////////////// 2586 if (nexttrans==9 || nexttrans==10) { 2587 2588 2589 nextsh.find('.defaultimg').css({'opacity':0}); 2590 2591 var ssamount=0; 2592 // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT 2593 nextsh.find('.slotslide').each(function(i) { 2594 var ss=jQuery(this); 2595 ssamount++; 2596 TweenLite.fromTo(ss,masterspeed/1000,{opacity:0,transformPerspective:600,left:0,top:0},{opacity:1,ease:Power2.easeInOut,delay:(i*4)/1000}); 2597 2598 }); 2599 2600 //nextsh.find('.defaultimg').transition({'opacity':1},(masterspeed+(ssamount*4))); 2601 2602 setTimeout(function() { 2603 letItFree(container,opt,nextsh,actsh,nextli,actli) 2604 },(masterspeed+(ssamount*4))); 2605 } 2606 2607 2608 /////////////////////////// 2609 // SIMPLE FADE ANIMATION // 2610 /////////////////////////// 2611 2612 if (nexttrans==11 || nexttrans==26) { 2613 2614 2615 nextsh.find('.defaultimg').css({'opacity':0,'position':'relative'}); 2616 2617 var ssamount=0; 2618 if (nexttrans==26) masterspeed=0; 2619 2620 // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT 2621 nextsh.find('.slotslide').each(function(i) { 2622 var ss=jQuery(this); 2623 TweenLite.fromTo(ss,masterspeed/1000,{opacity:0},{opacity:1,ease:Power2.easeInOut}); 2624 }); 2625 2626 setTimeout(function() { 2627 letItFree(container,opt,nextsh,actsh,nextli,actli) 2628 },masterspeed+15); 2629 } 2630 2631 2632 2633 2634 2635 2636 if (nexttrans==12 || nexttrans==13 || nexttrans==14 || nexttrans==15) { 2637 2638 //masterspeed = masterspeed * 3; 2639 2640 2641 setTimeout(function() { 2642 actsh.find('.defaultimg').css({opacity:0}); 2643 },100); 2644 nextsh.find('.defaultimg').css({'opacity':0}); 2645 2646 // kill(); 2647 2648 var oow = opt.width; 2649 var ooh = opt.height; 2650 2651 2652 // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT 2653 var ssn=nextsh.find('.slotslide') 2654 2655 if (opt.fullWidth=="on" || opt.fullSreen=="on") { 2656 oow=ssn.width(); 2657 ooh=ssn.height(); 2658 } 2659 var twx = 0; 2660 var twy = 0; 2661 2662 if (nexttrans==12) 2663 twx = oow; 2664 else 2665 if (nexttrans==15) 2666 twx = 0-oow; 2667 else 2668 if (nexttrans==13) 2669 twy = ooh; 2670 else 2671 if (nexttrans==14) 2672 twy = 0-ooh; 2673 2674 // SPECIALS FOR EXTENDED ANIMATIONS 2675 var op = 1; 2676 var scal = 1; 2677 var fromscale = 1; 2678 var easeitout = Power2.easeInOut; 2679 var easeitin = Power2.easeInOut;
2680 var speedy = masterspeed/1000; 2681 var speedy2 = speedy; 2682 2683 // DEPENDING ON EXTENDED SPECIALS, DIFFERENT SCALE AND OPACITY FUNCTIONS NEED TO BE ADDED 2684 if (specials == 1) op = 0; 2685 if (specials == 2) op = 0; 2686 if (specials == 3) { 2687 easeitout = Power2.easeInOut; 2688 easeitin = Power1.easeInOut; 2689 actli.css({'position':'absolute','z-index':20}); 2690 nextli.css({'position':'absolute','z-index':15}); 2691 speedy = masterspeed / 1200; 2692 } 2693 2694 if (specials==4 || specials==5) 2695 scal=0.6; 2696 if (specials==6 ) 2697 scal=1.4; 2698 2699 2700 if (specials==5 || specials==6) { 2701 fromscale=1.4; 2702 op=0; 2703 oow=0; 2704 ooh=0;twx=0;twy=0; 2705 } 2706 if (specials==6) fromscale=0.6; 2707 2708 2709 2710 TweenLite.fromTo(ssn,speedy, 2711 {left:twx, top:twy, scale:fromscale, opacity:op,rotation:opt.rotate}, 2712 {opacity:1,rotation:0,left:0,top:0,scale:1,ease:easeitin,onComplete:function() { 2713 letItFree(container,opt,nextsh,actsh,nextli,actli); 2714 actli.css({'position':'absolute','z-index':18}); 2715 nextli.css({'position':'absolute','z-index':20}); 2716 } 2717 2718 }); 2719 2720 var ssa=actsh.find('.slotslide'); 2721 2722 if (specials==4 || specials==5) { 2723 oow = 0; ooh=0; 2724 } 2725 2726 if (specials!=1) { 2727 if (nexttrans==12) 2728 TweenLite.to(ssa,speedy2,{'left':(0-oow)+'px',scale:scal,opacity:op,rotation:opt.rotate,ease:easeitout}); 2729 else 2730 if (nexttrans==15) 2731 TweenLite.to(ssa,speedy2,{'left':(oow)+'px',scale:scal,opacity:op,rotation:opt.rotate,ease:easeitout}); 2732 else 2733 if (nexttrans==13) 2734 TweenLite.to(ssa,speedy2,{'top':(0-ooh)+'px',scale:scal,opacity:op,rotation:opt.rotate,ease:easeitout}); 2735 else 2736 if (nexttrans==14) 2737 TweenLite.to(ssa,speedy2,{'top':(ooh)+'px',scale:scal,opacity:op,rotation:opt.rotate,ease:easeitout}); 2738 } 2739 nextli.css({'opacity':1}); 2740 2741 } 2742 2743 2744 ////////////////////////////////////// 2745 // THE SLOTSLIDE - TRANSITION XVI. // 2746 ////////////////////////////////////// 2747 if (nexttrans==16) { // PAPERCUT 2748 2749 2750 2751 actli.css({'position':'absolute','z-index':20}); 2752 nextli.css({'position':'absolute','z-index':15}); 2753 2754 2755 // PREPARE THE CUTS 2756 actli.wrapInner('<div class="tp-half-one" style="position:relative; width:100%;height:100%"></div>'); 2757 2758 actli.find('.tp-half-one').clone(true).appendTo(actli).addClass("tp-half-two"); 2759 actli.find('.tp-half-two').removeClass('tp-half-one'); 2760 2761 var oow = opt.width; 2762 var ooh = opt.height; 2763 if (opt.autoHeight=="on") 2764 ooh = container.height(); 2765 2766 2767 actli.find('.tp-half-one .defaultimg').wrap('<div class="tp-papercut" style="width:'+oow+'px;height:'+ooh+'px;"></div>') 2768 2769 actli.find('.tp-half-two .defaultimg').wrap('<div class="tp-papercut" style="width:'+oow+'px;height:'+ooh+'px;"></div>') 2770 2771 actli.find('.tp-half-two .defaultimg').css({position:'absolute',top:'-50%'}); 2772 2773 actli.find('.tp-half-two .tp-caption').wrapAll('<div style="position:absolute;top:-50%;left:0px"></div>'); 2774 2775 TweenLite.set(actli.find('.tp-half-two'), 2776 {width:oow,height:ooh,overflow:'hidden',zIndex:15,position:'absolute',top:ooh/2,left:'0px',transformPerspective:600,transformOrigin:"center bottom"}); 2777 2778 TweenLite.set(actli.find('.tp-half-one'), 2779 {width:oow,height:ooh/2,overflow:'visible',zIndex:10,position:'absolute',top:'0px',left:'0px',transformPerspective:600,transformOrigin:"center top"}); 2780 2781 2782 2783 // ANIMATE THE CUTS 2784 var img=actli.find('.defaultimg'); 2785 2786 2787 var ro1=Math.round(Math.random()*20-10); 2788 var ro2=Math.round(Math.random()*20-10); 2789 var ro3=Math.round(Math.random()*20-10); 2790 var xof = Math.random()*0.4-0.2; 2791 var yof = Math.random()*0.4-0.2; 2792 var sc1=Math.random()*1+1; 2793 var sc2=Math.random()*1+1; 2794 2795 2796 TweenLite.fromTo(actli.find('.tp-half-one'),masterspeed/1000, 2797 {width:oow,height:ooh/2,position:'absolute',top:'0px',left:'0px',transformPerspective:600,transformOrigin:"center top"}, 2798 {scale:sc1,rotation:ro1,y:(0-ooh-ooh/4),ease:Power2.easeInOut}); 2799 setTimeout(function() { 2800 TweenLite.set(actli.find('.tp-half-one'),{overflow:'hidden'}); 2801 },50); 2802 TweenLite.fromTo(actli.find('.tp-half-one'),masterspeed/2000,{opacity:1,transformPerspective:600,transformOrigin:"center center"},{opacity:0,delay:masterspeed/2000}); 2803 2804 TweenLite.fromTo(actli.find('.tp-half-two'),masterspeed/1000, 2805 {width:oow,height:ooh,overflow:'hidden',position:'absolute',top:ooh/2,left:'0px',transformPerspective:600,transformOrigin:"center bottom"}, 2806 {scale:sc2,rotation:ro2,y:ooh+ooh/4,ease:Power2.easeInOut}); 2807 2808 TweenLite.fromTo(actli.find('.tp-half-two'),masterspeed/2000,{opacity:1,transformPerspective:600,transformOrigin:"center center"},{opacity:0,delay:masterspeed/2000}); 2809 2810 if (actli.html()!=null) 2811 TweenLite.fromTo(nextli,(masterspeed-200)/1000,{opacity:0,scale:0.8,x:opt.width*xof, y:ooh*yof,rotation:ro3,transformPerspective:600,transformOrigin:"center center"},{rotation:0,scale:1,x:0,y:0,opacity:1,ease:Power2.easeInOut}); 2812 2813 nextsh.find('.defaultimg').css({'opacity':1}); 2814 setTimeout(function() { 2815 2816 2817 // CLEAN UP BEFORE WE START 2818 actli.css({'position':'absolute','z-index':18}); 2819 nextli.css({'position':'absolute','z-index':20}); 2820 nextsh.find('.defaultimg').css({'opacity':1}); 2821 actsh.find('.defaultimg').css({'opacity':0}); 2822 if (actli.find('.tp-half-one').length>0) { 2823 actli.find('.tp-half-one .defaultimg').unwrap();
2824 actli.find('.tp-half-one .slotholder').unwrap(); 2825 2826 } 2827 actli.find('.tp-half-two').remove(); 2828 opt.transition = 0; 2829 opt.act = opt.next; 2830 2831 },masterspeed); 2832 nextli.css({'opacity':1}); 2833 2834 } 2835 2836 //////////////////////////////////////// 2837 // THE SLOTSLIDE - TRANSITION XVII. // 2838 /////////////////////////////////////// 2839 if (nexttrans==17) { // 3D CURTAIN HORIZONTAL 2840 2841 2842 //SET DEFAULT IMG UNVISIBLE 2843 nextsh.find('.defaultimg').css({'opacity':0}); 2844 2845 // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT 2846 2847 2848 nextsh.find('.slotslide').each(function(j) { 2849 var ss=jQuery(this); 2850 2851 TweenLite.fromTo(ss,(masterspeed)/800, 2852 {opacity:0,rotationY:0,scale:0.9,rotationX:-110,transformPerspective:600,transformOrigin:"center center"}, 2853 {opacity:1,top:0,left:0,scale:1,rotation:0,rotationX:0,rotationY:0,ease:Power3.easeOut,delay:j*0.06,onComplete:function() { 2854 if (j==opt.slots-1) letItFree(container,opt,nextsh,actsh,nextli,actli) 2855 }}); 2856 2857 }); 2858 } 2859 2860 2861 2862 //////////////////////////////////////// 2863 // THE SLOTSLIDE - TRANSITION XVIII. // 2864 /////////////////////////////////////// 2865 if (nexttrans==18) { // 3D CURTAIN VERTICAL 2866 2867 2868 //SET DEFAULT IMG UNVISIBLE 2869 nextsh.find('.defaultimg').css({'opacity':0}); 2870 2871 2872 // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT 2873 2874 nextsh.find('.slotslide').each(function(j) { 2875 var ss=jQuery(this); 2876 2877 TweenLite.fromTo(ss,(masterspeed)/500, 2878 {opacity:0,rotationY:310,scale:0.9,rotationX:10,transformPerspective:600,transformOrigin:"center center"}, 2879 {opacity:1,top:0,left:0,scale:1,rotation:0,rotationX:0,rotationY:0,ease:Power3.easeOut,delay:j*0.06,onComplete:function() { 2880 if (j==opt.slots-1) 2881 letItFree(container,opt,nextsh,actsh,nextli,actli) 2882 }}); 2883 2884 }); 2885 2886 2887 2888 } 2889 2890 2891 //////////////////////////////////////// 2892 // THE SLOTSLIDE - TRANSITION XIX. // 2893 /////////////////////////////////////// 2894 2895 2896 if (nexttrans==19 || nexttrans==22) { // IN CUBE 2897 2898 2899 //SET DEFAULT IMG UNVISIBLE 2900 nextsh.find('.defaultimg').css({'opacity':0}); 2901 setTimeout(function() { 2902 actsh.find('.defaultimg').css({opacity:0}); 2903 },100); 2904 var chix=nextli.css('z-index'); 2905 var chix2=actli.css('z-index'); 2906 2907 var rot = 90; 2908 var op = 1; 2909 if (direction==1) rot = -90; 2910 2911 if (nexttrans==19) { 2912 var torig = "center center -"+opt.height/2; 2913 op=0; 2914 2915 } else { 2916 var torig = "center center "+opt.height/2; 2917 2918 } 2919 2920 // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT 2921 2922 //if (nexttrans==129) { 2923 TweenLite.fromTo(nextsh,masterspeed/2000,{transformPerspective:600,z:0,x:0,rotationY:0},{rotationY:1,ease:Power1.easeInOut,z:-40}); 2924 TweenLite.fromTo(nextsh,masterspeed/2000,{transformPerspective:600,z:-40,rotationY:1},{rotationY:0,z:0,ease:Power1.easeInOut,x:0,delay:3*(masterspeed/4000)}); 2925 TweenLite.fromTo(actsh,masterspeed/2000,{transformPerspective:600,z:0,x:0,rotationY:0},{rotationY:1,x:0,ease:Power1.easeInOut,z:-40}); 2926 TweenLite.fromTo(actsh,masterspeed/2000,{transformPerspective:600,z:-40,x:0,rotationY:1},{rotationY:0,z:0,x:0,ease:Power1.easeInOut,delay:3*(masterspeed/4000)}); 2927 //} 2928 2929 nextsh.find('.slotslide').each(function(j) { 2930 var ss=jQuery(this); 2931 2932 TweenLite.fromTo(ss,masterspeed/1000, 2933 {left:0,rotationY:opt.rotate,opacity:op,top:0,scale:0.8,transformPerspective:600,transformOrigin:torig,rotationX:rot}, 2934 {left:0,rotationY:0,opacity:1,top:0,z:0, scale:1,rotationX:0, delay:(j*50)/1000,ease:Power2.easeInOut,onComplete: function() { 2935 2936 if (j==opt.slots-1) 2937 letItFree(container,opt,nextsh,actsh,nextli,actli) 2938 } 2939 }); 2940 TweenLite.to(ss,0.1,{opacity:1,delay:(j*50)/1000+masterspeed/3000}); 2941 2942 }); 2943 2944 actsh.find('.slotslide').each(function(j) { 2945 var ss=jQuery(this); 2946 var rot = -90; 2947 if (direction==1) rot = 90; 2948 2949 TweenLite.fromTo(ss,masterspeed/1000, 2950 {opacity:1,rotationY:0,top:0,z:0,scale:1,transformPerspective:600,transformOrigin:torig, rotationX:0},
2951 {opacity:1,rotationY:opt.rotate,top:0, scale:0.8,rotationX:rot, delay:(j*50)/1000,ease:Power2.easeInOut,onComplete: function() { 2952 2953 if (j==opt.slots-1) 2954 letItFree(container,opt,nextsh,actsh,nextli,actli) 2955 } 2956 }); 2957 TweenLite.to(ss,0.1,{opacity:0,delay:(j*50)/1000+(masterspeed/1000 - (masterspeed/10000))}); 2958 2959 2960 }); 2961 } 2962 2963 2964 2965 2966 //////////////////////////////////////// 2967 // THE SLOTSLIDE - TRANSITION XX. // 2968 /////////////////////////////////////// 2969 if (nexttrans==20 ) { // FLYIN 2970 2971 2972 //SET DEFAULT IMG UNVISIBLE 2973 nextsh.find('.defaultimg').css({'opacity':0}); 2974 setTimeout(function() { 2975 actsh.find('.defaultimg').css({opacity:0}); 2976 },100); 2977 var chix=nextli.css('z-index'); 2978 var chix2=actli.css('z-index'); 2979 2980 2981 if (direction==1) { 2982 var ofx = -opt.width 2983 var rot =70; 2984 var torig = "left center -"+opt.height/2; 2985 } else { 2986 var ofx = opt.width; 2987 var rot = -70; 2988 var torig = "right center -"+opt.height/2; 2989 } 2990 2991 2992 nextsh.find('.slotslide').each(function(j) { 2993 var ss=jQuery(this); 2994 //ss.css({overflow:'visible'}); 2995 TweenLite.fromTo(ss,masterspeed/1500, 2996 {left:ofx,rotationX:40,z:-600, opacity:op,top:0,transformPerspective:600,transformOrigin:torig,rotationY:rot}, 2997 {left:0, delay:(j*50)/1000,ease:Power2.easeInOut}); 2998 2999 TweenLite.fromTo(ss,masterspeed/1000, 3000 {rotationX:40,z:-600, opacity:op,top:0,scale:1,transformPerspective:600,transformOrigin:torig,rotationY:rot}, 3001 {rotationX:0,opacity:1,top:0,z:0, scale:1,rotationY:0, delay:(j*50)/1000,ease:Power2.easeInOut,onComplete: function() { 3002 3003 if (j==opt.slots-1) 3004 letItFree(container,opt,nextsh,actsh,nextli,actli) 3005 } 3006 }); 3007 TweenLite.to(ss,0.1,{opacity:1,delay:(j*50)/1000+masterspeed/2000}); 3008 3009 }); 3010 3011 3012 3013 actsh.find('.slotslide').each(function(j) { 3014 var ss=jQuery(this); 3015 //ss.css({overflow:'visible'}); 3016 if (direction!=1) { 3017 var ofx = -opt.width 3018 var rot =70; 3019 var torig = "left center -"+opt.height/2; 3020 } else { 3021 var ofx = opt.width; 3022 var rot = -70; 3023 var torig = "right center -"+opt.height/2; 3024 } 3025 TweenLite.fromTo(ss,masterspeed/1000, 3026 {opacity:1,rotationX:0,top:0,z:0,scale:1,left:0, transformPerspective:600,transformOrigin:torig, rotationY:0}, 3027 {opacity:1,rotationX:40,top:0, z:-600, left:ofx, scale:0.8,rotationY:rot, delay:(j*50)/1000,ease:Power2.easeInOut,onComplete: function() { 3028 3029 if (j==opt.slots-1) 3030 letItFree(container,opt,nextsh,actsh,nextli,actli) } 3031 }); 3032 TweenLite.to(ss,0.1,{opacity:0,delay:(j*50)/1000+(masterspeed/1000 - (masterspeed/10000))}); 3033 3034 3035 }); 3036 } 3037 3038 3039 3040 3041 3042 3043 //////////////////////////////////////// 3044 // THE SLOTSLIDE - TRANSITION XX. // 3045 /////////////////////////////////////// 3046 if (nexttrans==21 || nexttrans==25) { // TURNOFF 3047 3048 3049 //SET DEFAULT IMG UNVISIBLE 3050 nextsh.find('.defaultimg').css({'opacity':0}); 3051 setTimeout(function() { 3052 actsh.find('.defaultimg').css({opacity:0}); 3053 },100); 3054 var chix=nextli.css('z-index'); 3055 var chix2=actli.css('z-index'); 3056 3057 3058 if (direction==1) { 3059 var ofx = -opt.width 3060 var rot =110; 3061 3062 if (nexttrans==25) { 3063 var torig = "center top 0" 3064 rot2 = -rot; 3065 rot = opt.rotate; 3066 } else { 3067 var torig = "left center 0"; 3068 rot2 = opt.rotate; 3069 } 3070 3071 } else { 3072 var ofx = opt.width; 3073 var rot = -110; 3074 if (nexttrans==25) { 3075 var torig = "center bottom 0" 3076 rot2 = -rot; 3077 rot = opt.rotate; 3078 } else { 3079 var torig = "right center 0"; 3080 rot2 = opt.rotate; 3081 } 3082 } 3083 3084 3085 nextsh.find('.slotslide').each(function(j) { 3086 var ss=jQuery(this); 3087 3088 3089 TweenLite.fromTo(ss,masterspeed/1500, 3090 {left:0,rotationX:rot2,z:0, opacity:0,top:0,scale:1,transformPerspective:600,transformOrigin:torig,rotationY:rot}, 3091 {left:0,rotationX:0,top:0,z:0, scale:1,rotationY:0, delay:(j*100)/1000+masterspeed/10000,ease:Power2.easeInOut,onComplete: function() { 3092 3093 if (j==opt.slots-1) 3094 letItFree(container,opt,nextsh,actsh,nextli,actli) 3095 } 3096 });
3097 TweenLite.to(ss,0.3,{opacity:1,delay:(j*100)/1000+(masterspeed*0.2)/2000+masterspeed/10000}); 3098 3099 }); 3100 3101 3102 3103 if (direction!=1) { 3104 var ofx = -opt.width 3105 var rot = 90; 3106 3107 if (nexttrans==25) { 3108 var torig = "center top 0" 3109 rot2 = -rot; 3110 rot = opt.rotate; 3111 } else { 3112 var torig = "left center 0"; 3113 rot2 = opt.rotate; 3114 } 3115 3116 } else { 3117 var ofx = opt.width; 3118 var rot = -90; 3119 if (nexttrans==25) { 3120 var torig = "center bottom 0" 3121 rot2 = -rot; 3122 rot = opt.rotate; 3123 } else { 3124 var torig = "right center 0"; 3125 rot2 = opt.rotate; 3126 } 3127 } 3128 3129 actsh.find('.slotslide').each(function(j) { 3130 var ss=jQuery(this); 3131 3132 3133 TweenLite.fromTo(ss,masterspeed/3000, 3134 {left:0,rotationX:0,z:0, opacity:1,top:0,scale:1,transformPerspective:600,transformOrigin:torig,rotationY:0}, 3135 {left:0,rotationX:rot2,top:0,z:0, scale:1,rotationY:rot, delay:(j*100)/1000,ease:Power1.easeInOut}); 3136 TweenLite.to(ss,0.2,{opacity:0,delay:(j*50)/1000+(masterspeed/3000 - (masterspeed/10000))}); 3137 3138 3139 }); 3140 } 3141 3142 3143 3144 //////////////////////////////////////// 3145 // THE SLOTSLIDE - TRANSITION XX. // 3146 /////////////////////////////////////// 3147 if (nexttrans==23 || nexttrans == 24) { // cube-horizontal - inboxhorizontal 3148 3149 3150 //SET DEFAULT IMG UNVISIBLE 3151 nextsh.find('.defaultimg').css({'opacity':0}); 3152 setTimeout(function() { 3153 actsh.find('.defaultimg').css({opacity:0}); 3154 },100); 3155 var chix=nextli.css('z-index'); 3156 var chix2=actli.css('z-index'); 3157 3158 var rot = -90; 3159 if (direction==1) 3160 rot = 90; 3161 3162 var op = 1; 3163 3164 3165 if (nexttrans==23) { 3166 var torig = "center center -"+opt.width/2; 3167 op=0; 3168 3169 } else { 3170 var torig = "center center "+opt.width/2; 3171 3172 } 3173 3174 3175 var opx=0; 3176 3177 // ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT 3178 TweenLite.fromTo(nextsh,masterspeed/2000,{transformPerspective:600,z:0,x:0,rotationY:0},{rotationY:1,ease:Power1.easeInOut,z:-90}); 3179 TweenLite.fromTo(nextsh,masterspeed/2000,{transformPerspective:600,z:-90,rotationY:1},{rotationY:0,z:0,ease:Power1.easeInOut,x:0,delay:3*(masterspeed/4000)}); 3180 TweenLite.fromTo(actsh,masterspeed/2000,{transformPerspective:600,z:0,x:0,rotationY:0},{rotationY:1,x:0,ease:Power1.easeInOut,z:-90}); 3181 TweenLite.fromTo(actsh,masterspeed/2000,{transformPerspective:600,z:-90,x:0,rotationY:1},{rotationY:0,z:0,x:0,ease:Power1.easeInOut,delay:3*(masterspeed/4000)}); 3182 3183 nextsh.find('.slotslide').each(function(j) { 3184 var ss=jQuery(this); 3185 3186 TweenLite.fromTo(ss,masterspeed/1000, 3187 {left:opx,rotationX:opt.rotate,opacity:op,top:0,scale:1,transformPerspective:600,transformOrigin:torig,rotationY:rot}, 3188 {left:0,rotationX:0,opacity:1,top:0,z:0, scale:1,rotationY:0, delay:(j*50)/1000,ease:Power2.easeInOut,onComplete: function() { 3189 3190 if (j==opt.slots-1) 3191 letItFree(container,opt,nextsh,actsh,nextli,actli); 3192 3193 } 3194 }); 3195 TweenLite.to(ss,0.1,{opacity:1,delay:(j*50)/1000+masterspeed/3000}); 3196 3197 }); 3198 3199 rot = 90; 3200 if (direction==1) 3201 rot = -90; 3202 3203 3204 3205 3206 actsh.find('.slotslide').each(function(j) { 3207 var ss=jQuery(this); 3208 TweenLite.fromTo(ss,masterspeed/1000, 3209 {left:0,opacity:1,rotationX:0,top:0,z:0,scale:1,transformPerspective:600,transformOrigin:torig, rotationY:0}, 3210 {left:opx,opacity:1,rotationX:opt.rotate,top:0, scale:1,rotationY:rot, delay:(j*50)/1000,ease:Power2.easeInOut,onComplete: function() { 3211 3212 if (j==opt.slots-1) 3213 letItFree(container,opt,nextsh,actsh,nextli,actli) 3214 3215 } 3216 }); 3217 TweenLite.to(ss,0.1,{opacity:0,delay:(j*50)/1000+(masterspeed/1000 - (masterspeed/10000))}); 3218 3219 3220 }); 3221 } 3222 3223 3224 var data={}; 3225 data.slideIndex=opt.next+1;
3226 container.trigger('revolution.slide.onchange',data); 3227 setTimeout(function() { container.trigger('revolution.slide.onafterswap'); },masterspeed); 3228 container.trigger('revolution.slide.onvideostop'); 3229 } 3230 3231 3232 /****************************** 3233 - STOP KEN BURN - 3234 ********************************/ 3235 function stopKenBurn(container,opt) { 3236 try{ 3237 var actli = container.find('>ul:first-child >li:eq('+opt.act+')'); 3238 } catch(e) { 3239 var actli=container.find('>ul:first-child >li:eq(1)'); 3240 } 3241 3242 opt.lastslide=opt.act; 3243 3244 var nextli = container.find('>ul:first-child >li:eq('+opt.next+')'); 3245 3246 3247 var actsh = actli.find('.slotholder'); 3248 var nextsh = nextli.find('.slotholder'); 3249 3250 nextsh.find('.defaultimg').each(function() { 3251 var defimg = jQuery(this); 3252 if (defimg.data('kenburn')!=undefined) 3253 defimg.data('kenburn').restart(); 3254 TweenLite.killTweensOf(defimg,false); 3255 TweenLite.set(defimg,{scale:1,rotationZ:0}); 3256 3257 defimg.data('bgposition',nextsh.data('bgposition')); 3258 defimg.data('currotate',nextsh.data('rotationstart')); 3259 defimg.data('curscale',nextsh.data('bgfit')); 3260 3261 }); 3262 /*actsh.find('.defaultimg').each(function() { 3263 var defimg = jQuery(this); 3264 TweenLite.killTweensOf(defimg,false); 3265 TweenLite.set(defimg,{scale:1,rotationZ:0}); 3266 if (defimg.data('oldbgposition')!=undefined) 3267 defimg.data('bgposition',defimg.data('oldbgposition')); 3268 3269 defimg.data('currotate',nextsh.data('rotationstart')); 3270 defimg.data('curscale',nextsh.data('zoomstart')/100); 3271 3272 });*/ 3273 3274 } 3275 3276 3277 /****************************** 3278 - startKenBurn - 3279 ********************************/ 3280 function startKenBurn(container,opt) { 3281 3282 try{ 3283 var actli = container.find('>ul:first-child >li:eq('+opt.act+')'); 3284 } catch(e) { 3285 var actli=container.find('>ul:first-child >li:eq(1)'); 3286 } 3287 3288 opt.lastslide=opt.act; 3289 3290 var nextli = container.find('>ul:first-child >li:eq('+opt.next+')'); 3291 3292 3293 var actsh = actli.find('.slotholder'); 3294 var nextsh = nextli.find('.slotholder'); 3295 3296 var 3297 bgps = nextsh.data('bgposition'), 3298 bgpe = nextsh.data('bgpositionend'), 3299 zos = nextsh.data('zoomstart')/100, 3300 zoe = nextsh.data('zoomend')/100, 3301 ros = nextsh.data('rotationstart'), 3302 roe = nextsh.data('rotationend'), 3303 bgfs = nextsh.data('bgfit'), 3304 bgfe = nextsh.data('bgfitend'), 3305 easeme = nextsh.data('easeme'), 3306 dur = nextsh.data('duration')/1000; 3307 3308 if (bgfs==undefined) bgfs=100; 3309 if (bgfe==undefined) bgfe=100; 3310 3311 bgfs = calculateKenBurnScales(bgfs,nextsh,opt); 3312 bgfe = calculateKenBurnScales(bgfe,nextsh,opt); 3313 3314 3315 if (zos==undefined) zos=1; 3316 if (zoe==undefined) zoe=1; 3317 if (ros==undefined) ros=0; 3318 if (roe==undefined) roe=0; 3319 3320 if (zos<1) zos=1; 3321 if (zoe<1) zoe=1; 3322 3323 3324 3325 nextsh.find('.defaultimg').each(function() { 3326 var defimg = jQuery(this); 3327 3328 defimg.data('kenburn',TweenLite.fromTo(defimg,dur,{transformPerspective:1200, backgroundSize:bgfs, z:0,backgroundPosition:bgps,rotationZ:ros},{yoyo:2,rotationZ:roe,ease:easeme,backgroundSize:bgfe,backgroundPosition:bgpe,onUpdate:function() { 3329 defimg.data('bgposition',defimg.css('backgroundPosition')); 3330 if (!isIE(8)) defimg.data('currotate',getRotationDegrees(defimg)); 3331 if (!isIE(8)) defimg.data('curscale',defimg.css('backgroundSize')); 3332 }}) 3333 ); 3334 3335 }) 3336 } 3337 3338 3339 /*********************************************** 3340 - KEN BURN BACKGROUND FIT CALCULATOR - 3341 ***********************************************/ 3342 function calculateKenBurnScales(proc,sloth,opt) { 3343 var ow = sloth.data('owidth'); 3344 var oh = sloth.data('oheight'); 3345 3346 var factor = (opt.container.width() /ow); 3347 var nheight = oh * factor; 3348 3349 var hfactor = (nheight / opt.container.height())*proc; 3350 3351 3352 3353 return (proc+"% "+hfactor+"%"); 3354 } 3355 3356 3357 /****************************************************** 3358 - CALCULATE CURRENT SCALE AND ROTATION - 3359 *******************************************************/ 3360 3361 function getMatrix(obj) { 3362 var matrix = obj.css("-webkit-transform") || 3363 obj.css("-moz-transform") || 3364 obj.css("-ms-transform") || 3365 obj.css("-o-transform") || 3366 obj.css("transform"); 3367 return matrix; 3368 }; 3369 3370 function parseMatrix(_str) { 3371 return _str.replace(/^matrix(3d)?\((.*)\)$/,'$2').split(/, /); 3372 } 3373 3374 function getScaleDegrees(obj) { 3375 var matrix = parseMatrix(getMatrix(obj)), 3376 scale = 1; 3377 3378 if(matrix[0] !== 'none') { 3379 var a = matrix[0], 3380 b = matrix[1], 3381 d = 10; 3382 scale = Math.round( Math.sqrt( a*a + b*b ) * d ) / d; 3383 } 3384 3385 return scale; 3386 }; 3387 3388 function getRotationDegrees(obj) { 3389 var matrix = obj.css("-webkit-transform") || 3390 obj.css("-moz-transform") || 3391 obj.css("-ms-transform") || 3392 obj.css("-o-transform") || 3393 obj.css("transform"); 3394 if(matrix !== 'none') { 3395 var values = matrix.split('(')[1].split(')')[0].split(','); 3396 var a = values[0]; 3397 var b = values[1]; 3398 var angle = Math.round(Math.atan2(b, a) * (180/Math.PI)); 3399 } else { var angle = 0; } 3400 return (angle < 0) ? angle +=360 : angle; 3401 } 3402 3403 /************************************** 3404 - GIVE FREE THE TRANSITIOSN - 3405 **************************************/ 3406 function letItFree(container,opt,nextsh,actsh,nextli,actli) { 3407 removeSlots(container,opt); 3408 nextsh.find('.defaultimg').css({'opacity':1}); 3409 if (nextli.index()!=actli.index()) actsh.find('.defaultimg').css({'opacity':0}); 3410 opt.act=opt.next; 3411 moveSelectedThumb(container); 3412 if (nextsh.data('kenburns')=="on") 3413 startKenBurn(container,opt); 3414 } 3415 3416
3417 ////////////////////////////////////////// 3418 // CHANG THE YOUTUBE PLAYER STATE HERE // 3419 //////////////////////////////////////// 3420 function onPlayerStateChange(event) { 3421 3422 var embedCode = event.target.getVideoEmbedCode(); 3423 var ytcont = jQuery('#'+embedCode.split('id="')[1].split('"')[0]) 3424 var container = ytcont.closest('.tp-simpleresponsive'); 3425 var player = ytcont.parent().data('player'); 3426 3427 if (event.data == YT.PlayerState.PLAYING) { 3428 3429 var bt = container.find('.tp-bannertimer'); 3430 var opt = bt.data('opt'); 3431 3432 3433 if (ytcont.closest('.tp-caption').data('volume')=="mute") 3434 player.mute(); 3435 3436 opt.videoplaying=true; 3437 container.trigger('stoptimer'); 3438 //konsole.log("VideoPlay set to True due onPlayerStateChange PLAYING"); 3439 container.trigger('revolution.slide.onvideoplay'); //opt.videostartednow=1; 3440 3441 3442 } else { 3443 3444 var bt = container.find('.tp-bannertimer'); 3445 var opt = bt.data('opt'); 3446 3447 if (event.data!=-1) { 3448 opt.videoplaying=false; 3449 container.trigger('playtimer'); 3450 container.trigger('revolution.slide.onvideostop'); //opt.videostoppednow=1; 3451 3452 } 3453 3454 } 3455 if (event.data==0 && opt.nextslideatend==true) 3456 opt.container.revnext(); 3457 3458 3459 } 3460 3461 3462
3463 //////////////////////// 3464 // VIMEO ADD EVENT ///// 3465 //////////////////////// 3466 function addEvent(element, eventName, callback) { 3467 3468 if (element.addEventListener) element.addEventListener(eventName, callback, false); 3469 else 3470 element.attachEvent(eventName, callback, false); 3471 } 3472 3473 3474 3475 ///////////////////////////////////// 3476 // EVENT HANDLING FOR VIMEO VIDEOS // 3477 ///////////////////////////////////// 3478 3479 function vimeoready_auto(player_id,autoplay) { 3480 3481 var froogaloop = $f(player_id); 3482 var vimcont = jQuery('#'+player_id); 3483 var container = vimcont.closest('.tp-simpleresponsive'); 3484 3485 3486 froogaloop.addEvent('ready', function(data) { 3487 if(autoplay) froogaloop.api('play'); 3488 3489 froogaloop.addEvent('play', function(data) { 3490 var bt = container.find('.tp-bannertimer'); 3491 var opt = bt.data('opt'); 3492 3493 opt.videoplaying=true; 3494 container.trigger('stoptimer'); 3495 if (vimcont.closest('.tp-caption').data('volume')=="mute") 3496 froogaloop.api('setVolume',"0"); 3497 //konsole.log("VideoPlay set to True due vimeoready_auto PLAYING"); 3498 });
3499 3500 froogaloop.addEvent('finish', function(data) { 3501 var bt = container.find('.tp-bannertimer'); 3502 var opt = bt.data('opt'); 3503 opt.videoplaying=false; 3504 container.trigger('playtimer'); 3505 //konsole.log("VideoPlay set to False due vimeoready_auto FINISH"); 3506 container.trigger('revolution.slide.onvideoplay'); //opt.videostartednow=1; 3507 if (opt.nextslideatend==true) 3508 opt.container.revnext(); 3509 3510 }); 3511 3512 froogaloop.addEvent('pause', function(data) { 3513 var bt = container.find('.tp-bannertimer'); 3514 var opt = bt.data('opt'); 3515 opt.videoplaying=false; 3516 container.trigger('playtimer'); 3517 //konsole.log("VideoPlay set to False due vimeoready_auto PAUSE"); 3518 container.trigger('revolution.slide.onvideostop'); //opt.videostoppednow=1; 3519 }); 3520 }); 3521 } 3522 3523 3524 /////////////////////////////////////// 3525 // EVENT HANDLING FOR VIDEO JS VIDEOS // 3526 //////////////////////////////////////// 3527 function html5vidready(myPlayer,player_id) { 3528 3529 if (player_id==undefined) player_id = jQuery(myPlayer["b"]).attr('id'); 3530 var player_cont = jQuery('#'+player_id); 3531 var container = player_cont.closest('.tp-simpleresponsive'); 3532 3533 3534 3535 myPlayer.on("canplay",function() { 3536 3537 player_cont.data('canplay',1); 3538 }); 3539 3540 myPlayer.on("play",function() { 3541 3542 if (player_cont.closest('.tp-caption').data('volume')=="mute") 3543 myPlayer.volume(0); 3544 var bt = jQuery('body').find('.tp-bannertimer'); 3545 var opt = bt.data('opt'); 3546 container.trigger('revolution.slide.onvideoplay'); 3547 3548 try{ 3549 opt.videoplaying=true; 3550 container.trigger('stoptimer'); 3551 } catch(e) {} 3552 3553 3554 //konsole.log("VideoPlay set to True due html5vidready PLAYING"); 3555 }); 3556 3557 myPlayer.on("pause",function() { 3558 var bt = container.find('.tp-bannertimer'); 3559 var opt = bt.data('opt'); 3560 opt.videoplaying=false; 3561 container.trigger('playtimer'); 3562 //konsole.log("VideoPlay set to False due html5vidready pause"); 3563 container.trigger('revolution.slide.onvideostop'); //opt.videostoppednow=1; 3564 }); 3565 3566 myPlayer.on("ended",function() { 3567 var bt = container.find('.tp-bannertimer'); 3568 var opt = bt.data('opt'); 3569 opt.videoplaying=false; 3570 container.trigger('playtimer'); 3571 //konsole.log("VideoPlay set to False due html5vidready pause"); 3572 container.trigger('revolution.slide.onvideostop'); //opt.videostoppednow=1; 3573 if (opt.nextslideatend==true) 3574 opt.container.revnext(); 3575 }); 3576 3577 3578 myPlayer.on('loadedmetadata', function(data) { 3579 3580 player_cont.data('loadedmetadata',1); 3581 3582 3583 var videoWidth =0; 3584 var videoHeight=0; 3585 3586 for(var prop in this) { 3587 try{ 3588 if(this[prop].hasOwnProperty('videoWidth')) 3589 videoWidth = this[prop].videoWidth; 3590 3591 if(this[prop].hasOwnProperty('videoHeight')) 3592 videoHeight = this[prop].videoHeight; 3593 } catch(e) {} 3594 } 3595 3596 3597 var mediaAspect = videoWidth/videoHeight; 3598 3599 3600 3601 3602 if (player_cont.data('mediaAspect') == undefined) player_cont.data('mediaAspect',mediaAspect); 3603 if (player_cont.closest('.tp-caption').data('forcecover')==1) 3604 updateHTML5Size(player_cont,container); 3605 3606 }); 3607 3608 } 3609 ///////////////////////////////////// 3610 // RESIZE HTML5VIDEO FOR FULLSCREEN// 3611 ///////////////////////////////////// 3612 function updateHTML5Size(pc,container) { 3613 var windowW = container.width(); 3614 var windowH = container.height(); 3615 var mediaAspect = pc.data('mediaAspect'); 3616 3617 var windowAspect = windowW/windowH; 3618 pc.parent().find('.vjs-poster').css({width:"100%",height:"100%"}); 3619 if (windowAspect < mediaAspect) { 3620 // taller 3621 pc 3622 .width(windowH*mediaAspect) 3623 .height(windowH); 3624 pc 3625 .css('top',0) 3626 .css('left',-(windowH*mediaAspect-windowW)/2) 3627 .css('height',windowH); 3628 pc.find('.vjs-tech').css('width',windowH*mediaAspect); 3629 3630 } else { 3631 // wider 3632 pc 3633 .width(windowW) 3634 .height(windowW/mediaAspect); 3635 pc 3636 .css('top',-(windowW/mediaAspect-windowH)/2) 3637 .css('left',0) 3638 .css('height',windowW/mediaAspect); 3639 pc.find('.vjs-tech').css('width','100%'); 3640 3641 } 3642 3643 } 3644 3645 3646
3647 ///////////////////////////////////// 3648 // - CREATE ANIMATION OBJECT - // 3649 ///////////////////////////////////// 3650 3651 function newAnimObject() { 3652 var a = new Object(); 3653 a.x=0; 3654 a.y=0; 3655 a.rotationX = 0; 3656 a.rotationY = 0; 3657 a.rotationZ = 0; 3658 a.scale = 1; 3659 a.scaleX = 1; 3660 a.scaleY = 1; 3661 a.skewX = 0; 3662 a.skewY = 0; 3663 a.opacity=0; 3664 a.transformOrigin = "center, center"; 3665 a.transformPerspective = 400; 3666 a.rotation = 0; 3667 return a; 3668 } 3669 3670 /////////////////////////////////////////////////// 3671 // ANALYSE AND READ OUT DATAS FROM HTML CAPTIONS // 3672 /////////////////////////////////////////////////// 3673 function getAnimDatas(frm,data) { 3674 3675 var customarray = data.split(';'); 3676 jQuery.each(customarray,function(index,param) { 3677 3678 param = param.split(":") 3679 3680 var w = param[0], 3681 v = param[1]; 3682 if (w=="rotationX") frm.rotationX = parseInt(v,0); 3683 if (w=="rotationY") frm.rotationY = parseInt(v,0); 3684 if (w=="rotationZ") frm.rotationZ = parseInt(v,0); 3685 if (w=="rotationZ") frm.rotation = parseInt(v,0); 3686 if (w=="scaleX") frm.scaleX = parseFloat(v); 3687 if (w=="scaleY") frm.scaleY = parseFloat(v); 3688 if (w=="opacity") frm.opacity = parseFloat(v); 3689 if (w=="skewX") frm.skewX = parseInt(v,0);
3690 if (w=="skewY") frm.skewY = parseInt(v,0); 3691 if (w=="x") frm.x = parseInt(v,0); 3692 if (w=="y") frm.y = parseInt(v,0); 3693 if (w=="z") frm.z = parseInt(v,0); 3694 if (w=="transformOrigin") frm.transformOrigin = v.toString(); 3695 if (w=="transformPerspective") frm.transformPerspective=parseInt(v,0); 3696 }) 3697 3698 return frm; 3699 } 3700 /////////////////////////////////////////////////////////////////// 3701 // ANALYSE AND READ OUT DATAS FROM HTML CAPTIONS ANIMATION STEPS // 3702 /////////////////////////////////////////////////////////////////// 3703 function getAnimSteps(data) { 3704 3705 var paramarray = data.split("animation:"); 3706 var params = new Object(); 3707 3708 params.animation = getAnimDatas(newAnimObject(),paramarray[1]); 3709 var customarray = paramarray[0].split(';'); 3710 3711 jQuery.each(customarray,function(index,param) { 3712 param = param.split(":") 3713 var w = param[0], 3714 v = param[1]; 3715 if (w=="typ") params.typ = v; 3716 if (w=="speed") params.speed = parseInt(v,0)/1000; 3717 if (w=="start") params.start = parseInt(v,0)/1000; 3718 if (w=="elementdelay") params.elementdelay = parseFloat(v); 3719 if (w=="ease") params.ease = v; 3720 }) 3721 3722 return params; 3723 } 3724 3725 3726 3727 3728 //////////////////////// 3729 // SHOW THE CAPTION // 3730 /////////////////////// 3731 function animateTheCaptions(nextli, opt,recalled) { 3732 3733 var offsetx=0; 3734 var offsety=0; 3735 3736 nextli.find('.tp-caption').each(function(i) { 3737 3738 3739 offsetx = opt.width/2 - (opt.startwidth*opt.bw)/2; 3740 3741 3742 3743 var xbw = opt.bw; 3744 var xbh = opt.bh; 3745 3746 3747 if (opt.fullScreen=="on") 3748 offsety = opt.height/2 - (opt.startheight*opt.bh)/2; 3749 3750 if (opt.autoHeight=="on") 3751 offsety = opt.container.height()/2 - (opt.startheight*opt.bh)/2;; 3752 3753 if (offsety<0) offsety=0; 3754 3755 var nextcaption=jQuery(this);//nextli.find('.tp-caption:eq('+i+')'); 3756 3757 var handlecaption=0; 3758 3759 // HIDE CAPTION IF RESOLUTION IS TOO LOW 3760 if (opt.width<opt.hideCaptionAtLimit && nextcaption.data('captionhidden')=="on") { 3761 nextcaption.addClass("tp-hidden-caption") 3762 handlecaption=1; 3763 } else { 3764 if (opt.width<opt.hideAllCaptionAtLimit || opt.width<opt.hideAllCaptionAtLilmit) { 3765 nextcaption.addClass("tp-hidden-caption") 3766 handlecaption=1; 3767 } else { 3768 nextcaption.removeClass("tp-hidden-caption") 3769 } 3770 } 3771 3772 3773 3774 if (handlecaption==0) { 3775 3776 // ADD A CLICK LISTENER TO THE CAPTION 3777 if (nextcaption.data('linktoslide')!=undefined && !nextcaption.hasClass("hasclicklistener")) { 3778 nextcaption.addClass("hasclicklistener") 3779 nextcaption.css({'cursor':'pointer'}); 3780 if (nextcaption.data('linktoslide')!="no") { 3781 nextcaption.click(function() { 3782 var nextcaption=jQuery(this); 3783 var dir = nextcaption.data('linktoslide'); 3784 if (dir!="next" && dir!="prev") { 3785 opt.container.data('showus',dir); 3786 opt.container.parent().find('.tp-rightarrow').click(); 3787 } else 3788 if (dir=="next") 3789 opt.container.parent().find('.tp-rightarrow').click(); 3790 else 3791 if (dir=="prev") 3792 opt.container.parent().find('.tp-leftarrow').click(); 3793 }); 3794 } 3795 }// END OF CLICK LISTENER 3796 3797 3798 if (offsetx<0) offsetx=0; 3799 3800 3801 // YOUTUBE AND VIMEO LISTENRES INITIALISATION 3802 3803 var frameID = "iframe"+Math.round(Math.random()*1000+1); 3804 3805 if (nextcaption.find('iframe').length>0 || nextcaption.find('video').length>0) { 3806 3807 if (nextcaption.data('autoplayonlyfirsttime') == true || nextcaption.data('autoplayonlyfirsttime')=="true" ) { 3808 nextcaption.data('autoplay',true); 3809 } 3810 3811 nextcaption.find('iframe').each(function() { 3812 var ifr=jQuery(this); 3813 3814 3815 // START YOUTUBE HANDLING 3816 opt.nextslideatend = nextcaption.data('nextslideatend'); 3817 if (nextcaption.data('thumbimage')!=undefined && nextcaption.data('thumbimage').length>2 && nextcaption.data('autoplay')!=true && !recalled) { 3818 nextcaption.find('.tp-thumb-image').remove(); 3819 nextcaption.append('<div class="tp-thumb-image" style="cursor:pointer; position:absolute;top:0px;left:0px;width:100%;height:100%;background-image:url('+nextcaption.data('thumbimage')+'); background-size:cover"></div>'); 3820 } 3821 3822 if (ifr.attr('src').toLowerCase().indexOf('youtube')>=0) { 3823 3824 if (!ifr.hasClass("HasListener")) { 3825 try { 3826 ifr.attr('id',frameID); 3827 3828 var player; 3829 var ytint = setInterval(function() { 3830 if (YT !=undefined) 3831 if (typeof YT.Player != undefined && typeof YT.Player !="undefined") { 3832 3833 if (nextcaption.data('autoplay')==true) { 3834 player = new YT.Player(frameID, { 3835 events: { 3836 "onStateChange": onPlayerStateChange, 3837 'onReady': function(event) { 3838 event.target.playVideo(); 3839 } 3840 } 3841 });
3842 } else 3843 player = new YT.Player(frameID, { 3844 events: { 3845 "onStateChange": onPlayerStateChange 3846 } 3847 }); 3848 ifr.addClass("HasListener"); 3849 3850 nextcaption.data('player',player); 3851 clearInterval(ytint); 3852 } 3853 } 3854 , 100) 3855 3856 3857 3858 } catch(e) {} 3859 } else { 3860 if (nextcaption.data('autoplay')==true) { 3861 var player=nextcaption.data('player'); 3862 nextcaption.data('timerplay',setTimeout(function() { 3863 if (nextcaption.data('forcerewind')=="on") 3864 player.seekTo(0); 3865 player.playVideo(); 3866 },nextcaption.data('start'))); 3867 } 3868 } // END YOUTUBE HANDLING 3869 3870 // PLAY VIDEO IF THUMBNAIL HAS BEEN CLICKED 3871 nextcaption.find('.tp-thumb-image').click(function() { 3872 TweenLite.to(jQuery(this),0.3,{opacity:0,ease:Power3.easeInOut,onComplete: function() { 3873 nextcaption.find('.tp-thumb-image').remove(); 3874 } 3875 }) 3876 var player=nextcaption.data('player'); 3877 player.playVideo(); 3878 }) 3879 } else { 3880 // START VIMEO HANDLING 3881 if (ifr.attr('src').toLowerCase().indexOf('vimeo')>=0) { 3882 3883 if (!ifr.hasClass("HasListener")) { 3884 ifr.addClass("HasListener"); 3885 ifr.attr('id',frameID); 3886 var isrc = ifr.attr('src'); 3887 var queryParameters = {}, queryString = isrc, 3888 re = /([^&=]+)=([^&]*)/g, m; 3889 // Creates a map with the query string parameters 3890 while (m = re.exec(queryString)) { 3891 queryParameters[decodeURIComponent(m[1])] = decodeURIComponent(m[2]); 3892 } 3893 3894 if (queryParameters['player_id']!=undefined) 3895 isrc = isrc.replace(queryParameters['player_id'],frameID); 3896 else 3897 isrc=isrc+"&player_id="+frameID; 3898 3899 try{ isrc = isrc.replace('api=0','api=1'); } catch(e) {} 3900 3901 isrc=isrc+"&api=1"; 3902 3903 ifr.attr('src',isrc); 3904 var player = nextcaption.find('iframe')[0]; 3905 var vimint = setInterval(function() { 3906 if ($f !=undefined) 3907 if (typeof $f(frameID).api != undefined && typeof $f(frameID).api !="undefined") { 3908 $f(player).addEvent('ready', function(){ 3909 vimeoready_auto(frameID,nextcaption.data('autoplay')) 3910 }); 3911 clearInterval(vimint); 3912 } 3913 },100); 3914 3915 } else { 3916 if (nextcaption.data('autoplay')==true) { 3917 3918 var ifr = nextcaption.find('iframe'); 3919 var id = ifr.attr('id'); 3920 var vimint = setInterval(function() { 3921 if ($f !=undefined) 3922 if (typeof $f(id).api != undefined && typeof $f(id).api !="undefined") { 3923 var froogaloop = $f(id); 3924 nextcaption.data('timerplay',setTimeout(function() { 3925 if (nextcaption.data('forcerewind')=="on") 3926 froogaloop.api("seekTo",0); 3927 froogaloop.api("play"); 3928 },nextcaption.data('start'))); 3929 clearInterval(vimint); 3930 } 3931 },100); 3932 } 3933 }// END HAS LISTENER HANDLING 3934 3935 // PLAY VIDEO IF THUMBNAIL HAS BEEN CLICKED 3936 nextcaption.find('.tp-thumb-image').click(function() { 3937 TweenLite.to(jQuery(this),0.3,{opacity:0,ease:Power3.easeInOut,onComplete: function() { 3938 nextcaption.find('.tp-thumb-image').remove(); 3939 } 3940 }) 3941 var ifr = nextcaption.find('iframe'); 3942 var id = ifr.attr('id'); 3943 var vimint = setInterval(function() { 3944 if ($f !=undefined) 3945 if (typeof $f(id).api != undefined && typeof $f(id).api !="undefined") { 3946 var froogaloop = $f(id); 3947 froogaloop.api("play"); 3948 clearInterval(vimint); 3949 } 3950 },100); 3951 }) 3952 3953 3954 } // END OF VIMEO HANDLING 3955 } // END OF CHOOSE BETWEEN YOUTUBE AND VIMEO 3956 }); // END OF LOOP THROUGH IFRAMES 3957 3958 // START OF VIDEO JS 3959 if (nextcaption.find('video').length>0) { 3960 3961 3962 nextcaption.find('video').each(function(i) { 3963 var html5vid = jQuery(this).parent(); 3964 3965 if (nextcaption.data('dottedoverlay')!="none" && nextcaption.data('dottedoverlay')!=undefined) 3966 if (nextcaption.find('.tp-dottedoverlay').length!=1) 3967 html5vid.append('<div class="tp-dottedoverlay '+nextcaption.data('dottedoverlay')+'"></div>'); 3968 3969 var mediaaspect=16/9; 3970 if (nextcaption.data('aspectratio')=="4:3") mediaaspect=4/3; 3971 html5vid.data('mediaAspect',mediaaspect); 3972 3973 3974 3975 if (html5vid.closest('.tp-caption').data('forcecover')==1) 3976 updateHTML5Size(html5vid,opt.container); 3977 3978 var htmlint = setInterval(function() { 3979 if (typeof videojs !=undefined && typeof videojs !="undefined") 3980 var html5vid = nextcaption.find('video').parent(); 3981 3982 if (html5vid!=undefined && html5vid.hasClass("video-js")) { 3983 3984 3985 opt.nextslideatend = nextcaption.data('nextslideatend'); 3986 if (!html5vid.hasClass("HasListener")) { 3987 html5vid.addClass("HasListener"); 3988 var videoID = "videoid_"+Math.round(Math.random()*1000+1); 3989 html5vid.attr('id',videoID); 3990 3991 videojs(videoID).ready(function(){ 3992 3993 html5vidready(this,videoID) 3994 3995 });
3996 3997 } else { 3998 videoID = html5vid.attr('id'); 3999 } 4000 4001 4002 if (nextcaption.data('autoplay')==true) { 4003 4004 4005 var bt=jQuery('body').find('#'+opt.container.attr('id')).find('.tp-bannertimer'); 4006 setTimeout(function(){ 4007 4008 opt.videoplaying=true; 4009 opt.container.trigger('stoptimer'); 4010 },200); 4011 4012 //konsole.log("VideoPlay set to True due HTML5 VIDEO 1st/2nd load AutoPlay"); 4013 4014 4015 videojs(videoID).ready(function(){ 4016 var myPlayer = this; 4017 4018 if (html5vid.data('loadedmetadata')==1 || html5vid.data('canplay') == 1) 4019 if (nextcaption.data('forcerewind')=="on") 4020 myPlayer.currentTime(0); 4021 4022 html5vid.data('timerplay',setTimeout(function() { 4023 if (html5vid.data('loadedmetadata')==1 || html5vid.data('canplay') == 1) { 4024 if (nextcaption.data('forcerewind')=="on") 4025 myPlayer.currentTime(0); 4026 4027 if (html5vid.closest('.tp-caption').data('volume')=="mute") 4028 myPlayer.volume(0); 4029 } 4030 setTimeout(function() { 4031 myPlayer.play(0); 4032 html5vid.find('.vjs-poster').css({display:"none"}); 4033 },50); 4034 },10+nextcaption.data('start'))); 4035 }); 4036 4037 } 4038 4039 4040 html5vid.find('.vjs-poster').css({display:"block"}); 4041 4042 4043 4044 4045 if (html5vid.data('ww') == undefined) html5vid.data('ww',html5vid.width()); 4046 if (html5vid.data('hh') == undefined) html5vid.data('hh',html5vid.height()); 4047 4048 videojs(videoID).ready(function(){ 4049 if (!nextcaption.hasClass("fullscreenvideo")) { 4050 var myPlayer = videojs(videoID); 4051 4052 try{ 4053 myPlayer.width(html5vid.data('ww')*opt.bw); 4054 myPlayer.height(html5vid.data('hh')*opt.bh); 4055 } catch(e) {} 4056 } 4057 }); 4058 4059 4060 4061 if (html5vid.closest('.tp-caption').data('forcecover')==1) { 4062 updateHTML5Size(html5vid,opt.container); 4063 html5vid.addClass("fullcoveredvideo"); 4064 } 4065 4066 clearInterval(htmlint); 4067 4068 4069 } 4070 4071 },100) 4072 }); 4073 } // END OF VIDEO JS FUNCTIONS 4074 4075 // IF AUTOPLAY IS ON, WE NEED SOME STOP FUNCTION ON 4076 if (nextcaption.data('autoplay')==true) { 4077 var bt=jQuery('body').find('#'+opt.container.attr('id')).find('.tp-bannertimer'); 4078 4079 setTimeout(function() { 4080 4081 opt.videoplaying=true; 4082 opt.container.trigger('stoptimer'); 4083 4084 },200) 4085 opt.videoplaying=true; 4086 opt.container.trigger('stoptimer'); 4087 4088 if (nextcaption.data('autoplayonlyfirsttime') == true || nextcaption.data('autoplayonlyfirsttime')=="true" ) { 4089 nextcaption.data('autoplay',false); 4090 nextcaption.data('autoplayonlyfirsttime',false); 4091 } 4092 } 4093 } 4094 4095 4096 4097 4098 // NEW ENGINE 4099 //if (nextcaption.hasClass("randomrotate") && (opt.ie || opt.ie9)) nextcaption.removeClass("randomrotate").addClass("sfb"); 4100 // nextcaption.removeClass('noFilterClass'); 4101 4102 4103 4104 var imw =0; 4105 var imh = 0; 4106 4107 if (nextcaption.find('img').length>0) { 4108 var im = nextcaption.find('img'); 4109 if (im.data('ww') == undefined) im.data('ww',im.width()); 4110 if (im.data('hh') == undefined) im.data('hh',im.height()); 4111 4112 var ww = im.data('ww'); 4113 var hh = im.data('hh'); 4114 4115 4116 im.width(ww*opt.bw); 4117 im.height(hh*opt.bh); 4118 imw = im.width(); 4119 imh = im.height(); 4120 } else { 4121 4122 if (nextcaption.find('iframe').length>0 || nextcaption.find('.video-js').length>0) { 4123 4124 var im = nextcaption.find('iframe'); 4125 im.css({display:"block"}); 4126 if (nextcaption.data('ww') == undefined) { 4127 nextcaption.data('ww',im.width()); 4128 } 4129 if (nextcaption.data('hh') == undefined) nextcaption.data('hh',im.height()); 4130 4131 var ww = nextcaption.data('ww'); 4132 var hh = nextcaption.data('hh'); 4133 4134 var nc =nextcaption; 4135 if (nc.data('fsize') == undefined) nc.data('fsize',parseInt(nc.css('font-size'),0) || 0); 4136 if (nc.data('pt') == undefined) nc.data('pt',parseInt(nc.css('paddingTop'),0) || 0); 4137 if (nc.data('pb') == undefined) nc.data('pb',parseInt(nc.css('paddingBottom'),0) || 0); 4138 if (nc.data('pl') == undefined) nc.data('pl',parseInt(nc.css('paddingLeft'),0) || 0); 4139 if (nc.data('pr') == undefined) nc.data('pr',parseInt(nc.css('paddingRight'),0) || 0); 4140 4141 if (nc.data('mt') == undefined) nc.data('mt',parseInt(nc.css('marginTop'),0) || 0); 4142 if (nc.data('mb') == undefined) nc.data('mb',parseInt(nc.css('marginBottom'),0) || 0); 4143 if (nc.data('ml') == undefined) nc.data('ml',parseInt(nc.css('marginLeft'),0) || 0); 4144 if (nc.data('mr') == undefined) nc.data('mr',parseInt(nc.css('marginRight'),0) || 0); 4145 4146 if (nc.data('bt') == undefined) nc.data('bt',parseInt(nc.css('borderTop'),0) || 0); 4147 if (nc.data('bb') == undefined) nc.data('bb',parseInt(nc.css('borderBottom'),0) || 0); 4148 if (nc.data('bl') == undefined) nc.data('bl',parseInt(nc.css('borderLeft'),0) || 0); 4149 if (nc.data('br') == undefined) nc.data('br',parseInt(nc.css('borderRight'),0) || 0); 4150 4151 if (nc.data('lh') == undefined) nc.data('lh',parseInt(nc.css('lineHeight'),0) || 0); 4152 4153 var fvwidth=opt.width; 4154 var fvheight=opt.height; 4155 if (fvwidth>opt.startwidth) fvwidth=opt.startwidth; 4156 if (fvheight>
4156opt.startheight) fvheight=opt.startheight; 4157 4158 4159 4160 if (!nextcaption.hasClass('fullscreenvideo')) 4161 nextcaption.css({ 4162 4163 'font-size': (nc.data('fsize') * opt.bw)+"px", 4164 4165 'padding-top': (nc.data('pt') * opt.bh) + "px", 4166 'padding-bottom': (nc.data('pb') * opt.bh) + "px", 4167 'padding-left': (nc.data('pl') * opt.bw) + "px", 4168 'padding-right': (nc.data('pr') * opt.bw) + "px", 4169 4170 'margin-top': (nc.data('mt') * opt.bh) + "px", 4171 'margin-bottom': (nc.data('mb') * opt.bh) + "px", 4172 'margin-left': (nc.data('ml') * opt.bw) + "px", 4173 'margin-right': (nc.data('mr') * opt.bw) + "px", 4174 4175 'border-top': (nc.data('bt') * opt.bh) + "px", 4176 'border-bottom': (nc.data('bb') * opt.bh) + "px", 4177 'border-left': (nc.data('bl') * opt.bw) + "px", 4178 'border-right': (nc.data('br') * opt.bw) + "px", 4179 4180 'line-height': (nc.data('lh') * opt.bh) + "px", 4181 'height':(hh*opt.bh)+'px', 4182 }); 4183 else { 4184 offsetx=0; offsety=0; 4185 nextcaption.data('x',0) 4186 nextcaption.data('y',0) 4187 4188 var ovhh = opt.height 4189 if (opt.autoHeight=="on") 4190 ovhh = opt.container.height() 4191 nextcaption.css({ 4192 4193 'width':opt.width, 4194 'height':ovhh 4195 }); 4196 } 4197 4198 4199 im.width(ww*opt.bw); 4200 im.height(hh*opt.bh); 4201 imw = im.width(); 4202 imh = im.height(); 4203 } 4204 4205 else { 4206 4207 4208 nextcaption.find('.tp-resizeme, .tp-resizeme *').each(function() { 4209 calcCaptionResponsive(jQuery(this),opt); 4210 }); 4211 4212 if (nextcaption.hasClass("tp-resizeme")) { 4213 nextcaption.find('*').each(function() { 4214 calcCaptionResponsive(jQuery(this),opt); 4215 }); 4216 } 4217 4218 calcCaptionResponsive(nextcaption,opt); 4219 4220 imh=nextcaption.outerHeight(true); 4221 imw=nextcaption.outerWidth(true); 4222 4223 // NEXTCAPTION FRONTCORNER CHANGES 4224 var ncch = nextcaption.outerHeight(); 4225 var bgcol = nextcaption.css('backgroundColor'); 4226 nextcaption.find('.frontcorner').css({ 4227 'borderWidth':ncch+"px", 4228 'left':(0-ncch)+'px', 4229 'borderRight':'0px solid transparent', 4230 'borderTopColor':bgcol 4231 }); 4232 4233 nextcaption.find('.frontcornertop').css({ 4234 'borderWidth':ncch+"px", 4235 'left':(0-ncch)+'px', 4236 'borderRight':'0px solid transparent', 4237 'borderBottomColor':bgcol 4238 }); 4239 4240 // NEXTCAPTION BACKCORNER CHANGES 4241 nextcaption.find('.backcorner').css({ 4242 'borderWidth':ncch+"px", 4243 'right':(0-ncch)+'px', 4244 'borderLeft':'0px solid transparent', 4245 'borderBottomColor':bgcol 4246 }); 4247 4248 // NEXTCAPTION BACKCORNER CHANGES 4249 nextcaption.find('.backcornertop').css({ 4250 'borderWidth':ncch+"px", 4251 'right':(0-ncch)+'px', 4252 'borderLeft':'0px solid transparent', 4253 'borderTopColor':bgcol 4254 }); 4255 4256 } 4257 4258 4259 } 4260 4261 if (opt.fullScreenAlignForce == "on") { 4262 xbw = 1; 4263 xbh = 1; 4264 offsetx=0; 4265 offsety=0; 4266 } 4267 4268 4269 4270 if (nextcaption.data('voffset')==undefined) nextcaption.data('voffset',0); 4271 if (nextcaption.data('hoffset')==undefined) nextcaption.data('hoffset',0); 4272 4273 var vofs= nextcaption.data('voffset')*xbw; 4274 var hofs= nextcaption.data('hoffset')*xbw; 4275 4276 var crw = opt.startwidth*xbw; 4277 var crh = opt.startheight*xbw; 4278 4279 if (opt.fullScreenAlignForce == "on") { 4280 crw = opt.container.width(); 4281 crh = opt.container.height(); 4282 4283 } 4284 4285 4286 4287 // CENTER THE CAPTION HORIZONTALLY 4288 if (nextcaption.data('x')=="center" || nextcaption.data('xcenter')=='center') { 4289 nextcaption.data('xcenter','center'); 4290 //nextcaption.data('x',(crw/2 - nextcaption.outerWidth(true)/2)/xbw+ hofs); 4291 nextcaption.data('x',(crw/2 - nextcaption.outerWidth(true)/2) + hofs); 4292 4293 4294 } 4295 4296 // ALIGN LEFT THE CAPTION HORIZONTALLY 4297 if (nextcaption.data('x')=="left" || nextcaption.data('xleft')=='left') { 4298 nextcaption.data('xleft','left'); 4299 nextcaption.data('x',(0)/xbw+hofs); 4300 4301 } 4302 4303 // ALIGN RIGHT THE CAPTION HORIZONTALLY 4304 if (nextcaption.data('x')=="right" || nextcaption.data('xright')=='right') { 4305 nextcaption.data('xright','right'); 4306 nextcaption.data('x',((crw - nextcaption.outerWidth(true))+hofs)/xbw); 4307 //konsole.log("crw:"+crw+" width:"+nextcaption.outerWidth(true)+" xbw:"+xbw); 4308 //konsole.log("x-pos:"+nextcaption.data('x')) 4309 } 4310 4311 4312 // CENTER THE CAPTION VERTICALLY 4313 if (nextcaption.data('y')=="center" || nextcaption.data('ycenter')=='center') { 4314 nextcaption.data('ycenter','center'); 4315 nextcaption.data('y',(crh/2 - nextcaption.outerHeight(true)/2) + vofs); 4316 } 4317 4318 // ALIGN TOP THE CAPTION VERTICALLY 4319 if (nextcaption.data('y')=="top" || nextcaption.data('ytop')=='top') { 4320 nextcaption.data('ytop','top'); 4321 nextcaption.data('y',(0)/opt.bh+vofs); 4322 4323 } 4324 4325 // ALIGN BOTTOM THE CAPTION VERTICALLY 4326 if (nextcaption.data('y')=="bottom" || nextcaption.data('ybottom')=='bottom') { 4327 nextcaption.data('ybottom','bottom'); 4328 nextcaption.data('y',((crh - nextcaption.outerHeight(true))+vofs)/xbw); 4329 } 4330 4331 4332 4333 // THE TRANSITIONS OF CAPTIONS 4334 // MDELAY AND MSPEED 4335 if (nextcaption.data('start') == undefined) nextcaption.data('start',1000); 4336 4337 4338 4339 var easedata=nextcaption.data('easing'); 4340 if (easedata==undefined) easedata="Power1.easeOut"; 4341 4342
4343 var mdelay = nextcaption.data('start')/1000; 4344 var mspeed = nextcaption.data('speed')/1000; 4345 4346 4347 if (nextcaption.data('x')=="center" || nextcaption.data('xcenter')=='center') 4348 var calcx = (nextcaption.data('x')+offsetx); 4349 else 4350 var calcx = (xbw*nextcaption.data('x')+offsetx); 4351 4352 4353 if (nextcaption.data('y')=="center" || nextcaption.data('ycenter')=='center') 4354 var calcy = (nextcaption.data('y')+offsety); 4355 else 4356 var calcy = (opt.bh*nextcaption.data('y')+offsety); 4357 4358 4359 4360 4361 TweenLite.set(nextcaption,{top:calcy,left:calcx,overwrite:"auto"}); 4362 4363 if (!recalled) { 4364 4365 4366 4367 // CLEAR THE TIMELINE, SINCE IT CAN BE DAMAGED, OR PAUSED AT A FEW PART 4368 if (nextcaption.data('timeline')!=undefined) 4369 nextcaption.data('timeline').clear(); 4370 4371 // MAKE SURE THE ANIMATION ENDS WITH A CLEANING ON MOZ TRANSFORMS 4372 function animcompleted() { 4373 setTimeout(function() { 4374 nextcaption.css({transform:"none",'-moz-transform':'none','-webkit-transform':'none'}); 4375 },100) 4376 } 4377 4378 4379 function tlstart() { 4380 nextcaption.data('timer',setTimeout(function() { 4381 if (nextcaption.hasClass("fullscreenvideo")) 4382 nextcaption.css({'display':'block'}); 4383 4384 },nextcaption.data('start'))); 4385 } 4386 4387 var tl = new TimelineLite({smoothChildTiming:true,onStart:tlstart}); 4388 4389 4390 4391 if (opt.fullScreenAlignForce == "on") 4392 calcy = nextcaption.data('y')+offsety; 4393 4394 var animobject = nextcaption; 4395 if (nextcaption.data('mySplitText') !=undefined) nextcaption.data('mySplitText').revert(); 4396 4397 4398 if (nextcaption.data('splitin') == "chars" || nextcaption.data('splitin') == "words" || nextcaption.data('splitin') == "lines" || nextcaption.data('splitout') == "chars" || nextcaption.data('splitout') == "words" || nextcaption.data('splitout') == "lines") { 4399 if (nextcaption.find('a').length>0) 4400 nextcaption.data('mySplitText',new SplitText(nextcaption.find('a'),{type:"lines,words,chars",charsClass:"tp-splitted",wordsClass:"tp-splitted",linesClass:"tp-splitted"})); 4401 else 4402 nextcaption.data('mySplitText',new SplitText(nextcaption,{type:"lines,words,chars",charsClass:"tp-splitted",wordsClass:"tp-splitted",linesClass:"tp-splitted"})); 4403 4404 nextcaption.addClass("splitted"); 4405 } 4406 4407 if (nextcaption.data('splitin') == "chars") 4408 animobject = nextcaption.data('mySplitText').chars; 4409 4410 4411 if (nextcaption.data('splitin') == "words") 4412 animobject = nextcaption.data('mySplitText').words; 4413 4414 4415 if (nextcaption.data('splitin') == "lines") 4416 animobject = nextcaption.data('mySplitText').lines; 4417 4418 4419 4420 var frm = newAnimObject(); 4421 var endfrm = newAnimObject(); 4422 4423 4424 if (nextcaption.data('repeat')!=undefined) repeatV = nextcaption.data('repeat'); 4425 if (nextcaption.data('yoyo')!=undefined) yoyoV = nextcaption.data('yoyo'); 4426 if (nextcaption.data('repeatdelay')!=undefined) repeatdelayV = nextcaption.data('repeatdelay'); 4427 4428 // WHICH ANIMATION TYPE SHOULD BE USED 4429 if (nextcaption.hasClass("customin")) frm = getAnimDatas(frm,nextcaption.data('customin')); 4430 else 4431 if (nextcaption.hasClass("randomrotate")) { 4432 4433 frm.scale = Math.random()*3+1; 4434 frm.rotation = Math.round(Math.random()*200-100); 4435 frm.x = Math.round(Math.random()*200-100); 4436 frm.y = Math.round(Math.random()*200-100); 4437 } 4438 else 4439 if (nextcaption.hasClass('lfr') || nextcaption.hasClass('skewfromright')) frm.x = 15+opt.width; 4440 else 4441 if (nextcaption.hasClass('lfl') || nextcaption.hasClass('skewfromleft')) frm.x = -15-imw; 4442 else 4443 if (nextcaption.hasClass('sfl') | nextcaption.hasClass('skewfromleftshort')) frm.x = -50; 4444 else 4445 if (nextcaption.hasClass('sfr') | nextcaption.hasClass('skewfromrightshort')) frm.x = 50; 4446 else 4447 if (nextcaption.hasClass('lft')) frm.y = -25 - imh; 4448 else 4449 if (nextcaption.hasClass('lfb')) frm.y = 25 + opt.height; 4450 else 4451 if (nextcaption.hasClass('sft')) frm.y = -50; 4452 else 4453 if (nextcaption.hasClass('sfb')) frm.y = 50; 4454 4455 4456 if (nextcaption.hasClass('skewfromright') || nextcaption.hasClass('skewfromrightshort')) frm.skewX = -85 4457 else 4458 if (nextcaption.hasClass('skewfromleft') || nextcaption.hasClass('skewfromleftshort')) frm.skewX = 85 4459 4460 4461 // FOR SAFARI WE NEED TO REMOVE 3D ROTATIONS 4462 if (get_browser().toLowerCase()=="safari") { 4463 frm.rotationX=0;frm.rotationY=0; 4464 } 4465
4466 var elemdelay = (nextcaption.data('elementdelay') == undefined) ? 0 : nextcaption.data('elementdelay'); 4467 endfrm.ease = frm.ease = (nextcaption.data('easing') == undefined) ? Power1.easeInOut : nextcaption.data('easing'); 4468 4469 4470 // DISTANCES SHOULD BE RESIZED ALSO 4471 4472 frm.data = new Object(); 4473 frm.data.oldx = frm.x; 4474 frm.data.oldy = frm.y; 4475 4476 endfrm.data = new Object(); 4477 endfrm.data.oldx = endfrm.x; 4478 endfrm.data.oldy = endfrm.y; 4479 4480 frm.x = frm.x * xbw; 4481 frm.y = frm.y * xbw; 4482 4483 var newtl = new TimelineLite(); 4484 4485 4486 4487 // CHANGE to TweenLite. if Yoyo and Repeat is used. Dont forget to laod the Right Tools for it !! 4488 if (nextcaption.hasClass("customin")) { 4489 if (animobject != nextcaption) 4490 tl.add(TweenLite.set(nextcaption, { opacity:1,scaleX:1,scaleY:1,rotationX:0,rotationY:0,rotationZ:0,skewX:0,skewY:0,z:0,x:0,y:0,visibility:'visible',opacity:1,delay:0,overwrite:"all"})); 4491 frm.visibility = "hidden"; 4492 endfrm.visibility = "visible"; 4493 endfrm.overwrite = "all"; 4494 endfrm.opacity = 1; 4495 endfrm.onComplete = animcompleted(); 4496 endfrm.delay = mdelay; 4497 4498 tl.add(newtl.staggerFromTo(animobject,mspeed,frm,endfrm,elemdelay),"frame0"); 4499 4500 } else { 4501 frm.visibility = "visible"; 4502 frm.transformPerspective = 600; 4503 if (animobject != nextcaption) 4504 tl.add(TweenLite.set(nextcaption, { opacity:1,scaleX:1,scaleY:1,rotationX:0,rotationY:0,rotationZ:0,skewX:0,skewY:0,z:0,x:0,y:0,visibility:'visible',opacity:1,delay:0,overwrite:"all"})); 4505 4506 endfrm.visibility = "visible"; 4507 endfrm.delay = mdelay; 4508 endfrm.onComplete = animcompleted(); 4509 endfrm.opacity = 1; 4510 if (nextcaption.hasClass("randomrotate") && animobject != nextcaption) { 4511 4512 for (var i=0;i<animobject.length;i++) { 4513 var obj =new Object(); 4514 var endobj = new Object(); 4515 jQuery.extend(obj,frm); 4516 jQuery.extend(endobj,endfrm); 4517 frm.scale = Math.random()*3+1; 4518 frm.rotation = Math.round(Math.random()*200-100); 4519 frm.x = Math.round(Math.random()*200-100); 4520 frm.y = Math.round(Math.random()*200-100); 4521 4522 if (i!=0) endobj.delay = mdelay + (i*elemdelay); 4523 4524 4525 tl.append(TweenLite.fromTo(animobject[i],mspeed,obj,endobj),"frame0"); 4526 } 4527 4528 4529 4530 } else 4531 tl.add(newtl.staggerFromTo(animobject,mspeed,frm,endfrm,elemdelay),"frame0"); 4532 //tl.add(TweenLite.fromTo(nextcaption,mspeed,frm,endfrm),"frame0"); 4533 } 4534 4535 // SAVE IT TO NCAPTION BEFORE NEW STEPS WILL BE ADDED 4536 nextcaption.data('timeline',tl); 4537 4538 // FURTHER ANIMATIONS IN CASE THERE ARE MORE THAN ONE STEP IN THE ANIMATION CHAIN 4539 var frames = new Array(); 4540 if (nextcaption.data('frames')!=undefined) { 4541 var rowtext = nextcaption.data('frames'); 4542 rowtext = rowtext.replace(/\s+/g, ''); 4543 rowtext = rowtext.replace("{",""); 4544 var spframes = rowtext.split('}'); 4545 jQuery.each(spframes,function(index,spframe){ 4546 if (spframe.length>0) { 4547 var params = getAnimSteps(spframe); 4548 4549 addMoveCaption(nextcaption,opt,params,"frame"+(index+10),xbw) 4550 4551 } 4552 }) 4553 } // END OF ANIMATION STEPS 4554 4555 tl = nextcaption.data('timeline'); 4556 4557 // IF THERE IS ANY EXIT ANIM DEFINED 4558 if (nextcaption.data('end')!=undefined) { 4559 4560 endMoveCaption(nextcaption,opt,nextcaption.data('end')/1000,frm,"frame99",xbw); 4561 } else { 4562 endMoveCaption(nextcaption,opt,999999,frm,"frame99",xbw); 4563 } 4564 4565 // SAVE THE TIMELINE IN DOM ELEMENT 4566 tl = nextcaption.data('timeline'); 4567 nextcaption.data('timeline',tl); 4568 4569 4570 } 4571 } 4572 4573 if (recalled) { 4574 if (nextcaption.data('timeline') != undefined) { 4575 var tweens = nextcaption.data('timeline').getTweensOf(); 4576 jQuery.each(tweens,function(index,tween) { 4577 if (tween.vars.data != undefined) { 4578 var newx = tween.vars.data.oldx * xbw; 4579 var newy = tween.vars.data.oldy * xbw; 4580 if (tween.progress() !=1 && tween.progress()!=0) { 4581 try{ 4582 //tween.updateTo({x:newx, y:newy},true); 4583 tween.vars.x = newx; 4584 tween.vary.y = newy; 4585 } catch(e) { 4586 4587 } 4588 } else { 4589 if (tween.progress()==1) { 4590 TweenLite.set(tween.target,{x:newx,y:newy}); 4591 } 4592 } 4593 } 4594 }) 4595 } 4596 } 4597 }) 4598 4599 var bt=jQuery('body').find('#'+opt.container.attr('id')).find('.tp-bannertimer'); 4600 bt.data('opt',opt); 4601 4602 4603 } 4604 4605 4606 function get_browser(){ 4607 var N=navigator.appName, ua=navigator.userAgent, tem; 4608 var M=ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
4609 if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1]; 4610 M=M? [M[1], M[2]]: [N, navigator.appVersion, '-?']; 4611 return M[0]; 4612 } 4613 function get_browser_version(){ 4614 var N=navigator.appName, ua=navigator.userAgent, tem; 4615 var M=ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i); 4616 if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1]; 4617 M=M? [M[1], M[2]]: [N, navigator.appVersion, '-?']; 4618 return M[1]; 4619 } 4620 4621 ///////////////////////////////////////////////////////////////// 4622 // - CALCULATE THE RESPONSIVE SIZES OF THE CAPTIONS - // 4623 ///////////////////////////////////////////////////////////////// 4624 function calcCaptionResponsive(nc,opt) { 4625 if (nc.data('fsize') == undefined) nc.data('fsize',parseInt(nc.css('font-size'),0) || 0); 4626 if (nc.data('pt') == undefined) nc.data('pt',parseInt(nc.css('paddingTop'),0) || 0); 4627 if (nc.data('pb') == undefined) nc.data('pb',parseInt(nc.css('paddingBottom'),0) || 0); 4628 if (nc.data('pl') == undefined) nc.data('pl',parseInt(nc.css('paddingLeft'),0) || 0); 4629 if (nc.data('pr') == undefined) nc.data('pr',parseInt(nc.css('paddingRight'),0) || 0); 4630 4631 if (nc.data('mt') == undefined) nc.data('mt',parseInt(nc.css('marginTop'),0) || 0); 4632 if (nc.data('mb') == undefined) nc.data('mb',parseInt(nc.css('marginBottom'),0) || 0); 4633 if (nc.data('ml') == undefined) nc.data('ml',parseInt(nc.css('marginLeft'),0) || 0); 4634 if (nc.data('mr') == undefined) nc.data('mr',parseInt(nc.css('marginRight'),0) || 0); 4635 4636 if (nc.data('bt') == undefined) nc.data('bt',parseInt(nc.css('borderTopWidth'),0) || 0); 4637 if (nc.data('bb') == undefined) nc.data('bb',parseInt(nc.css('borderBottomWidth'),0) || 0); 4638 if (nc.data('bl') == undefined) nc.data('bl',parseInt(nc.css('borderLeftWidth'),0) || 0); 4639 if (nc.data('br') == undefined) nc.data('br',parseInt(nc.css('borderRightWidth'),0) || 0); 4640 4641 if (nc.data('ls') == undefined) nc.data('ls',parseInt(nc.css('letterSpacing'),0) || 0); 4642 4643 if (nc.data('lh') == undefined) nc.data('lh',parseInt(nc.css('lineHeight'),0) || 0); 4644 if (nc.data('minwidth') == undefined) nc.data('minwidth',parseInt(nc.css('minWidth'),0) || 0); 4645 if (nc.data('minheight') == undefined) nc.data('minheight',parseInt(nc.css('minHeight'),0) || 0); 4646 if (nc.data('maxwidth') == undefined) nc.data('maxwidth',parseInt(nc.css('maxWidth'),0) || "none"); 4647 if (nc.data('maxheight') == undefined) nc.data('maxheight',parseInt(nc.css('maxHeight'),0) || "none"); 4648 4649 if (nc.data('wan') == undefined) nc.data('wan',nc.css("-webkit-transition")); 4650 if (nc.data('moan') == undefined) nc.data('moan',nc.css("-moz-animation-transition")); 4651 if (nc.data('man') == undefined) nc.data('man',nc.css("-ms-animation-transition")); 4652 if (nc.data('ani') == undefined) nc.data('ani',nc.css("transition")); 4653 4654 4655 4656 4657 4658 if (!nc.hasClass("tp-splitted")) { 4659 4660 4661 nc.css("-webkit-transition", "none"); 4662 nc.css("-moz-transition", "none"); 4663 nc.css("-ms-transition", "none"); 4664 nc.css("transition", "none"); 4665 4666 TweenLite.set(nc,{ 4667 fontSize: Math.round((nc.data('fsize') * opt.bw))+"px", 4668 4669 letterSpacing:Math.floor((nc.data('ls') * opt.bw))+"px", 4670 4671 paddingTop: Math.round((nc.data('pt') * opt.bh)) + "px", 4672 paddingBottom: Math.round((nc.data('pb') * opt.bh)) + "px", 4673 paddingLeft: Math.round((nc.data('pl') * opt.bw)) + "px", 4674 paddingRight: Math.round((nc.data('pr') * opt.bw)) + "px", 4675 4676 marginTop: (nc.data('mt') * opt.bh) + "px", 4677 marginBottom: (nc.data('mb') * opt.bh) + "px", 4678 marginLeft: (nc.data('ml') * opt.bw) + "px", 4679 marginRight: (nc.data('mr') * opt.bw) + "px", 4680 4681 borderTopWidth: Math.round((nc.data('bt') * opt.bh)) + "px", 4682 borderBottomWidth: Math.round((nc.data('bb') * opt.bh)) + "px", 4683 borderLeftWidth: Math.round((nc.data('bl') * opt.bw)) + "px", 4684 borderRightWidth: Math.round((nc.data('br') * opt.bw)) + "px", 4685 4686 lineHeight: Math.round((nc.data('lh') * opt.bh)) + "px", 4687 minWidth:(nc.data('minwidth') * opt.bw) + "px", 4688 minHeight:(nc.data('minheight') * opt.bh) + "px", 4689 overwrite:"auto" 4690 });
4691 setTimeout(function() { 4692 nc.css("-webkit-transition", nc.data('wan')); 4693 nc.css("-moz-transition", nc.data('moan')); 4694 nc.css("-ms-transition", nc.data('man')); 4695 nc.css("transition", nc.data('ani')); 4696 4697 },30); 4698 4699 //konsole.log(nc.data('maxwidth')+" "+nc.data('maxheight')); 4700 if (nc.data('maxheight')!='none') 4701 nc.css({'maxHeight':(nc.data('maxheight') * opt.bh) + "px"}); 4702 4703 4704 if (nc.data('maxwidth')!='none') 4705 nc.css({'maxWidth':(nc.data('maxwidth') * opt.bw) + "px"}); 4706 } 4707 } 4708 4709 4710 ////////////////////////// 4711 // REMOVE THE CAPTIONS // 4712 ///////////////////////// 4713 function removeTheCaptions(actli,opt) { 4714 4715 4716 actli.find('.tp-caption').each(function(i) { 4717 var nextcaption=jQuery(this); //actli.find('.tp-caption:eq('+i+')'); 4718 4719 if (nextcaption.find('iframe').length>0) { 4720 // VIMEO VIDEO PAUSE 4721 try { 4722 var ifr = nextcaption.find('iframe'); 4723 var id = ifr.attr('id'); 4724 var froogaloop = $f(id); 4725 froogaloop.api("pause"); 4726 clearTimeout(nextcaption.data('timerplay')); 4727 } catch(e) {} 4728 //YOU TUBE PAUSE 4729 try { 4730 var player=nextcaption.data('player'); 4731 player.stopVideo(); 4732 clearTimeout(nextcaption.data('timerplay')); 4733 } catch(e) {} 4734 } 4735 4736 // IF HTML5 VIDEO IS EMBEDED 4737 if (nextcaption.find('video').length>0) { 4738 try{ 4739 nextcaption.find('video').each(function(i) { 4740 var html5vid = jQuery(this).parent(); 4741 var videoID =html5vid.attr('id'); 4742 clearTimeout(html5vid.data('timerplay')); 4743 videojs(videoID).ready(function(){ 4744 var myPlayer = this; 4745 myPlayer.pause(); 4746 }); 4747 }) 4748 }catch(e) {} 4749 } // END OF VIDEO JS FUNCTIONS 4750 try { 4751 4752 //var tl = TimelineLite.exportRoot(); 4753 var tl = nextcaption.data('timeline'); 4754 var endstarts = tl.getLabelTime("frame99"); 4755 var curtime = tl.time(); 4756 if (endstarts>curtime) { 4757 4758 // WE NEED TO STOP ALL OTHER NIMATIONS 4759 var tweens = tl.getTweensOf(nextcaption); 4760 jQuery.each(tweens,function(index,tw) { 4761 4762 if (index!=0) 4763 tw.pause(); 4764 }); 4765 tl.play("frame99"); 4766 } 4767 4768 } catch(e) {} 4769 4770 4771 4772 }); 4773 } 4774 4775 ////////////////////////////// 4776 // MOVE THE CAPTIONS // 4777 //////////////////////////// 4778 function addMoveCaption(nextcaption,opt,params,frame,downscale) { 4779 var tl = nextcaption.data('timeline'); 4780 4781 var newtl = new TimelineLite(); 4782 4783 var animobject = nextcaption; 4784 4785 if (params.typ == "chars") animobject = nextcaption.data('mySplitText').chars; 4786 else 4787 if (params.typ == "words") animobject = nextcaption.data('mySplitText').words; 4788 else 4789 if (params.typ == "lines") animobject = nextcaption.data('mySplitText').lines; 4790 params.animation.ease = params.ease; 4791 4792 if (params.animation.rotationZ !=undefined) params.animation.rotation = params.animation.rotationZ; 4793 params.animation.data = new Object(); 4794 params.animation.data.oldx = params.animation.x; 4795 params.animation.data.oldy = params.animation.y; 4796 4797 params.animation.x = params.animation.x * downscale; 4798 params.animation.y = params.animation.y * downscale; 4799 4800 4801 tl.add(newtl.staggerTo(animobject,params.speed,params.animation,params.elementdelay),params.start); 4802 tl.addLabel(frame,params.start); 4803 4804 nextcaption.data('timeline',tl); 4805 4806 } 4807 ////////////////////////////// 4808 // MOVE OUT THE CAPTIONS // 4809 //////////////////////////// 4810 function endMoveCaption(nextcaption,opt,mdelay,backwards,frame,downscale) { 4811 4812 var tl = nextcaption.data('timeline'); 4813 var newtl = new TimelineLite(); 4814 4815 var frm = newAnimObject(); 4816 var mspeed= (nextcaption.data('endspeed') == undefined) ? nextcaption.data('speed') : nextcaption.data('endspeed'); 4817 frm.ease = (nextcaption.data('endeasing') == undefined) ? Power1.easeInOut : nextcaption.data('endeasing'); 4818 4819 mspeed = mspeed/1000; 4820 4821 4822 if (nextcaption.hasClass('ltr') || 4823 nextcaption.hasClass('ltl') || 4824 nextcaption.hasClass('str') || 4825 nextcaption.hasClass('stl') || 4826 nextcaption.hasClass('ltt') || 4827 nextcaption.hasClass('ltb') || 4828 nextcaption.hasClass('stt') || 4829 nextcaption.hasClass('stb') || 4830 nextcaption.hasClass('skewtoright') || 4831 nextcaption.hasClass('skewtorightshort') || 4832 nextcaption.hasClass('skewtoleft') || 4833 nextcaption.hasClass('skewtoleftshort') || 4834 nextcaption.hasClass('fadeout') || 4835 nextcaption.hasClass("randomrotateout")) 4836 { 4837 4838 if (nextcaption.hasClass('skewtoright') || nextcaption.hasClass('skewtorightshort')) frm.skewX = 35 4839 else 4840 if (nextcaption.hasClass('skewtoleft') || nextcaption.hasClass('skewtoleftshort')) frm.skewX = -35 4841 4842 4843 if (nextcaption.hasClass('ltr') || nextcaption.hasClass('skewtoright')) 4844 frm.x=opt.width+60; 4845 else if (nextcaption.hasClass('ltl') || nextcaption.hasClass('skewtoleft')) 4846 frm.x=0-(opt.width+60); 4847 else if (nextcaption.hasClass('ltt')) 4848 frm.y=0-(opt.height+60); 4849 else if (nextcaption.hasClass('ltb')) 4850 frm.y=opt.height+60; 4851 else if (nextcaption.hasClass('str') || nextcaption.hasClass('skewtorightshort')) { 4852 frm.x=50;frm.opacity=0; 4853 } else if (nextcaption.hasClass('stl') || nextcaption.hasClass('skewtoleftshort')) { 4854 frm.x=-50;frm.opacity=0; 4855 } else if (nextcaption.hasClass('stt')) { 4856 frm.y=-50;frm.opacity=0; 4857 } else if (nextcaption.hasClass('stb')) { 4858 frm.y=50;frm.opacity=0; 4859 } else if (nextcaption.hasClass("randomrotateout")) { 4860 frm.x = Math.random()*opt.width; 4861 frm.y = Math.random()*opt.height; 4862 frm.scale = Math.random()*2+0.3; 4863 frm.rotation = Math.random()*360-180; 4864 frm.opacity = 0; 4865 } else if (nextcaption.hasClass('fadeout')) { 4866 frm.opacity = 0; 4867 } 4868 4869 if (nextcaption.hasClass('skewtorightshort')) frm.x = 270; 4870 else 4871 if (nextcaption.hasClass('skewtoleftshort')) frm.x = -270 4872 frm.data = new Object(); 4873 frm.data.oldx = frm.x; 4874 frm.data.oldy = frm.y; 4875 frm.x = frm.x * downscale; 4876 frm.y = frm.y * downscale; 4877 4878 frm.overwrite="auto"; 4879 var animobject = nextcaption; 4880 var animobject = nextcaption; 4881 if (nextcaption.data('splitout') == "chars") animobject = nextcaption.data('mySplitText').chars; 4882 else 4883 if (nextcaption.data('splitout') == "words") animobject = nextcaption.data('mySplitText').words; 4884 else 4885 if (nextcaption.data('splitout') == "lines") animobject = nextcaption.data('mySplitText').lines;
4886 var elemdelay = (nextcaption.data('endelementdelay') == undefined) ? 0 : nextcaption.data('endelementdelay'); 4887 //tl.add(TweenLite.to(nextcaption,mspeed,frm),mdelay); 4888 tl.add(newtl.staggerTo(animobject,mspeed,frm,elemdelay),mdelay); 4889 4890 } 4891 4892 else 4893 4894 if (nextcaption.hasClass("customout")) { 4895 4896 frm = getAnimDatas(frm,nextcaption.data('customout')); 4897 var animobject = nextcaption; 4898 if (nextcaption.data('splitout') == "chars") animobject = nextcaption.data('mySplitText').chars; 4899 else 4900 if (nextcaption.data('splitout') == "words") animobject = nextcaption.data('mySplitText').words; 4901 else 4902 if (nextcaption.data('splitout') == "lines") animobject = nextcaption.data('mySplitText').lines; 4903 4904 var elemdelay = (nextcaption.data('endelementdelay') == undefined) ? 0 : nextcaption.data('endelementdelay'); 4905 frm.onStart = function() { 4906 4907 TweenLite.set(nextcaption,{ 4908 transformPerspective:frm.transformPerspective, 4909 transformOrigin:frm.transformOrigin, 4910 overwrite:"auto" 4911 }); 4912 } 4913 4914 frm.data = new Object(); 4915 frm.data.oldx = frm.x; 4916 frm.data.oldy = frm.y; 4917 4918 frm.x = frm.x * downscale; 4919 frm.y = frm.y * downscale; 4920 4921 tl.add(newtl.staggerTo(animobject,mspeed,frm,elemdelay),mdelay); 4922 } 4923 4924 else { 4925 backwards.delay = 0; 4926 tl.add(TweenLite.to(nextcaption,mspeed,backwards),mdelay); 4927 } 4928 4929 4930 tl.addLabel(frame,mdelay); 4931 nextcaption.data('timeline',tl); 4932 } 4933 4934 /////////////////////////// 4935 // REMOVE THE LISTENERS // 4936 /////////////////////////// 4937 function removeAllListeners(container,opt) { 4938 container.children().each(function() { 4939 try{ jQuery(this).die('click'); } catch(e) {} 4940 try{ jQuery(this).die('mouseenter');} catch(e) {} 4941 try{ jQuery(this).die('mouseleave');} catch(e) {} 4942 try{ jQuery(this).unbind('hover');} catch(e) {} 4943 }) 4944 try{ container.die('click','mouseenter','mouseleave');} catch(e) {} 4945 clearInterval(opt.cdint);
4946 container=null; 4947 4948 4949 4950 } 4951 4952 /////////////////////////// 4953 // - COUNTDOWN - // 4954 ///////////////////////// 4955 function countDown(container,opt) { 4956 opt.cd=0; 4957 opt.loop=0; 4958 if (opt.stopAfterLoops!=undefined && opt.stopAfterLoops>-1) 4959 opt.looptogo=opt.stopAfterLoops; 4960 else 4961 opt.looptogo=9999999; 4962 4963 if (opt.stopAtSlide!=undefined && opt.stopAtSlide>-1) 4964 opt.lastslidetoshow=opt.stopAtSlide; 4965 else 4966 opt.lastslidetoshow=999; 4967 4968 opt.stopLoop="off"; 4969 4970 if (opt.looptogo==0) opt.stopLoop="on"; 4971 4972 4973 if (opt.slideamount >1 && !(opt.stopAfterLoops==0 && opt.stopAtSlide==1) ) { 4974 var bt=container.find('.tp-bannertimer'); 4975 4976 4977 // LISTENERS //container.trigger('stoptimer'); 4978 container.on('stoptimer',function() { 4979 bt.data('tween').pause(); 4980 4981 }); 4982 container.on('starttimer',function() { 4983 if (opt.conthover!=1 && opt.videoplaying!=true && opt.width>opt.hideSliderAtLimit && opt.bannertimeronpause != true && opt.overnav !=true) 4984 if (opt.stopLoop=="on" && opt.next==opt.lastslidetoshow-1) 4985 { 4986 // NOTHING 4987 } 4988 else { 4989 bt.css({visibility:"visible"}); 4990 bt.data('tween').play(); 4991 } 4992 }); 4993 container.on('restarttimer',function() { 4994 if (opt.stopLoop=="on" && opt.next==opt.lastslidetoshow-1) 4995 { 4996 // NOTHING 4997 } 4998 else { 4999 bt.css({visibility:"visible"}); 5000 bt.data('tween',TweenLite.fromTo(bt,opt.delay/1000,{width:"0%"},{width:"100%",ease:Linear.easeNone,onComplete:countDownNext,delay:1})); 5001 5002 } 5003 }); 5004 5005 container.on('nulltimer',function() { 5006 5007 bt.data('tween').pause(0); 5008 5009 }); 5010 5011 5012 5013 function countDownNext() { 5014 if (jQuery('body').find(container).length==0) { 5015 removeAllListeners(container,opt); 5016 clearInterval(opt.cdint); 5017 } 5018 5019 //STATE OF API CHANGED -> MOVE TO AIP BETTER 5020 if (container.data('conthover-changed') == 1) { 5021 opt.conthover= container.data('conthover'); 5022 container.data('conthover-changed',0); 5023 } 5024 5025 // SWAP TO NEXT BANNER 5026 opt.act=opt.next; 5027 opt.next=opt.next+1; 5028 if (opt.next>container.find('>ul >li').length-1) { 5029 opt.next=0; 5030 opt.looptogo=opt.looptogo-1; 5031 5032 if (opt.looptogo<=0) { 5033 opt.stopLoop="on"; 5034 5035 } 5036 } 5037 5038 // STOP TIMER IF NO LOOP NO MORE NEEDED. 5039 5040 if (opt.stopLoop=="on" && opt.next==opt.lastslidetoshow-1) { 5041 container.find('.tp-bannertimer').css({'visibility':'hidden'}); 5042 container.trigger('revolution.slide.onstop'); 5043 } else { 5044 bt.data('tween').restart(); 5045 } 5046 5047 // SWAP THE SLIDES 5048 swapSlide(container,opt); 5049 5050 } 5051 5052 bt.data('tween',TweenLite.fromTo(bt,opt.delay/1000,{width:"0%"},{width:"100%",ease:Linear.easeNone,onComplete:countDownNext,delay:1})); 5053 bt.data('opt',opt); 5054 5055 5056 container.hover( 5057 function() { 5058 5059 if (opt.onHoverStop=="on") { 5060 container.trigger('stoptimer'); 5061 5062 container.trigger('revolution.slide.onpause'); 5063 var nextsh = container.find('>ul >li:eq('+opt.next+') .slotholder'); 5064 nextsh.find('.defaultimg').each(function() { 5065 var dimg = jQuery(this); 5066 if (dimg.data('kenburn')!=undefined) 5067 dimg.data('kenburn').pause(); 5068 });
5069 } 5070 }, 5071 function() { 5072 if (container.data('conthover')!=1) { 5073 container.trigger('revolution.slide.onresume'); 5074 container.trigger('starttimer'); 5075 5076 var nextsh = container.find('>ul >li:eq('+opt.next+') .slotholder'); 5077 nextsh.find('.defaultimg').each(function() { 5078 var dimg = jQuery(this); 5079 if (dimg.data('kenburn')!=undefined) 5080 dimg.data('kenburn').play(); 5081 }); 5082 } 5083 }); 5084 } 5085 } 5086 5087 5088 5089})(jQuery); 5090 5091 5092// SOME ERROR MESSAGES IN CASE THE PLUGIN CAN NOT BE LOADED 5093function revslider_showDoubleJqueryError(sliderID) { 5094 var errorMessage = "Revolution Slider Error: You have some jquery.js library include that comes after the revolution files js include."; 5095 errorMessage += "<br> This includes make eliminates the revolution slider libraries, and make it not work."; 5096 errorMessage += "<br><br> To fix it you can:<br> 1. In the Slider Settings -> Troubleshooting set option: <strong><b>Put JS Includes To Body</b></strong> option to true."; 5097 errorMessage += "<br> 2. Find the double jquery.js include and remove it."; 5098 errorMessage = "<span style='font-size:16px;color:#BC0C06;'>" + errorMessage + "</span>" 5099 jQuery(sliderID).show().html(errorMessage); 5100} 5101 5102/*! 5103 * VERSION: beta 0.2.3 5104 * DATE: 2013-07-10 5105 * UPDATES AND DOCS AT: http://www.greensock.com 5106 * 5107 * @license Copyright (c) 2008-2013, GreenSock. All rights reserved. 5108 * SplitText is a Club GreenSock membership benefit; You must have a valid membership to use 5109 * this code without violating the terms of use. Visit http://www.greensock.com/club/ to sign up or get more details. 5110 * This work is subject to the software agreement that was issued with your membership. 5111 * 5112 * @author: Jack Doyle, [email protected] 5113 */ 5114(function(t){"use strict";var e=t.GreenSockGlobals||t,i=function(t){var i,s=t.split("."),r=e;for(i=0;s.length>i;i++)r[s[i]]=r=r[s[i]]||{};return r},s=i("com.greensock.utils"),r=function(t){var e=t.nodeType,i="";if(1===e||9===e||11===e){if("string"==typeof t.textContent)return t.textContent;for(t=t.firstChild;t;t=t.nextSibling)i+=r(t)}else if(3===e||4===e)return t.nodeValue;return i},n=document,a=n.defaultView?n.defaultView.getComputedStyle:function(){},o=/([A-Z])/g,h=function(t,e,i,s){var r;return(i=i||a(t,null))?(t=i.getPropertyValue(e.replace(o,"-$1").toLowerCase()),r=t||i.length?t:i[e]):t.currentStyle&&(i=t.currentStyle,r=i[e]),s?r:parseInt(r,10)||0},l=function(t){return t.length&&t[0]&&(t[0].nodeType&&t[0].style&&!t.nodeType||t[0].length&&t[0][0])?!0:!1},_=function(t){var e,i,s,r=[],n=t.length;for(e=0;n>e;e++)if(i=t[e],l(i))for(s=i.length,s=0;i.length>s;s++)r.push(i[s]);else r.push(i);return r},u=")eefec303079ad17405c",c=/(?:<br>|<br\/>|<br \/>)/gi,p=n.all&&!n.addEventListener,f="<div style='position:relative;display:inline-block;"+(p?"*display:inline;*zoom:1;'":"'"),m=function(t){t=t||"";var e=-1!==t.indexOf("++"),i=1;return e&&(t=t.split("++").join("")),function(){return f+(t?" class='"+t+(e?i++:"")+"'>":">")}},d=s.SplitText=e.SplitText=function(t,e){if("string"==typeof t&&(t=d.selector(t)),!t)throw"cannot split a null element.";this.elements=l(t)?_(t):[t],this.chars=[],this.words=[],this.lines=[],this._originals=[],this.vars=e||{},this.split(e)},g=function(t,e,i,s,o){c.test(t.innerHTML)&&(t.innerHTML=t.innerHTML.replace(c,u));var l,_,p,f,d,g,v,y,T,w,b,x,P,S=r(t),C=e.type||e.split||"chars,words,lines",k=-1!==C.indexOf("lines")?[]:null,R=-1!==C.indexOf("words"),A=-1!==C.indexOf("chars"),D="absolute"===e.position||e.absolute===!0,O=D?"­ ":" ",M=-999,L=a(t),I=h(t,"paddingLeft",L),E=h(t,"borderBottomWidth",L)+h(t,"borderTopWidth",L),N=h(t,"borderLeftWidth",L)+h(t,"borderRightWidth",L),F=h(t,"paddingTop",L)+h(t,"paddingBottom",L),U=h(t,"paddingLeft",L)+h(t,"paddingRight",L),X=h(t,"textAlign",L,!0),z=t.clientHeight,B=t.clientWidth,j=S.length,Y="</div>",q=m(e.wordsClass),V=m(e.charsClass),Q=-1!==(e.linesClass||"").indexOf("++"),G=e.linesClass;for(Q&&(G=G.split("++").join("")),p=q(),f=0;j>f;f++)g=S.charAt(f),")"===g&&S.substr(f,20)===u?(p+=Y+"<BR/>",f!==j-1&&(p+=" "+q()),f+=19):" "===g&&" "!==S.charAt(f-1)&&f!==j-1?(p+=Y,f!==j-1&&(p+=O+q())):p+=A&&" "!==g?V()+g+"</div>":g;for(t.innerHTML=p+Y,d=t.getElementsByTagName("*"),j=d.length,v=[],f=0;j>f;f++)v[f]=d[f];if(k||D)for(f=0;j>f;f++)y=v[f],_=y.parentNode===t,(_||D||A&&!R)&&(T=y.offsetTop,k&&_&&T!==M&&"BR"!==y.nodeName&&(l=[],k.push(l),M=T),D&&(y._x=y.offsetLeft,y._y=T,y._w=y.offsetWidth,y._h=y.offsetHeight),k&&(R!==_&&A||(l.push(y),y._x-=I),_&&f&&(v[f-1]._wordEnd=!0)));for(f=0;j>f;f++)y=v[f],_=y.parentNode===t,"BR"!==y.nodeName?(D&&(b=y.style,R||_||(y._x+=y.parentNode._x,y._y+=y.parentNode._y),b.left=y._x+"px",b.top=y._y+"px",b.position="absolute",b.display="block",b.width=y._w+1+"px",b.height=y._h+"px"),R?_?s.push(y):A&&i.push(y):_?(t.removeChild(y),v.splice(f--,1),j--):!_&&A&&(T=!k&&!D&&y.nextSibling,t.appendChild(y),T||t.appendChild(n.createTextNode(" ")),i.push(y))):k||D?(t.removeChild(y),v.splice(f--,1),j--):R||t.appendChild(y);if(k){for(D&&(w=n.createElement("div"),t.appendChild(w),x=w.offsetWidth+"px",T=w.offsetParent===t?0:t.offsetLeft,t.removeChild(w)),b=t.style.cssText,t.style.cssText="display:none;";t.firstChild;)t.removeChild(t.firstChild);for(P=!D||!R&&!A,f=0;k.length>f;f++){for(l=k[f],w=n.createElement("div"),w.style.cssText="display:block;text-align:"+X+";position:"+(D?"absolute;":"relative;"),G&&(w.className=G+(Q?f+1:"")),o.push(w),j=l.length,d=0;j>d;d++)"BR"!==l[d].nodeName&&(y=l[d],w.appendChild(y),P&&(y._wordEnd||R)&&w.appendChild(n.createTextNode(" ")),D&&(0===d&&(w.style.top=y._y+"px",w.style.left=I+T+"px"),y.style.top="0px",T&&(y.style.left=y._x-T+"px")));R||A||(w.innerHTML=r(w).split(String.fromCharCode(160)).join(" ")),D&&(w.style.width=x,w.style.height=y._h+"px"),t.appendChild(w)}t.style.cssText=b}D&&(z>t.clientHeight&&(t.style.height=z-F+"px",z>t.clientHeight&&(t.style.height=z+E+"px")),B>t.clientWidth&&(t.style.width=B-U+"px",B>t.clientWidth&&(t.style.width=B+N+"px")))},v=d.prototype;v.split=function(t){this.isSplit&&this.revert(),this.vars=t||this.vars,this._originals.length=this.chars.length=this.words.length=this.lines.length=0;for(var e=0;this.elements.length>e;e++)this._originals[e]=this.elements[e].innerHTML,g(this.elements[e],this.vars,this.chars,this.words,this.lines);return this.isSplit=!0,this},v.revert=function(){if(!this._originals)throw"revert() call wasn't scoped properly.";for(var t=this._originals.length;--t>-1;)this.elements[t].innerHTML=this._originals[t];return this.chars=[],this.words=[],this.lines=[],this.isSplit=!1,this},d.selector=t.$||t.jQuery||function(e){return t.$?(d.selector=t.$,t.$(e)):n?n.getElementById("#"===e.charAt(0)?e.substr(1):e):e}})(window||{}); 5115
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.