jquery.themepunch.revolution.js 80 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535
  1. /**************************************************************************
  2. * jquery.themepunch.revolution.js - jQuery Plugin for Revolution Slider
  3. * @version: 5.1 (20.10.2015)
  4. * @requires jQuery v1.7 or later (tested on 1.9)
  5. * @author ThemePunch
  6. **************************************************************************/
  7. (function(jQuery,undefined){
  8. "use strict";
  9. jQuery.fn.extend({
  10. revolution: function(options) {
  11. // SET DEFAULT VALUES OF ITEM //
  12. var defaults = {
  13. delay:9000,
  14. responsiveLevels:4064, // Single or Array for Responsive Levels i.e.: 4064 or i.e. [2048, 1024, 768, 480]
  15. visibilityLevels:[2048,1024,778,480], // Single or Array for Responsive Visibility Levels i.e.: 4064 or i.e. [2048, 1024, 768, 480]
  16. gridwidth:960, // Single or Array i.e. 960 or [960, 840,760,460]
  17. gridheight:500, // Single or Array i.e. 500 or [500, 450,400,350]
  18. minHeight:0,
  19. autoHeight:"off",
  20. sliderType : "standard", // standard, carousel, hero
  21. sliderLayout : "auto", // auto, fullwidth, fullscreen
  22. fullScreenAutoWidth:"off", // Turns the FullScreen Slider to be a FullHeight but auto Width Slider
  23. fullScreenAlignForce:"off",
  24. fullScreenOffsetContainer:"", // Size for FullScreen Slider minimising Calculated on the Container sizes
  25. fullScreenOffset:"0", // Size for FullScreen Slider minimising
  26. hideCaptionAtLimit:0, // It Defines if a caption should be shown under a Screen Resolution ( Basod on The Width of Browser)
  27. hideAllCaptionAtLimit:0, // Hide all The Captions if Width of Browser is less then this value
  28. hideSliderAtLimit:0, // Hide the whole slider, and stop also functions if Width of Browser is less than this value
  29. disableProgressBar:"off", // Hides Progress Bar if is set to "on"
  30. stopAtSlide:-1, // Stop Timer if Slide "x" has been Reached. If stopAfterLoops set to 0, then it stops already in the first Loop at slide X which defined. -1 means do not stop at any slide. stopAfterLoops has no sinn in this case.
  31. stopAfterLoops:-1, // Stop Timer if All slides has been played "x" times. IT will stop at THe slide which is defined via stopAtSlide:x, if set to -1 slide never stop automatic
  32. shadow:0, //0 = no Shadow, 1,2,3 = 3 Different Art of Shadows (No Shadow in Fullwidth Version !)
  33. dottedOverlay:"none", //twoxtwo, threexthree, twoxtwowhite, threexthreewhite
  34. startDelay:0, // Delay before the first Animation starts.
  35. lazyType : "smart", //full, smart, single
  36. spinner:"spinner0",
  37. shuffle:"off", // Random Order of Slides,
  38. viewPort:{
  39. enable:false, // if enabled, slider wait with start or wait at first slide.
  40. outof:"wait", // wait,pause
  41. visible_area:"60%"
  42. },
  43. fallbacks:{
  44. isJoomla:false,
  45. panZoomDisableOnMobile:"off",
  46. simplifyAll:"on",
  47. nextSlideOnWindowFocus:"off",
  48. disableFocusListener:true
  49. },
  50. parallax : {
  51. type : "off", // off, mouse, scroll, mouse+scroll
  52. levels: [10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85],
  53. origo:"enterpoint", // slidercenter or enterpoint
  54. speed:400,
  55. bgparallax : "on",
  56. opacity:"on",
  57. disable_onmobile:"off",
  58. ddd_shadow:"on",
  59. ddd_bgfreeze:"off",
  60. ddd_overflow:"visible",
  61. ddd_layer_overflow:"visible",
  62. ddd_z_correction:65,
  63. ddd_path:"mouse"
  64. },
  65. carousel : {
  66. horizontal_align : "center",
  67. vertical_align : "center",
  68. infinity : "on",
  69. space : 0,
  70. maxVisibleItems : 3,
  71. stretch:"off",
  72. fadeout:"on",
  73. maxRotation:0,
  74. minScale:0,
  75. vary_fade:"off",
  76. vary_rotation:"on",
  77. vary_scale:"off",
  78. border_radius:"0px",
  79. padding_top:0,
  80. padding_bottom:0
  81. },
  82. navigation : {
  83. keyboardNavigation:"on",
  84. keyboard_direction:"horizontal", // horizontal - left/right arrows, vertical - top/bottom arrows
  85. mouseScrollNavigation:"off",
  86. onHoverStop:"on", // Stop Banner Timet at Hover on Slide on/off
  87. touch:{
  88. touchenabled:"off", // Enable Swipe Function : on/off
  89. swipe_treshold : 75, // The number of pixels that the user must move their finger by before it is considered a swipe.
  90. swipe_min_touches : 1, // Min Finger (touch) used for swipe
  91. drag_block_vertical:false, // Prevent Vertical Scroll during Swipe
  92. swipe_direction:"horizontal"
  93. },
  94. arrows: {
  95. style:"",
  96. enable:false,
  97. hide_onmobile:false,
  98. hide_onleave:true,
  99. hide_delay:200,
  100. hide_delay_mobile:1200,
  101. hide_under:0,
  102. hide_over:9999,
  103. tmp:'',
  104. left : {
  105. h_align:"left",
  106. v_align:"center",
  107. h_offset:20,
  108. v_offset:0,
  109. },
  110. right : {
  111. h_align:"right",
  112. v_align:"center",
  113. h_offset:20,
  114. v_offset:0
  115. }
  116. },
  117. bullets: {
  118. style:"",
  119. enable:false,
  120. hide_onmobile:false,
  121. hide_onleave:true,
  122. hide_delay:200,
  123. hide_delay_mobile:1200,
  124. hide_under:0,
  125. hide_over:9999,
  126. direction:"horizontal",
  127. h_align:"left",
  128. v_align:"center",
  129. space:0,
  130. h_offset:20,
  131. v_offset:0,
  132. tmp:'<span class="tp-bullet-image"></span><span class="tp-bullet-title"></span>'
  133. },
  134. thumbnails: {
  135. style:"",
  136. enable:false,
  137. width:100,
  138. height:50,
  139. min_width:100,
  140. wrapper_padding:2,
  141. wrapper_color:"#f5f5f5",
  142. wrapper_opacity:1,
  143. tmp:'<span class="tp-thumb-image"></span><span class="tp-thumb-title"></span>',
  144. visibleAmount:5,
  145. hide_onmobile:false,
  146. hide_onleave:true,
  147. hide_delay:200,
  148. hide_delay_mobile:1200,
  149. hide_under:0,
  150. hide_over:9999,
  151. direction:"horizontal",
  152. span:false,
  153. position:"inner",
  154. space:2,
  155. h_align:"left",
  156. v_align:"center",
  157. h_offset:20,
  158. v_offset:0
  159. },
  160. tabs: {
  161. style:"",
  162. enable:false,
  163. width:100,
  164. min_width:100,
  165. height:50,
  166. wrapper_padding:10,
  167. wrapper_color:"#f5f5f5",
  168. wrapper_opacity:1,
  169. tmp:'<span class="tp-tab-image"></span>',
  170. visibleAmount:5,
  171. hide_onmobile:false,
  172. hide_onleave:true,
  173. hide_delay:200,
  174. hide_delay_mobile:1200,
  175. hide_under:0,
  176. hide_over:9999,
  177. direction:"horizontal",
  178. span:false,
  179. space:0,
  180. position:"inner",
  181. h_align:"left",
  182. v_align:"center",
  183. h_offset:20,
  184. v_offset:0
  185. }
  186. },
  187. extensions:"extensions/", //example extensions/ or extensions/source/
  188. extensions_suffix:".min.js",
  189. debugMode:false
  190. };
  191. // Merge of Defaults
  192. options = jQuery.extend(true,{},defaults, options);
  193. return this.each(function() {
  194. var c = jQuery(this);
  195. //REMOVE SLIDES IF SLIDER IS HERO
  196. if (options.sliderType=="hero") {
  197. c.find('>ul>li').each(function(i) {
  198. if (i>0) jQuery(this).remove();
  199. })
  200. }
  201. options.jsFileLocation = options.jsFileLocation || getScriptLocation("themepunch.revolution.min.js");
  202. options.jsFileLocation = options.jsFileLocation + options.extensions;
  203. options.scriptsneeded = getNeededScripts(options,c);
  204. options.curWinRange = 0;
  205. jQuery(this).on("scriptsloaded",function() {
  206. if (options.modulesfailing ) {
  207. c.html('<div style="margin:auto;line-height:40px;font-size:14px;color:#fff;padding:15px;background:#e74c3c;margin:20px 0px;">!! Error at loading Slider Revolution 5.0 Extrensions.'+options.errorm+'</div>').show();
  208. return false;
  209. }
  210. // CHECK FOR MIGRATION
  211. if (_R.migration!=undefined) options = _R.migration(c,options);
  212. punchgs.force3D = true;
  213. if (options.simplifyAll!=="on") punchgs.TweenLite.lagSmoothing(1000,16);
  214. prepareOptions(c,options);
  215. initSlider(c,options);
  216. });
  217. waitForScripts(c,options.scriptsneeded);
  218. })
  219. },
  220. // Add a New Call Back to some Module
  221. revaddcallback: function(callback) {
  222. return this.each(function() {
  223. var container=jQuery(this);
  224. if (container!=undefined && container.length>0 && jQuery('body').find('#'+container.attr('id')).length>0) {
  225. var bt = container.parent().find('.tp-bannertimer'),
  226. opt = bt.data('opt');
  227. if (opt.callBackArray === undefined)
  228. opt.callBackArray = new Array();
  229. opt.callBackArray.push(callback);
  230. }
  231. })
  232. },
  233. // Get Current Parallax Proc
  234. revgetparallaxproc : function() {
  235. var container=jQuery(this);
  236. if (container!=undefined && container.length>0 && jQuery('body').find('#'+container.attr('id')).length>0) {
  237. var bt = container.parent().find('.tp-bannertimer'),
  238. opt = bt.data('opt');
  239. return opt.scrollproc;
  240. }
  241. },
  242. // ENABLE DEBUG MODE
  243. revdebugmode: function() {
  244. return this.each(function() {
  245. var container=jQuery(this);
  246. if (container!=undefined && container.length>0 && jQuery('body').find('#'+container.attr('id')).length>0) {
  247. var bt = container.parent().find('.tp-bannertimer'),
  248. opt = bt.data('opt');
  249. opt.debugMode = true;
  250. containerResized(container,opt);
  251. }
  252. })
  253. },
  254. // METHODE SCROLL
  255. revscroll: function(oy) {
  256. return this.each(function() {
  257. var container=jQuery(this);
  258. if (container!=undefined && container.length>0 && jQuery('body').find('#'+container.attr('id')).length>0)
  259. jQuery('body,html').animate({scrollTop:(container.offset().top+(opt.li[0].height())-oy)+"px"},{duration:400});
  260. })
  261. },
  262. // METHODE PAUSE
  263. revredraw: function(oy) {
  264. return this.each(function() {
  265. var container=jQuery(this);
  266. if (container!=undefined && container.length>0 && jQuery('body').find('#'+container.attr('id')).length>0) {
  267. var bt = container.parent().find('.tp-bannertimer');
  268. var opt = bt.data('opt');
  269. containerResized(container,opt);
  270. }
  271. })
  272. },
  273. // METHODE PAUSE
  274. revkill: function(oy) {
  275. var self = this,
  276. container=jQuery(this);
  277. punchgs.TweenLite.killDelayedCallsTo(_R.showHideNavElements);
  278. if (_R.endMoveCaption)
  279. punchgs.TweenLite.killDelayedCallsTo(_R.endMoveCaption);
  280. if (container!=undefined && container.length>0 && jQuery('body').find('#'+container.attr('id')).length>0) {
  281. container.data('conthover',1);
  282. container.data('conthover-changed',1);
  283. container.trigger('revolution.slide.onpause');
  284. var bt = container.parent().find('.tp-bannertimer'),
  285. opt = bt.data('opt');
  286. opt.tonpause = true;
  287. container.trigger('stoptimer');
  288. punchgs.TweenLite.killTweensOf(container.find('*'),false);
  289. punchgs.TweenLite.killTweensOf(container,false);
  290. container.unbind('hover, mouseover, mouseenter,mouseleave, resize');
  291. var resizid = "resize.revslider-"+container.attr('id');
  292. jQuery(window).off(resizid);
  293. container.find('*').each(function() {
  294. var el = jQuery(this);
  295. el.unbind('on, hover, mouseenter,mouseleave,mouseover, resize,restarttimer, stoptimer');
  296. el.off('on, hover, mouseenter,mouseleave,mouseover, resize');
  297. el.data('mySplitText',null);
  298. el.data('ctl',null);
  299. if (el.data('tween')!=undefined)
  300. el.data('tween').kill();
  301. if (el.data('kenburn')!=undefined)
  302. el.data('kenburn').kill();
  303. if (el.data('timeline_out')!=undefined)
  304. el.data('timeline_out').kill();
  305. if (el.data('timeline')!=undefined)
  306. el.data('timeline').kill();
  307. el.remove();
  308. el.empty();
  309. el=null;
  310. })
  311. punchgs.TweenLite.killTweensOf(container.find('*'),false);
  312. punchgs.TweenLite.killTweensOf(container,false);
  313. bt.remove();
  314. try{container.closest('.forcefullwidth_wrapper_tp_banner').remove();} catch(e) {}
  315. try{container.closest('.rev_slider_wrapper').remove()} catch(e) {}
  316. try{container.remove();} catch(e) {}
  317. container.empty();
  318. container.html();
  319. container = null;
  320. opt = null;
  321. delete(self.c);
  322. delete(self.opt);
  323. return true;
  324. } else {
  325. return false;
  326. }
  327. },
  328. // METHODE PAUSE
  329. revpause: function() {
  330. return this.each(function() {
  331. var c=jQuery(this);
  332. if (c!=undefined && c.length>0 && jQuery('body').find('#'+c.attr('id')).length>0) {
  333. c.data('conthover',1);
  334. c.data('conthover-changed',1);
  335. c.trigger('revolution.slide.onpause');
  336. var bt = c.parent().find('.tp-bannertimer');
  337. var opt = bt.data('opt');
  338. opt.tonpause = true;
  339. c.trigger('stoptimer');
  340. }
  341. })
  342. },
  343. // METHODE RESUME
  344. revresume: function() {
  345. return this.each(function() {
  346. var c=jQuery(this);
  347. if (c!=undefined && c.length>0 && jQuery('body').find('#'+c.attr('id')).length>0) {
  348. c.data('conthover',0);
  349. c.data('conthover-changed',1);
  350. c.trigger('revolution.slide.onresume');
  351. var bt = c.parent().find('.tp-bannertimer');
  352. var opt = bt.data('opt');
  353. opt.tonpause = false;
  354. c.trigger('starttimer');
  355. }
  356. })
  357. },
  358. // METHODE NEXT
  359. revnext: function() {
  360. return this.each(function() {
  361. // CATCH THE CONTAINER
  362. var c=jQuery(this);
  363. if (c!=undefined && c.length>0 && jQuery('body').find('#'+c.attr('id')).length>0) {
  364. var bt = c.parent().find('.tp-bannertimer'),
  365. opt = bt.data('opt');
  366. _R.callingNewSlide(opt,c,1);
  367. }
  368. })
  369. },
  370. // METHODE RESUME
  371. revprev: function() {
  372. return this.each(function() {
  373. // CATCH THE CONTAINER
  374. var c=jQuery(this);
  375. if (c!=undefined && c.length>0 && jQuery('body').find('#'+c.attr('id')).length>0) {
  376. var bt = c.parent().find('.tp-bannertimer'),
  377. opt = bt.data('opt');
  378. _R.callingNewSlide(opt,c,-1);
  379. }
  380. })
  381. },
  382. // METHODE LENGTH
  383. revmaxslide: function() {
  384. // CATCH THE CONTAINER
  385. return jQuery(this).find('.tp-revslider-mainul >li').length;
  386. },
  387. // METHODE CURRENT
  388. revcurrentslide: function() {
  389. // CATCH THE CONTAINER
  390. var c=jQuery(this);
  391. if (c!=undefined && c.length>0 && jQuery('body').find('#'+c.attr('id')).length>0) {
  392. var bt = c.parent().find('.tp-bannertimer');
  393. var opt = bt.data('opt');
  394. return parseInt(opt.act,0)+1;
  395. }
  396. },
  397. // METHODE CURRENT
  398. revlastslide: function() {
  399. // CATCH THE CONTAINER
  400. return jQuery(this).find('.tp-revslider-mainul >li').length;
  401. },
  402. // METHODE JUMP TO SLIDE
  403. revshowslide: function(slide) {
  404. return this.each(function() {
  405. // CATCH THE CONTAINER
  406. var c=jQuery(this);
  407. if (c!=undefined && c.length>0 && jQuery('body').find('#'+c.attr('id')).length>0) {
  408. var bt = c.parent().find('.tp-bannertimer'),
  409. opt = bt.data('opt');
  410. _R.callingNewSlide(opt,c,"to"+(slide-1));
  411. }
  412. })
  413. },
  414. revcallslidewithid: function(slide) {
  415. return this.each(function() {
  416. // CATCH THE CONTAINER
  417. var c=jQuery(this);
  418. if (c!=undefined && c.length>0 && jQuery('body').find('#'+c.attr('id')).length>0) {
  419. var bt = c.parent().find('.tp-bannertimer'),
  420. opt = bt.data('opt');
  421. _R.callingNewSlide(opt,c,slide);
  422. }
  423. })
  424. }
  425. });
  426. //////////////////////////////////////////////////////////////
  427. // - REVOLUTION FUNCTION EXTENSIONS FOR GLOBAL USAGE - //
  428. //////////////////////////////////////////////////////////////
  429. var _R = jQuery.fn.revolution;
  430. jQuery.extend(true, _R, {
  431. simp : function(a,b,basic) {
  432. var c = Math.abs(a) - (Math.floor(Math.abs(a / b))*b);
  433. if (basic)
  434. return c;
  435. else
  436. return a<0 ? -1*c : c;
  437. },
  438. // - IS IOS VERSION OLDER THAN 5 ??
  439. iOSVersion : function() {
  440. var oldios = false;
  441. if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
  442. if (navigator.userAgent.match(/OS 4_\d like Mac OS X/i)) {
  443. oldios = true;
  444. }
  445. } else {
  446. oldios = false;
  447. }
  448. return oldios;
  449. },
  450. // - CHECK IF BROWSER IS IE -
  451. isIE : function( version, comparison ){
  452. var $div = jQuery('<div style="display:none;"/>').appendTo(jQuery('body'));
  453. $div.html('<!--[if '+(comparison||'')+' IE '+(version||'')+']><a>&nbsp;</a><![endif]-->');
  454. var ieTest = $div.find('a').length;
  455. $div.remove();
  456. return ieTest;
  457. },
  458. // - IS MOBILE ??
  459. is_mobile : function() {
  460. var agents = ['android', 'webos', 'iphone', 'ipad', 'blackberry','Android', 'webos', ,'iPod', 'iPhone', 'iPad', 'Blackberry', 'BlackBerry'];
  461. var ismobile=false;
  462. for(var i in agents) {
  463. if (navigator.userAgent.split(agents[i]).length>1) {
  464. ismobile = true;
  465. }
  466. }
  467. return ismobile;
  468. },
  469. // - CALL BACK HANDLINGS - //
  470. callBackHandling : function(opt,type,position) {
  471. try{
  472. if (opt.callBackArray)
  473. jQuery.each(opt.callBackArray,function(i,c) {
  474. if (c) {
  475. if (c.inmodule && c.inmodule === type)
  476. if (c.atposition && c.atposition === position)
  477. if (c.callback)
  478. c.callback.call();
  479. }
  480. });
  481. } catch(e) {
  482. console.log("Call Back Failed");
  483. }
  484. },
  485. get_browser : function(){
  486. var N=navigator.appName, ua=navigator.userAgent, tem;
  487. var M=ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
  488. if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];
  489. M=M? [M[1], M[2]]: [N, navigator.appVersion, '-?'];
  490. return M[0];
  491. },
  492. get_browser_version : function(){
  493. var N=navigator.appName, ua=navigator.userAgent, tem;
  494. var M=ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
  495. if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1];
  496. M=M? [M[1], M[2]]: [N, navigator.appVersion, '-?'];
  497. return M[1];
  498. },
  499. // GET THE HORIZONTAL OFFSET OF SLIDER BASED ON THE THU`MBNAIL AND TABS LEFT AND RIGHT SIDE
  500. getHorizontalOffset : function(container,side) {
  501. var thumbloff = gWiderOut(container,'.outer-left'),
  502. thumbroff = gWiderOut(container,'.outer-right');
  503. switch (side) {
  504. case "left":
  505. return thumbloff;
  506. break;
  507. case "right":
  508. return thumbroff;
  509. break;
  510. case "both":
  511. return thumbloff+thumbroff;
  512. break;
  513. }
  514. },
  515. // - CALLING THE NEW SLIDE - //
  516. callingNewSlide : function(opt,container,direction) {
  517. var aindex = container.find('.next-revslide').length>0 ? container.find('.next-revslide').index() : container.find('.processing-revslide').length>0 ? container.find('.processing-revslide').index() : container.find('.active-revslide').index(),
  518. nindex = 0;
  519. container.find('.next-revslide').removeClass("next-revslide");
  520. // SET NEXT DIRECTION
  521. if (direction && jQuery.isNumeric(direction) || direction.match(/to/g)) {
  522. if (direction===1 || direction === -1) {
  523. nindex = aindex + direction;
  524. nindex = nindex<0 ? opt.slideamount-1 : nindex>=opt.slideamount ? 0 : nindex;
  525. } else {
  526. direction=jQuery.isNumeric(direction) ? direction : parseInt(direction.split("to")[1],0);
  527. nindex = direction<0 ? 0 : direction>opt.slideamount-1 ? opt.slideamount-1 : direction;
  528. }
  529. container.find('.tp-revslider-slidesli:eq('+nindex+')').addClass("next-revslide");
  530. } else
  531. if (direction) {
  532. container.find('.tp-revslider-slidesli').each(function() {
  533. var li=jQuery(this);
  534. if (li.data('index')===direction) li.addClass("next-revslide");
  535. })
  536. }
  537. nindex = container.find('.next-revslide').index();
  538. container.trigger("revolution.nextslide.waiting");
  539. if (nindex !== aindex && nindex!=-1)
  540. swapSlide(container,opt);
  541. else
  542. container.find('.next-revslide').removeClass("next-revslide");
  543. },
  544. slotSize : function(img,opt) {
  545. opt.slotw=Math.ceil(opt.width/opt.slots);
  546. if (opt.sliderLayout=="fullscreen")
  547. opt.sloth=Math.ceil(jQuery(window).height()/opt.slots);
  548. else
  549. opt.sloth=Math.ceil(opt.height/opt.slots);
  550. if (opt.autoHeight=="on" && img!==undefined && img!=="")
  551. opt.sloth=Math.ceil(img.height()/opt.slots);
  552. },
  553. setSize : function(opt) {
  554. var ofh = (opt.top_outer || 0) + (opt.bottom_outer || 0),
  555. cpt = parseInt((opt.carousel.padding_top||0),0),
  556. cpb = parseInt((opt.carousel.padding_bottom||0),0),
  557. maxhei = opt.gridheight[opt.curWinRange];
  558. maxhei = maxhei<opt.minHeight ? opt.minHeight : maxhei;
  559. if (opt.sliderLayout=="fullwidth" && opt.autoHeight=="off") punchgs.TweenLite.set(opt.c,{maxHeight:maxhei+"px"});
  560. opt.c.css({marginTop:cpt,marginBottom:cpb});
  561. opt.width=opt.ul.width();
  562. opt.height=opt.ul.height();
  563. setScale(opt);
  564. opt.height = Math.round(opt.gridheight[opt.curWinRange] * (opt.width/opt.gridwidth[opt.curWinRange]));
  565. if (opt.height>opt.gridheight[opt.curWinRange] && opt.autoHeight!="on") opt.height=opt.gridheight[opt.curWinRange];
  566. if (opt.sliderLayout=="fullscreen" || opt.infullscreenmode) {
  567. opt.height = opt.bw * opt.gridheight[opt.curWinRange];
  568. var cow = opt.c.parent().width();
  569. var coh = jQuery(window).height();
  570. if (opt.fullScreenOffsetContainer!=undefined) {
  571. try{
  572. var offcontainers = opt.fullScreenOffsetContainer.split(",");
  573. if (offcontainers)
  574. jQuery.each(offcontainers,function(index,searchedcont) {
  575. coh = jQuery(searchedcont).length>0 ? coh - jQuery(searchedcont).outerHeight(true) : coh;
  576. });
  577. } catch(e) {}
  578. try{
  579. if (opt.fullScreenOffset.split("%").length>1 && opt.fullScreenOffset!=undefined && opt.fullScreenOffset.length>0)
  580. coh = coh - (jQuery(window).height()* parseInt(opt.fullScreenOffset,0)/100);
  581. else
  582. if (opt.fullScreenOffset!=undefined && opt.fullScreenOffset.length>0)
  583. coh = coh - parseInt(opt.fullScreenOffset,0);
  584. } catch(e) {}
  585. }
  586. coh = coh<opt.minHeight ? opt.minHeight : coh;
  587. coh = coh - ofh;
  588. opt.c.parent().height(coh);
  589. opt.c.closest('.rev_slider_wrapper').height(coh);
  590. opt.c.css({'height':'100%'});
  591. opt.height=coh;
  592. if (opt.minHeight!=undefined && opt.height<opt.minHeight)
  593. opt.height = opt.minHeight;
  594. } else {
  595. if (opt.minHeight!=undefined && opt.height<opt.minHeight)
  596. opt.height = opt.minHeight;
  597. opt.c.height(opt.height);
  598. }
  599. var si = { height:(cpt+cpb+ofh+opt.height)};
  600. opt.c.closest('.forcefullwidth_wrapper_tp_banner').find('.tp-fullwidth-forcer').css(si);
  601. opt.c.closest('.rev_slider_wrapper').css(si);
  602. setScale(opt);
  603. },
  604. enterInViewPort : function(opt) {
  605. // START COUNTER IF VP ENTERED, AND COUNTDOWN WAS NOT ON YET
  606. if (opt.waitForCountDown) {
  607. countDown(opt.c,opt);
  608. opt.waitForCountDown=false;
  609. }
  610. // START FIRST SLIDE IF NOT YET STARTED AND VP ENTERED
  611. if (opt.waitForFirstSlide) {
  612. swapSlide(opt.c,opt);
  613. opt.waitForFirstSlide=false;
  614. }
  615. if (opt.sliderlaststatus == "playing" || opt.sliderlaststatus==undefined) {
  616. opt.c.trigger("starttimer");
  617. }
  618. if (opt.lastplayedvideos != undefined && opt.lastplayedvideos.length>0) {
  619. jQuery.each(opt.lastplayedvideos,function(i,_nc) {
  620. _R.playVideo(_nc,opt);
  621. });
  622. }
  623. },
  624. leaveViewPort : function(opt) {
  625. opt.sliderlaststatus = opt.sliderstatus;
  626. opt.c.trigger("stoptimer");
  627. if (opt.playingvideos != undefined && opt.playingvideos.length>0) {
  628. opt.lastplayedvideos = jQuery.extend(true,[],opt.playingvideos);
  629. if (opt.playingvideos)
  630. jQuery.each(opt.playingvideos,function(i,_nc) {
  631. if (_R.stopVideo) _R.stopVideo(_nc,opt);
  632. });
  633. }
  634. }
  635. });
  636. var _ISM = _R.is_mobile();
  637. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  638. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  639. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  640. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  641. var lAjax = function(s,o) {
  642. if (jQuery('body').data(s)) return false;
  643. if (o.filesystem) {
  644. if (o.errorm===undefined)
  645. o.errorm = "<br>Local Filesystem Detected !<br>Put this to your header:";
  646. console.warn('Local Filesystem detected !');
  647. o.errorm = o.errorm+'<br>&lt;script type="text/javascript" src="'+o.jsFileLocation+s+o.extensions_suffix+'"&gt;&lt;/script&gt;';
  648. console.warn(o.jsFileLocation+s+o.extensions_suffix+' could not be loaded !');
  649. console.warn('Please use a local Server or work online or make sure that you load all needed Libraries manually in your Document.');
  650. console.log(" ");
  651. o.modulesfailing = true;
  652. return false;
  653. }
  654. jQuery.ajax({
  655. url:o.jsFileLocation+s+o.extensions_suffix,
  656. 'dataType':'script',
  657. 'cache':true,
  658. "error":function(e) {
  659. console.warn("Slider Revolution 5.0 Error !")
  660. console.error("Failure at Loading:"+s+o.extensions_suffix+" on Path:"+o.jsFileLocation)
  661. console.info(e);
  662. }
  663. });
  664. jQuery('body').data(s,true);
  665. }
  666. var getNeededScripts = function(o,c) {
  667. var n = new Object(),
  668. _n = o.navigation;
  669. n.kenburns = false;
  670. n.parallax = false;
  671. n.carousel = false;
  672. n.navigation = false;
  673. n.videos = false;
  674. n.actions = false;
  675. n.layeranim = false;
  676. n.migration = false;
  677. // MIGRATION EXTENSION
  678. if (!c.data('version') || !c.data('version').toString().match(/5./gi)) {
  679. n.kenburns = true;
  680. n.parallax = true;
  681. n.carousel = false;
  682. n.navigation = true;
  683. n.videos = true;
  684. n.actions = true;
  685. n.layeranim = true;
  686. n.migration = true;
  687. }
  688. else {
  689. // KEN BURN MODUL
  690. c.find('img').each(function(){
  691. if (jQuery(this).data('kenburns')=="on") n.kenburns = true;
  692. });
  693. // NAVIGATION EXTENSTION
  694. if (o.sliderType =="carousel" || _n.keyboardNavigation=="on" || _n.mouseScrollNavigation=="on" || _n.touch.touchenabled=="on" || _n.arrows.enable || _n.bullets.enable || _n.thumbnails.enable || _n.tabs.enable )
  695. n.navigation = true;
  696. // LAYERANIM, VIDEOS, ACTIONS EXTENSIONS
  697. c.find('.tp-caption, .tp-static-layer, .rs-background-video-layer').each(function(){
  698. var _nc = jQuery(this);
  699. if ((_nc.data('ytid')!=undefined || _nc.find('iframe').length>0 && _nc.find('iframe').attr('src').toLowerCase().indexOf('youtube')>0))
  700. n.videos = true;
  701. if ((_nc.data('vimeoid')!=undefined || _nc.find('iframe').length>0 && _nc.find('iframe').attr('src').toLowerCase().indexOf('vimeo')>0))
  702. n.videos = true;
  703. if (_nc.data('actions')!==undefined)
  704. n.actions = true;
  705. n.layeranim = true;
  706. });
  707. c.find('li').each(function() {
  708. if (jQuery(this).data('link') && jQuery(this).data('link')!=undefined) {
  709. n.layeranim = true;
  710. n.actions = true;
  711. }
  712. })
  713. // VIDEO EXTENSION
  714. if (!n.videos && (c.find('.rs-background-video-layer').length>0 || c.find(".tp-videolayer").length>0 || c.find('iframe').length>0 || c.find('video').length>0))
  715. n.videos = true;
  716. // VIDEO EXTENSION
  717. if (o.sliderType =="carousel")
  718. n.carousel = true;
  719. if (o.parallax.type!=="off" || o.viewPort.enable || o.viewPort.enable=="true")
  720. n.parallax = true;
  721. }
  722. if (o.sliderType=="hero") {
  723. n.carousel = false;
  724. n.navigation = false;
  725. }
  726. if (window.location.href.match(/file:/gi)) {
  727. n.filesystem = true;
  728. o.filesystem = true;
  729. }
  730. // LOAD THE NEEDED LIBRARIES
  731. if (n.videos && typeof _R.isVideoPlaying=='undefined') lAjax('revolution.extension.video',o);
  732. if (n.carousel && typeof _R.prepareCarousel=='undefined') lAjax('revolution.extension.carousel',o);
  733. if (!n.carousel && typeof _R.animateSlide=='undefined') lAjax('revolution.extension.slideanims',o);
  734. if (n.actions && typeof _R.checkActions=='undefined') lAjax('revolution.extension.actions',o);
  735. if (n.layeranim && typeof _R.handleStaticLayers=='undefined') lAjax('revolution.extension.layeranimation',o);
  736. if (n.kenburns && typeof _R.stopKenBurn=='undefined') lAjax('revolution.extension.kenburn',o);
  737. if (n.navigation && typeof _R.createNavigation=='undefined') lAjax('revolution.extension.navigation',o);
  738. if (n.migration && typeof _R.migration=='undefined') lAjax('revolution.extension.migration',o);
  739. if (n.parallax && typeof _R.checkForParallax=='undefined') lAjax('revolution.extension.parallax',o);
  740. return n;
  741. }
  742. ///////////////////////////////////
  743. // - WAIT FOR SCRIPT LOADS - //
  744. ///////////////////////////////////
  745. var waitForScripts = function(c,n) {
  746. // CHECK KEN BURN DEPENDENCIES
  747. if (n.filesystem ||
  748. (typeof punchgs !== 'undefined' &&
  749. (!n.kenburns || (n.kenburns && typeof _R.stopKenBurn !== 'undefined')) &&
  750. (!n.navigation || (n.navigation && typeof _R.createNavigation !== 'undefined')) &&
  751. (!n.carousel || (n.carousel && typeof _R.prepareCarousel !== 'undefined')) &&
  752. (!n.videos || (n.videos && typeof _R.resetVideo !== 'undefined')) &&
  753. (!n.actions || (n.actions && typeof _R.checkActions !== 'undefined')) &&
  754. (!n.layeranim || (n.layeranim && typeof _R.handleStaticLayers !== 'undefined')) &&
  755. (!n.migration || (n.migration && typeof _R.migration !== 'undefined')) &&
  756. (!n.parallax || (n.parallax && typeof _R.checkForParallax !== 'undefined')) &&
  757. (n.carousel || (!n.carousel && typeof _R.animateSlide !== 'undefined'))
  758. ))
  759. c.trigger("scriptsloaded");
  760. else
  761. setTimeout(function() {
  762. waitForScripts(c,n);
  763. },50);
  764. }
  765. //////////////////////////////////
  766. // - GET SCRIPT LOCATION - //
  767. //////////////////////////////////
  768. var getScriptLocation = function(a) {
  769. var srcexp = new RegExp("themepunch.revolution.min.js","gi"),
  770. ret = "";
  771. jQuery("script").each(function() {
  772. var src = jQuery(this).attr("src");
  773. if (src && src.match(srcexp))
  774. ret = src;
  775. });
  776. ret = ret.replace('jquery.themepunch.revolution.min.js', '');
  777. ret = ret.replace('jquery.themepunch.revolution.js', '');
  778. ret = ret.split("?")[0];
  779. return ret;
  780. }
  781. //////////////////////////////////////////
  782. // - ADVANCED RESPONSIVE LEVELS - //
  783. //////////////////////////////////////////
  784. var setCurWinRange = function(opt,vis) {
  785. var curlevel = 0,
  786. curwidth = 9999,
  787. lastmaxlevel = 0,
  788. lastmaxid = 0,
  789. curid = 0,
  790. winw = jQuery(window).width(),
  791. l = vis && opt.responsiveLevels==9999 ? opt.visibilityLevels : opt.responsiveLevels;
  792. if (l && l.length)
  793. jQuery.each(l,function(index,level) {
  794. if (winw<level) {
  795. if (lastmaxlevel==0 || lastmaxlevel>level) {
  796. curwidth = level;
  797. curid = index;
  798. lastmaxlevel = level;
  799. }
  800. }
  801. if (winw>level && lastmaxlevel<level) {
  802. lastmaxlevel = level;
  803. lastmaxid = index;
  804. }
  805. });
  806. if (lastmaxlevel<curwidth)
  807. curid = lastmaxid;
  808. if (!vis)
  809. opt.curWinRange = curid;
  810. else
  811. opt.forcedWinRange = curid;
  812. }
  813. //////////////////////////////////////////
  814. // - INITIALISATION OF OPTIONS - //
  815. //////////////////////////////////////////
  816. var prepareOptions = function(container,opt) {
  817. opt.carousel.maxVisibleItems = opt.carousel.maxVisibleItems < 1 ? 999 : opt.carousel.maxVisibleItems; // === 1 ? 2 : opt.carousel.maxVisibleItems;
  818. opt.carousel.vertical_align = opt.carousel.vertical_align === "top" ? "0%" : opt.carousel.vertical_align==="bottom" ? "100%" : "50%";
  819. }
  820. var gWiderOut = function(c,cl) {
  821. var r = 0;
  822. c.find(cl).each(function() {
  823. var a = jQuery(this);
  824. if (!a.hasClass("tp-forcenotvisible") && r<a.outerWidth())
  825. r = a.outerWidth();
  826. });
  827. return r;
  828. }
  829. //////////////////////////////////////////
  830. // - INITIALISATION OF SLIDER - //
  831. //////////////////////////////////////////
  832. var initSlider = function (container,opt) {
  833. if (container==undefined) return false;
  834. // CHECK FOR ALTERNATIVE IMAGE, AND IFRAM EXIST, AND WE ARE IN IE8, MOBILE, DRAW IT SIMPLE
  835. if (container.data('aimg')!=undefined)
  836. if ((container.data('aie8')=="enabled" && _R.isIE(8)) || (container.data('amobile')=="enabled" && _ISM))
  837. container.html('<img class="tp-slider-alternative-image" src="'+container.data("aimg")+'">');
  838. // PREPRARE SOME CLASSES AND VARIABLES
  839. container.find('>ul').addClass("tp-revslider-mainul");
  840. // CREATE SOME DEFAULT OPTIONS FOR LATER
  841. opt.c=container;
  842. opt.ul = container.find('.tp-revslider-mainul');
  843. opt.cid = container.attr('id');
  844. opt.ul.css({visibility:"visible"});
  845. opt.slideamount = opt.ul.find('>li').length;
  846. opt.slayers = container.find('.tp-static-layers');
  847. // Save Original Index of Slides
  848. opt.ul.find('>li').each(function(i) {
  849. jQuery(this).data('originalindex',i);
  850. });
  851. // RANDOMIZE THE SLIDER SHUFFLE MODE
  852. if (opt.shuffle=="on") {
  853. var fsa = new Object,
  854. fli = opt.ul.find('>li:first-child');
  855. fsa.fstransition = fli.data('fstransition');
  856. fsa.fsmasterspeed = fli.data('fsmasterspeed');
  857. fsa.fsslotamount = fli.data('fsslotamount');
  858. for (var u=0;u<opt.slideamount;u++) {
  859. var it = Math.round(Math.random()*opt.slideamount);
  860. opt.ul.find('>li:eq('+it+')').prependTo(opt.ul);
  861. }
  862. var newfli = opt.ul.find('>li:first-child');
  863. newfli.data('fstransition',fsa.fstransition);
  864. newfli.data('fsmasterspeed',fsa.fsmasterspeed);
  865. newfli.data('fsslotamount',fsa.fsslotamount);
  866. // COLLECT ALL LI INTO AN ARRAY
  867. opt.li = opt.ul.find('>li');
  868. }
  869. opt.li = opt.ul.find('>li');
  870. opt.thumbs = new Array();
  871. opt.slots=4;
  872. opt.act=-1;
  873. opt.firststart=1;
  874. opt.loadqueue = new Array();
  875. opt.syncload = 0;
  876. opt.conw = container.width();
  877. opt.conh = container.height();
  878. if (opt.responsiveLevels.length>1)
  879. opt.responsiveLevels[0] = 9999;
  880. else
  881. opt.responsiveLevels = 9999;
  882. // RECORD THUMBS AND SET INDEXES
  883. jQuery.each(opt.li,function(index,li) {
  884. var li = jQuery(li),
  885. img = li.find('.rev-slidebg') || li.find('img').first(),
  886. i = 0;
  887. li.addClass("tp-revslider-slidesli");
  888. if (li.data('index')===undefined) li.data('index','rs-'+Math.round(Math.random()*999999));
  889. var obj = new Object;
  890. obj.params = new Array();
  891. obj.id = li.data('index');
  892. obj.src = li.data('thumb')!==undefined ? li.data('thumb') : img.data('lazyload') !== undefined ? img.data('lazyload') : img.attr('src');
  893. if (li.data('title') !== undefined) obj.params.push({from:RegExp("\\{\\{title\\}\\}","g"), to:li.data("title")})
  894. if (li.data('description') !== undefined) obj.params.push({from:RegExp("\\{\\{description\\}\\}","g"), to:li.data("description")})
  895. for (var i=1;i<=10;i++) {
  896. if (li.data("param"+i)!==undefined)
  897. obj.params.push({from:RegExp("\\{\\{param"+i+"\\}\\}","g"), to:li.data("param"+i)})
  898. }
  899. opt.thumbs.push(obj);
  900. li.data('origindex',li.index());
  901. // IF LINK ON SLIDE EXISTS, NEED TO CREATE A PROPER LAYER FOR IT.
  902. if (li.data('link')!=undefined) {
  903. var link = li.data('link'),
  904. target= li.data('target') || "_self",
  905. zindex= li.data('slideindex')==="back" ? 0 : 60,
  906. linktoslide=li.data('linktoslide'),
  907. checksl = linktoslide;
  908. if (linktoslide != undefined)
  909. if (linktoslide!="next" && linktoslide!="prev")
  910. opt.li.each(function() {
  911. var t = jQuery(this);
  912. if (t.data('origindex')+1==checksl) linktoslide = t.data('index');
  913. });
  914. if (link!="slide") linktoslide="no";
  915. var apptxt = '<div class="tp-caption sft slidelink" style="cursor:pointer;width:100%;height:100%;z-index:'+zindex+';" data-x="center" data-y="center" ',
  916. jts = linktoslide==="scroll_under" ? '[{"event":"click","action":"scrollbelow","offset":"100px","delay":"0"}]' :
  917. linktoslide==="prev" ? '[{"event":"click","action":"jumptoslide","slide":"prev","delay":"0.2"}]' :
  918. linktoslide==="next" ? '[{"event":"click","action":"jumptoslide","slide":"next","delay":"0.2"}]' : '[{"event":"click","action":"jumptoslide","slide":"'+linktoslide+'","delay":"0.2"}]'
  919. apptxt = linktoslide=="no" ? apptxt +' data-start="0">' : apptxt + 'data-actions='+"'"+jts + "'"+' data-start="0">';
  920. apptxt = apptxt + '<a style="width:100%;height:100%;display:block"';
  921. apptxt = link!="slide" ? apptxt + ' target="'+target+'" href="'+link+'"' : apptxt;
  922. apptxt = apptxt + '><span style="width:100%;height:100%;display:block"></span></a></div>';
  923. li.append(apptxt);
  924. }
  925. });
  926. // CREATE GRID WIDTH AND HEIGHT ARRAYS
  927. opt.rle = opt.responsiveLevels.length || 1;
  928. opt.gridwidth = cArray(opt.gridwidth,opt.rle);
  929. opt.gridheight = cArray(opt.gridheight,opt.rle);
  930. // END OF VERSION 5.0 INIT MODIFICATION
  931. // SIMPLIFY ANIMATIONS ON OLD IOS AND IE8 IF NEEDED
  932. if (opt.simplifyAll=="on" && (_R.isIE(8) || _R.iOSVersion())) {
  933. container.find('.tp-caption').each(function() {
  934. var tc = jQuery(this);
  935. tc.removeClass("customin customout").addClass("fadein fadeout");
  936. tc.data('splitin',"");
  937. tc.data('speed',400);
  938. })
  939. opt.li.each(function() {
  940. var li= jQuery(this);
  941. li.data('transition',"fade");
  942. li.data('masterspeed',500);
  943. li.data('slotamount',1);
  944. var img = li.find('.rev-slidebg') || li.find('>img').first();
  945. img.data('kenburns',"off");
  946. });
  947. }
  948. opt.desktop = !navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|BB10|mobi|tablet|opera mini|nexus 7)/i);
  949. // SOME OPTIONS WHICH SHOULD CLOSE OUT SOME OTHER SETTINGS
  950. opt.autoHeight = opt.sliderLayout=="fullscreen" ? "on" : opt.autoHeight;
  951. if (opt.sliderLayout=="fullwidth" && opt.autoHeight=="off") container.css({maxHeight:opt.gridheight[opt.curWinRange]+"px"});
  952. // BUILD A FORCE FULLWIDTH CONTAINER, TO SPAN THE FULL SLIDER TO THE FULL WIDTH OF BROWSER
  953. if (opt.sliderLayout!="auto" && container.closest('.forcefullwidth_wrapper_tp_banner').length==0) {
  954. if (opt.sliderLayout!=="fullscreen" || opt.fullScreenAutoWidth!="on") {
  955. var cp = container.parent(),
  956. mb = cp.css('marginBottom'),
  957. mt = cp.css('marginTop');
  958. mb = mb===undefined ? 0 : mb;
  959. mt = mt===undefined ? 0 : mt;
  960. cp.wrap('<div class="forcefullwidth_wrapper_tp_banner" style="position:relative;width:100%;height:auto;margin-top:'+mt+';margin-bottom:'+mb+'"></div>');
  961. container.closest('.forcefullwidth_wrapper_tp_banner').append('<div class="tp-fullwidth-forcer" style="width:100%;height:'+container.height()+'px"></div>');
  962. container.parent().css({marginTop:"0px",marginBottom:"0px"});
  963. //container.css({'backgroundColor':container.parent().css('backgroundColor'),'backgroundImage':container.parent().css('backgroundImage')});
  964. container.parent().css({position:'absolute'});
  965. }
  966. }
  967. // SHADOW ADD ONS
  968. if (opt.shadow!==undefined && opt.shadow>0) {
  969. container.parent().addClass('tp-shadow'+opt.shadow);
  970. container.parent().append('<div class="tp-shadowcover"></div>');
  971. container.parent().find('.tp-shadowcover').css({'backgroundColor':container.parent().css('backgroundColor'),'backgroundImage':container.parent().css('backgroundImage')});
  972. }
  973. // ESTIMATE THE CURRENT WINDOWS RANGE INDEX
  974. setCurWinRange(opt);
  975. setCurWinRange(opt,true);
  976. // IF THE CONTAINER IS NOT YET INITIALISED, LETS GO FOR IT
  977. if (!container.hasClass("revslider-initialised")) {
  978. // MARK THAT THE CONTAINER IS INITIALISED WITH SLIDER REVOLUTION ALREADY
  979. container.addClass("revslider-initialised");
  980. // FOR BETTER SELECTION, ADD SOME BASIC CLASS
  981. container.addClass("tp-simpleresponsive");
  982. // WE DONT HAVE ANY ID YET ? WE NEED ONE ! LETS GIVE ONE RANDOMLY FOR RUNTIME
  983. if (container.attr('id')==undefined) container.attr('id',"revslider-"+Math.round(Math.random()*1000+5));
  984. // CHECK IF FIREFOX 13 IS ON WAY.. IT HAS A STRANGE BUG, CSS ANIMATE SHOULD NOT BE USED
  985. opt.firefox13 = false;
  986. opt.ie = !jQuery.support.opacity;
  987. opt.ie9 = (document.documentMode == 9);
  988. opt.origcd=opt.delay;
  989. // CHECK THE jQUERY VERSION
  990. var version = jQuery.fn.jquery.split('.'),
  991. versionTop = parseFloat(version[0]),
  992. versionMinor = parseFloat(version[1]),
  993. versionIncrement = parseFloat(version[2] || '0');
  994. if (versionTop==1 && versionMinor < 7)
  995. container.html('<div style="text-align:center; padding:40px 0px; font-size:20px; color:#992222;"> The Current Version of jQuery:'+version+' <br>Please update your jQuery Version to min. 1.7 in Case you wish to use the Revolution Slider Plugin</div>');
  996. if (versionTop>1) opt.ie=false;
  997. // PREPARE VIDEO PLAYERS
  998. var addedApis = new Object();
  999. addedApis.addedyt=0;
  1000. addedApis.addedvim=0;
  1001. addedApis.addedvid=0;
  1002. container.find('.tp-caption, .rs-background-video-layer').each(function(i) {
  1003. var _nc = jQuery(this),
  1004. an = _nc.data('autoplayonlyfirsttime'),
  1005. ap = _nc.data('autoplay');
  1006. if (_nc.hasClass("tp-static-layer") && _R.handleStaticLayers)
  1007. _R.handleStaticLayers(_nc,opt);
  1008. // FIX VISIBLE IFRAME BUG IN SAFARI
  1009. var iff = 0;
  1010. _nc.find('iframe').each(function() {
  1011. punchgs.TweenLite.set(jQuery(this),{autoAlpha:0});
  1012. iff++;
  1013. })
  1014. if (iff>0)
  1015. _nc.data('iframes',true)
  1016. if (_nc.hasClass("tp-caption")) {
  1017. // PREPARE LAYERS AND WRAP THEM WITH PARALLAX, LOOP, MASK HELP CONTAINERS
  1018. var ec = _nc.hasClass("slidelink") ? "width:100% !important;height:100% !important;" : "";
  1019. _nc.wrap('<div class="tp-parallax-wrap" style="'+ec+'position:absolute;visibility:hidden"><div class="tp-loop-wrap" style="'+ec+'position:absolute;"><div class="tp-mask-wrap" style="'+ec+'position:absolute" ></div></div></div>');
  1020. var lar = ['pendulum', 'rotate','slideloop','pulse','wave'],
  1021. _lc = _nc.closest('.tp-loop-wrap');
  1022. jQuery.each(lar,function(i,k) {
  1023. var lw = _nc.find('.rs-'+k),
  1024. f = lw.data() || "";
  1025. if (f!="") {
  1026. _lc.data(f);
  1027. _lc.addClass("rs-"+k);
  1028. lw.children(0).unwrap();
  1029. _nc.data('loopanimation',"on");
  1030. }
  1031. });
  1032. punchgs.TweenLite.set(_nc,{visibility:"hidden"});
  1033. }
  1034. var as = _nc.data('actions');
  1035. if (as!==undefined) _R.checkActions(_nc,opt,as);
  1036. checkHoverDependencies(_nc,opt);
  1037. if (_R.checkVideoApis)
  1038. addedApis = _R.checkVideoApis(_nc,opt,addedApis);
  1039. // REMOVE VIDEO AUTOPLAYS FOR MOBILE DEVICES
  1040. if (_ISM) {
  1041. if (an == true || an=="true") {
  1042. _nc.data('autoplayonlyfirsttime',"false");
  1043. an=false;
  1044. }
  1045. if (ap==true || ap=="true" || ap=="on" || ap=="1sttime") {
  1046. _nc.data('autoplay',"off");
  1047. ap="off";
  1048. }
  1049. }
  1050. // PREPARE TIMER BEHAVIOUR BASED ON AUTO PLAYED VIDEOS IN SLIDES
  1051. if (an == true || an=="true" || ap == "1sttime")
  1052. _nc.closest('li.tp-revslider-slidesli').addClass("rs-pause-timer-once");
  1053. if (ap==true || ap=="true" || ap == "on" || ap == "no1sttime")
  1054. _nc.closest('li.tp-revslider-slidesli').addClass("rs-pause-timer-always");
  1055. });
  1056. container.hover(
  1057. function() {
  1058. container.trigger('tp-mouseenter');
  1059. opt.overcontainer=true;
  1060. },
  1061. function() {
  1062. container.trigger('tp-mouseleft');
  1063. opt.overcontainer=false;
  1064. });
  1065. container.on('mouseover',function() {
  1066. container.trigger('tp-mouseover');
  1067. opt.overcontainer=true;
  1068. })
  1069. // REMOVE ANY VIDEO JS SETTINGS OF THE VIDEO IF NEEDED (OLD FALL BACK, AND HELP FOR 3THD PARTY PLUGIN CONFLICTS)
  1070. container.find('.tp-caption video').each(function(i) {
  1071. var v = jQuery(this);
  1072. v.removeClass("video-js vjs-default-skin");
  1073. v.attr("preload","");
  1074. v.css({display:"none"});
  1075. });
  1076. //PREPARE LOADINGS ALL IN SEQUENCE
  1077. if (opt.sliderType!=="standard") opt.lazyType = "all";
  1078. // PRELOAD STATIC LAYERS
  1079. loadImages(container.find('.tp-static-layers'),opt,0);
  1080. waitForCurrentImages(container.find('.tp-static-layers img'),opt,function() {
  1081. container.find('.tp-static-layers img').each(function() {
  1082. var e = jQuery(this),
  1083. src = e.data('lazyload') != undefined ? e.data('lazyload') : e.attr('src'),
  1084. loadobj = getLoadObj(opt,src);
  1085. e.attr('src',loadobj.src)
  1086. })
  1087. })
  1088. // SET ALL LI AN INDEX AND INIT LAZY LOADING
  1089. opt.li.each(function(i) {
  1090. var li = jQuery(this);
  1091. if (opt.lazyType=="all" || (opt.lazyType=="smart" && (i==0 || i == 1 || i == opt.slideamount || i == opt.slideamount-1))) {
  1092. loadImages(li,opt,i);
  1093. waitForCurrentImages(li,opt,function() {
  1094. if (opt.sliderType=="carousel")
  1095. punchgs.TweenLite.to(li,1,{autoAlpha:1,ease:punchgs.Power3.easeInOut});
  1096. });
  1097. }
  1098. });
  1099. // IF DEEPLINK HAS BEEN SET
  1100. var deeplink = getUrlVars("#")[0];
  1101. if (deeplink.length<9) {
  1102. if (deeplink.split('slide').length>1) {
  1103. var dslide=parseInt(deeplink.split('slide')[1],0);
  1104. if (dslide<1) dslide=1;
  1105. if (dslide>opt.slideamount) dslide=opt.slideamount;
  1106. opt.startWithSlide=dslide-1;
  1107. }
  1108. }
  1109. // PREPARE THE SPINNER
  1110. container.append( '<div class="tp-loader '+opt.spinner+'">'+
  1111. '<div class="dot1"></div>'+
  1112. '<div class="dot2"></div>'+
  1113. '<div class="bounce1"></div>'+
  1114. '<div class="bounce2"></div>'+
  1115. '<div class="bounce3"></div>'+
  1116. '</div>');
  1117. // RESET THE TIMER
  1118. if (container.find('.tp-bannertimer').length===0) container.append('<div class="tp-bannertimer" style="visibility:hidden"></div>');
  1119. container.find('.tp-bannertimer').css({'width':'0%'});
  1120. container.find('.tp-bannertimer').data('opt',opt);
  1121. // PREPARE THE SLIDES
  1122. opt.ul.css({'display':'block'});
  1123. prepareSlides(container,opt);
  1124. if (opt.parallax.type!=="off") _R.checkForParallax(container,opt);
  1125. // PREPARE SLIDER SIZE
  1126. _R.setSize(opt);
  1127. // Call the Navigation Builder
  1128. if (opt.sliderType!=="hero") _R.createNavigation(container,opt);
  1129. if (_R.resizeThumbsTabs) _R.resizeThumbsTabs(opt);
  1130. contWidthManager(opt);
  1131. var _v = opt.viewPort;
  1132. opt.inviewport = false;
  1133. if (_v !=undefined && _v.enable) {
  1134. _v.visible_area = parseFloat(_v.visible_area)/100;
  1135. _v.visible_area = _v.visible_area<0.001 ? _v.visible_area*100 : _v.visible_area;
  1136. if (_R.scrollTicker) _R.scrollTicker(opt,container);
  1137. }
  1138. // START THE SLIDER
  1139. setTimeout(function() {
  1140. if ( opt.sliderType =="carousel") _R.prepareCarousel(opt);
  1141. if (!_v.enable || (_v.enable && opt.inviewport) || (_v.enable && !opt.inviewport && !_v.outof=="wait")) {
  1142. swapSlide(container,opt);
  1143. }
  1144. else
  1145. opt.waitForFirstSlide = true;
  1146. if (_R.manageNavigation) _R.manageNavigation(opt);
  1147. // START COUNTDOWN
  1148. if (opt.slideamount>1) {
  1149. if (!_v.enable || (_v.enable && opt.inviewport))
  1150. countDown(container,opt);
  1151. else
  1152. opt.waitForCountDown = true;
  1153. }
  1154. setTimeout(function() {
  1155. container.trigger('revolution.slide.onloaded');
  1156. },100);
  1157. },opt.startDelay);
  1158. opt.startDelay=0;
  1159. /******************************
  1160. - FULLSCREEN CHANGE -
  1161. ********************************/
  1162. // FULLSCREEN MODE TESTING
  1163. jQuery("body").data('rs-fullScreenMode',false);
  1164. jQuery(window).on ('mozfullscreenchange webkitfullscreenchange fullscreenchange',function(){
  1165. jQuery("body").data('rs-fullScreenMode',!jQuery("body").data('rs-fullScreenMode'));
  1166. if (jQuery("body").data('rs-fullScreenMode')) {
  1167. setTimeout(function() {
  1168. jQuery(window).trigger("resize");
  1169. },200);
  1170. }
  1171. });
  1172. var resizid = "resize.revslider-"+container.attr('id');
  1173. // IF RESIZED, NEED TO STOP ACTUAL TRANSITION AND RESIZE ACTUAL IMAGES
  1174. jQuery(window).on(resizid,function() {
  1175. if (container==undefined) return false;
  1176. if (jQuery('body').find(container)!=0)
  1177. contWidthManager(opt);
  1178. if (container.outerWidth(true)!=opt.width || container.is(":hidden") || (opt.sliderLayout=="fullscreen" && jQuery(window).height()!=opt.lastwindowheight)) {
  1179. opt.lastwindowheight = jQuery(window).height();
  1180. containerResized(container,opt);
  1181. }
  1182. });
  1183. hideSliderUnder(container,opt);
  1184. contWidthManager(opt);
  1185. if (!opt.fallbacks.disableFocusListener && opt.fallbacks.disableFocusListener != "true" && opt.fallbacks.disableFocusListener !== true) tabBlurringCheck(container,opt);
  1186. }
  1187. }
  1188. /*************************************
  1189. - CREATE SIMPLE ARRAYS -
  1190. **************************************/
  1191. var cArray = function(b,l) {
  1192. if (!jQuery.isArray(b)) {
  1193. var t = b;
  1194. b = new Array();
  1195. b.push(t);
  1196. }
  1197. if (b.length<l) {
  1198. var t = b[b.length-1];
  1199. for (var i=0;i<(l-b.length)+2;i++)
  1200. b.push(t)
  1201. }
  1202. return b;
  1203. }
  1204. var checkHoverDependencies = function(_nc,opt) {
  1205. if (_nc.data('start')==="sliderenter") {
  1206. if (opt.layersonhover===undefined) {
  1207. opt.c.on('tp-mouseenter',function() {
  1208. if (opt.layersonhover)
  1209. jQuery.each(opt.layersonhover,function(i,tnc) {
  1210. tnc.data('animdirection',"in");
  1211. var otl = tnc.data('timeline_out'),
  1212. base_offsetx = opt.sliderType==="carousel" ? 0 : opt.width/2 - (opt.gridwidth[opt.curWinRange]*opt.bw)/2,
  1213. base_offsety=0,
  1214. cli = tnc.closest('.tp-revslider-slidesli');
  1215. if (cli.hasClass("active-revslide") || cli.hasClass("processing-revslide")) {
  1216. if (otl!=undefined) {
  1217. otl.pause(0);
  1218. otl.kill();
  1219. }
  1220. _R.animateSingleCaption(tnc,opt,base_offsetx,base_offsety,0,false,true);
  1221. var tl = tnc.data('timeline');
  1222. tnc.data('triggerstate',"on");
  1223. tl.play(0);
  1224. }
  1225. });
  1226. });
  1227. opt.c.on('tp-mouseleft',function() {
  1228. if (opt.layersonhover)
  1229. jQuery.each(opt.layersonhover,function(i,tnc) {
  1230. tnc.data('animdirection',"out");
  1231. tnc.data('triggered',true);
  1232. tnc.data('triggerstate',"off");
  1233. if (_R.stopVideo) _R.stopVideo(tnc,opt);
  1234. if (_R.endMoveCaption) _R.endMoveCaption(tnc,null,null,opt);
  1235. });
  1236. });
  1237. opt.layersonhover = new Array;
  1238. }
  1239. opt.layersonhover.push(_nc);
  1240. }
  1241. }
  1242. var contWidthManager = function(opt) {
  1243. var rl = _R.getHorizontalOffset(opt.c,"left");
  1244. if (opt.sliderLayout!="auto" && (opt.sliderLayout!=="fullscreen" || opt.fullScreenAutoWidth!="on")) {
  1245. var loff = Math.ceil(opt.c.closest('.forcefullwidth_wrapper_tp_banner').offset().left - rl);
  1246. punchgs.TweenLite.set(opt.c.parent(),{'left':(0-loff)+"px",'width':jQuery(window).width()-_R.getHorizontalOffset(opt.c,"both")});
  1247. } else {
  1248. if (opt.sliderLayout=="fullscreen" && opt.fullScreenAutoWidth=="on")
  1249. punchgs.TweenLite.set(opt.ul,{left:0,width:opt.c.width()});
  1250. else
  1251. punchgs.TweenLite.set(opt.ul,{left:rl,width:opt.c.width()-_R.getHorizontalOffset(opt.c,"both")});
  1252. }
  1253. // put Static Layer Wrapper in Position
  1254. if (opt.slayers && (opt.sliderLayout!="fullwidth" && opt.sliderLayout!="fullscreen"))
  1255. punchgs.TweenLite.set(opt.slayers,{left:rl});
  1256. }
  1257. var cv = function(a,d) {
  1258. return a===undefined ? d : a;
  1259. }
  1260. var hideSliderUnder = function(container,opt,resized) {
  1261. // FIRST TIME STOP/START HIDE / SHOW SLIDER
  1262. //REMOVE AND SHOW SLIDER ON DEMAND
  1263. var contpar= container.parent();
  1264. if (jQuery(window).width()<opt.hideSliderAtLimit) {
  1265. container.trigger('stoptimer');
  1266. if (contpar.css('display')!="none")
  1267. contpar.data('olddisplay',contpar.css('display'));
  1268. contpar.css({display:"none"});
  1269. } else {
  1270. if (container.is(":hidden") && resized) {
  1271. if (contpar.data('olddisplay')!=undefined && contpar.data('olddisplay')!="undefined" && contpar.data('olddisplay') != "none")
  1272. contpar.css({display:contpar.data('olddisplay')});
  1273. else
  1274. contpar.css({display:"block"});
  1275. container.trigger('restarttimer');
  1276. setTimeout(function() {
  1277. containerResized(container,opt);
  1278. },150)
  1279. }
  1280. }
  1281. if (_R.hideUnHideNav) _R.hideUnHideNav(opt);
  1282. }
  1283. //////////////////////////
  1284. // CONTAINER RESIZED //
  1285. /////////////////////////
  1286. var containerResized = function (c,opt) {
  1287. if (opt.infullscreenmode == true)
  1288. opt.minHeight = jQuery(window).height();
  1289. setCurWinRange(opt);
  1290. setCurWinRange(opt,true);
  1291. if (!_R.resizeThumbsTabs || _R.resizeThumbsTabs(opt)===true) {
  1292. hideSliderUnder(c,opt,true);
  1293. contWidthManager(opt);
  1294. if ( opt.sliderType =="carousel") _R.prepareCarousel(opt,true);
  1295. if (c===undefined) return false;
  1296. _R.setSize(opt);
  1297. opt.conw = opt.c.width();
  1298. opt.conh = opt.infullscreenmode ? opt.minHeight : opt.c.height();
  1299. var actsh = c.find('.active-revslide .slotholder'),
  1300. nextsh = c.find('.processing-revslide .slotholder');
  1301. removeSlots(c,opt,c,2);
  1302. if (opt.sliderType==="standard") {
  1303. punchgs.TweenLite.set(nextsh.find('.defaultimg'),{opacity:0});
  1304. actsh.find('.defaultimg').css({'opacity':1});
  1305. }
  1306. if ( opt.sliderType =="carousel" && opt.lastconw != opt.conw) {
  1307. clearTimeout(opt.pcartimer);
  1308. opt.pcartimer = setTimeout(function() {
  1309. _R.prepareCarousel(opt,true);
  1310. },100);
  1311. opt.lastconw = opt.conw;
  1312. }
  1313. if (_R.manageNavigation) _R.manageNavigation(opt);
  1314. if (_R.animateTheCaptions) _R.animateTheCaptions(c.find('.active-revslide'), opt,true);
  1315. if (nextsh.data('kenburns')=="on")
  1316. _R.startKenBurn(nextsh,opt,nextsh.data('kbtl').progress());
  1317. if (actsh.data('kenburns')=="on")
  1318. _R.startKenBurn(actsh,opt,actsh.data('kbtl').progress());
  1319. // DOUBLE CALL FOR SOME FUNCTION TO AVOID PORTRAIT/LANDSCAPE ISSUES, AND TO AVOID FULLSCREEN/NORMAL SWAP ISSUES
  1320. if (_R.animateTheCaptions) _R.animateTheCaptions(nextsh.closest('li'), opt,true);
  1321. if (_R.manageNavigation) _R.manageNavigation(opt);
  1322. }
  1323. }
  1324. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1325. /////////////////////////////////////////////////////////////////////////////// PREPARING / REMOVING ////////////////////////////////////////////////////////
  1326. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1327. var setScale = function(opt) {
  1328. opt.bw = (opt.width / opt.gridwidth[opt.curWinRange]);
  1329. opt.bh = (opt.height / opt.gridheight[opt.curWinRange]);
  1330. if (opt.bh>opt.bw)
  1331. opt.bh=opt.bw
  1332. else
  1333. opt.bw = opt.bh;
  1334. if (opt.bh>1 || opt.bw>1) { opt.bw=1; opt.bh=1; }
  1335. }
  1336. /////////////////////////////////////////
  1337. // - PREPARE THE SLIDES / SLOTS - //
  1338. ///////////////////////////////////////
  1339. var prepareSlides = function(container,opt) {
  1340. container.find('.tp-caption').each(function() {
  1341. var c = jQuery(this);
  1342. if (c.data('transition')!==undefined) c.addClass(c.data('transition'));
  1343. });
  1344. // PREPARE THE UL CONTAINER TO HAVEING MAX HEIGHT AND HEIGHT FOR ANY SITUATION
  1345. opt.ul.css({overflow:'hidden',width:'100%',height:'100%',maxHeight:container.parent().css('maxHeight')})
  1346. if (opt.autoHeight=="on") {
  1347. opt.ul.css({overflow:'hidden',width:'100%',height:'100%',maxHeight:"none"});
  1348. container.css({'maxHeight':'none'});
  1349. container.parent().css({'maxHeight':'none'});
  1350. }
  1351. //_R.setSize("",opt);
  1352. opt.li.each(function(j) {
  1353. var li=jQuery(this),
  1354. originalIndex = li.data('originalindex');
  1355. //START WITH CORRECT SLIDE
  1356. if ((opt.startWithSlide !=undefined && originalIndex==opt.startWithSlide) || opt.startWithSlide ===undefined && j==0)
  1357. li.addClass("next-revslide");
  1358. // MAKE LI OVERFLOW HIDDEN FOR FURTHER ISSUES
  1359. li.css({'width':'100%','height':'100%','overflow':'hidden'});
  1360. });
  1361. if (opt.sliderType === "carousel") {
  1362. //SET CAROUSEL
  1363. opt.ul.css({overflow:"visible"}).wrap('<div class="tp-carousel-wrapper" style="width:100%;height:100%;position:absolute;top:0px;left:0px;overflow:hidden;"></div>');
  1364. var apt = '<div style="clear:both;display:block;width:100%;height:1px;position:relative;margin-bottom:-1px"></div>';
  1365. opt.c.parent().prepend(apt);
  1366. opt.c.parent().append(apt);
  1367. _R.prepareCarousel(opt);
  1368. }
  1369. // RESOLVE OVERFLOW HIDDEN OF MAIN CONTAINER
  1370. container.parent().css({'overflow':'visible'});
  1371. opt.li.find('>img').each(function(j) {
  1372. var img=jQuery(this),
  1373. bgvid = img.closest('li').find('.rs-background-video-layer');
  1374. bgvid.addClass("defaultvid").css({zIndex:30});
  1375. img.addClass('defaultimg');
  1376. // TURN OF KEN BURNS IF WE ARE ON MOBILE AND IT IS WISHED SO
  1377. if (opt.panZoomDisableOnMobile == "on" && _ISM) {
  1378. img.data('kenburns',"off");
  1379. img.data('bgfit',"cover");
  1380. }
  1381. img.wrap('<div class="slotholder" style="width:100%;height:100%;"></div>');
  1382. bgvid.appendTo(img.closest('li').find('.slotholder'));
  1383. var dts = img.data();
  1384. img.closest('.slotholder').data(dts);
  1385. if (bgvid.length>0 && dts.bgparallax!=undefined)
  1386. bgvid.data('bgparallax',dts.bgparallax);
  1387. if (opt.dottedOverlay!="none" && opt.dottedOverlay!=undefined)
  1388. img.closest('.slotholder').append('<div class="tp-dottedoverlay '+opt.dottedOverlay+'"></div>');
  1389. var src=img.attr('src');
  1390. dts.src = src;
  1391. dts.bgfit = dts.bgfit || "cover";
  1392. dts.bgrepeat = dts.bgrepeat || "no-repeat",
  1393. dts.bgposition = dts.bgposition || "center center";
  1394. var pari = img.closest('.slotholder');
  1395. img.parent().append('<div class="tp-bgimg defaultimg" style="background-color:'+img.css("backgroundColor")+';background-repeat:'+dts.bgrepeat+';background-image:url('+src+');background-size:'+dts.bgfit+';background-position:'+dts.bgposition+';width:100%;height:100%;"></div>');
  1396. var comment = document.createComment("Runtime Modification - Img tag is Still Available for SEO Goals in Source - " + img.get(0).outerHTML);
  1397. img.replaceWith(comment);
  1398. img = pari.find('.tp-bgimg');
  1399. img.data(dts);
  1400. img.attr("src",src);
  1401. if (opt.sliderType === "standard" || opt.sliderType==="undefined")
  1402. img.css({'opacity':0});
  1403. })
  1404. }
  1405. // REMOVE SLOTS //
  1406. var removeSlots = function(container,opt,where,addon) {
  1407. opt.removePrepare = opt.removePrepare + addon;
  1408. where.find('.slot, .slot-circle-wrapper').each(function() {
  1409. jQuery(this).remove();
  1410. });
  1411. opt.transition = 0;
  1412. opt.removePrepare = 0;
  1413. }
  1414. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1415. /////////////////////////////////////////////////////////////////////////////// SLIDE SWAPS ////////////////////////////////////////////////////////////
  1416. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1417. // THE IMAGE IS LOADED, WIDTH, HEIGHT CAN BE SAVED
  1418. var cutParams = function(a) {
  1419. var b = a;
  1420. if (a!=undefined && a.length>0)
  1421. b = a.split("?")[0];
  1422. return b;
  1423. }
  1424. var relativeRedir = function(redir){
  1425. return location.pathname.replace(/(.*)\/[^/]*/, "$1/"+redir);
  1426. }
  1427. var abstorel = function (base, relative) {
  1428. var stack = base.split("/"),
  1429. parts = relative.split("/");
  1430. stack.pop(); // remove current file name (or empty string)
  1431. // (omit if "base" is the current folder without trailing slash)
  1432. for (var i=0; i<parts.length; i++) {
  1433. if (parts[i] == ".")
  1434. continue;
  1435. if (parts[i] == "..")
  1436. stack.pop();
  1437. else
  1438. stack.push(parts[i]);
  1439. }
  1440. return stack.join("/");
  1441. }
  1442. var imgLoaded = function(img,opt,progress) {
  1443. opt.syncload--;
  1444. if (opt.loadqueue)
  1445. jQuery.each(opt.loadqueue, function(index,queue) {
  1446. var mqsrc = queue.src.replace(/\.\.\/\.\.\//gi,""),
  1447. fullsrc = self.location.href,
  1448. origin = document.location.origin,
  1449. fullsrc_b = fullsrc.substring(0,fullsrc.length-1)+"/"+mqsrc,
  1450. origin_b = origin+"/"+mqsrc,
  1451. absolute = abstorel(self.location.href,queue.src);
  1452. fullsrc = fullsrc.substring(0,fullsrc.length-1)+mqsrc;
  1453. origin = origin+mqsrc;
  1454. if (cutParams(origin) === cutParams(decodeURIComponent(img.src)) ||
  1455. cutParams(fullsrc)=== cutParams(decodeURIComponent(img.src)) ||
  1456. cutParams(absolute)=== cutParams(decodeURIComponent(img.src)) ||
  1457. cutParams(origin_b) === cutParams(decodeURIComponent(img.src)) ||
  1458. cutParams(fullsrc_b)=== cutParams(decodeURIComponent(img.src)) ||
  1459. cutParams(queue.src) === cutParams(decodeURIComponent(img.src)) ||
  1460. cutParams(queue.src).replace(/^.*\/\/[^\/]+/, '') === cutParams(decodeURIComponent(img.src)).replace(/^.*\/\/[^\/]+/, '') ||
  1461. (window.location.origin==="file://" && cutParams(img.src).match(new RegExp(mqsrc)))) {
  1462. queue.progress = progress;
  1463. queue.width = img.width;
  1464. queue.height = img.height;
  1465. }
  1466. });
  1467. progressImageLoad(opt);
  1468. }
  1469. // PRELOAD IMAGES 3 PIECES ON ONE GO, CHECK LOAD PRIORITY
  1470. var progressImageLoad = function(opt) {
  1471. if (opt.syncload == 3) return;
  1472. if (opt.loadqueue)
  1473. jQuery.each(opt.loadqueue, function(index,queue) {
  1474. if (queue.progress.match(/prepared/g)) {
  1475. if (opt.syncload<=3) {
  1476. opt.syncload++;
  1477. var img = new Image();
  1478. img.onload = function() {
  1479. imgLoaded(this,opt,"loaded");
  1480. };
  1481. img.onerror = function() {
  1482. imgLoaded(this,opt,"failed");
  1483. };
  1484. img.src=queue.src;
  1485. queue.progress="inload";
  1486. }
  1487. }
  1488. });
  1489. }
  1490. // ADD TO QUEUE THE NOT LOADED IMAGES YES
  1491. var addToLoadQueue = function(src,opt,prio) {
  1492. var alreadyexist = false;
  1493. if (opt.loadqueue)
  1494. jQuery.each(opt.loadqueue, function(index,queue) {
  1495. if (queue.src === src) alreadyexist = true;
  1496. });
  1497. if (!alreadyexist) {
  1498. var loadobj = new Object();
  1499. loadobj.src = src;
  1500. loadobj.prio = prio;
  1501. loadobj.progress = "prepared";
  1502. opt.loadqueue.push(loadobj);
  1503. }
  1504. }
  1505. // LOAD THE IMAGES OF THE PREDEFINED CONTAINER
  1506. var loadImages = function(container,opt,prio) {
  1507. container.find('img,.defaultimg').each(function() {
  1508. var element = jQuery(this),
  1509. src = element.data('lazyload') !== undefined && element.data('lazyload')!=="undefined" ? element.data('lazyload') : element.attr('src');
  1510. element.data('start-to-load',jQuery.now());
  1511. addToLoadQueue(src,opt,prio);
  1512. });
  1513. progressImageLoad(opt);
  1514. }
  1515. // FIND SEARCHED IMAGE IN THE LOAD QUEUE
  1516. var getLoadObj = function(opt,src) {
  1517. var obj = new Object();
  1518. if (opt.loadqueue)
  1519. jQuery.each(opt.loadqueue, function(index,queue) {
  1520. if (queue.src == src) obj = queue;
  1521. });
  1522. return obj;
  1523. }
  1524. // WAIT PROGRESS TILL THE PREDEFINED CONTAINER HAS ALL IMAGES LOADED INSIDE
  1525. var waitForCurrentImages = function(nextli,opt,callback) {
  1526. var waitforload = false;
  1527. nextli.find('img,.defaultimg').each(function() {
  1528. var element = jQuery(this),
  1529. src = element.data('lazyload') != undefined ? element.data('lazyload') : element.attr('src'),
  1530. loadobj = getLoadObj(opt,src);
  1531. // IF ELEMENTS IS NOT LOADED YET, AND IT IS NOW LOADED
  1532. if (element.data('loaded')===undefined && loadobj !==undefined && loadobj.progress && loadobj.progress.match(/loaded/g)) {
  1533. element.attr('src',loadobj.src);
  1534. // IF IT IS A DEFAULT IMG, WE NEED TO ASSIGN SOME SPECIAL VALUES TO IT
  1535. if (element.hasClass("defaultimg")) {
  1536. if (!_R.isIE(8))
  1537. element.css({backgroundImage:'url("'+loadobj.src+'")'});
  1538. else {
  1539. defimg.attr('src',loadobj.src);
  1540. }
  1541. nextli.data('owidth',loadobj.width);
  1542. nextli.data('oheight',loadobj.height);
  1543. nextli.find('.slotholder').data('owidth',loadobj.width);
  1544. nextli.find('.slotholder').data('oheight',loadobj.height);
  1545. } else {
  1546. var w = element.data('ww'),
  1547. h = element.data('hh');
  1548. element.data('owidth',loadobj.width);
  1549. element.data('oheight',loadobj.height);
  1550. w = w==undefined || w =="auto" || w=="" ? loadobj.width : w;
  1551. h = h==undefined || h =="auto" || h=="" ? loadobj.height : h;
  1552. element.data('ww',w);
  1553. element.data('hh',h);
  1554. }
  1555. // ELEMENT IS NOW FULLY LOADED
  1556. element.data('loaded',true);
  1557. }
  1558. if (loadobj && loadobj.progress && loadobj.progress.match(/inprogress|inload|prepared/g))
  1559. if (jQuery.now()-element.data('start-to-load')<5000)
  1560. waitforload = true;
  1561. else
  1562. console.error(src+" Could not be loaded !");
  1563. // WAIT FOR VIDEO API'S
  1564. if (opt.youtubeapineeded == true && (!window['YT'] || YT.Player==undefined)) {
  1565. waitforload = true;
  1566. if (jQuery.now()-opt.youtubestarttime>5000 && opt.youtubewarning!=true) {
  1567. opt.youtubewarning = true;
  1568. var txt = "YouTube Api Could not be loaded !";
  1569. if (location.protocol === 'https:') txt = txt + " Please Check and Renew SSL Certificate !";
  1570. console.error(txt);
  1571. opt.c.append('<div style="position:absolute;top:50%;width:100%;color:#e74c3c; font-size:16px; text-align:center; padding:15px;background:#000; display:block;"><strong>'+txt+'</strong></div>')
  1572. }
  1573. }
  1574. if (opt.vimeoapineeded == true && !window['Froogaloop']) {
  1575. waitforload = true;
  1576. if (jQuery.now()-opt.vimeostarttime>5000 && opt.vimeowarning!=true) {
  1577. opt.vimeowarning= true;
  1578. var txt = "Vimeo Froogaloop Api Could not be loaded !";
  1579. if (location.protocol === 'https:') txt = txt + " Please Check and Renew SSL Certificate !";
  1580. console.error(txt);
  1581. opt.c.append('<div style="position:absolute;top:50%;width:100%;color:#e74c3c; font-size:16px; text-align:center; padding:15px;background:#000; display:block;"><strong>'+txt+'</strong></div>')
  1582. }
  1583. }
  1584. });
  1585. if (waitforload)
  1586. setTimeout(function() {
  1587. waitForCurrentImages(nextli,opt,callback) ;
  1588. },19);
  1589. else
  1590. callback();
  1591. }
  1592. //////////////////////////////////////
  1593. // - CALL TO SWAP THE SLIDES - //
  1594. /////////////////////////////////////
  1595. var swapSlide = function(container,opt) {
  1596. clearTimeout(opt.waitWithSwapSlide);
  1597. if (container.find('.processing-revslide').length>0) {
  1598. opt.waitWithSwapSlide = setTimeout(function() {
  1599. swapSlide(container,opt);
  1600. },150);
  1601. return false;
  1602. }
  1603. var actli = container.find('.active-revslide'),
  1604. nextli = container.find('.next-revslide'),
  1605. defimg= nextli.find('.defaultimg');
  1606. if (nextli.index() === actli.index()) {
  1607. nextli.removeClass("next-revslide");
  1608. return false;
  1609. }
  1610. nextli.removeClass("next-revslide").addClass("processing-revslide");
  1611. // CHECK IF WE ARE ALREADY AT LAST ITEM TO PLAY IN REAL LOOP SESSION
  1612. if (opt.stopLoop=="on" && nextli.index()==opt.lastslidetoshow-1) {
  1613. container.find('.tp-bannertimer').css({'visibility':'hidden'});
  1614. container.trigger('revolution.slide.onstop');
  1615. opt.noloopanymore = 1;
  1616. }
  1617. // INCREASE LOOP AMOUNTS
  1618. if (nextli.index()===opt.slideamount-1) {
  1619. opt.looptogo=opt.looptogo-1;
  1620. if (opt.looptogo<=0)
  1621. opt.stopLoop="on";
  1622. }
  1623. opt.tonpause = true;
  1624. container.trigger('stoptimer');
  1625. opt.cd=0;
  1626. container.find('.tp-loader').css({display:"block"});
  1627. loadImages(nextli,opt,1);
  1628. // WAIT FOR SWAP SLIDE PROGRESS
  1629. waitForCurrentImages(nextli,opt,function() {
  1630. // MANAGE BG VIDEOS
  1631. nextli.find('.rs-background-video-layer').each(function() {
  1632. var _nc = jQuery(this);
  1633. if (!_nc.hasClass("HasListener")) {
  1634. _nc.data('bgvideo',1);
  1635. _R.manageVideoLayer(_nc,opt);
  1636. }
  1637. _nc.append('<div class="rs-fullvideo-cover"></div>')
  1638. });
  1639. swapSlideProgress(opt,defimg,container)
  1640. });
  1641. }
  1642. //////////////////////////////////////
  1643. // - PROGRESS SWAP THE SLIDES - //
  1644. /////////////////////////////////////
  1645. var swapSlideProgress = function(opt,defimg,container) {
  1646. var actli = container.find('.active-revslide'),
  1647. nextli = container.find('.processing-revslide'),
  1648. actsh = actli.find('.slotholder'),
  1649. nextsh = nextli.find('.slotholder');
  1650. opt.tonpause = false;
  1651. opt.cd=0;
  1652. container.trigger('nulltimer');
  1653. container.find('.tp-loader').css({display:"none"});
  1654. // if ( opt.sliderType =="carousel") _R.prepareCarousel(opt);
  1655. _R.setSize(opt);
  1656. _R.slotSize(defimg,opt);
  1657. if (_R.manageNavigation) _R.manageNavigation(opt);
  1658. var data={};
  1659. data.nextslide=nextli;
  1660. data.currentslide=actli;
  1661. container.trigger('revolution.slide.onbeforeswap',data);
  1662. opt.transition = 1;
  1663. opt.videoplaying = false;
  1664. // IF DELAY HAS BEEN SET VIA THE SLIDE, WE TAKE THE NEW VALUE, OTHER WAY THE OLD ONE...
  1665. if (nextli.data('delay')!=undefined) {
  1666. opt.cd=0;
  1667. opt.delay=nextli.data('delay');
  1668. } else
  1669. opt.delay=opt.origcd;
  1670. var ai = actli.index(),
  1671. ni = nextli.index();
  1672. opt.sdir = ni<ai ? 1 : 0;
  1673. if (opt.sc_indicator=="arrow") {
  1674. if (ai==0 && ni==opt.slideamount-1) opt.sdir = 1;
  1675. if (ai==opt.slideamount-1 && ni==0) opt.sdir = 0;
  1676. }
  1677. opt.lsdir = opt.lsdir === undefined ? opt.sdir : opt.lsdir;
  1678. opt.dirc = opt.lsdir != opt.sdir;
  1679. opt.lsdir = opt.sdir;
  1680. ///////////////////////////
  1681. // REMOVE THE CAPTIONS //
  1682. ///////////////////////////
  1683. if (actli.index() != nextli.index() && opt.firststart!=1)
  1684. if (_R.removeTheCaptions) _R.removeTheCaptions(actli,opt);
  1685. if (!nextli.hasClass('rs-pause-timer-once') && !nextli.hasClass("rs-pause-timer-always"))
  1686. container.trigger('restarttimer');
  1687. else
  1688. opt.videoplaying = true;
  1689. nextli.removeClass("rs-pause-timer-once");
  1690. var nexttrans,
  1691. direction=-1,
  1692. mtl;
  1693. // SELECT SLIDER TYPE
  1694. if ( opt.sliderType =="carousel") {
  1695. mtl = new punchgs.TimelineLite();
  1696. _R.prepareCarousel(opt,mtl);
  1697. letItFree(container,opt,nextsh,actsh,nextli,actli,mtl);
  1698. opt.transition = 0;
  1699. opt.firststart = 0;
  1700. } else {
  1701. mtl = new punchgs.TimelineLite({onComplete:function() {
  1702. letItFree(container,opt,nextsh,actsh,nextli,actli,mtl);
  1703. }});
  1704. mtl.add(punchgs.TweenLite.set(nextsh.find('.defaultimg'),{opacity:0}));
  1705. mtl.pause();
  1706. if (opt.firststart==1) {
  1707. punchgs.TweenLite.set(actli,{autoAlpha:0});
  1708. opt.firststart=0;
  1709. }
  1710. punchgs.TweenLite.set(actli,{zIndex:18});
  1711. punchgs.TweenLite.set(nextli,{autoAlpha:0,zIndex:20});
  1712. // IF THERE IS AN OTHER FIRST SLIDE START HAS BEED SELECTED
  1713. if (nextli.data('differentissplayed') =='prepared') {
  1714. nextli.data('differentissplayed','done');
  1715. nextli.data('transition',nextli.data('savedtransition'));
  1716. nextli.data('slotamount',nextli.data('savedslotamount'));
  1717. nextli.data('masterspeed',nextli.data('savedmasterspeed'));
  1718. }
  1719. if (nextli.data('fstransition') != undefined && nextli.data('differentissplayed') !="done") {
  1720. nextli.data('savedtransition',nextli.data('transition'));
  1721. nextli.data('savedslotamount',nextli.data('slotamount'));
  1722. nextli.data('savedmasterspeed',nextli.data('masterspeed'));
  1723. nextli.data('transition',nextli.data('fstransition'));
  1724. nextli.data('slotamount',nextli.data('fsslotamount'));
  1725. nextli.data('masterspeed',nextli.data('fsmasterspeed'));
  1726. nextli.data('differentissplayed','prepared');
  1727. }
  1728. if (nextli.data('transition')==undefined) nextli.data('transition',"random");
  1729. nexttrans = 0;
  1730. var transtext = nextli.data('transition') !== undefined ? nextli.data('transition').split(",") : "fade",
  1731. curtransid = nextli.data('nexttransid') == undefined ? -1 : nextli.data('nexttransid');
  1732. if (nextli.data('randomtransition')=="on")
  1733. curtransid = Math.round(Math.random()*transtext.length);
  1734. else
  1735. curtransid=curtransid+1;
  1736. if (curtransid==transtext.length) curtransid=0;
  1737. nextli.data('nexttransid',curtransid);
  1738. var comingtransition = transtext[curtransid];
  1739. if (opt.ie) {
  1740. if (comingtransition=="boxfade") comingtransition = "boxslide";
  1741. if (comingtransition=="slotfade-vertical") comingtransition = "slotzoom-vertical";
  1742. if (comingtransition=="slotfade-horizontal") comingtransition = "slotzoom-horizontal";
  1743. }
  1744. if (_R.isIE(8))
  1745. comingtransition = 11;
  1746. mtl = _R.animateSlide(nexttrans, comingtransition, container, opt, nextli, actli, nextsh, actsh, mtl);
  1747. if (nextsh.data('kenburns')=="on") {
  1748. _R.startKenBurn(nextsh,opt);
  1749. mtl.add(punchgs.TweenLite.set(nextsh,{autoAlpha:0}))
  1750. }
  1751. // SHOW FIRST LI && ANIMATE THE CAPTIONS
  1752. mtl.pause();
  1753. }
  1754. // START PARALLAX IF NEEDED
  1755. if (opt.parallax.type!="off" && opt.parallax.firstgo==undefined && _R.scrollHandling) {
  1756. opt.parallax.firstgo = true;
  1757. opt.lastscrolltop = -999;
  1758. _R.scrollHandling(opt);
  1759. setTimeout(function() {
  1760. opt.lastscrolltop = -999;
  1761. _R.scrollHandling(opt);
  1762. },210);
  1763. setTimeout(function() {
  1764. opt.lastscrolltop = -999;
  1765. _R.scrollHandling(opt);
  1766. },420);
  1767. }
  1768. if (_R.animateTheCaptions) {
  1769. _R.animateTheCaptions(nextli, opt,null,mtl);
  1770. } else {
  1771. if (mtl != undefined) setTimeout(function() {
  1772. mtl.resume();
  1773. },30);
  1774. }
  1775. punchgs.TweenLite.to(nextli,0.001,{autoAlpha:1});
  1776. //if (_R.callStaticDDDParallax) _R.callStaticDDDParallax(container,opt,nextli);
  1777. }
  1778. //////////////////////////////////////////
  1779. // GIVE FREE THE TRANSITIOSN //
  1780. //////////////////////////////////////////
  1781. var letItFree = function(container,opt,nextsh,actsh,nextli,actli,mtl) {
  1782. if (opt.sliderType==="carousel") {
  1783. // CAROUSEL SLIDER
  1784. } else {
  1785. opt.removePrepare = 0;
  1786. punchgs.TweenLite.to(nextsh.find('.defaultimg'),0.001,{zIndex:20,autoAlpha:1,onComplete:function() {
  1787. removeSlots(container,opt,nextli,1);
  1788. }});
  1789. if (nextli.index()!=actli.index()) {
  1790. punchgs.TweenLite.to(actli,0.2,{zIndex:18,autoAlpha:0,onComplete:function() {
  1791. removeSlots(container,opt,actli,1);
  1792. }});
  1793. }
  1794. }
  1795. container.find('.active-revslide').removeClass("active-revslide");
  1796. container.find('.processing-revslide').removeClass("processing-revslide").addClass("active-revslide");
  1797. opt.act=nextli.index();
  1798. if (opt.parallax.type=="scroll" || opt.parallax.type=="scroll+mouse" || opt.parallax.type=="mouse+scroll") {
  1799. opt.lastscrolltop = -999;
  1800. _R.scrollHandling(opt);
  1801. }
  1802. mtl.clear();
  1803. if (actsh.data('kbtl')!=undefined) {
  1804. actsh.data('kbtl').reverse();
  1805. actsh.data('kbtl').timeScale(25);
  1806. }
  1807. if (nextsh.data('kenburns')=="on") {
  1808. if (nextsh.data('kbtl')!=undefined) {
  1809. nextsh.data('kbtl').timeScale(1);
  1810. nextsh.data('kbtl').play();
  1811. }
  1812. else
  1813. _R.startKenBurn(nextsh,opt);
  1814. }
  1815. nextli.find('.rs-background-video-layer').each(function(i) {
  1816. if (_ISM) return false;
  1817. var _nc = jQuery(this)
  1818. _R.resetVideo(_nc,opt);
  1819. punchgs.TweenLite.fromTo(_nc,1,{autoAlpha:0},{autoAlpha:1,ease:punchgs.Power3.easeInOut,delay:0.2,onComplete:function() {
  1820. if (_R.animcompleted) _R.animcompleted(_nc,opt);
  1821. }});
  1822. });
  1823. actli.find('.rs-background-video-layer').each(function(i) {
  1824. if (_ISM) return false;
  1825. var _nc = jQuery(this);
  1826. if (_R.stopVideo) {
  1827. _R.resetVideo(_nc,opt);
  1828. _R.stopVideo(_nc,opt);
  1829. }
  1830. punchgs.TweenLite.to(_nc,1,{autoAlpha:0,ease:punchgs.Power3.easeInOut,delay:0.2});
  1831. });
  1832. // TIRGGER THE ON CHANGE EVENTS
  1833. var data={};
  1834. data.slideIndex=nextli.index()+1;
  1835. data.slideLIIndex=nextli.index();
  1836. data.slide = nextli;
  1837. data.currentslide=nextli;
  1838. data.prevslide = actli;
  1839. container.trigger('revolution.slide.onchange',data);
  1840. container.trigger('revolution.slide.onafterswap',data);
  1841. //if (_R.callStaticDDDParallax) _R.callStaticDDDParallax(container,opt,nextli);
  1842. }
  1843. ///////////////////////////
  1844. // REMOVE THE LISTENERS //
  1845. ///////////////////////////
  1846. var removeAllListeners = function(container,opt) {
  1847. container.children().each(function() {
  1848. try{ jQuery(this).die('click'); } catch(e) {}
  1849. try{ jQuery(this).die('mouseenter');} catch(e) {}
  1850. try{ jQuery(this).die('mouseleave');} catch(e) {}
  1851. try{ jQuery(this).unbind('hover');} catch(e) {}
  1852. })
  1853. try{ container.die('click','mouseenter','mouseleave');} catch(e) {}
  1854. clearInterval(opt.cdint);
  1855. container=null;
  1856. }
  1857. ///////////////////////////
  1858. // - countDown - //
  1859. /////////////////////////
  1860. var countDown = function(container,opt) {
  1861. opt.cd=0;
  1862. opt.loop=0;
  1863. if (opt.stopAfterLoops!=undefined && opt.stopAfterLoops>-1)
  1864. opt.looptogo=opt.stopAfterLoops;
  1865. else
  1866. opt.looptogo=9999999;
  1867. if (opt.stopAtSlide!=undefined && opt.stopAtSlide>-1)
  1868. opt.lastslidetoshow=opt.stopAtSlide;
  1869. else
  1870. opt.lastslidetoshow=999;
  1871. opt.stopLoop="off";
  1872. if (opt.looptogo==0) opt.stopLoop="on";
  1873. var bt=container.find('.tp-bannertimer');
  1874. // LISTENERS //container.trigger('stoptimer');
  1875. container.on('stoptimer',function() {
  1876. var bt = jQuery(this).find('.tp-bannertimer');
  1877. bt.data('tween').pause();
  1878. if (opt.disableProgressBar=="on") bt.css({visibility:"hidden"});
  1879. opt.sliderstatus = "paused";
  1880. });
  1881. container.on('starttimer',function() {
  1882. if (opt.conthover!=1 && opt.videoplaying!=true && opt.width>opt.hideSliderAtLimit && opt.tonpause != true && opt.overnav !=true)
  1883. if (opt.noloopanymore !== 1 && (!opt.viewPort.enable || opt.inviewport)) {
  1884. bt.css({visibility:"visible"});
  1885. bt.data('tween').resume();
  1886. opt.sliderstatus = "playing";
  1887. }
  1888. if (opt.disableProgressBar=="on") bt.css({visibility:"hidden"});
  1889. });
  1890. container.on('restarttimer',function() {
  1891. var bt = jQuery(this).find('.tp-bannertimer');
  1892. if (opt.mouseoncontainer && opt.navigation.onHoverStop=="on" && (!_ISM)) return false;
  1893. if (opt.noloopanymore !== 1 && (!opt.viewPort.enable || opt.inviewport)) {
  1894. bt.css({visibility:"visible"});
  1895. bt.data('tween').kill();
  1896. bt.data('tween',punchgs.TweenLite.fromTo(bt,opt.delay/1000,{width:"0%"},{force3D:"auto",width:"100%",ease:punchgs.Linear.easeNone,onComplete:countDownNext,delay:1}));
  1897. opt.sliderstatus = "playing";
  1898. }
  1899. if (opt.disableProgressBar=="on") bt.css({visibility:"hidden"});
  1900. });
  1901. container.on('nulltimer',function() {
  1902. bt.data('tween').pause(0);
  1903. if (opt.disableProgressBar=="on") bt.css({visibility:"hidden"});
  1904. opt.sliderstatus = "paused";
  1905. });
  1906. var countDownNext = function() {
  1907. if (jQuery('body').find(container).length==0) {
  1908. removeAllListeners(container,opt);
  1909. clearInterval(opt.cdint);
  1910. }
  1911. container.trigger("revolution.slide.slideatend");
  1912. //STATE OF API CHANGED -> MOVE TO AIP BETTER
  1913. if (container.data('conthover-changed') == 1) {
  1914. opt.conthover= container.data('conthover');
  1915. container.data('conthover-changed',0);
  1916. }
  1917. _R.callingNewSlide(opt,container,1);
  1918. }
  1919. bt.data('tween',punchgs.TweenLite.fromTo(bt,opt.delay/1000,{width:"0%"},{force3D:"auto",width:"100%",ease:punchgs.Linear.easeNone,onComplete:countDownNext,delay:1}));
  1920. bt.data('opt',opt);
  1921. if (opt.slideamount >1 && !(opt.stopAfterLoops==0 && opt.stopAtSlide==1)) {
  1922. container.trigger("starttimer");
  1923. }
  1924. else {
  1925. opt.noloopanymore = 1;
  1926. container.trigger("nulltimer");
  1927. }
  1928. container.on('tp-mouseenter',function() {
  1929. opt.mouseoncontainer = true;
  1930. if (opt.navigation.onHoverStop=="on" && (!_ISM)) {
  1931. container.trigger('stoptimer');
  1932. container.trigger('revolution.slide.onpause');
  1933. }
  1934. });
  1935. container.on('tp-mouseleft',function() {
  1936. opt.mouseoncontainer = false;
  1937. if (container.data('conthover')!=1 && opt.navigation.onHoverStop=="on" && ((opt.viewPort.enable==true && opt.inviewport) || opt.viewPort.enable==false)) {
  1938. container.trigger('revolution.slide.onresume');
  1939. container.trigger('starttimer');
  1940. }
  1941. });
  1942. }
  1943. //////////////////////////////////////////////////////
  1944. // * Revolution Slider - NEEDFULL FUNCTIONS
  1945. // * @version: 1.0 (30.10.2014)
  1946. // * @author ThemePunch
  1947. //////////////////////////////////////////////////////
  1948. // - BLUR / FOXUS FUNCTIONS ON BROWSER
  1949. var vis = (function(){
  1950. var stateKey,
  1951. eventKey,
  1952. keys = {
  1953. hidden: "visibilitychange",
  1954. webkitHidden: "webkitvisibilitychange",
  1955. mozHidden: "mozvisibilitychange",
  1956. msHidden: "msvisibilitychange"
  1957. };
  1958. for (stateKey in keys) {
  1959. if (stateKey in document) {
  1960. eventKey = keys[stateKey];
  1961. break;
  1962. }
  1963. }
  1964. return function(c) {
  1965. if (c) document.addEventListener(eventKey, c);
  1966. return !document[stateKey];
  1967. }
  1968. })();
  1969. var restartOnFocus = function(opt) {
  1970. if (opt==undefined || opt.c==undefined) return false;
  1971. if (opt.windowfocused!=true) {
  1972. opt.windowfocused = true;
  1973. punchgs.TweenLite.delayedCall(0.3,function(){
  1974. // TAB IS ACTIVE, WE CAN START ANY PART OF THE SLIDER
  1975. if (opt.fallbacks.nextSlideOnWindowFocus=="on") opt.c.revnext();
  1976. opt.c.revredraw();
  1977. if (opt.lastsliderstatus=="playing")
  1978. opt.c.revresume();
  1979. });
  1980. }
  1981. }
  1982. var lastStatBlur = function(opt) {
  1983. opt.windowfocused = false;
  1984. opt.lastsliderstatus = opt.sliderstatus;
  1985. opt.c.revpause();
  1986. var actsh = opt.c.find('.active-revslide .slotholder'),
  1987. nextsh = opt.c.find('.processing-revslide .slotholder');
  1988. if (nextsh.data('kenburns')=="on")
  1989. _R.stopKenBurn(nextsh,opt);
  1990. if (actsh.data('kenburns')=="on")
  1991. _R.stopKenBurn(actsh,opt);
  1992. }
  1993. var tabBlurringCheck = function(container,opt) {
  1994. var notIE = (document.documentMode === undefined),
  1995. isChromium = window.chrome;
  1996. if (notIE && !isChromium) {
  1997. // checks for Firefox and other NON IE Chrome versions
  1998. jQuery(window).on("focusin", function () {
  1999. restartOnFocus(opt);
  2000. }).on("focusout", function () {
  2001. lastStatBlur(opt);
  2002. });
  2003. } else {
  2004. // checks for IE and Chromium versions
  2005. if (window.addEventListener) {
  2006. // bind focus event
  2007. window.addEventListener("focus", function (event) {
  2008. restartOnFocus(opt);
  2009. }, false);
  2010. // bind blur event
  2011. window.addEventListener("blur", function (event) {
  2012. lastStatBlur(opt);
  2013. }, false);
  2014. } else {
  2015. // bind focus event
  2016. window.attachEvent("focus", function (event) {
  2017. restartOnFocus(opt);
  2018. });
  2019. // bind focus event
  2020. window.attachEvent("blur", function (event) {
  2021. lastStatBlur(opt);
  2022. });
  2023. }
  2024. }
  2025. }
  2026. // - GET THE URL PARAMETER //
  2027. var getUrlVars = function (hashdivider){
  2028. var vars = [], hash;
  2029. var hashes = window.location.href.slice(window.location.href.indexOf(hashdivider) + 1).split('_');
  2030. for(var i = 0; i < hashes.length; i++)
  2031. {
  2032. hashes[i] = hashes[i].replace('%3D',"=");
  2033. hash = hashes[i].split('=');
  2034. vars.push(hash[0]);
  2035. vars[hash[0]] = hash[1];
  2036. }
  2037. return vars;
  2038. }
  2039. })(jQuery);