1/******************************************** 2 * REVOLUTION 5.0 EXTENSION - LAYER ANIMATION 3 * @version: 1.1.5 (23.10.2015) 4 * @requires jquery.themepunch.revolution.js 5 * @author ThemePunch 6*********************************************/ 7 8(function($) { 9 10var _R = jQuery.fn.revolution, 11 _ISM = _R.is_mobile(); 12 13/////////////////////////////////////////// 14// EXTENDED FUNCTIONS AVAILABLE GLOBAL // 15/////////////////////////////////////////// 16jQuery.extend(true,_R, { 17 18 // MAKE SURE THE ANIMATION ENDS WITH A CLEANING ON MOZ TRANSFORMS 19 animcompleted : function(_nc,opt) { 20 var t = _nc.data('videotype'), 21 ap = _nc.data('autoplay'), 22 an = _nc.data('autoplayonlyfirsttime'); 23 24 25 if (t!=undefined && t!="none") 26 if (ap==true || ap=="true" || ap=="on" || ap=="1sttime" || an) { 27 _R.playVideo(_nc,opt); 28 if ( an || ap=="1sttime") { 29 _nc.data('autoplayonlyfirsttime',false); 30 _nc.data('autoplay',"off"); 31 } 32 } else 33 if (ap=="no1sttime") 34 _nc.data('autoplay','on'); 35 }, 36 37 /******************************************************** 38 - PREPARE AND DEFINE STATIC LAYER DIRECTIONS - 39 *********************************************************/ 40 handleStaticLayers : function(_nc,opt) { 41 var s = parseInt(_nc.data('startslide'),0), 42 e = parseInt(_nc.data('endslide'),0); 43 if (s < 0) 44 s=0; 45 if (e <0 ) 46 e = opt.slideamount; 47 if (s===0 && e===opt.slideamount-1) 48 e = opt.slideamount+1; 49 _nc.data('startslide',s); 50 _nc.data('endslide',e); 51 }, 52 53 /************************************ 54 ANIMATE ALL CAPTIONS 55 *************************************/ 56 animateTheCaptions : function(nextli, opt,recalled,mtl) { 57 var base_offsetx = opt.sliderType==="carousel" ? 0 : opt.width/2 - (opt.gridwidth[opt.curWinRange]*opt.bw)/2, 58 base_offsety=0, 59 index = nextli.data('index'); 60 61 62 opt.layers = opt.layers || new Object(); 63 opt.layers[index] = opt.layers[index] || nextli.find('.tp-caption') 64 opt.layers["static"] = opt.layers["static"] || opt.c.find('.tp-static-layers').find('.tp-caption'); 65 66 var allcaptions = new Array; 67 68 opt.conh = opt.c.height(); 69 opt.conw = opt.c.width(); 70 opt.ulw = opt.ul.width(); 71 opt.ulh = opt.ul.height(); 72 73 74 75 /* ENABLE DEBUG MODE */ 76 if (opt.debugMode) { 77 nextli.addClass("indebugmode"); 78 nextli.find('.helpgrid').remove(); 79 opt.c.find('.hglayerinfo').remove(); 80 nextli.append('<div class="helpgrid" style="width:'+(opt.gridwidth[opt.curWinRange]*opt.bw)+'px;height:'+(opt.gridheight[opt.curWinRange]*opt.bw)+'px;"></div>'); 81 var hg = nextli.find('.helpgrid'); 82 hg.append('<div class="hginfo">Zoom:'+(Math.round(opt.bw*100))+'% Device Level:'+opt.curWinRange+' Grid Preset:'+opt.gridwidth[opt.curWinRange]+'x'+opt.gridheight[opt.curWinRange]+'</div>') 83 opt.c.append('<div class="hglayerinfo"></div>') 84 hg.append('<div class="tlhg"></div>'); 85 } 86 87 if (allcaptions) 88 jQuery.each(allcaptions,function(i) { 89 var _nc = jQuery(this); 90 punchgs.TweenLite.set(_nc.find('.tp-videoposter'),{autoAlpha:1}); 91 punchgs.TweenLite.set(_nc.find('iframe'),{autoAlpha:0}); 92 }) 93 94 // COLLECT ALL CAPTIONS 95 if (opt.layers[index]) 96 jQuery.each(opt.layers[index], function(i,a) { allcaptions.push(a); }); 97 if (opt.layers["static"]) 98 jQuery.each(opt.layers["static"], function(i,a) { allcaptions.push(a); }); 99 100 // GO THROUGH ALL CAPTIONS, AND MANAGE THEM 101 if (allcaptions) 102 jQuery.each(allcaptions,function(i) { 103 _R.animateSingleCaption(jQuery(this),opt,base_offsetx,base_offsety,i,recalled) 104 }); 105 106 var bt=jQuery('body').find('#'+opt.c.attr('id')).find('.tp-bannertimer'); 107 bt.data('opt',opt); 108 109 110 if (mtl != undefined) setTimeout(function() { 111 mtl.resume(); 112 },30); 113 }, 114 115 /*************************************** 116 - ANIMATE THE CAPTIONS - 117 ***************************************/ 118 animateSingleCaption : function(_nc,opt,offsetx,offsety,i,recalled,triggerforce) { 119 120 var internrecalled = recalled, 121 staticdirection = staticLayerStatus(_nc,opt,"in",true), 122 _pw = _nc.data('_pw') || _nc.closest('.tp-parallax-wrap'), 123 _lw = _nc.data('_lw') || _nc.closest('.tp-loop-wrap'), 124 _mw = _nc.data('_mw') || _nc.closest('.tp-mask-wrap'), 125 _responsive = _nc.data('responsive') || "on", 126 _respoffset = _nc.data('responsive_offset') || "on", 127 _ba = _nc.data('basealign') || "grid", 128 _gw = _ba==="grid" ? opt.width : opt.ulw, //opt.conw, 129 _gh = _ba==="grid" ? opt.height : opt.ulh, //opt.conh; 130 rtl = jQuery('body').hasClass("rtl"); 131 132 133 134 if (!_nc.data('_pw')) { 135 _nc.data('_pw',_pw); 136 _nc.data('_lw',_lw); 137 _nc.data('_mw',_mw); 138 } 139 140 if (opt.sliderLayout=="fullscreen") 141 offsety = _gh/2 - (opt.gridheight[opt.curWinRange]*opt.bh)/2; 142 143 if (opt.autoHeight=="on" || (opt.minHeight!=undefined && opt.minHeight>0)) 144 offsety = opt.conh/2 - (opt.gridheight[opt.curWinRange]*opt.bh)/2;; 145 146 if (offsety<0) offsety=0; 147 148 149 150 // LAYER GRID FOR DEBUGGING 151 if (opt.debugMode) { 152 _nc.closest('li').find('.helpgrid').css({top:offsety+"px", left:offsetx+"px"}); 153 var linfo = opt.c.find('.hglayerinfo'); 154 _nc.on("hover, mouseenter",function() { 155 var ltxt = "", 156 spa = 0; 157 if (_nc.data())
158 jQuery.each(_nc.data(),function(key,val) { 159 if (typeof val !== "object") { 160 161 ltxt = ltxt + '<span style="white-space:nowrap"><span style="color:#27ae60">'+key+":</span>"+val+"</span> "; 162 163 } 164 }); 165 linfo.html(ltxt); 166 }); 167 } 168 /* END OF DEBUGGING */ 169 170 171 var handlecaption=0, 172 layervisible = makeArray(_nc.data('visibility'),opt)[opt.forcedWinRange] || makeArray(_nc.data('visibility'),opt) || "on"; 173 174 175 176 // HIDE CAPTION IF RESOLUTION IS TOO LOW 177 if (layervisible=="off" || (_gw<opt.hideCaptionAtLimit && _nc.data('captionhidden')=="on") || (_gw<opt.hideAllCaptionAtLimit)) 178 _nc.addClass("tp-hidden-caption"); 179 else 180 _nc.removeClass("tp-hidden-caption") 181 182 183 184 _nc.data('layertype',"html"); 185 186 if (offsetx<0) offsetx=0; 187 188 // FALL BACK TO NORMAL IMAGES 189 if (_nc.data('thumbimage')!=undefined && _nc.data('videoposter')==undefined) 190 _nc.data('videoposter',_nc.data('thumbimage')) 191 192 // FALL BACK TO NORMAL IMAGE IF NO VIDEO SHOULD BE PLAYED ON MOBILE DEVICES 193 if (_nc.hasClass("tp-videolayer") && _nc.data('videoposter')!=undefined && (_nc.data('posterOnMobile')=="on" || _nc.data('posteronmobile')=="on") && _ISM) { 194 var vidw = makeArray(_nc.data('videowidth'),opt)[opt.curWinRange] || makeArray(_nc.data('videowidth'),opt) || "auto", 195 vidh = makeArray(_nc.data('videoheight'),opt)[opt.curWinRange] || makeArray(_nc.data('videoheight'),opt) || "auto"; 196 197 vidw = parseFloat(ww), 198 vidh = parseFloat(hh); 199 200 _nc.append('<div class="tp-videoposter" style="position:absolute;top:0px;left:0px;width:100%;height:100%;background-image:url('+_nc.data('videoposter')+'); background-size:cover;background-position:center center;"></div>'); 201 if (vidw!="100%") 202 _nc.css({minWidth:vidw+"px",minHeight:vidh+"px"}); 203 else 204 _nc.css({width:"100%",height:"100%"}); 205 _nc.removeClass("tp-videolayer"); 206 } 207 208 // IF IT IS AN IMAGE 209 if (_nc.find('img').length>0) { 210 var im = _nc.find('img'); 211 _nc.data('layertype',"image"); 212 if (im.width()==0) im.css({width:"auto"}); 213 if (im.height()==0) im.css({height:"auto"}); 214 215 216 217 218 if (im.data('ww') == undefined && im.width()>0) im.data('ww',im.width()); 219 if (im.data('hh') == undefined && im.height()>0) im.data('hh',im.height()); 220 221 var ww = im.data('ww'), 222 hh = im.data('hh'), 223 fuw = _ba =="slide" ? opt.ulw : opt.gridwidth[opt.curWinRange], 224 fuh = _ba =="slide" ? opt.ulh : opt.gridheight[opt.curWinRange], 225 226 ww = makeArray(im.data('ww'),opt)[opt.curWinRange] || makeArray(im.data('ww'),opt) || "auto", 227 hh = makeArray(im.data('hh'),opt)[opt.curWinRange] || makeArray(im.data('hh'),opt) || "auto"; 228 229 var wful = ww==="full" || ww === "full-proportional", 230 hful = hh==="full" || hh === "full-proportional"; 231 232 if (ww==="full-proportional") { 233 var ow = im.data('owidth'), 234 oh = im.data('oheight'); 235 if (ow/fuw < oh/fuh) { 236 ww = fuw; 237 hh = oh*(fuw/ow); 238 } else { 239 hh = fuh; 240 ww = ow*(fuh/oh); 241 } 242 } else { 243 ww = wful ? fuw : parseFloat(ww); 244 hh = hful ? fuh : parseFloat(hh); 245 } 246 247 248 if (ww==undefined) ww=0; 249 if (hh==undefined) hh=0; 250 251 if (_responsive!=="off") { 252 253 if (_ba!="grid" && wful) 254 im.width(ww); 255 else 256 im.width(ww*opt.bw); 257 if (_ba!="grid" && hful) 258 im.height(hh); 259 else 260 im.height(hh*opt.bh); 261 } else { 262 im.width(ww); 263 im.height(hh); 264 } 265 } 266 267 if (_ba==="slide") { 268 offsetx = 0; 269 offsety=0; 270 } 271 272 273 // IF IT IS A VIDEO LAYER 274 if (_nc.hasClass("tp-videolayer") || _nc.find('iframe').length>0 || _nc.find('video').length>0) { 275 276 _nc.data('layertype',"video"); 277 _R.manageVideoLayer(_nc,opt,recalled,internrecalled); 278 if (!recalled && !internrecalled) { 279 var t = _nc.data('videotype'); 280 _R.resetVideo(_nc,opt); 281 } 282 283 var asprat = _nc.data('aspectratio'); 284 if (asprat!=undefined && asprat.split(":").length>1) 285 _R.prepareCoveredVideo(asprat,opt,_nc); 286 287 var im = _nc.find('iframe') ? _nc.find('iframe') : im = _nc.find('video'), 288 html5vid = _nc.find('iframe') ? false : true, 289 yvcover = _nc.hasClass('coverscreenvideo'); 290 291 im.css({display:"block"}); 292 293 // SET WIDTH / HEIGHT 294 if (_nc.data('videowidth') == undefined) { 295 _nc.data('videowidth',im.width()); 296 _nc.data('videoheight',im.height()); 297 } 298 var ww = makeArray(_nc.data('videowidth'),opt)[opt.curWinRange] || makeArray(_nc.data('videowidth'),opt) || "auto", 299 hh = makeArray(_nc.data('videoheight'),opt)[opt.curWinRange] || makeArray(_nc.data('videoheight'),opt) || "auto", 300 getobj; 301 302 ww = parseFloat(ww); 303 hh = parseFloat(hh); 304 305 306 // READ AND WRITE CSS SETTINGS OF IFRAME AND VIDEO FOR RESIZING ELEMENST ON DEMAND 307 if (_nc.data('cssobj')===undefined) { 308 getobj = getcssParams(_nc,0); 309 _nc.data('cssobj',getobj); 310 } 311 312 var ncobj = setResponsiveCSSValues(_nc.data('cssobj'),opt); 313 314 315 // IE8 FIX FOR AUTO LINEHEIGHT 316 if (ncobj.lineHeight=="auto") ncobj.lineHeight = ncobj.fontSize+4; 317 318 319 if (!_nc.hasClass('fullscreenvideo') && !yvcover) { 320 321 punchgs.TweenLite.set(_nc,{ 322 paddingTop: Math.round((ncobj.paddingTop * opt.bh)) + "px",
323 paddingBottom: Math.round((ncobj.paddingBottom * opt.bh)) + "px", 324 paddingLeft: Math.round((ncobj.paddingLeft* opt.bw)) + "px", 325 paddingRight: Math.round((ncobj.paddingRight * opt.bw)) + "px", 326 marginTop: (ncobj.marginTop * opt.bh) + "px", 327 marginBottom: (ncobj.marginBottom * opt.bh) + "px", 328 marginLeft: (ncobj.marginLeft * opt.bw) + "px", 329 marginRight: (ncobj.marginRight * opt.bw) + "px", 330 borderTopWidth: Math.round(ncobj.borderTopWidth * opt.bh) + "px", 331 borderBottomWidth: Math.round(ncobj.borderBottomWidth * opt.bh) + "px", 332 borderLeftWidth: Math.round(ncobj.borderLeftWidth * opt.bw) + "px", 333 borderRightWidth: Math.round(ncobj.borderRightWidth * opt.bw) + "px", 334 width:(ww*opt.bw)+"px", 335 height:(hh*opt.bh)+"px" 336 }); 337 } else { 338 offsetx=0; offsety=0; 339 _nc.data('x',0) 340 _nc.data('y',0) 341 342 var ovhh = _gh; 343 if (opt.autoHeight=="on") ovhh = opt.conh 344 _nc.css({'width':_gw, 'height':ovhh }); 345 346 347 } 348 349 if ((html5vid == false && !yvcover) || ((_nc.data('forcecover')!=1 && !_nc.hasClass('fullscreenvideo') && !yvcover))) { 350 im.width(ww*opt.bw); 351 im.height(hh*opt.bh); 352 } 353 } // END OF POSITION AND STYLE READ OUTS OF VIDEO 354 355 356 357 // ALL WRAPPED REKURSIVE ELEMENTS SHOULD BE RESPONSIVE HANDLED 358 _nc.find('.tp-resizeme, .tp-resizeme *').each(function() { 359 calcCaptionResponsive(jQuery(this),opt,"rekursive",_responsive); 360 }); 361 362 // ALL ELEMENTS IF THE MAIN ELEMENT IS REKURSIVE RESPONSIVE SHOULD BE REPONSIVE HANDLED 363 if (_nc.hasClass("tp-resizeme")) 364 _nc.find('*').each(function() { 365 calcCaptionResponsive(jQuery(this),opt,"rekursive",_responsive); 366 }); 367 368 // RESPONIVE HANDLING OF CURRENT LAYER 369 calcCaptionResponsive(_nc,opt,0,_responsive); 370 371 // _nc FRONTCORNER CHANGES 372 var ncch = _nc.outerHeight(), 373 bgcol = _nc.css('backgroundColor'); 374 sharpCorners(_nc,'.frontcorner','left','borderRight','borderTopColor',ncch,bgcol); 375 sharpCorners(_nc,'.frontcornertop','left','borderRight','borderBottomColor',ncch,bgcol); 376 sharpCorners(_nc,'.backcorner','right','borderLeft','borderBottomColor',ncch,bgcol); 377 sharpCorners(_nc,'.backcornertop','right','borderLeft','borderTopColor',ncch,bgcol); 378 379 380 if (opt.fullScreenAlignForce == "on") { 381 offsetx=0; 382 offsety=0; 383 } 384 385 var arrobj = _nc.data('arrobj'); 386 if (arrobj===undefined) { 387 var arrobj = new Object(); 388 arrobj.voa = makeArray(_nc.data('voffset'),opt)[opt.curWinRange] || makeArray(_nc.data('voffset'),opt)[0]; 389 arrobj.hoa = makeArray(_nc.data('hoffset'),opt)[opt.curWinRange] || makeArray(_nc.data('hoffset'),opt)[0]; 390 arrobj.elx = makeArray(_nc.data('x'),opt)[opt.curWinRange] || makeArray(_nc.data('x'),opt)[0]; 391 arrobj.ely = makeArray(_nc.data('y'),opt)[opt.curWinRange] || makeArray(_nc.data('y'),opt)[0]; 392 } 393 394 395 // CORRECTION OF NEGATIVE VALUES FROM OLDER SLIDER 396 //arrobj.voa = arrobj.ely==="bottom" ? arrobj.voa * -1 : arrobj.voa; 397 //arrobj.hoa = arrobj.elx==="right" ? arrobj.hoa * -1 : arrobj.hoa; 398 399 400 var voa = arrobj.voa.length==0 ? 0 : arrobj.voa, 401 hoa = arrobj.hoa.length==0 ? 0 : arrobj.hoa, 402 elx = arrobj.elx.length==0 ? 0 : arrobj.elx, 403 ely = arrobj.ely.length==0 ? 0 : arrobj.ely, 404 eow = _nc.outerWidth(true), 405 eoh = _nc.outerHeight(true); 406 407 408 // NEED CLASS FOR FULLWIDTH AND FULLHEIGHT LAYER SETTING !! 409 if (eow==0 && eoh==0) { 410 eow = opt.ulw; 411 eoh = opt.ulh; 412 } 413 414 var vofs= _respoffset !=="off" ? parseInt(voa,0)*opt.bw : parseInt(voa,0), 415 hofs= _respoffset !=="off" ? parseInt(hoa,0)*opt.bw : parseInt(hoa,0), 416 crw = _ba==="grid" ? opt.gridwidth[opt.curWinRange]*opt.bw : _gw, 417 crh = _ba==="grid" ? opt.gridheight[opt.curWinRange]*opt.bw : _gh; 418 419 420 421 if (opt.fullScreenAlignForce == "on") { 422 crw = opt.ulw; 423 crh = opt.ulh; 424 } 425 426 427 // ALIGN POSITIONED ELEMENTS 428 429 430 elx = elx==="center" || elx==="middle" ? (crw/2 - eow/2) + hofs : elx==="left" ? hofs : elx==="right" ? (crw - eow) - hofs : _respoffset !=="off" ? elx * opt.bw : elx; 431 ely = ely=="center" || ely=="middle" ? (crh/2 - eoh/2) + vofs : ely =="top" ? vofs : ely=="bottom" ? (crh - eoh)-vofs : _respoffset !=="off" ? ely*opt.bw : ely; 432 433 if (rtl) 434 elx = elx + eow; 435 436 // THE TRANSITIONS OF CAPTIONS 437 // MDELAY AND MSPEED 438 439 440 var $lts = _nc.data('lasttriggerstate'), 441 $cts = _nc.data('triggerstate'), 442 $start = _nc.data('start') || 100, 443 $end = _nc.data('end'),
444 mdelay = triggerforce ? 0 : $start==="bytrigger" || $start==="sliderenter" ? 0 : parseFloat($start)/1000, 445 calcx = (elx+offsetx), 446 calcy = (ely+offsety), 447 tpcapindex = _nc.css("z-Index"); 448 449 450 if (!triggerforce) 451 if ($lts=="reset" && $start!="bytrigger") { 452 _nc.data("triggerstate","on"); 453 _nc.data('animdirection',"in"); 454 $cts = "on"; 455 } else 456 if ($lts=="reset" && $start=="bytrigger") { 457 _nc.data("triggerstate","off"); 458 _nc.data('animdirection',"out"); 459 $cts = "off"; 460 } 461 462 463 // SET TOP/LEFT POSITION OF LAYER 464 punchgs.TweenLite.set(_pw,{zIndex:tpcapindex, top:calcy,left:calcx,overwrite:"auto"}); 465 466 if (staticdirection == 0) internrecalled = true; 467 468 // STATIC LAYER, THINK ON THIS !!! 469 if (_nc.data('timeline')!=undefined && !internrecalled) { 470 if (staticdirection!=2) 471 _nc.data('timeline').gotoAndPlay(0); 472 internrecalled = true; 473 } 474 475 // KILL OUT ANIMATION 476 477 if (!recalled && _nc.data('timeline_out') && staticdirection!=2 && staticdirection!=0) { 478 _nc.data('timeline_out').kill(); 479 _nc.data('outstarted',0); 480 } 481 482 // TRIGGERED ELEMENTS SHOULD 483 if (triggerforce && _nc.data('timeline')!=undefined) { 484 _nc.removeData('$anims') 485 _nc.data('timeline').pause(0); 486 _nc.data('timeline').kill(); 487 if (_nc.data('newhoveranim')!=undefined) { 488 _nc.data('newhoveranim').progress(0); 489 _nc.data('newhoveranim').kill(); 490 } 491 _nc.removeData('timeline'); 492 punchgs.TweenLite.killTweensOf(_nc); 493 _nc.unbind('hover'); 494 _nc.removeClass("rs-hover-ready"); 495 496 _nc.removeData('newhoveranim'); 497 498 } 499 500 var $time = _nc.data('timeline') ? _nc.data('timeline').time() : 0, 501 $progress = _nc.data('timeline')!==undefined ? _nc.data('timeline').progress() : 0, 502 tl = _nc.data('timeline') || new punchgs.TimelineLite({smoothChildTiming:true}); 503 504 $progress = jQuery.isNumeric($progress) ? $progress: 0; 505 506 tl.pause(); 507 // LAYER IS TRIGGERED ?? 508 509 510 511 if ($progress<1 && _nc.data('outstarted') != 1 || staticdirection==2 || triggerforce) { 512 var animobject = _nc; 513 514 if (_nc.data('mySplitText') !=undefined) _nc.data('mySplitText').revert(); 515 516 if (_nc.data('splitin')!=undefined && _nc.data('splitin').match(/chars|words|lines/g) || _nc.data('splitout')!=undefined && _nc.data('splitout').match(/chars|words|lines/g)) { 517 var splittarget = _nc.find('a').length>0 ? _nc.find('a') : _nc; 518 _nc.data('mySplitText',new punchgs.SplitText(splittarget,{type:"lines,words,chars",charsClass:"tp-splitted",wordsClass:"tp-splitted",linesClass:"tp-splitted"})); 519 _nc.addClass("splitted"); 520 } 521 522 if ( _nc.data('mySplitText') !==undefined && _nc.data('splitin') && _nc.data('splitin').match(/chars|words|lines/g)) animobject = _nc.data('mySplitText')[_nc.data('splitin')] 523 524 var $a = new Object(); 525 526 527 528 var reverseanim = _nc.data('transform_in')!=undefined ? _nc.data('transform_in').match(/\(R\)/gi) : false; 529 530 // BUILD ANIMATION LIBRARY AND HOVER ANIMATION 531 if (!_nc.data('$anims') || triggerforce || reverseanim) { 532 var $from = newAnimObject(), 533 $result = newAnimObject(), 534 $hover = newHoverAnimObject(), 535 hashover = _nc.data('transform_hover')!==undefined || _nc.data('style_hover')!==undefined; 536 537 // WHICH ANIMATION TYPE SHOULD BE USED 538 $result = getAnimDatas($result,_nc.data('transform_idle')); 539 540 $from = getAnimDatas($result,_nc.data('transform_in'),opt.sdir==1); 541 542 if (hashover) { 543 544 $hover = getAnimDatas($hover,_nc.data('transform_hover')); 545 $hover = convertHoverStyle($hover,_nc.data('style_hover')); 546 _nc.data('hover',$hover); 547 } 548 549 // DELAYS 550 $from.elemdelay = (_nc.data('elementdelay') == undefined) ? 0 : _nc.data('elementdelay'); 551 $result.anim.ease = $from.anim.ease = $from.anim.ease || punchgs.Power1.easeInOut; 552 553 554 555 // HOVER ANIMATION 556 if (hashover && !_nc.hasClass("rs-hover-ready")) { 557 558 _nc.addClass("rs-hover-ready"); 559 _nc.hover(function(e) { 560 var nc = jQuery(e.currentTarget), 561 t = nc.data('hover'), 562 intl = nc.data('timeline'); 563 564 if (intl && intl.progress()==1) { 565 566 if (nc.data('newhoveranim')===undefined || nc.data('newhoveranim')==="none") { 567 nc.data('newhoveranim',punchgs.TweenLite.to(nc,t.speed,t.anim)); 568 569 } else { 570 nc.data('newhoveranim').progress(0); 571 nc.data('newhoveranim').play(); 572 } 573 } 574 }, 575 function(e) { 576 var nc = jQuery(e.currentTarget), 577 intl = nc.data('timeline'); 578 579 if (intl && intl.progress()==1 && nc.data('newhoveranim')!=undefined) { 580 nc.data('newhoveranim').reverse(); 581 } 582 }); 583 } 584 $a = new Object(); 585 $a.f = $from; 586 $a.r = $result; 587 _nc.data('$anims'); 588 } else { 589 $a = _nc.data('$anims'); 590 } 591 592 593 594 // SET WRAPPING CONTAINER SIZES 595 var $mask_frm = getMaskDatas(_nc.data('mask_in')), 596 newtl = new punchgs.TimelineLite(); 597 598 $a.f.anim.x = $a.f.anim.x * opt.bw || getBorderDirections($a.f.anim.x,opt,eow,eoh,calcy,calcx, "horizontal" ); 599 $a.f.anim.y = $a.f.anim.y * opt.bw || getBorderDirections($a.f.anim.y,opt,eow,eoh,calcy,calcx, "vertical" ); 600 601 602 603 // IF LAYER IS NOT STATIC, OR STATIC AND NOT ANIMATED IN AT THIS LOOP 604 if (staticdirection != 2 || triggerforce) { 605 606 // SPLITED ANIMATION IS IN GAME 607 if (animobject != _nc) { 608 var oldease = $a.r.anim.ease; 609 tl.add(punchgs.TweenLite.set(_nc, $a.r.anim)); 610 $a.r = newAnimObject(); 611 $a.r.anim.ease = oldease; 612 } 613 614 $a.f.anim.visibility = "hidden"; 615 616 617 newtl.eventCallback("onStart",function(){ 618 punchgs.TweenLite.set(_nc,{visibility:"visible"}); 619 // FIX VISIBLE IFRAME BUG IN SAFARI 620 if (_nc.data('iframes')) 621 _nc.find('iframe').each(function() { 622 punchgs.TweenLite.set(jQuery(this),{autoAlpha:1}); 623 }) 624 punchgs.TweenLite.set(_pw,{visibility:"visible"}); 625 var data={}; 626 data.layer = _nc;
627 data.eventtype = "enterstage"; 628 data.layertype = _nc.data('layertype'); 629 data.layersettings = _nc.data(); 630 opt.c.trigger("revolution.layeraction",data) 631 }); 632 633 newtl.eventCallback("onComplete",function() { 634 var data={}; 635 data.layer = _nc; 636 data.eventtype = "enteredstage"; 637 data.layertype = _nc.data('layertype'); 638 data.layersettings = _nc.data(); 639 opt.c.trigger("revolution.layeraction",data); 640 _R.animcompleted(_nc,opt); 641 }); 642 643 // SHOW ELEMENTS WITH SLIDEENTER A BIT LATER FIRST ! 644 if (($start=="sliderenter" && opt.overcontainer)) 645 mdelay = 0.6; 646 647 tl.add(newtl.staggerFromTo(animobject,$a.f.speed,$a.f.anim,$a.r.anim,$a.f.elemdelay),mdelay); 648 649 650 // MASK ANIMATION 651 if ($mask_frm) { 652 var $mask_rsl = new Object(); 653 $mask_rsl.ease = $a.r.anim.ease; 654 $mask_rsl.overflow = $mask_frm.anim.overflow ="hidden"; 655 $mask_rsl.x = $mask_rsl.y = 0; 656 657 $mask_frm.anim.x = $mask_frm.anim.x * opt.bw || getBorderDirections($mask_frm.anim.x,opt,eow,eoh,calcy,calcx,"horizontal"); 658 $mask_frm.anim.y = $mask_frm.anim.y * opt.bw || getBorderDirections($mask_frm.anim.y,opt,eow,eoh,calcy,calcx,"vertical"); 659 660 661 tl.add(punchgs.TweenLite.fromTo(_mw,$a.f.speed,$mask_frm.anim,$mask_rsl,$from.elemdelay),mdelay); 662 } else { 663 tl.add(punchgs.TweenLite.set(_mw,{overflow:"visible"},$from.elemdelay),0); 664 } 665 } 666 667 // SAVE IT TO NCAPTION BEFORE NEW STEPS WILL BE ADDED 668 _nc.data('timeline',tl); 669 670 // IF THERE IS ANY EXIT ANIM DEFINED 671 // For Static Layers -> 1 -> In, 2-> Out 0-> Ignore -1-> Not Static 672 staticdirection = staticLayerStatus(_nc,opt,"in"); 673 674 if (($progress === 0 || staticdirection==2) && $end!=="bytrigger" && !triggerforce && $end!="sliderleave") 675 if (($end!=undefined) && (staticdirection==-1 || staticdirection==2) && ($end!=="bytriger")) 676 punchgs.TweenLite.delayedCall(parseInt(_nc.data('end'),0)/1000,_R.endMoveCaption,[_nc,_mw,_pw,opt]); 677 else 678 punchgs.TweenLite.delayedCall(999999,_R.endMoveCaption,[_nc,_mw,_pw,opt]); 679 680 681 // SAVE THE TIMELINE IN DOM ELEMENT 682 683 tl = _nc.data('timeline'); 684 685 if (_nc.data('loopanimation')=="on") callCaptionLoops(_lw,opt.bw); 686 687 688 689 690 if (($start!="sliderenter" || ($start=="sliderenter" && opt.overcontainer)) && (staticdirection==-1 || staticdirection==1 || triggerforce || (staticdirection==0 && $progress<1 && _nc.hasClass("rev-static-visbile")))) 691 if (($progress<1 && $progress>0) || 692 ($progress==0 && $start!="bytrigger" && $lts!="keep") || 693 ($progress==0 && $start!="bytrigger" && $lts=="keep" && $cts=="on") || 694 ($start=="bytrigger" && $lts=="keep" && $cts=="on")) 695 tl.resume($time); 696 } 697 698 //punchgs.TweenLite.set(_mw,{width:eow, height:eoh}); 699 if (_nc.data('loopanimation')=="on") punchgs.TweenLite.set(_lw,{minWidth:eow,minHeight:eoh}); 700 701 if (_nc.data('slidelink')!=0 && (_nc.data('slidelink')==1 || _nc.hasClass("slidelink"))) { 702 punchgs.TweenLite.set(_mw,{width:"100%", height:"100%"}); 703 _nc.data('slidelink',1); 704 } else { 705 punchgs.TweenLite.set(_mw,{width:"auto", height:"auto"}); 706 _nc.data('slidelink',0); 707 } 708 }, 709 710 ////////////////////////////// 711 // MOVE OUT THE CAPTIONS // 712 //////////////////////////// 713 endMoveCaption : function(_nc,_mw,_pw,opt) { 714 715 _mw = _mw || _nc.data('_mw'); 716 _pw = _pw || _nc.data('_pw'); 717 718 // Kill TimeLine of "in Animation" 719 _nc.data('outstarted',1); 720 721 722 if (_nc.data('timeline')) 723 _nc.data('timeline').pause(); 724 else 725 if (_nc.data('_pw')===undefined) return; 726 727 var tl = new punchgs.TimelineLite(), 728 subtl = new punchgs.TimelineLite(), 729 newmasktl = new punchgs.TimelineLite(), 730 $from = getAnimDatas(newAnimObject(),_nc.data('transform_in'),opt.sdir==1), 731 $to = _nc.data('transform_out') ? getAnimDatas(newEndAnimObject(),_nc.data('transform_out'),opt.sdir==1) : getAnimDatas(newEndAnimObject(),_nc.data('transform_in'),opt.sdir==1), 732 animobject = _nc.data('splitout') && _nc.data('splitout').match(/words|chars|lines/g) ? _nc.data('mySplitText')[_nc.data('splitout')] : _nc,
733 elemdelay = (_nc.data('endelementdelay') == undefined) ? 0 : _nc.data('endelementdelay'), 734 iw = _nc.innerWidth(), 735 ih = _nc.innerHeight(), 736 p = _pw.position(); 737 738 // IF REVERSE AUTO ANIMATION ENABLED 739 if (_nc.data('transform_out') && _nc.data('transform_out').match(/auto:auto/g)) { 740 $from.speed = $to.speed; 741 $from.anim.ease = $to.anim.ease; 742 $to = $from; 743 } 744 745 var $mask_to = getMaskDatas(_nc.data('mask_out')); 746 747 $to.anim.x = $to.anim.x * opt.bw || getBorderDirections($to.anim.x,opt,iw,ih,p.top,p.left,"horizontal"); 748 $to.anim.y = $to.anim.y * opt.bw || getBorderDirections($to.anim.y,opt,iw,ih,p.top,p.left,"vertical"); 749 750 subtl.eventCallback("onStart",function(){ 751 var data={}; 752 data.layer = _nc; 753 data.eventtype = "leavestage"; 754 data.layertype = _nc.data('layertype'); 755 data.layersettings = _nc.data(); 756 opt.c.trigger("revolution.layeraction",data); 757 }); 758 759 subtl.eventCallback("onComplete",function(){ 760 punchgs.TweenLite.set(_nc,{visibility:"hidden"}); 761 punchgs.TweenLite.set(_pw,{visibility:"hidden"}); 762 var data={}; 763 data.layer = _nc; 764 data.eventtype = "leftstage"; 765 data.layertype = _nc.data('layertype'); 766 data.layersettings = _nc.data(); 767 opt.c.trigger("revolution.layeraction",data); 768 }); 769 770 tl.add(subtl.staggerTo(animobject,$to.speed,$to.anim,elemdelay),0); 771 772 // MASK ANIMATION 773 if ($mask_to) { 774 $mask_to.anim.ease = $to.anim.ease; 775 $mask_to.anim.overflow = "hidden"; 776 777 $mask_to.anim.x = $mask_to.anim.x * opt.bw || getBorderDirections($mask_to.anim.x,opt,iw,ih,p.top,p.left,"horizontal"); 778 $mask_to.anim.y = $mask_to.anim.y * opt.bw || getBorderDirections($mask_to.anim.y,opt,iw,ih,p.top,p.left,"vertical"); 779 780 781 tl.add(newmasktl.to(_mw,$to.speed,$mask_to.anim,elemdelay),0); 782 } else { 783 tl.add(newmasktl.set(_mw,{overflow:"visible",overwrite:"auto"},elemdelay),0); 784 } 785 786 _nc.data('timeline_out',tl); 787 }, 788 789 ////////////////////////// 790 // REMOVE THE CAPTIONS // 791 ///////////////////////// 792 removeTheCaptions : function(actli,opt) { 793 var removetime = 0, 794 index = actli.data('index'), 795 allcaptions = new Array; 796 797 // COLLECT ALL CAPTIONS 798 if (opt.layers[index]) 799 jQuery.each(opt.layers[index], function(i,a) { allcaptions.push(a); }); 800 if (opt.layers["static"]) 801 jQuery.each(opt.layers["static"], function(i,a) { allcaptions.push(a); }); 802 punchgs.TweenLite.killDelayedCallsTo(_R.endMoveCaption); 803 804 // GO THROUGH ALL CAPTIONS, AND MANAGE THEM 805 if (allcaptions) 806 jQuery.each(allcaptions,function(i) { 807 var _nc=jQuery(this), 808 stat = staticLayerStatus(_nc,opt,"out"); 809 if (stat != 0 ) { //0 == ignore 810 killCaptionLoops(_nc); 811 clearTimeout(_nc.data('videoplaywait')); 812 if (_R.stopVideo) _R.stopVideo(_nc,opt); 813 _R.endMoveCaption(_nc,null,null,opt) 814 opt.playingvideos = []; 815 opt.lastplayedvideos = []; 816 } 817 }); 818 } 819}); 820 821 822 823 824 825/********************************************************************************************** 826 - HELPER FUNCTIONS FOR LAYER TRANSFORMS - 827**********************************************************************************************/ 828 829 830 831///////////////////////////////////// 832// - CREATE ANIMATION OBJECT - // 833///////////////////////////////////// 834var newAnimObject = function() { 835 var a = new Object(); 836 a.anim = new Object(); 837 a.anim.x=0; 838 a.anim.y=0; 839 a.anim.z=0; 840 a.anim.rotationX = 0; 841 a.anim.rotationY = 0; 842 a.anim.rotationZ = 0; 843 a.anim.scaleX = 1; 844 a.anim.scaleY = 1; 845 a.anim.skewX = 0; 846 a.anim.skewY = 0; 847 a.anim.opacity=1; 848 a.anim.transformOrigin = "50% 50%"; 849 a.anim.transformPerspective = 600; 850 a.anim.rotation = 0; 851 a.anim.ease = punchgs.Power3.easeOut; 852 a.anim.force3D = "auto"; 853 a.speed = 0.3; 854 a.anim.autoAlpha = 1; 855 a.anim.visibility = "visible"; 856 a.anim.overwrite = "all"; 857 return a; 858} 859 860var newEndAnimObject = function() { 861 var a = new Object(); 862 a.anim = new Object(); 863 a.anim.x=0; 864 a.anim.y=0; 865 a.anim.z=0; 866 return a; 867} 868 869var newHoverAnimObject = function() { 870 var a = new Object(); 871 a.anim = new Object(); 872 a.speed = 0.2; 873 return a; 874} 875 876var animDataTranslator = function(val,defval) { 877 878 if (jQuery.isNumeric(parseFloat(val))) { 879 return parseFloat(val); 880 } else 881 if (val===undefined || val==="inherit") { 882 return defval; 883 } else 884 if (val.split("{").length>1) { 885 var min = val.split(","), 886 max = parseFloat(min[1].split("}")[0]); 887 min = parseFloat(min[0].split("{")[1]); 888 val = Math.random()*(max-min) + min; 889 } 890 return val; 891} 892 893var getBorderDirections = function (x,o,w,h,top,left,direction) { 894 895 if (!jQuery.isNumeric(x) && x.match(/%]/g)) { 896 x = x.split("[")[1].split("]")[0]; 897 if (direction=="horizontal") 898 x = (w+2)*parseInt(x,0)/100; 899 else 900 if (direction=="vertical") 901 x = (h+2)*parseInt(x,0)/100; 902 } else { 903 904
905 x = x === "layer_left" ? (0-w) : x === "layer_right" ? w : x; 906 x = x === "layer_top" ? (0-h) : x==="layer_bottom" ? h : x; 907 x = x === "left" || x==="stage_left" ? (0-w-left) : x === "right" || x==="stage_right" ? o.conw-left : x === "center" || x === "stage_center" ? (o.conw/2 - w/2)-left : x; 908 x = x === "top" || x==="stage_top" ? (0-h-top) : x==="bottom" || x==="stage_bottom" ? o.conh-top : x === "middle" || x === "stage_middle" ? (o.conh/2 - h/2)-top : x; 909 } 910 911 return x; 912} 913 914/////////////////////////////////////////////////// 915// ANALYSE AND READ OUT DATAS FROM HTML CAPTIONS // 916/////////////////////////////////////////////////// 917var getAnimDatas = function(frm,data,reversed) { 918 var o = new Object(); 919 o = jQuery.extend(true,{},o, frm); 920 if (data === undefined) 921 return o; 922 923 var customarray = data.split(';'); 924 if (customarray) 925 jQuery.each(customarray,function(index,pa) { 926 var p = pa.split(":") 927 var w = p[0], 928 v = p[1]; 929 930 931 if (reversed && v!=undefined && v.length>0 && v.match(/\(R\)/)) { 932 v = v.replace("(R)",""); 933 v = v==="right" ? "left" : v==="left" ? "right" : v==="top" ? "bottom" : v==="bottom" ? "top" : v; 934 if (v[0]==="[" && v[1]==="-") v = v.replace("[-","["); 935 else 936 if (v[0]==="[" && v[1]!=="-") v = v.replace("[","[-"); 937 else 938 if (v[0]==="-") v = v.replace("-",""); 939 else 940 if (v[0].match(/[1-9]/)) v="-"+v; 941 942 } 943 944 if (v!=undefined) { 945 v = v.replace(/\(R\)/,''); 946 if (w=="rotationX" || w=="rX") o.anim.rotationX = animDataTranslator(v,o.anim.rotationX)+"deg"; 947 if (w=="rotationY" || w=="rY") o.anim.rotationY = animDataTranslator(v,o.anim.rotationY)+"deg"; 948 if (w=="rotationZ" || w=="rZ") o.anim.rotation = animDataTranslator(v,o.anim.rotationZ)+"deg"; 949 if (w=="scaleX" || w=="sX") o.anim.scaleX = animDataTranslator(v,o.anim.scaleX); 950 if (w=="scaleY" || w=="sY") o.anim.scaleY = animDataTranslator(v,o.anim.scaleY); 951 if (w=="opacity" || w=="o") o.anim.opacity = animDataTranslator(v,o.anim.opacity); 952 if (w=="skewX" || w=="skX") o.anim.skewX = animDataTranslator(v,o.anim.skewX); 953 if (w=="skewY" || w=="skY") o.anim.skewY = animDataTranslator(v,o.anim.skewY); 954 if (w=="x") o.anim.x = animDataTranslator(v,o.anim.x); 955 if (w=="y") o.anim.y = animDataTranslator(v,o.anim.y); 956 if (w=="z") o.anim.z = animDataTranslator(v,o.anim.z); 957 if (w=="transformOrigin" || w=="tO") o.anim.transformOrigin = v.toString(); 958 if (w=="transformPerspective" || w=="tP") o.anim.transformPerspective=parseInt(v,0); 959 if (w=="speed" || w=="s") o.speed = parseFloat(v)/1000; 960 if (w=="ease" || w=="e") o.anim.ease = v; 961 } 962 963 }) 964 965 return o; 966} 967 968 969 970///////////////////////////////// 971// BUILD MASK ANIMATION OBJECT // 972///////////////////////////////// 973var getMaskDatas = function(d) { 974 if (d === undefined) 975 return false; 976 977 var o = new Object(); 978 o.anim = new Object(); 979 var s = d.split(';') 980 if (s) 981 jQuery.each(s,function(index,param) { 982 param = param.split(":") 983 var w = param[0], 984 v = param[1]; 985 if (w=="x") o.anim.x = v; 986 if (w=="y") o.anim.y = v; 987 if (w=="s") o.speed = parseFloat(v)/1000; 988 if (w=="e" || w=="ease") o.anim.ease = v; 989 }); 990 991 return o; 992} 993 994 995 996 997//////////////////////// 998// SHOW THE CAPTION // 999/////////////////////// 1000 1001var makeArray = function(obj,opt,show) { 1002 1003 if (obj==undefined) obj = 0; 1004 1005 if (!jQuery.isArray(obj) && jQuery.type(obj)==="string" && (obj.split(",").length>1 || obj.split("[").length>1)) { 1006 obj = obj.replace("[",""); 1007 obj = obj.replace("]",""); 1008 var newobj = obj.match(/'/g) ? obj.split("',") : obj.split(","); 1009 obj = new Array(); 1010 if (newobj) 1011 jQuery.each(newobj,function(index,element) { 1012 element = element.replace("'",""); 1013 element = element.replace("'",""); 1014 obj.push(element); 1015 }) 1016 } else { 1017 var tempw = obj; 1018 if (!jQuery.isArray(obj) ) { 1019 obj = new Array(); 1020 obj.push(tempw); 1021 } 1022 } 1023 1024 var tempw = obj[obj.length-1]; 1025 1026 if (obj.length<opt.rle) { 1027 for (var i=1;i<=opt.curWinRange;i++) { 1028 obj.push(tempw); 1029 } 1030 } 1031 return obj; 1032} 1033 1034 1035/* CREATE SHARP CORNERS */ 1036function sharpCorners(nc,$class, $side,$borderh,$borderv,ncch,bgcol) { 1037 var a = nc.find($class); 1038 a.css('borderWidth',ncch+"px"); 1039 a.css($side,(0-ncch)+'px'); 1040 a.css($borderh,'0px solid transparent'); 1041 a.css($borderv,bgcol); 1042} 1043 1044 1045 1046 1047 1048var staticLayerStatus = function(_nc,opt,dir,dontmod) { 1049 1050 var a = -1; 1051 if (_nc.hasClass("tp-static-layer")) { 1052 var s = parseInt(_nc.data('startslide'),0), 1053 e = parseInt(_nc.data('endslide'),0), 1054 pi = opt.c.find('.processing-revslide').index(), 1055 ai = pi!=-1 ? pi : opt.c.find('.active-revslide').index(); 1056 1057 ai = ai == -1 ? 0 : ai; 1058 1059 1060 if (dir==="in") { 1061 // IF STATIC ITEM CURRENTLY NOT VISIBLE 1062 if (!_nc.hasClass("rev-static-visbile")) { 1063 // IF ITEM SHOULD BECOME VISIBLE 1064 1065 if ((s<=ai && e>=ai) || (s == ai) || (e == ai)){ 1066 if (!dontmod) { 1067 _nc.addClass("rev-static-visbile"); 1068 _nc.removeClass("rev-static-hidden"); 1069 } 1070 a = 1; 1071 } else 1072 a = 0; 1073 1074 // IF STATIC ITEM ALREADY VISIBLE 1075 } else { 1076 if ((e==ai) || (s > ai) || (e < ai)) 1077 a = 2; 1078 else 1079 a = 0; 1080 } 1081 } else { 1082 // IF STATIC ITEM CURRENTLY NOT VISIBLE 1083 if (_nc.hasClass("rev-static-visbile")) { 1084 if ((s > ai) || 1085 (e < ai)) { 1086 a = 2; 1087 if (!dontmod) { 1088 _nc.removeClass("rev-static-visbile"); 1089 _nc.addClass("rev-static-hidden"); 1090 } 1091 } else { 1092 a = 0; 1093 } 1094 } else { 1095 a = 2; 1096 } 1097 } 1098 } 1099 1100 return a; // 1 -> In, 2-> Out 0-> Ignore -1-> Not Static 1101} 1102 1103 1104 1105var convertHoverStyle = function(t,s) { 1106 if (s===undefined) return t; 1107 s = s.replace("c:","color:"); 1108 s = s.replace("bg:","background-color:"); 1109 s = s.replace("bw:","border-width:"); 1110 s = s.replace("bc:","border-color:"); 1111 s = s.replace("br:","borderRadius:"); 1112 s = s.replace("bs:","border-style:"); 1113 s = s.replace("td:","text-decoration:"); 1114 var sp = s.split(";"); 1115 if (sp) 1116 jQuery.each(sp,function(key,cont){ 1117 var attr = cont.split(":"); 1118 if (attr[0].length>0) 1119 t.anim[attr[0]] = attr[1]; 1120 }) 1121 1122 return t; 1123 1124} 1125//////////////////////////////////////////////// 1126// - GET CSS ATTRIBUTES OF ELEMENT - // 1127//////////////////////////////////////////////// 1128var getcssParams = function(nc,level) { 1129 1130 var obj = new Object(), 1131 gp = false, 1132 pc; 1133 1134 // CHECK IF CURRENT ELEMENT SHOULD RESPECT REKURSICVE RESIZES, AND SHOULD OWN THE SAME ATTRIBUTES FROM PARRENT ELEMENT 1135 if (level=="rekursive") { 1136 pc = nc.closest('.tp-caption'); 1137 if (pc && nc.css("fontSize") === pc.css("fontSize")) 1138 gp = true; 1139 } 1140 1141 obj.basealign = nc.data('basealign') || "grid"; 1142 obj.fontSize = gp ? pc.data('fontsize')===undefined ? parseInt(pc.css('fontSize'),0) || 0 : pc.data('fontsize') : nc.data('fontsize')===undefined ? parseInt(nc.css('fontSize'),0) || 0 : nc.data('fontsize'); 1143 obj.fontWeight = gp ? pc.data('fontweight')===undefined ? parseInt(pc.css('fontWeight'),0) || 0 : pc.data('fontweight') : nc.data('fontweight')===undefined ? parseInt(nc.css('fontWeight'),0) || 0 : nc.data('fontweight'); 1144 obj.whiteSpace = gp ? pc.data('whitespace')===undefined ? pc.css('whitespace') || "normal" : pc.data('whitespace') : nc.data('whitespace')===undefined ? nc.css('whitespace') || "normal" : nc.data('whitespace'); 1145 1146 obj.lineHeight = gp ? pc.data('lineheight')===undefined ? parseInt(pc.css('lineHeight'),0) || 0 : pc.data('lineheight') : nc.data('lineheight')===undefined ? parseInt(nc.css('lineHeight'),0) || 0 : nc.data('lineheight'); 1147 obj.letterSpacing = gp ? pc.data('letterspacing')===undefined ? parseFloat(pc.css('letterSpacing'),0) || 0 : pc.data('letterspacing') : nc.data('letterspacing')===undefined ? parseFloat(nc.css('letterSpacing')) || 0 : nc.data('letterspacing'); 1148 1149 obj.paddingTop = nc.data('paddingtop')===undefined ? parseInt(nc.css('paddingTop'),0) || 0 : nc.data('paddingtop'); 1150 obj.paddingBottom = nc.data('paddingbottom')===undefined ? parseInt(nc.css('paddingBottom'),0) || 0 : nc.data('paddingbottom'); 1151 obj.paddingLeft = nc.data('paddingleft')===undefined ? parseInt(nc.css('paddingLeft'),0) || 0 : nc.data('paddingleft'); 1152 obj.paddingRight = nc.data('paddingright')===undefined ? parseInt(nc.css('paddingRight'),0) || 0 : nc.data('paddingright'); 1153 1154 obj.marginTop = nc.data('margintop')===undefined ? parseInt(nc.css('marginTop'),0) || 0 : nc.data('margintop'); 1155 obj.marginBottom = nc.data('marginbottom')===undefined ? parseInt(nc.css('marginBottom'),0) || 0 : nc.data('marginbottom'); 1156 obj.marginLeft = nc.data('marginleft')===undefined ? parseInt(nc.css('marginLeft'),0) || 0 : nc.data('marginleft'); 1157 obj.marginRight = nc.data('marginright')===undefined ? parseInt(nc.css('marginRight'),0) || 0 : nc.data('marginright'); 1158 1159 obj.borderTopWidth = nc.data('bordertopwidth')===undefined ? parseInt(nc.css('borderTopWidth'),0) || 0 : nc.data('bordertopwidth'); 1160 obj.borderBottomWidth = nc.data('borderbottomwidth')===undefined ? parseInt(nc.css('borderBottomWidth'),0) || 0 : nc.data('borderbottomwidth'); 1161 obj.borderLeftWidth = nc.data('borderleftwidth')===undefined ? parseInt(nc.css('borderLeftWidth'),0) || 0 : nc.data('borderleftwidth'); 1162 obj.borderRightWidth = nc.data('borderrightwidth')===undefined ? parseInt(nc.css('borderRightWidth'),0) || 0 : nc.data('borderrightwidth'); 1163 1164 if (level!="rekursive") { 1165 obj.color = nc.data('color')===undefined ? "nopredefinedcolor" : nc.data('color'); 1166 obj.whiteSpace = gp ? pc.data('whitespace')===undefined ? pc.css('whiteSpace') || "nowrap" : pc.data('whitespace') : nc.data('whitespace')===undefined ? nc.css('whiteSpace') || "nowrap" : nc.data('whitespace'); 1167 1168 obj.minWidth = nc.data('width')===undefined ? parseInt(nc.css('minWidth'),0) || 0 : nc.data('width'); 1169 obj.minHeight = nc.data('height')===undefined ? parseInt(nc.css('minHeight'),0) || 0 : nc.data('height'); 1170 1171 if (nc.data('videowidth')!=undefined && nc.data('videoheight')!=undefined) { 1172 var vwid = nc.data('videowidth'), 1173 vhei = nc.data('videoheight'); 1174 vwid = vwid==="100%" ? "none" : vwid; 1175 vhei = vhei==="100%" ? "none" : vhei; 1176 nc.data('width',vwid); 1177 nc.data('height',vhei); 1178 } 1179 1180 obj.maxWidth = nc.data('width')===undefined ? parseInt(nc.css('maxWidth'),0) || "none" : nc.data('width'); 1181 obj.maxHeight = nc.data('height')===undefined ? parseInt(nc.css('maxHeight'),0) || "none" : nc.data('height'); 1182 1183 obj.wan = nc.data('wan')===undefined ? parseInt(nc.css('-webkit-transition'),0) || "none" : nc.data('wan'); 1184 obj.moan = nc.data('moan')===undefined ? parseInt(nc.css('-moz-animation-transition'),0) || "none" : nc.data('moan'); 1185 obj.man = nc.data('man')===undefined ? parseInt(nc.css('-ms-animation-transition'),0) || "none" : nc.data('man'); 1186 obj.ani = nc.data('ani')===undefined ? parseInt(nc.css('transition'),0) || "none" : nc.data('ani'); 1187 } 1188 1189 obj.styleProps = nc.css(["background-color", 1190 "border-top-color", 1191 "border-bottom-color", 1192 "border-right-color", 1193 "border-left-color", 1194 "border-top-style", 1195 "border-bottom-style", 1196 "border-left-style", 1197 "border-right-style", 1198 "border-left-width", 1199 "border-right-width", 1200 "border-bottom-width", 1201 "border-top-width", 1202 // "color", 1203 "text-decoration", 1204 "font-style", 1205 "border-radius"]); 1206 return obj; 1207} 1208 1209// READ SINGLE OR ARRAY VALUES OF OBJ CSS ELEMENTS 1210var setResponsiveCSSValues = function(obj,opt) { 1211 var newobj = new Object(); 1212 if (obj) 1213 jQuery.each(obj,function(key,val){ 1214 newobj[key] = makeArray(val,opt)[opt.curWinRange] || obj[key]; 1215 }) 1216 return newobj; 1217} 1218 1219var minmaxconvert = function(a,m,r,fr) { 1220 1221 a = jQuery.isNumeric(a) ? (a * m)+"px" : a; 1222 a = a==="full" ? fr : a==="auto" || a==="none" ? r : a; 1223 return a; 1224 1225} 1226
1227///////////////////////////////////////////////////////////////// 1228// - CALCULATE THE RESPONSIVE SIZES OF THE CAPTIONS - // 1229///////////////////////////////////////////////////////////////// 1230var calcCaptionResponsive = function(nc,opt,level,responsive) { 1231 var getobj; 1232 1233 if (nc.data('cssobj')===undefined) { 1234 getobj = getcssParams(nc,level); 1235 nc.data('cssobj',getobj); 1236 } else 1237 getobj = nc.data('cssobj'); 1238 1239 var obj = setResponsiveCSSValues(getobj,opt); 1240 1241 var bw=opt.bw, 1242 bh=opt.bh; 1243 1244 if (responsive==="off") { 1245 bw=1; 1246 bh=1; 1247 } 1248 1249 // IE8 FIX FOR AUTO LINEHEIGHT 1250 if (obj.lineHeight=="auto") obj.lineHeight = obj.fontSize+4; 1251 1252 1253 if (!nc.hasClass("tp-splitted")) { 1254 1255 nc.css("-webkit-transition", "none"); 1256 nc.css("-moz-transition", "none"); 1257 nc.css("-ms-transition", "none"); 1258 nc.css("transition", "none"); 1259 1260 var hashover = nc.data('transform_hover')!==undefined || nc.data('style_hover')!==undefined; 1261 if (hashover) punchgs.TweenLite.set(nc,obj.styleProps); 1262 1263 punchgs.TweenLite.set(nc,{ 1264 1265 fontSize: Math.round((obj.fontSize * bw))+"px", 1266 fontWeight: obj.fontWeight, 1267 letterSpacing:Math.floor((obj.letterSpacing * bw))+"px", 1268 paddingTop: Math.round((obj.paddingTop * bh)) + "px", 1269 paddingBottom: Math.round((obj.paddingBottom * bh)) + "px", 1270 paddingLeft: Math.round((obj.paddingLeft* bw)) + "px", 1271 paddingRight: Math.round((obj.paddingRight * bw)) + "px", 1272 marginTop: (obj.marginTop * bh) + "px", 1273 marginBottom: (obj.marginBottom * bh) + "px", 1274 marginLeft: (obj.marginLeft * bw) + "px", 1275 marginRight: (obj.marginRight * bw) + "px", 1276 borderTopWidth: Math.round(obj.borderTopWidth * bh) + "px", 1277 borderBottomWidth: Math.round(obj.borderBottomWidth * bh) + "px", 1278 borderLeftWidth: Math.round(obj.borderLeftWidth * bw) + "px", 1279 borderRightWidth: Math.round(obj.borderRightWidth * bw) + "px", 1280 lineHeight: Math.round(obj.lineHeight * bh) + "px", 1281 overwrite:"auto"}); 1282 1283 if (level!="rekursive") { 1284 1285 1286 1287 var winw = obj.basealign =="slide" ? opt.ulw : opt.gridwidth[opt.curWinRange], 1288 winh = obj.basealign =="slide" ? opt.ulh : opt.gridheight[opt.curWinRange], 1289 maxw = minmaxconvert(obj.maxWidth,bw,"none",winw), 1290 maxh = minmaxconvert(obj.maxHeight,bh,"none",winh), 1291 minw = minmaxconvert(obj.minWidth,bw,"0px",winw), 1292 minh = minmaxconvert(obj.minHeight,bh,"0px",winh); 1293 1294 punchgs.TweenLite.set(nc,{ 1295 maxWidth:maxw, 1296 maxHeight:maxh, 1297 minWidth:minw, 1298 minHeight:minh, 1299 whiteSpace:obj.whiteSpace, 1300 overwrite:"auto" 1301 }); 1302 if (obj.color!="nopredefinedcolor") 1303 punchgs.TweenLite.set(nc,{color:obj.color,overwrite:"auto"}); 1304 1305 } 1306 1307 setTimeout(function() { 1308 nc.css("-webkit-transition", nc.data('wan')); 1309 nc.css("-moz-transition", nc.data('moan')); 1310 nc.css("-ms-transition", nc.data('man')); 1311 nc.css("transition", nc.data('ani')); 1312 1313 },30); 1314 } 1315} 1316 1317 1318////////////////////// 1319// CAPTION LOOPS // 1320////////////////////// 1321var callCaptionLoops = function(el,factor) { 1322 1323 // SOME LOOPING ANIMATION ON INTERNAL ELEMENTS 1324 if (el.hasClass("rs-pendulum")) { 1325 if (el.data('loop-timeline')==undefined) { 1326 el.data('loop-timeline',new punchgs.TimelineLite); 1327 var startdeg = el.data('startdeg')==undefined ? -20 : el.data('startdeg'), 1328 enddeg = el.data('enddeg')==undefined ? 20 : el.data('enddeg'), 1329 speed = el.data('speed')==undefined ? 2 : el.data('speed'), 1330 origin = el.data('origin')==undefined ? "50% 50%" : el.data('origin'), 1331 easing = el.data('easing')==undefined ? punchgs.Power2.easeInOut : el.data('ease'); 1332 1333 1334 startdeg = startdeg * factor; 1335 enddeg = enddeg * factor; 1336 1337 el.data('loop-timeline').append(new punchgs.TweenLite.fromTo(el,speed,{force3D:"auto",rotation:startdeg,transformOrigin:origin},{rotation:enddeg,ease:easing})); 1338 el.data('loop-timeline').append(new punchgs.TweenLite.fromTo(el,speed,{force3D:"auto",rotation:enddeg,transformOrigin:origin},{rotation:startdeg,ease:easing,onComplete:function() { 1339 el.data('loop-timeline').restart(); 1340 }})); 1341 } 1342 1343 } 1344 1345 // SOME LOOPING ANIMATION ON INTERNAL ELEMENTS 1346 if (el.hasClass("rs-rotate")) { 1347 if (el.data('loop-timeline')==undefined) { 1348 el.data('loop-timeline',new punchgs.TimelineLite); 1349 var startdeg = el.data('startdeg')==undefined ? 0 : el.data('startdeg'), 1350 enddeg = el.data('enddeg')==undefined ? 360 : el.data('enddeg'); 1351 speed = el.data('speed')==undefined ? 2 : el.data('speed'), 1352 origin = el.data('origin')==undefined ? "50% 50%" : el.data('origin'), 1353 easing = el.data('easing')==undefined ? punchgs.Power2.easeInOut : el.data('easing'); 1354 1355 startdeg = startdeg * factor; 1356 enddeg = enddeg * factor; 1357 1358 el.data('loop-timeline').append(new punchgs.TweenLite.fromTo(el,speed,{force3D:"auto",rotation:startdeg,transformOrigin:origin},{rotation:enddeg,ease:easing,onComplete:function() { 1359 el.data('loop-timeline').restart(); 1360 }})); 1361 } 1362 1363 } 1364 1365 // SOME LOOPING ANIMATION ON INTERNAL ELEMENTS 1366 if (el.hasClass("rs-slideloop")) { 1367 if (el.data('loop-timeline')==undefined) { 1368 el.data('loop-timeline',new punchgs.TimelineLite); 1369 var xs = el.data('xs')==undefined ? 0 : el.data('xs'), 1370 ys = el.data('ys')==undefined ? 0 : el.data('ys'), 1371 xe = el.data('xe')==undefined ? 0 : el.data('xe'), 1372 ye = el.data('ye')==undefined ? 0 : el.data('ye'), 1373 speed = el.data('speed')==undefined ? 2 : el.data('speed'), 1374 easing = el.data('easing')==undefined ? punchgs.Power2.easeInOut : el.data('easing'); 1375 1376 xs = xs * factor; 1377 ys = ys * factor; 1378 xe = xe * factor; 1379 ye = ye * factor; 1380 1381 el.data('loop-timeline').append(new punchgs.TweenLite.fromTo(el,speed,{force3D:"auto",x:xs,y:ys},{x:xe,y:ye,ease:easing})); 1382 el.data('loop-timeline').append(new punchgs.TweenLite.fromTo(el,speed,{force3D:"auto",x:xe,y:ye},{x:xs,y:ys,onComplete:function() { 1383 el.data('loop-timeline').restart(); 1384 }})); 1385 } 1386 } 1387 1388 // SOME LOOPING ANIMATION ON INTERNAL ELEMENTS 1389 if (el.hasClass("rs-pulse")) { 1390 if (el.data('loop-timeline')==undefined) { 1391 el.data('loop-timeline',new punchgs.TimelineLite); 1392 var zoomstart = el.data('zoomstart')==undefined ? 0 : el.data('zoomstart'),
1393 zoomend = el.data('zoomend')==undefined ? 0 : el.data('zoomend'), 1394 speed = el.data('speed')==undefined ? 2 : el.data('speed'), 1395 easing = el.data('easing')==undefined ? punchgs.Power2.easeInOut : el.data('easing'); 1396 1397 el.data('loop-timeline').append(new punchgs.TweenLite.fromTo(el,speed,{force3D:"auto",scale:zoomstart},{scale:zoomend,ease:easing})); 1398 el.data('loop-timeline').append(new punchgs.TweenLite.fromTo(el,speed,{force3D:"auto",scale:zoomend},{scale:zoomstart,onComplete:function() { 1399 el.data('loop-timeline').restart(); 1400 }})); 1401 } 1402 } 1403 1404 if (el.hasClass("rs-wave")) { 1405 if (el.data('loop-timeline')==undefined) { 1406 el.data('loop-timeline',new punchgs.TimelineLite); 1407 1408 var angle= el.data('angle')==undefined ? 10 : parseInt(el.data('angle'),0), 1409 radius = el.data('radius')==undefined ? 10 : parseInt(el.data('radius'),0), 1410 speed = el.data('speed')==undefined ? -20 : el.data('speed'), 1411 origin = el.data('origin')==undefined ? "50% 50%" : el.data('origin'), 1412 ors = origin.split(" "), 1413 oo = new Object(); 1414 1415 if (ors.length>=1) { 1416 oo.x = ors[0]; 1417 oo.y = ors[1]; 1418 } else { 1419 oo.x = "50%"; 1420 oo.y = "50%"; 1421 } 1422 1423 angle = angle*factor; 1424 radius = radius * factor; 1425 1426 var yo = (0-el.height()/2) + (radius*(-1+(parseInt(oo.y,0)/100))), 1427 xo = (el.width())*(-0.5+(parseInt(oo.x,0)/100)), 1428 angobj= {a:0, ang : angle, element:el, unit:radius, xoffset:xo, yoffset:yo}; 1429 1430 1431 el.data('loop-timeline').append(new punchgs.TweenLite.fromTo(angobj,speed, 1432 { a:360 }, 1433 { a:0, 1434 force3D:"auto", 1435 ease:punchgs.Linear.easeNone, 1436 onUpdate:function() { 1437 1438 var rad = angobj.a * (Math.PI / 180); 1439 punchgs.TweenLite.to(angobj.element,0.1,{force3D:"auto",x:angobj.xoffset+Math.cos(rad) * angobj.unit, y:angobj.yoffset+angobj.unit * (1 - Math.sin(rad))}); 1440 1441 }, 1442 onComplete:function() { 1443 el.data('loop-timeline').restart(); 1444 } 1445 } 1446 )); 1447 } 1448 } 1449} 1450 1451var killCaptionLoops = function(nextcaption) { 1452 // SOME LOOPING ANIMATION ON INTERNAL ELEMENTS 1453 nextcaption.find('.rs-pendulum, .rs-slideloop, .rs-pulse, .rs-wave').each(function() { 1454 var el = jQuery(this); 1455 if (el.data('loop-timeline')!=undefined) { 1456 el.data('loop-timeline').pause(); 1457 el.data('loop-timeline',null); 1458 } 1459 }); 1460} 1461 1462})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.