');
actli.find('.tp-half-one').clone(true).appendTo(actli).addClass("tp-half-two");
actli.find('.tp-half-two').removeClass('tp-half-one');
actli.find('.tp-half-two').wrapInner('');
var oow = opt.width;
var ooh = opt.height;
if (opt.fullWidth=="on" || opt.fullSreen=="on") {
oow=opt.container.parent().width();
ooh=opt.container.parent().height();
}
// ANIMATE THE CUTS
var img=actli.find('.defaultimg');
if (img.length>0 && img.data("fullwidthcentering")=="on") {
var imgh=ooh/2;
var to=img.position().top;
} else {
var imgh=ooh/2;
var to=0;
}
actli.find('.tp-half-one').css({'width':oow+"px",'height':(to+imgh)+"px",'overflow':'hidden','position':'absolute','top':'0px','left':'0px'});
actli.find('.tp-half-two').css({'width':oow+"px",'height':(to+imgh)+"px",'overflow':'hidden','position':'absolute','top':(to+imgh)+'px','left':'0px'});
actli.find('.tp-half-two .tp-offset').css({'position':'absolute','top':(0-imgh-to)+'px','left':'0px'});
// Delegate .transition() calls to .animate()
// if the browser can't do CSS transitions.
if (!jQuery.support.transition) {
actli.find('.tp-half-one').animate({'opacity':0,'top':(0-ooh/2)+"px"},{duration: 500,queue:false});
actli.find('.tp-half-two').animate({'opacity':0,'top':(ooh)+"px"},{duration: 500,queue:false});
} else {
var ro1=Math.round(Math.random()*40-20);
var ro2=Math.round(Math.random()*40-20);
var sc1=Math.random()*1+1;
var sc2=Math.random()*1+1;
actli.find('.tp-half-one').transition({opacity:1, scale:sc1, rotate:ro1,y:(0-ooh/1.4)+"px"},800,'in');
actli.find('.tp-half-two').transition({opacity:1, scale:sc2, rotate:ro2,y:(0+ooh/1.4)+"px"},800,'in');
if (actli.html()!=null) nextli.transition({scale:0.8,x:opt.width*0.1, y:ooh*0.1, rotate:ro1},0).transition({rotate:0, scale:1,x:0,y:0},600,'snap');
}
nextsh.find('.defaultimg').css({'opacity':1});
setTimeout(function() {
// CLEAN UP BEFORE WE START
actli.css({'position':'absolute','z-index':18});
nextli.css({'position':'absolute','z-index':20});
nextsh.find('.defaultimg').css({'opacity':1});
actsh.find('.defaultimg').css({'opacity':0});
if (actli.find('.tp-half-one').length>0) {
actli.find('.tp-half-one >img, .tp-half-one >div').unwrap();
}
actli.find('.tp-half-two').remove();
opt.transition = 0;
opt.act = opt.next;
},800);
nextli.css({'opacity':1});
}
////////////////////////////////////////
// THE SLOTSLIDE - TRANSITION XVII. //
///////////////////////////////////////
if (nexttrans==17) { // 3D CURTAIN HORIZONTAL
masterspeed = masterspeed + 100;
if (opt.slots>10) opt.slots=10;
nextli.css({'opacity':1});
// PREPARE THE SLOTS HERE
prepareOneSlideV(actsh,opt,true);
prepareOneSlideV(nextsh,opt,false);
//SET DEFAULT IMG UNVISIBLE
nextsh.find('.defaultimg').css({'opacity':0});
//actsh.find('.defaultimg').css({'opacity':0});
// ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
nextsh.find('.slotslide').each(function(j) {
var ss=jQuery(this);
ss.transition({ opacity:0, rotateY:350 ,rotateX:40, perspective:'1400px'},0);
setTimeout(function() {
ss.transition({opacity:1, top:0, left:0, scale:1, perspective:'150px', rotate:0,rotateY:0, rotateX:0},masterspeed*2,function() {
if (j==opt.slots-1) {
removeSlots(container,opt);
nextsh.find('.defaultimg').css({'opacity':1});
if (nextli.index()!=actli.index()) actsh.find('.defaultimg').css({'opacity':0});
opt.act=opt.next;
moveSelectedThumb(container);
}
});
},j*100);
});
}
////////////////////////////////////////
// THE SLOTSLIDE - TRANSITION XVIII. //
///////////////////////////////////////
if (nexttrans==18) { // 3D CURTAIN VERTICAL
masterspeed = masterspeed + 100;
if (opt.slots>10) opt.slots=10;
nextli.css({'opacity':1});
// PREPARE THE SLOTS HERE
prepareOneSlide(actsh,opt,true);
prepareOneSlide(nextsh,opt,false);
//SET DEFAULT IMG UNVISIBLE
nextsh.find('.defaultimg').css({'opacity':0});
//actsh.find('.defaultimg').css({'opacity':0});
// ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
nextsh.find('.slotslide').each(function(j) {
var ss=jQuery(this);
ss.transition({ rotateX:10 ,rotateY:310, perspective:'1400px', rotate:0,opacity:0},0);
setTimeout(function() {
ss.transition({top:0, left:0, scale:1, perspective:'150px', rotate:0,rotateY:0, rotateX:0,opacity:1},masterspeed*2,function() {
if (j==opt.slots-1) {
removeSlots(container,opt);
nextsh.find('.defaultimg').css({'opacity':1});
if (nextli.index()!=actli.index()) actsh.find('.defaultimg').css({'opacity':0});
opt.act=opt.next;
moveSelectedThumb(container);
}
});
},j*100);
});
}
////////////////////////////////////////
// THE SLOTSLIDE - TRANSITION XIX. //
///////////////////////////////////////
if (nexttrans==19) { // CUBIC VERTICAL
masterspeed = masterspeed + 100;
if (opt.slots>10) opt.slots=10;
nextli.css({'opacity':1});
// PREPARE THE SLOTS HERE
prepareOneSlide(actsh,opt,true);
prepareOneSlide(nextsh,opt,false);
//SET DEFAULT IMG UNVISIBLE
nextsh.find('.defaultimg').css({'opacity':0});
//actsh.find('.defaultimg').css({'opacity':0});
var chix=nextli.css('z-index');
var chix2=actli.css('z-index');
//actli.css({'z-index':22});
// ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
nextsh.find('.slotslide').each(function(j) {
var ss=jQuery(this);
//ss.css({'overflow':'visible'});
ss.parent().css({'overflow':'visible'});
ss.css({'background':'#333'});
if (direction==1)
ss.transition({ opacity:0,left:0,top:opt.height/2,rotate3d:'1, 0, 0, -90deg '},0);
else
ss.transition({ opacity:0,left:0,top:0-opt.height/2,rotate3d:'1, 0, 0, 90deg '},0);
setTimeout(function() {
ss.transition({opacity:1,top:0,perspective:opt.height*2,rotate3d:' 1, 0, 0, 0deg '},masterspeed*2,function() {
if (j==opt.slots-1) {
removeSlots(container,opt);
nextsh.find('.defaultimg').css({'opacity':1});
if (nextli.index()!=actli.index()) actsh.find('.defaultimg').css({'opacity':0});
opt.act=opt.next;
moveSelectedThumb(container);
}
});
},j*150);
});
actsh.find('.slotslide').each(function(j) {
var ss=jQuery(this);
ss.parent().css({'overflow':'visible'});
ss.css({'background':'#333'});
ss.transition({ top:0,rotate3d: '1, 0, 0, 0deg'},0);
actsh.find('.defaultimg').css({'opacity':0});
setTimeout(function() {
if (direction==1)
ss.transition({opacity:0.6,left:0,perspective: opt.height*2,top:0-opt.height/2,rotate3d: '1, 0, 0, 90deg'},masterspeed*2,function() {});
else
ss.transition({opacity:0.6,left:0,perspective: opt.height*2,top:(0+opt.height/2),rotate3d: '1, 0, 0, -90deg'},masterspeed*2,function() {});
},j*150);
});
}
////////////////////////////////////////
// THE SLOTSLIDE - TRANSITION XX. //
///////////////////////////////////////
if (nexttrans==20) { // FLYIN
masterspeed = masterspeed + 100;
if (opt.slots>10) opt.slots=10;
nextli.css({'opacity':1});
// PREPARE THE SLOTS HERE
prepareOneSlideV(actsh,opt,true);
prepareOneSlideV(nextsh,opt,false);
//SET DEFAULT IMG UNVISIBLE
nextsh.find('.defaultimg').css({'opacity':0});
//actsh.find('.defaultimg').css({'opacity':0});
// ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
nextsh.find('.slotslide').each(function(j) {
var ss=jQuery(this);
ss.parent().css({'overflow':'visible'});
if (direction==1)
ss.transition({ scale:0.8,top:0,left:0-opt.width,rotate3d: '2, 5, 0, 110deg'},0);
else
ss.transition({ scale:0.8,top:0,left:0+opt.width,rotate3d: '2, 5, 0, -110deg'},0);
setTimeout(function() {
ss.transition({ scale:0.8,left:0,perspective: opt.width,rotate3d: '1, 5, 0, 0deg'},masterspeed*2,'ease').transition({scale:1},200,'out',function() {
if (j==opt.slots-1) {
removeSlots(container,opt);
nextsh.find('.defaultimg').css({'opacity':1});
if (nextli.index()!=actli.index()) actsh.find('.defaultimg').css({'opacity':0});
opt.act=opt.next;
moveSelectedThumb(container);
}
});
},j*100);
});
actsh.find('.slotslide').each(function(j) {
var ss=jQuery(this);
ss.transition({ scale:0.5,left:0,rotate3d: '1, 5, 0, 5deg'},300,'in-out');
actsh.find('.defaultimg').css({'opacity':0});
setTimeout(function() {
if (direction==1)
ss.transition({top:0,left:opt.width/2,perspective: opt.width,rotate3d: '0, -3, 0, 70deg',opacity:0},masterspeed*2,'out',function() {});
else
ss.transition({top:0,left:0-opt.width/2,perspective: opt.width,rotate3d: '0, -3, 0, -70deg',opacity:0},masterspeed*2,'out',function() {});
},j*100);
});
}
////////////////////////////////////////
// THE SLOTSLIDE - TRANSITION XX. //
///////////////////////////////////////
if (nexttrans==21) { // TURNOFF
masterspeed = masterspeed + 100;
if (opt.slots>10) opt.slots=10;
nextli.css({'opacity':1});
// PREPARE THE SLOTS HERE
prepareOneSlideV(actsh,opt,true);
prepareOneSlideV(nextsh,opt,false);
//SET DEFAULT IMG UNVISIBLE
nextsh.find('.defaultimg').css({'opacity':0});
//actsh.find('.defaultimg').css({'opacity':0});
// ALL NEW SLOTS SHOULD BE SLIDED FROM THE LEFT TO THE RIGHT
nextsh.find('.slotslide').each(function(j) {
var ss=jQuery(this);
if (direction==1)
ss.transition({ top:0,left:0-(opt.width),rotate3d: '0, 1, 0, 90deg'},0);
else
ss.transition({ top:0,left:0+(opt.width),rotate3d: '0, 1, 0, -90deg'},0);
setTimeout(function() {
ss.transition({left:0,perspective: opt.width*2,rotate3d: '0, 0, 0, 0deg'},masterspeed*2,function() {
if (j==opt.slots-1) {
removeSlots(container,opt);
nextsh.find('.defaultimg').css({'opacity':1});
if (nextli.index()!=actli.index()) actsh.find('.defaultimg').css({'opacity':0});
opt.act=opt.next;
moveSelectedThumb(container);
}
});
},j*100);
});
actsh.find('.slotslide').each(function(j) {
var ss=jQuery(this);
ss.transition({ left:0,rotate3d: '0, 0, 0, 0deg'},0);
actsh.find('.defaultimg').css({'opacity':0});
setTimeout(function() {
if (direction==1)
ss.transition({top:0,left:(opt.width/2),perspective: opt.width,rotate3d: '0, 1, 0, -90deg'},masterspeed*1.5,function() {});
else
ss.transition({top:0,left:(0-opt.width/2),perspective: opt.width,rotate3d: '0, 1, 0, +90deg'},masterspeed*1.5,function() {});
},j*100);
});
}
var data={};
data.slideIndex=opt.next+1;
container.trigger('revolution.slide.onchange',data);
setTimeout(function() { container.trigger('revolution.slide.onafterswap'); },masterspeed);
container.trigger('revolution.slide.onvideostop');
}
function onYouTubePlayerAPIReady() {
}
//////////////////////////////////////////
// CHANG THE YOUTUBE PLAYER STATE HERE //
////////////////////////////////////////
function onPlayerStateChange(event) {
if (event.data == YT.PlayerState.PLAYING) {
var bt = jQuery('body').find('.tp-bannertimer');
var opt = bt.data('opt');
bt.stop();
opt.videoplaying=true;
//console.log("VideoPlay set to True due onPlayerStateChange PLAYING");
opt.videostartednow=1;
} else {
var bt = jQuery('body').find('.tp-bannertimer');
var opt = bt.data('opt');
if (event.data!=-1) {
if (opt.conthover==0)
bt.animate({'width':"100%"},{duration:((opt.delay-opt.cd)-100),queue:false, easing:"linear"});
opt.videoplaying=false;
opt.videostoppednow=1;
//console.log("VideoPlay set to False due onPlayerStateChange PAUSE");
}
}
if (event.data==0 && opt.nextslideatend==true)
opt.container.revnext();
}
///////////////////////////////
// YOUTUBE VIDEO AUTOPLAY //
///////////////////////////////
function onPlayerReady(event) {
event.target.playVideo();
}
////////////////////////
// VIMEO ADD EVENT /////
////////////////////////
function addEvent(element, eventName, callback) {
if (element.addEventListener) {
element.addEventListener(eventName, callback, false);
}
else {
element.attachEvent(eventName, callback, false);
}
}
//////////////////////////////////////////
// CHANGE THE YOUTUBE PLAYER STATE HERE //
////////////////////////////////////////
function vimeoready(player_id) {
var froogaloop = $f(player_id);
//jQuery('#debug').html(jQuery('#debug').html()+"
Frooga Func"+Math.round(Math.random()*100));
froogaloop.addEvent('ready', function(data) {
//jQuery('#debug').html(jQuery('#debug').html()+"
Ready"+Math.round(Math.random()*100));
froogaloop.addEvent('play', function(data) {
//jQuery('#debug').html(jQuery('#debug').html()+"
Play"+Math.round(Math.random()*100));
var bt = jQuery('body').find('.tp-bannertimer');
var opt = bt.data('opt');
bt.stop();
opt.videoplaying=true;
//console.log("VideoPlay set to True due vimeoready PLAYING");
});
froogaloop.addEvent('finish', function(data) {
var bt = jQuery('body').find('.tp-bannertimer');
var opt = bt.data('opt');
if (opt.conthover==0)
bt.animate({'width':"100%"},{duration:((opt.delay-opt.cd)-100),queue:false, easing:"linear"});
opt.videoplaying=false;
//console.log("VideoPlay set to False due vimeoready FINNSIH");
opt.videostartednow=1;
if (opt.nextslideatend==true)
opt.container.revnext();
});
froogaloop.addEvent('pause', function(data) {
var bt = jQuery('body').find('.tp-bannertimer');
var opt = bt.data('opt');
if (opt.conthover==0)
bt.animate({'width':"100%"},{duration:((opt.delay-opt.cd)-100),queue:false, easing:"linear"});
opt.videoplaying=false;
//console.log("VideoPlay set to False due vimeoready PAUSE");
opt.videostoppednow=1;
});
});
}
/////////////////////////////////////
// EVENT HANDLING FOR VIMEO VIDEOS //
/////////////////////////////////////
function vimeoready_auto(player_id) {
var froogaloop = $f(player_id);
froogaloop.addEvent('ready', function(data) {
froogaloop.api('play');
});
froogaloop.addEvent('play', function(data) {
var bt = jQuery('body').find('.tp-bannertimer');
var opt = bt.data('opt');
bt.stop();
opt.videoplaying=true;
//console.log("VideoPlay set to True due vimeoready_auto PLAYING");
});
froogaloop.addEvent('finish', function(data) {
var bt = jQuery('body').find('.tp-bannertimer');
var opt = bt.data('opt');
if (opt.conthover==0)
bt.animate({'width':"100%"},{duration:((opt.delay-opt.cd)-100),queue:false, easing:"linear"});
opt.videoplaying=false;
//console.log("VideoPlay set to False due vimeoready_auto FINISH");
opt.videostartednow=1;
if (opt.nextslideatend==true)
opt.container.revnext();
});
froogaloop.addEvent('pause', function(data) {
var bt = jQuery('body').find('.tp-bannertimer');
var opt = bt.data('opt');
if (opt.conthover==0)
bt.animate({'width':"100%"},{duration:((opt.delay-opt.cd)-100),queue:false, easing:"linear"});
opt.videoplaying=false;
//console.log("VideoPlay set to False due vimeoready_auto PAUSE");
opt.videostoppednow=1;
});
}
///////////////////////////////////////
// EVENT HANDLING FOR VIDEO JS VIDEOS //
////////////////////////////////////////
function html5vidready(myPlayer) {
myPlayer.on("play",function() {
var bt = jQuery('body').find('.tp-bannertimer');
var opt = bt.data('opt');
bt.stop();
try{
opt.videoplaying=true;
} catch(e) {}
//console.log("VideoPlay set to True due html5vidready PLAYING");
});
myPlayer.on("pause",function() {
var bt = jQuery('body').find('.tp-bannertimer');
var opt = bt.data('opt');
if (opt.conthover==0)
bt.animate({'width':"100%"},{duration:((opt.delay-opt.cd)-100),queue:false, easing:"linear"});
opt.videoplaying=false;
//console.log("VideoPlay set to False due html5vidready pause");
opt.videostoppednow=1;
});
myPlayer.on("ended",function() {
var bt = jQuery('body').find('.tp-bannertimer');
var opt = bt.data('opt');
if (opt.conthover==0)
bt.animate({'width':"100%"},{duration:((opt.delay-opt.cd)-100),queue:false, easing:"linear"});
opt.videoplaying=false;
//console.log("VideoPlay set to False due html5vidready pause");
opt.videostoppednow=1;
if (opt.nextslideatend==true)
opt.container.revnext();
});
}
////////////////////////
// SHOW THE CAPTION //
///////////////////////
function animateTheCaptions(nextli, opt,actli) {
//if (jQuery("body").find('#debug').length==0)
// jQuery("body").append('');
var offsetx=0;
var offsety=0;
nextli.find('.tp-caption').each(function(i) {
offsetx = opt.width/2 - opt.startwidth/2;
if (opt.bh>1) {
opt.bw=1;
opt.bh=1;
}
if (opt.bw>1) {
opt.bw=1;
opt.bh=1;
}
var xbw = opt.bw;
var xbh = opt.bh;
if (opt.fullScreen=="on")
offsety = opt.height/2 - (opt.startheight*opt.bh)/2;
if (offsety<0) offsety=0;
var nextcaption=nextli.find('.tp-caption:eq('+i+')');
var handlecaption=0;
// HIDE CAPTION IF RESOLUTION IS TOO LOW
if (opt.width0) {
nextcaption.find('iframe').each(function() {
var ifr=jQuery(this);
if (ifr.attr('src').toLowerCase().indexOf('youtube')>=0) {
opt.nextslideatend = nextcaption.data('nextslideatend');
if (!ifr.hasClass("HasListener")) {
try {
ifr.attr('id',frameID);
var player;
if (nextcaption.data('autoplay')==true)
player = new YT.Player(frameID, {
events: {
"onStateChange": onPlayerStateChange,
'onReady': onPlayerReady
}
});
else
player = new YT.Player(frameID, {
events: {
"onStateChange": onPlayerStateChange
}
});
ifr.addClass("HasListener");
nextcaption.data('player',player);
if (nextcaption.data('autoplay')==true) {
var bt=jQuery('body').find('#'+opt.container.attr('id')).find('.tp-bannertimer');
setTimeout(function(){
bt.stop();
opt.videoplaying=true;
},200);
//console.log("VideoPlay set to True due youtube 1st load AutoPlay");
}
} catch(e) {}
} else {
if (nextcaption.data('autoplay')==true) {
var player=nextcaption.data('player');
player.playVideo();
var bt=jQuery('body').find('#'+opt.container.attr('id')).find('.tp-bannertimer');
setTimeout(function(){
bt.stop();
opt.videoplaying=true;
},200);
//console.log("VideoPlay set to True due youtube 2nd load AutoPlay");
}
}
} else {
if (ifr.attr('src').toLowerCase().indexOf('vimeo')>=0) {
opt.nextslideatend = nextcaption.data('nextslideatend');
if (!ifr.hasClass("HasListener")) {
ifr.addClass("HasListener");
ifr.attr('id',frameID);
var isrc = ifr.attr('src');
var queryParameters = {}, queryString = isrc,
re = /([^&=]+)=([^&]*)/g, m;
// Creates a map with the query string parameters
while (m = re.exec(queryString)) {
queryParameters[decodeURIComponent(m[1])] = decodeURIComponent(m[2]);
}
if (queryParameters['player_id']!=undefined) {
isrc = isrc.replace(queryParameters['player_id'],frameID);
} else {
isrc=isrc+"&player_id="+frameID;
}
try{
isrc = isrc.replace('api=0','api=1');
} catch(e) {}
isrc=isrc+"&api=1";
ifr.attr('src',isrc);
var player = nextcaption.find('iframe')[0];
if (nextcaption.data('autoplay')==true) {
$f(player).addEvent('ready', vimeoready_auto);
var bt=jQuery('body').find('#'+opt.container.attr('id')).find('.tp-bannertimer');
setTimeout(function(){
bt.stop();
opt.videoplaying=true;
},200);
//console.log("VideoPlay set to True due vimeo 1st load AutoPlay");
} else {
$f(player).addEvent('ready', vimeoready);
}
} else {
if (nextcaption.data('autoplay')==true) {
var ifr = nextcaption.find('iframe');
var id = ifr.attr('id');
var froogaloop = $f(id);
froogaloop.api("pause");
var bt=jQuery('body').find('#'+opt.container.attr('id')).find('.tp-bannertimer');
setTimeout(function(){
bt.stop();
opt.videoplaying=true;
},200);
//console.log("VideoPlay set to True due youtube 2nd load AutoPlay");
}
}
}
}
});
}
// IF HTML5 VIDEO IS EMBEDED
if (nextcaption.find('video').length>0) {
nextcaption.find('video').each(function(i) {
var html5vid = jQuery(this).parent();
if (html5vid.hasClass("video-js")) {
opt.nextslideatend = nextcaption.data('nextslideatend');
if (!html5vid.hasClass("HasListener")) {
html5vid.addClass("HasListener");
var videoID = "videoid_"+Math.round(Math.random()*1000+1);
html5vid.attr('id',videoID);
videojs(videoID).ready(function(){
html5vidready(this)
});
} else {
videoID = html5vid.attr('id');
}
if (nextcaption.data('autoplay')==true) {
var bt=jQuery('body').find('#'+opt.container.attr('id')).find('.tp-bannertimer');
setTimeout(function(){
bt.stop();
opt.videoplaying=true;
},200);
//console.log("VideoPlay set to True due HTML5 VIDEO 1st/2nd load AutoPlay");
videojs(videoID).ready(function(){
var myPlayer = this;
html5vid.data('timerplay',setTimeout(function() {
myPlayer.play();
},nextcaption.data('start')));
});
}
if (html5vid.data('ww') == undefined) html5vid.data('ww',html5vid.width());
if (html5vid.data('hh') == undefined) html5vid.data('hh',html5vid.height());
videojs(videoID).ready(function(){
if (!nextcaption.hasClass("fullscreenvideo")) {
var myPlayer = videojs(videoID);
try{
myPlayer.width(html5vid.data('ww')*opt.bw);
myPlayer.height(html5vid.data('hh')*opt.bh);
} catch(e) {}
}
});
}
});
} // END OF VIDEO JS FUNCTIONS
if (nextcaption.hasClass("randomrotate") && (opt.ie || opt.ie9)) nextcaption.removeClass("randomrotate").addClass("sfb");
nextcaption.removeClass('noFilterClass');
var imw =0;
var imh = 0;
if (nextcaption.find('img').length>0) {
var im = nextcaption.find('img');
if (im.data('ww') == undefined) im.data('ww',im.width());
if (im.data('hh') == undefined) im.data('hh',im.height());
var ww = im.data('ww');
var hh = im.data('hh');
im.width(ww*opt.bw);
im.height(hh*opt.bh);
imw = im.width();
imh = im.height();
} else {
if (nextcaption.find('iframe').length>0) {
var im = nextcaption.find('iframe');
if (nextcaption.data('ww') == undefined) {
nextcaption.data('ww',im.width());
}
if (nextcaption.data('hh') == undefined) nextcaption.data('hh',im.height());
var ww = nextcaption.data('ww');
var hh = nextcaption.data('hh');
var nc =nextcaption;
if (nc.data('fsize') == undefined) nc.data('fsize',parseInt(nc.css('font-size'),0) || 0);
if (nc.data('pt') == undefined) nc.data('pt',parseInt(nc.css('paddingTop'),0) || 0);
if (nc.data('pb') == undefined) nc.data('pb',parseInt(nc.css('paddingBottom'),0) || 0);
if (nc.data('pl') == undefined) nc.data('pl',parseInt(nc.css('paddingLeft'),0) || 0);
if (nc.data('pr') == undefined) nc.data('pr',parseInt(nc.css('paddingRight'),0) || 0);
if (nc.data('mt') == undefined) nc.data('mt',parseInt(nc.css('marginTop'),0) || 0);
if (nc.data('mb') == undefined) nc.data('mb',parseInt(nc.css('marginBottom'),0) || 0);
if (nc.data('ml') == undefined) nc.data('ml',parseInt(nc.css('marginLeft'),0) || 0);
if (nc.data('mr') == undefined) nc.data('mr',parseInt(nc.css('marginRight'),0) || 0);
if (nc.data('bt') == undefined) nc.data('bt',parseInt(nc.css('borderTop'),0) || 0);
if (nc.data('bb') == undefined) nc.data('bb',parseInt(nc.css('borderBottom'),0) || 0);
if (nc.data('bl') == undefined) nc.data('bl',parseInt(nc.css('borderLeft'),0) || 0);
if (nc.data('br') == undefined) nc.data('br',parseInt(nc.css('borderRight'),0) || 0);
if (nc.data('lh') == undefined) nc.data('lh',parseInt(nc.css('lineHeight'),0) || 0);
var fvwidth=opt.width;
var fvheight=opt.height;
if (fvwidth>opt.startwidth) fvwidth=opt.startwidth;
if (fvheight>opt.startheight) fvheight=opt.startheight;
if (!nextcaption.hasClass('fullscreenvideo'))
nextcaption.css({
'font-size': (nc.data('fsize') * opt.bw)+"px",
'padding-top': (nc.data('pt') * opt.bh) + "px",
'padding-bottom': (nc.data('pb') * opt.bh) + "px",
'padding-left': (nc.data('pl') * opt.bw) + "px",
'padding-right': (nc.data('pr') * opt.bw) + "px",
'margin-top': (nc.data('mt') * opt.bh) + "px",
'margin-bottom': (nc.data('mb') * opt.bh) + "px",
'margin-left': (nc.data('ml') * opt.bw) + "px",
'margin-right': (nc.data('mr') * opt.bw) + "px",
'border-top': (nc.data('bt') * opt.bh) + "px",
'border-bottom': (nc.data('bb') * opt.bh) + "px",
'border-left': (nc.data('bl') * opt.bw) + "px",
'border-right': (nc.data('br') * opt.bw) + "px",
'line-height': (nc.data('lh') * opt.bh) + "px",
'height':(hh*opt.bh)+'px',
'white-space':"nowrap"
});
else
nextcaption.css({
'width':opt.startwidth*opt.bw,
'height':opt.startheight*opt.bh
});
im.width(ww*opt.bw);
im.height(hh*opt.bh);
imw = im.width();
imh = im.height();
} else {
nextcaption.find('.tp-resizeme, .tp-resizeme *').each(function() {
calcCaptionResponsive(jQuery(this),opt);
});
if (nextcaption.hasClass("tp-resizeme")) {
nextcaption.find('*').each(function() {
calcCaptionResponsive(jQuery(this),opt);
});
}
calcCaptionResponsive(nextcaption,opt);
imh=nextcaption.outerHeight(true);
imw=nextcaption.outerWidth(true);
// NEXTCAPTION FRONTCORNER CHANGES
var ncch = nextcaption.outerHeight();
var bgcol = nextcaption.css('backgroundColor');
nextcaption.find('.frontcorner').css({
'borderWidth':ncch+"px",
'left':(0-ncch)+'px',
'borderRight':'0px solid transparent',
'borderTopColor':bgcol
});
nextcaption.find('.frontcornertop').css({
'borderWidth':ncch+"px",
'left':(0-ncch)+'px',
'borderRight':'0px solid transparent',
'borderBottomColor':bgcol
});
// NEXTCAPTION BACKCORNER CHANGES
nextcaption.find('.backcorner').css({
'borderWidth':ncch+"px",
'right':(0-ncch)+'px',
'borderLeft':'0px solid transparent',
'borderBottomColor':bgcol
});
// NEXTCAPTION BACKCORNER CHANGES
nextcaption.find('.backcornertop').css({
'borderWidth':ncch+"px",
'right':(0-ncch)+'px',
'borderLeft':'0px solid transparent',
'borderTopColor':bgcol
});
}
}
if (nextcaption.data('voffset')==undefined) nextcaption.data('voffset',0);
if (nextcaption.data('hoffset')==undefined) nextcaption.data('hoffset',0);
var vofs= nextcaption.data('voffset')*xbw;
var hofs= nextcaption.data('hoffset')*xbw;
var crw = opt.startwidth*xbw;
var crh = opt.startheight*xbw;
// CENTER THE CAPTION HORIZONTALLY
if (nextcaption.data('x')=="center" || nextcaption.data('xcenter')=='center') {
nextcaption.data('xcenter','center');
nextcaption.data('x',(crw/2 - nextcaption.outerWidth(true)/2)/xbw+ hofs);
}
// ALIGN LEFT THE CAPTION HORIZONTALLY
if (nextcaption.data('x')=="left" || nextcaption.data('xleft')=='left') {
nextcaption.data('xleft','left');
nextcaption.data('x',(0)/xbw+hofs);
}
// ALIGN RIGHT THE CAPTION HORIZONTALLY
if (nextcaption.data('x')=="right" || nextcaption.data('xright')=='right') {
nextcaption.data('xright','right');
nextcaption.data('x',((crw - nextcaption.outerWidth(true))+hofs)/xbw);
//console.log("crw:"+crw+" width:"+nextcaption.outerWidth(true)+" xbw:"+xbw);
//console.log("x-pos:"+nextcaption.data('x'))
}
// CENTER THE CAPTION VERTICALLY
if (nextcaption.data('y')=="center" || nextcaption.data('ycenter')=='center') {
nextcaption.data('ycenter','center');
nextcaption.data('y',(crh/2 - nextcaption.outerHeight(true)/2)/opt.bh + vofs);
}
// ALIGN TOP THE CAPTION VERTICALLY
if (nextcaption.data('y')=="top" || nextcaption.data('ytop')=='top') {
nextcaption.data('ytop','top');
nextcaption.data('y',(0)/opt.bh+vofs);
}
// ALIGN BOTTOM THE CAPTION VERTICALLY
if (nextcaption.data('y')=="bottom" || nextcaption.data('ybottom')=='bottom') {
nextcaption.data('ybottom','bottom');
nextcaption.data('y',((crh - nextcaption.outerHeight(true))+vofs)/xbw);
}
if (nextcaption.hasClass('fade')) {
nextcaption.css({'opacity':0,'left':(xbw*nextcaption.data('x')+offsetx)+'px','top':(opt.bh*nextcaption.data('y')+offsety)+"px"});
}
if (nextcaption.hasClass("randomrotate")) {
nextcaption.css({'left':(xbw*nextcaption.data('x')+offsetx)+'px','top':((xbh*nextcaption.data('y'))+offsety)+"px" });
var sc=Math.random()*2+1;
var ro=Math.round(Math.random()*200-100);
var xx=Math.round(Math.random()*200-100);
var yy=Math.round(Math.random()*200-100);
nextcaption.data('repx',xx);
nextcaption.data('repy',yy);
nextcaption.data('repo',nextcaption.css('opacity'));
nextcaption.data('rotate',ro);
nextcaption.data('scale',sc);
nextcaption.transition({opacity:0, scale:sc, rotate:ro, x:xx, y: yy,duration: '0ms'});
} else {
if (opt.ie || opt.ie9 )
{}
else {
if (nextcaption.find('iframe').length==0)
nextcaption.transition({ scale:1, rotate:0});
}
}
if (nextcaption.hasClass('lfr')) {
nextcaption.css({'opacity':1,'left':(15+opt.width)+'px','top':(opt.bh*nextcaption.data('y')+offsety)+"px"});
}
if (nextcaption.hasClass('lfl')) {
nextcaption.css({'opacity':1,'left':(-15-imw)+'px','top':(opt.bh*nextcaption.data('y')+offsety)+"px"});
}
if (nextcaption.hasClass('sfl')) {
nextcaption.css({'opacity':0,'left':((xbw*nextcaption.data('x'))-50+offsetx)+'px','top':(opt.bh*nextcaption.data('y')+offsety)+"px"});
}
if (nextcaption.hasClass('sfr')) {
nextcaption.css({'opacity':0,'left':((xbw*nextcaption.data('x'))+50+offsetx)+'px','top':(opt.bh*nextcaption.data('y')+offsety)+"px"});
}
if (nextcaption.hasClass('lft')) {
nextcaption.css({'opacity':1,'left':(xbw*nextcaption.data('x')+offsetx)+'px','top':(-25 - imh)+"px"});
}
if (nextcaption.hasClass('lfb')) {
nextcaption.css({'opacity':1,'left':(xbw*nextcaption.data('x')+offsetx)+'px','top':(25+opt.height)+"px"});
}
if (nextcaption.hasClass('sft')) {
nextcaption.css({'opacity':0,'left':(xbw*nextcaption.data('x')+offsetx)+'px','top':((opt.bh*nextcaption.data('y')+offsety)-50)+"px"});
}
if (nextcaption.hasClass('sfb')) {
nextcaption.css({'opacity':0,'left':(xbw*nextcaption.data('x')+offsetx)+'px','top':((opt.bh*nextcaption.data('y')+offsety)+50)+"px"});
}
nextcaption.data('timer',setTimeout(function() {
var easetype=nextcaption.data('easing');
if (easetype==undefined) easetype="linear";
nextcaption.css({'visibility':'visible'});
if (nextcaption.hasClass('fade')) {
nextcaption.data('repo',nextcaption.css('opacity'));
//nextcaption.animate({'opacity':1},{duration:nextcaption.data('speed'),complete:function() { if (opt.ie) jQuery(this).addClass('noFilterClass');}});
nextcaption.transition({'opacity':1,duration:nextcaption.data('speed')});
//if (opt.ie) nextcaption.addClass('noFilterClass');
}
if (nextcaption.hasClass("randomrotate")) {
easetype = easetype.replace('Elastic','Back');
easetype = easetype.replace('Bounce','Back');
nextcaption.transition({opacity:1, scale:1, 'left':(xbw*nextcaption.data('x')+offsetx)+'px','top':(xbh*(nextcaption.data('y'))+offsety)+"px", rotate:0, x:0, y:0,duration: nextcaption.data('speed'), easing:easetype});
if (opt.ie) nextcaption.addClass('noFilterClass');
}
if (nextcaption.hasClass('lfr') ||
nextcaption.hasClass('lfl') ||
nextcaption.hasClass('sfr') ||
nextcaption.hasClass('sfl') ||
nextcaption.hasClass('lft') ||
nextcaption.hasClass('lfb') ||
nextcaption.hasClass('sft') ||
nextcaption.hasClass('sfb')
)
{
nextcaption.data('repx',nextcaption.position().left);
nextcaption.data('repy',nextcaption.position().top);
nextcaption.data('repo',nextcaption.css('opacity'));
if (easetype.indexOf("Bounce")>=0 || easetype.indexOf("Elastic")>=0)
nextcaption.animate({'opacity':1,'left':(xbw*nextcaption.data('x')+offsetx)+'px','top':opt.bh*(nextcaption.data('y'))+offsety+"px"},{duration:nextcaption.data('speed'), easing:easetype,complete:function() { if (opt.ie) jQuery(this).addClass('noFilterClass');}});
else
nextcaption.transition({'opacity':1,'left':(xbw*nextcaption.data('x')+offsetx)+'px','top':opt.bh*(nextcaption.data('y'))+offsety+"px",duration:nextcaption.data('speed'), easing:easetype});
//if (opt.ie) nextcaption.addClass('noFilterClass');
}
},nextcaption.data('start')));
// IF THERE IS ANY EXIT ANIM DEFINED
if (nextcaption.data('end')!=undefined)
nextcaption.data('timer-end',setTimeout(function() {
if ((opt.ie || opt.ie9) && (nextcaption.hasClass("randomrotate") || nextcaption.hasClass("randomrotateout"))) {
nextcaption.removeClass("randomrotate").removeClass("randomrotateout").addClass('fadeout');
}
endMoveCaption(nextcaption,opt);
},nextcaption.data('end')));
}
})
var bt=jQuery('body').find('#'+opt.container.attr('id')).find('.tp-bannertimer');
bt.data('opt',opt);
}
/////////////////////////////////////////////////////////////////
// - CALCULATE THE RESPONSIVE SIZES OF THE CAPTIONS - //
/////////////////////////////////////////////////////////////////
function calcCaptionResponsive(nc,opt) {
if (nc.data('fsize') == undefined) nc.data('fsize',parseInt(nc.css('font-size'),0) || 0);
if (nc.data('pt') == undefined) nc.data('pt',parseInt(nc.css('paddingTop'),0) || 0);
if (nc.data('pb') == undefined) nc.data('pb',parseInt(nc.css('paddingBottom'),0) || 0);
if (nc.data('pl') == undefined) nc.data('pl',parseInt(nc.css('paddingLeft'),0) || 0);
if (nc.data('pr') == undefined) nc.data('pr',parseInt(nc.css('paddingRight'),0) || 0);
if (nc.data('mt') == undefined) nc.data('mt',parseInt(nc.css('marginTop'),0) || 0);
if (nc.data('mb') == undefined) nc.data('mb',parseInt(nc.css('marginBottom'),0) || 0);
if (nc.data('ml') == undefined) nc.data('ml',parseInt(nc.css('marginLeft'),0) || 0);
if (nc.data('mr') == undefined) nc.data('mr',parseInt(nc.css('marginRight'),0) || 0);
if (nc.data('bt') == undefined) nc.data('bt',parseInt(nc.css('borderTopWidth'),0) || 0);
if (nc.data('bb') == undefined) nc.data('bb',parseInt(nc.css('borderBottomWidth'),0) || 0);
if (nc.data('bl') == undefined) nc.data('bl',parseInt(nc.css('borderLeftWidth'),0) || 0);
if (nc.data('br') == undefined) nc.data('br',parseInt(nc.css('borderRightWidth'),0) || 0);
if (nc.data('lh') == undefined) nc.data('lh',parseInt(nc.css('lineHeight'),0) || 0);
if (nc.data('minwidth') == undefined) nc.data('minwidth',parseInt(nc.css('minWidth'),0) || 0);
if (nc.data('minheight') == undefined) nc.data('minheight',parseInt(nc.css('minHeight'),0) || 0);
if (nc.data('maxwidth') == undefined) nc.data('maxwidth',parseInt(nc.css('maxWidth'),0) || "none");
if (nc.data('maxheight') == undefined) nc.data('maxheight',parseInt(nc.css('maxHeight'),0) || "none");
nc.css({
'font-size': Math.round((nc.data('fsize') * opt.bw))+"px",
'padding-top': Math.round((nc.data('pt') * opt.bh)) + "px",
'padding-bottom': Math.round((nc.data('pb') * opt.bh)) + "px",
'padding-left': Math.round((nc.data('pl') * opt.bw)) + "px",
'padding-right': Math.round((nc.data('pr') * opt.bw)) + "px",
'margin-top': (nc.data('mt') * opt.bh) + "px",
'margin-bottom': (nc.data('mb') * opt.bh) + "px",
'margin-left': (nc.data('ml') * opt.bw) + "px",
'margin-right': (nc.data('mr') * opt.bw) + "px",
'borderTopWidth': Math.round((nc.data('bt') * opt.bh)) + "px",
'borderBottomWidth': Math.round((nc.data('bb') * opt.bh)) + "px",
'borderLeftWidth': Math.round((nc.data('bl') * opt.bw)) + "px",
'borderRightWidth': Math.round((nc.data('br') * opt.bw)) + "px",
'line-height': Math.round((nc.data('lh') * opt.bh)) + "px",
'white-space':"nowrap",
'minWidth':(nc.data('minwidth') * opt.bw) + "px",
'minHeight':(nc.data('minheight') * opt.bh) + "px",
});
//console.log(nc.data('maxwidth')+" "+nc.data('maxheight'));
if (nc.data('maxheight')!='none')
nc.css({'maxHeight':(nc.data('maxheight') * opt.bh) + "px"});
if (nc.data('maxwidth')!='none')
nc.css({'maxWidth':(nc.data('maxwidth') * opt.bw) + "px"});
}
//////////////////////////
// REMOVE THE CAPTIONS //
/////////////////////////
function removeTheCaptions(actli,opt) {
actli.find('.tp-caption').each(function(i) {
var nextcaption=actli.find('.tp-caption:eq('+i+')');
nextcaption.stop(true,true);
clearTimeout(nextcaption.data('timer'));
clearTimeout(nextcaption.data('timer-end'));
var easetype=nextcaption.data('easing');
easetype="easeInOutSine";
var ll = nextcaption.data('repx');
var tt = nextcaption.data('repy');
var oo = nextcaption.data('repo');
var rot = nextcaption.data('rotate');
var sca = nextcaption.data('scale');
if (nextcaption.find('iframe').length>0) {
// VIMEO VIDEO PAUSE
try {
var ifr = nextcaption.find('iframe');
var id = ifr.attr('id');
var froogaloop = $f(id);
froogaloop.api("pause");
} catch(e) {}
//YOU TUBE PAUSE
try {
var player=nextcaption.data('player');
player.stopVideo();
} catch(e) {}
}
// IF HTML5 VIDEO IS EMBEDED
if (nextcaption.find('video').length>0) {
try{
nextcaption.find('video').each(function(i) {
var html5vid = jQuery(this).parent();
var videoID =html5vid.attr('id');
clearTimeout(html5vid.data('timerplay'));
videojs(videoID).ready(function(){
var myPlayer = this;
myPlayer.pause();
});
})
}catch(e) {}
} // END OF VIDEO JS FUNCTIONS
try {
/*if (rot!=undefined || sca!=undefined)
{
if (rot==undefined) rot=0;
if (sca==undefined) sca=1;
nextcaption.transition({'rotate':rot, 'scale':sca, 'opacity':0,'left':ll+'px','top':tt+"px"},(nextcaption.data('speed')+10), function() { nextcaption.removeClass('noFilterClass');nextcaption.css({'visibility':'hidden'})});
} else {
nextcaption.animate({'opacity':0,'left':ll+'px','top':tt+"px"},{duration:(nextcaption.data('speed')+10), easing:easetype, complete:function() { nextcaption.removeClass('noFilterClass');nextcaption.css({'visibility':'hidden'})}});
}*/
endMoveCaption(nextcaption,opt);
} catch(e) {}
});
}
//////////////////////////
// MOVE OUT THE CAPTIONS //
/////////////////////////
function endMoveCaption(nextcaption,opt) {
if (nextcaption.hasClass("randomrotate") && (opt.ie || opt.ie9)) nextcaption.removeClass("randomrotate").addClass("sfb");
if (nextcaption.hasClass("randomrotateout") && (opt.ie || opt.ie9)) nextcaption.removeClass("randomrotateout").addClass("stb");
var endspeed=nextcaption.data('endspeed');
if (endspeed==undefined) endspeed=nextcaption.data('speed');
var xx=nextcaption.data('repx');
var yy=nextcaption.data('repy');
var oo=nextcaption.data('repo');
if (opt.ie) {
nextcaption.css({'opacity':'inherit','filter':'inherit'});
}
if (nextcaption.hasClass('ltr') ||
nextcaption.hasClass('ltl') ||
nextcaption.hasClass('str') ||
nextcaption.hasClass('stl') ||
nextcaption.hasClass('ltt') ||
nextcaption.hasClass('ltb') ||
nextcaption.hasClass('stt') ||
nextcaption.hasClass('stb')
)
{
xx=nextcaption.position().left;
yy=nextcaption.position().top;
if (nextcaption.hasClass('ltr'))
xx=opt.width+60;
else if (nextcaption.hasClass('ltl'))
xx=0-nextcaption.width()-60;
else if (nextcaption.hasClass('ltt'))
yy=0-nextcaption.height()-60;
else if (nextcaption.hasClass('ltb'))
yy=opt.height+60;
else if (nextcaption.hasClass('str')) {
xx=xx+50;oo=0;
} else if (nextcaption.hasClass('stl')) {
xx=xx-50;oo=0;
} else if (nextcaption.hasClass('stt')) {
yy=yy-50;oo=0;
} else if (nextcaption.hasClass('stb')) {
yy=yy+50;oo=0;
}
var easetype=nextcaption.data('endeasing');
if (easetype==undefined) easetype="linear";
if (easetype.indexOf("Bounce")>=0 || easetype.indexOf("Elastic")>=0)
nextcaption.animate({'opacity':oo,'left':xx+'px','top':yy+"px"},{duration:nextcaption.data('endspeed'), easing:easetype,complete:function() { jQuery(this).css({visibility:'hidden'})}});
else
nextcaption.transition({'opacity':oo,'left':xx+'px','top':yy+"px",duration:nextcaption.data('endspeed'), easing:easetype});
if (opt.ie) nextcaption.removeClass('noFilterClass');
}
else
if ( nextcaption.hasClass("randomrotateout")) {
nextcaption.transition({opacity:0, scale:Math.random()*2+0.3, 'left':Math.random()*opt.width+'px','top':Math.random()*opt.height+"px", rotate:Math.random()*40, duration: endspeed, easing:easetype, complete:function() { jQuery(this).css({visibility:'hidden'})}});
if (opt.ie) nextcaption.removeClass('noFilterClass');
}
else
if (nextcaption.hasClass('fadeout')) {
if (opt.ie) nextcaption.removeClass('noFilterClass');
nextcaption.transition({'opacity':0,duration:200});
//nextcaption.animate({'opacity':0},{duration:200,complete:function() { jQuery(this).css({visibility:'hidden'})}});
}
else
if (nextcaption.hasClass('lfr') ||
nextcaption.hasClass('lfl') ||
nextcaption.hasClass('sfr') ||
nextcaption.hasClass('sfl') ||
nextcaption.hasClass('lft') ||
nextcaption.hasClass('lfb') ||
nextcaption.hasClass('sft') ||
nextcaption.hasClass('sfb')
)
{
if (nextcaption.hasClass('lfr'))
xx=opt.width+60;
else if (nextcaption.hasClass('lfl'))
xx=0-nextcaption.width()-60;
else if (nextcaption.hasClass('lft'))
yy=0-nextcaption.height()-60;
else if (nextcaption.hasClass('lfb'))
yy=opt.height+60;
var easetype=nextcaption.data('endeasing');
if (easetype==undefined) easetype="linear";
if (easetype.indexOf("Bounce")>=0 || easetype.indexOf("Elastic")>=0)
nextcaption.animate({'opacity':oo,'left':xx+'px','top':yy+"px"},{duration:nextcaption.data('endspeed'), easing:easetype, complete:function() { jQuery(this).css({visibility:'hidden'})}});
else
nextcaption.transition({'opacity':oo,'left':xx+'px','top':yy+"px",duration:nextcaption.data('endspeed'), easing:easetype});
if (opt.ie) nextcaption.removeClass('noFilterClass');
}
else
if (nextcaption.hasClass('fade')) {
//nextcaption.animate({'opacity':0},{duration:endspeed,complete:function() { jQuery(this).css({visibility:'hidden'})} });
nextcaption.transition({'opacity':0,duration:endspeed });
if (opt.ie) nextcaption.removeClass('noFilterClass');
}
else
if (nextcaption.hasClass("randomrotate")) {
nextcaption.transition({opacity:0, scale:Math.random()*2+0.3, 'left':Math.random()*opt.width+'px','top':Math.random()*opt.height+"px", rotate:Math.random()*40, duration: endspeed, easing:easetype });
if (opt.ie) nextcaption.removeClass('noFilterClass');
}
}
///////////////////////////
// REMOVE THE LISTENERS //
///////////////////////////
function removeAllListeners(container,opt) {
container.children().each(function() {
try{ jQuery(this).die('click'); } catch(e) {}
try{ jQuery(this).die('mouseenter');} catch(e) {}
try{ jQuery(this).die('mouseleave');} catch(e) {}
try{ jQuery(this).unbind('hover');} catch(e) {}
})
try{ container.die('click','mouseenter','mouseleave');} catch(e) {}
clearInterval(opt.cdint);
container=null;
}
///////////////////////////
// - COUNTDOWN - //
/////////////////////////
function countDown(container,opt) {
opt.cd=0;
opt.loop=0;
if (opt.stopAfterLoops!=undefined && opt.stopAfterLoops>-1)
opt.looptogo=opt.stopAfterLoops;
else
opt.looptogo=9999999;
if (opt.stopAtSlide!=undefined && opt.stopAtSlide>-1)
opt.lastslidetoshow=opt.stopAtSlide;
else
opt.lastslidetoshow=999;
opt.stopLoop="off";
if (opt.looptogo==0) opt.stopLoop="on";
if (opt.slideamount >1 && !(opt.stopAfterLoops==0 && opt.stopAtSlide==1) ) {
var bt=container.find('.tp-bannertimer');
if (bt.length>0) {
bt.css({'width':'0%'});
bt.animate({'width':"100%"},{duration:(opt.delay-100),queue:false, easing:"linear"});
}
bt.data('opt',opt);
opt.cdint=setInterval(function() {
if (jQuery('body').find(container).length==0) removeAllListeners(container,opt);
if (container.data('conthover-changed') == 1) {
opt.conthover= container.data('conthover');
container.data('conthover-changed',0);
}
if (opt.conthover!=1 && opt.videoplaying!=true && opt.width>opt.hideSliderAtLimit) opt.cd=opt.cd+100;
if (opt.fullWidth!="on")
if (opt.width>opt.hideSliderAtLimit)
container.parent().removeClass("tp-hide-revslider")
else
container.parent().addClass("tp-hide-revslider")
// EVENT TRIGGERING IN CASE VIDEO HAS BEEN STARTED
if (opt.videostartednow==1) {
container.trigger('revolution.slide.onvideoplay');
opt.videostartednow=0;
}
// EVENT TRIGGERING IN CASE VIDEO HAS BEEN STOPPED
if (opt.videostoppednow==1) {
container.trigger('revolution.slide.onvideostop');
opt.videostoppednow=0;
}
if (opt.cd>=opt.delay) {
opt.cd=0;
// SWAP TO NEXT BANNER
opt.act=opt.next;
opt.next=opt.next+1;
if (opt.next>container.find('>ul >li').length-1) {
opt.next=0;
opt.looptogo=opt.looptogo-1;
if (opt.looptogo<=0) {
opt.stopLoop="on";
}
}
// STOP TIMER IF NO LOOP NO MORE NEEDED.
if (opt.stopLoop=="on" && opt.next==opt.lastslidetoshow-1) {
clearInterval(opt.cdint);
container.find('.tp-bannertimer').css({'visibility':'hidden'});
container.trigger('revolution.slide.onstop');
}
// SWAP THE SLIDES
swapSlide(container,opt);
// Clear the Timer
if (bt.length>0) {
bt.css({'width':'0%'});
bt.animate({'width':"100%"},{duration:(opt.delay-100),queue:false, easing:"linear"});
}
}
},100);
container.hover(
function() {
if (opt.onHoverStop=="on") {
opt.conthover=1;
bt.stop();
container.trigger('revolution.slide.onpause');
}
},
function() {
if (container.data('conthover')!=1) {
container.trigger('revolution.slide.onresume');
opt.conthover=0;
if (opt.onHoverStop=="on" && opt.videoplaying!=true) {
bt.animate({'width':"100%"},{duration:((opt.delay-opt.cd)-100),queue:false, easing:"linear"});
}
}
});
}
}
})(jQuery);