revolution.extension.migration.js 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. /*****************************************************************************************************
  2. * jquery.themepunch.revmigrate.js - jQuery Plugin for Revolution Slider Migration from 4.x to 5.0
  3. * @version: 1.0.2 (20.01.2016)
  4. * @requires jQuery v1.7 or later (tested on 1.9)
  5. * @author ThemePunch
  6. *****************************************************************************************************/
  7. (function($) {
  8. var _R = jQuery.fn.revolution;
  9. ///////////////////////////////////////////
  10. // EXTENDED FUNCTIONS AVAILABLE GLOBAL //
  11. ///////////////////////////////////////////
  12. jQuery.extend(true,_R, {
  13. // OUR PLUGIN HERE :)
  14. migration: function(container,options) {
  15. // PREPARE THE NEW OPTIONS
  16. options = prepOptions(options);
  17. // PREPARE LAYER ANIMATIONS
  18. prepLayerAnimations(container,options);
  19. return options;
  20. }
  21. });
  22. var prepOptions = function(o) {
  23. // PARALLAX FALLBACKS
  24. if (o.parallaxLevels || o.parallaxBgFreeze) {
  25. var p = new Object();
  26. p.type = o.parallax
  27. p.levels = o.parallaxLevels;
  28. p.bgparallax = o.parallaxBgFreeze == "on" ? "off" : "on";
  29. p.disable_onmobile = o.parallaxDisableOnMobile;
  30. o.parallax = p;
  31. }
  32. if (o.disableProgressBar === undefined)
  33. o.disableProgressBar = o.hideTimerBar || "off";
  34. // BASIC FALLBACKS
  35. if (o.startwidth || o.startheight) {
  36. o.gridwidth = o.startwidth;
  37. o.gridheight = o.startheight;
  38. }
  39. if (o.sliderType===undefined)
  40. o.sliderType = "standard";
  41. if (o.fullScreen==="on")
  42. o.sliderLayout = "fullscreen";
  43. if (o.fullWidth==="on")
  44. o.sliderLayout = "fullwidth";
  45. if (o.sliderLayout===undefined)
  46. o.sliderLayout = "auto";
  47. // NAVIGATION ARROW FALLBACKS
  48. if (o.navigation===undefined) {
  49. var n = new Object();
  50. if (o.navigationArrows=="solo" || o.navigationArrows=="nextto") {
  51. var a = new Object();
  52. a.enable = true;
  53. a.style = o.navigationStyle || "";
  54. a.hide_onmobile = o.hideArrowsOnMobile==="on" ? true : false;
  55. a.hide_onleave = o.hideThumbs >0 ? true : false;
  56. a.hide_delay = o.hideThumbs>0 ? o.hideThumbs : 200;
  57. a.hide_delay_mobile = o.hideNavDelayOnMobile || 1500;
  58. a.hide_under = 0;
  59. a.tmp = '';
  60. a.left = {
  61. h_align:o.soloArrowLeftHalign,
  62. v_align:o.soloArrowLeftValign,
  63. h_offset:o.soloArrowLeftHOffset,
  64. v_offset:o.soloArrowLeftVOffset
  65. };
  66. a.right = {
  67. h_align:o.soloArrowRightHalign,
  68. v_align:o.soloArrowRightValign,
  69. h_offset:o.soloArrowRightHOffset,
  70. v_offset:o.soloArrowRightVOffset
  71. };
  72. n.arrows = a;
  73. }
  74. if (o.navigationType=="bullet") {
  75. var b = new Object();
  76. b.style = o.navigationStyle || "";
  77. b.enable=true;
  78. b.hide_onmobile = o.hideArrowsOnMobile==="on" ? true : false;
  79. b.hide_onleave = o.hideThumbs >0 ? true : false;
  80. b.hide_delay = o.hideThumbs>0 ? o.hideThumbs : 200;
  81. b.hide_delay_mobile = o.hideNavDelayOnMobile || 1500;
  82. b.hide_under = 0;
  83. b.direction="horizontal";
  84. b.h_align=o.navigationHAlign || "center";
  85. b.v_align=o.navigationVAlign || "bottom";
  86. b.space=5;
  87. b.h_offset=o.navigationHOffset || 0;
  88. b.v_offset=o.navigationVOffset || 20;
  89. b.tmp='<span class="tp-bullet-image"></span><span class="tp-bullet-title"></span>';
  90. n.bullets = b;
  91. }
  92. if (o.navigationType=="thumb") {
  93. var t = new Object();
  94. t.style=o.navigationStyle || "";
  95. t.enable=true;
  96. t.width=o.thumbWidth || 100;
  97. t.height=o.thumbHeight || 50;
  98. t.min_width=o.thumbWidth || 100;
  99. t.wrapper_padding=2;
  100. t.wrapper_color="#f5f5f5";
  101. t.wrapper_opacity=1;
  102. t.visibleAmount=o.thumbAmount || 3;
  103. t.hide_onmobile = o.hideArrowsOnMobile==="on" ? true : false;
  104. t.hide_onleave = o.hideThumbs >0 ? true : false;
  105. t.hide_delay = o.hideThumbs>0 ? o.hideThumbs : 200;
  106. t.hide_delay_mobile = o.hideNavDelayOnMobile || 1500;
  107. t.hide_under = 0;
  108. t.direction="horizontal";
  109. t.span=false;
  110. t.position="inner";
  111. t.space=2;
  112. t.h_align=o.navigationHAlign || "center";
  113. t.v_align=o.navigationVAlign || "bottom";
  114. t.h_offset=o.navigationHOffset || 0;
  115. t.v_offset=o.navigationVOffset || 20;
  116. t.tmp='<span class="tp-thumb-image"></span><span class="tp-thumb-title"></span>';
  117. n.thumbnails = t;
  118. }
  119. o.navigation = n;
  120. o.navigation.keyboardNavigation=o.keyboardNavigation || "on";
  121. o.navigation.onHoverStop=o.onHoverStop || "on";
  122. o.navigation.touch = {
  123. touchenabled:o.touchenabled || "on",
  124. swipe_treshold : o.swipe_treshold ||75,
  125. swipe_min_touches : o.swipe_min_touches || 1,
  126. drag_block_vertical:o.drag_block_vertical || false
  127. };
  128. }
  129. if (o.fallbacks==undefined)
  130. o.fallbacks = {
  131. isJoomla:o.isJoomla || false,
  132. panZoomDisableOnMobile: o.parallaxDisableOnMobile || "off",
  133. simplifyAll:o.simplifyAll || "on",
  134. nextSlideOnWindowFocus:o.nextSlideOnWindowFocus || "off",
  135. disableFocusListener:o.disableFocusListener || true
  136. };
  137. return o;
  138. }
  139. var prepLayerAnimations = function(container,opt) {
  140. var c = new Object(),
  141. cw = container.width(),
  142. ch = container.height();
  143. c.skewfromleftshort = "x:-50;skX:85;o:0";
  144. c.skewfromrightshort = "x:50;skX:-85;o:0";
  145. c.sfl = "x:-50;o:0";
  146. c.sfr = "x:50;o:0";
  147. c.sft = "y:-50;o:0";
  148. c.sfb = "y:50;o:0";
  149. c.skewfromleft = "x:top;skX:85;o:0";
  150. c.skewfromright = "x:bottom;skX:-85;o:0";
  151. c.lfl = "x:top;o:0";
  152. c.lfr = "x:bottom;o:0";
  153. c.lft = "y:left;o:0";
  154. c.lfb = "y:right;o:0";
  155. c.fade = "o:0";
  156. var src = (Math.random()*720-360)
  157. container.find('.tp-caption').each(function() {
  158. var cp = jQuery(this),
  159. rw = Math.random()*(cw*2)-cw,
  160. rh = Math.random()*(ch*2)-ch,
  161. rs = Math.random()*3,
  162. rz = Math.random()*720-360,
  163. rx = Math.random()*70-35,
  164. ry = Math.random()*70-35,
  165. ncc = cp.attr('class');
  166. c.randomrotate = "x:{-400,400};y:{-400,400};sX:{0,2};sY:{0,2};rZ:{-180,180};rX:{-180,180};rY:{-180,180};o:0;";
  167. if (ncc.match("randomrotate")) cp.data('transform_in',c.randomrotate)
  168. else
  169. if (ncc.match(/\blfl\b/)) cp.data('transform_in',c.lfl)
  170. else
  171. if (ncc.match(/\blfr\b/)) cp.data('transform_in',c.lfr)
  172. else
  173. if (ncc.match(/\blft\b/)) cp.data('transform_in',c.lft)
  174. else
  175. if (ncc.match(/\blfb\b/)) cp.data('transform_in',c.lfb)
  176. else
  177. if (ncc.match(/\bsfl\b/)) cp.data('transform_in',c.sfl)
  178. else
  179. if (ncc.match(/\bsfr\b/)) cp.data('transform_in',c.sfr)
  180. else
  181. if (ncc.match(/\bsft\b/)) cp.data('transform_in',c.sft)
  182. else
  183. if (ncc.match(/\bsfb\b/)) cp.data('transform_in',c.sfb)
  184. else
  185. if (ncc.match(/\bskewfromleftshort\b/)) cp.data('transform_in',c.skewfromleftshort)
  186. else
  187. if (ncc.match(/\bskewfromrightshort\b/)) cp.data('transform_in',c.skewfromrightshort)
  188. else
  189. if (ncc.match(/\bskewfromleft\b/)) cp.data('transform_in',c.skewfromleft)
  190. else
  191. if (ncc.match(/\bskewfromright\b/)) cp.data('transform_in',c.skewfromright)
  192. else
  193. if (ncc.match(/\bfade\b/)) cp.data('transform_in',c.fade);
  194. if (ncc.match(/\brandomrotateout\b/)) cp.data('transform_out',c.randomrotate)
  195. else
  196. if (ncc.match(/\bltl\b/)) cp.data('transform_out',c.lfl)
  197. else
  198. if (ncc.match(/\bltr\b/)) cp.data('transform_out',c.lfr)
  199. else
  200. if (ncc.match(/\bltt\b/)) cp.data('transform_out',c.lft)
  201. else
  202. if (ncc.match(/\bltb\b/)) cp.data('transform_out',c.lfb)
  203. else
  204. if (ncc.match(/\bstl\b/)) cp.data('transform_out',c.sfl)
  205. else
  206. if (ncc.match(/\bstr\b/)) cp.data('transform_out',c.sfr)
  207. else
  208. if (ncc.match(/\bstt\b/)) cp.data('transform_out',c.sft)
  209. else
  210. if (ncc.match(/\bstb\b/)) cp.data('transform_out',c.sfb)
  211. else
  212. if (ncc.match(/\bskewtoleftshortout\b/)) cp.data('transform_out',c.skewfromleftshort)
  213. else
  214. if (ncc.match(/\bskewtorightshortout\b/)) cp.data('transform_out',c.skewfromrightshort)
  215. else
  216. if (ncc.match(/\bskewtoleftout\b/)) cp.data('transform_out',c.skewfromleft)
  217. else
  218. if (ncc.match(/\bskewtorightout\b/)) cp.data('transform_out',c.skewfromright)
  219. else
  220. if (ncc.match(/\bfadeout\b/)) cp.data('transform_out',c.fade);
  221. if (cp.data('customin')!=undefined) cp.data('transform_in',cp.data('customin'));
  222. if (cp.data('customout')!=undefined) cp.data('transform_out',cp.data('customout'));
  223. })
  224. }
  225. })(jQuery);