revolution.extension.migration.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. /*****************************************************************************************************
  2. * jquery.themepunch.revmigrate.js - jQuery Plugin for Revolution Slider Migration from 4.x to 5.0
  3. * @version: 1.0.1 (18.08.2015)
  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. o.fallbacks = {
  130. isJoomla:o.isJoomla || false,
  131. panZoomDisableOnMobile: o.parallaxDisableOnMobile || "off",
  132. simplifyAll:o.simplifyAll || "on",
  133. nextSlideOnWindowFocus:o.nextSlideOnWindowFocus || "off",
  134. disableFocusListener:o.disableFocusListener || true
  135. };
  136. return o;
  137. }
  138. var prepLayerAnimations = function(container,opt) {
  139. var c = new Object(),
  140. cw = container.width(),
  141. ch = container.height();
  142. c.skewfromleftshort = "x:-50;skX:85;o:0";
  143. c.skewfromrightshort = "x:50;skX:-85;o:0";
  144. c.sfl = "x:-50;o:0";
  145. c.sfr = "x:50;o:0";
  146. c.sft = "y:-50;o:0";
  147. c.sfb = "y:50;o:0";
  148. c.skewfromleft = "x:top;skX:85;o:0";
  149. c.skewfromright = "x:bottom;skX:-85;o:0";
  150. c.lfl = "x:top;o:0";
  151. c.lfr = "x:bottom;o:0";
  152. c.lft = "y:left;o:0";
  153. c.lfb = "y:right;o:0";
  154. c.fade = "o:0";
  155. var src = (Math.random()*720-360)
  156. container.find('.tp-caption').each(function() {
  157. var cp = jQuery(this),
  158. rw = Math.random()*(cw*2)-cw,
  159. rh = Math.random()*(ch*2)-ch,
  160. rs = Math.random()*3,
  161. rz = Math.random()*720-360,
  162. rx = Math.random()*70-35,
  163. ry = Math.random()*70-35,
  164. ncc = cp.attr('class');
  165. 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;";
  166. if (ncc.match("randomrotate")) cp.data('transform_in',c.randomrotate)
  167. else
  168. if (ncc.match(/\blfl\b/)) cp.data('transform_in',c.lfl)
  169. else
  170. if (ncc.match(/\blfr\b/)) cp.data('transform_in',c.lfr)
  171. else
  172. if (ncc.match(/\blft\b/)) cp.data('transform_in',c.lft)
  173. else
  174. if (ncc.match(/\blfb\b/)) cp.data('transform_in',c.lfb)
  175. else
  176. if (ncc.match(/\bsfl\b/)) cp.data('transform_in',c.sfl)
  177. else
  178. if (ncc.match(/\bsfr\b/)) cp.data('transform_in',c.sfr)
  179. else
  180. if (ncc.match(/\bsft\b/)) cp.data('transform_in',c.sft)
  181. else
  182. if (ncc.match(/\bsfb\b/)) cp.data('transform_in',c.sfb)
  183. else
  184. if (ncc.match(/\bskewfromleftshort\b/)) cp.data('transform_in',c.skewfromleftshort)
  185. else
  186. if (ncc.match(/\bskewfromrightshort\b/)) cp.data('transform_in',c.skewfromrightshort)
  187. else
  188. if (ncc.match(/\bskewfromleft\b/)) cp.data('transform_in',c.skewfromleft)
  189. else
  190. if (ncc.match(/\bskewfromright\b/)) cp.data('transform_in',c.skewfromright)
  191. else
  192. if (ncc.match(/\bfade\b/)) cp.data('transform_in',c.fade);
  193. if (ncc.match(/\brandomrotateout\b/)) cp.data('transform_out',c.randomrotate)
  194. else
  195. if (ncc.match(/\bltl\b/)) cp.data('transform_out',c.lfl)
  196. else
  197. if (ncc.match(/\bltr\b/)) cp.data('transform_out',c.lfr)
  198. else
  199. if (ncc.match(/\bltt\b/)) cp.data('transform_out',c.lft)
  200. else
  201. if (ncc.match(/\bltb\b/)) cp.data('transform_out',c.lfb)
  202. else
  203. if (ncc.match(/\bstl\b/)) cp.data('transform_out',c.sfl)
  204. else
  205. if (ncc.match(/\bstr\b/)) cp.data('transform_out',c.sfr)
  206. else
  207. if (ncc.match(/\bstt\b/)) cp.data('transform_out',c.sft)
  208. else
  209. if (ncc.match(/\bstb\b/)) cp.data('transform_out',c.sfb)
  210. else
  211. if (ncc.match(/\bskewtoleftshortout\b/)) cp.data('transform_out',c.skewfromleftshort)
  212. else
  213. if (ncc.match(/\bskewtorightshortout\b/)) cp.data('transform_out',c.skewfromrightshort)
  214. else
  215. if (ncc.match(/\bskewtoleftout\b/)) cp.data('transform_out',c.skewfromleft)
  216. else
  217. if (ncc.match(/\bskewtorightout\b/)) cp.data('transform_out',c.skewfromright)
  218. else
  219. if (ncc.match(/\bfadeout\b/)) cp.data('transform_out',c.fade);
  220. if (cp.data('customin')!=undefined) cp.data('transform_in',cp.data('customin'));
  221. if (cp.data('customout')!=undefined) cp.data('transform_out',cp.data('customout'));
  222. })
  223. }
  224. })(jQuery);