1;(function($) { 2 3 "use strict"; 4 5 var etTheme = { 6 init: function() { 7 this.nanoScroll(); 8 this.fragmentsRefresh(); 9 this.affixJSInit(); 10 this.onePageMenu(); 11 this.configureHeightAndWidth(); 12 this.breadcrumbs(); 13 this.fixedHeader(); 14 this.mediaelementplayer(); 15 this.windowsPhoneFix(); 16 this.popup(); 17 this.searchPopup(); 18 this.imagesLightbox(); 19 this.loadInView(); 20 this.cleanSpaces(); 21 this.contentProdImages(); 22 this.wishlist(); 23 this.mainNavigation(); 24 this.backToTop(); 25 this.portfolio(); 26 this.isotope(); 27 this.testimonials(); 28 this.woocommerce(); 29 this.productsViewMode(); 30 this.checkViewMode(); 31 this.ajaxAddToCartInit(); 32 this.quickView(); 33 this.searchform(); 34 this.tabs(); 35 this.categoriesAccordion(); 36 this.toggles(); 37 this.closeParentBtn(); 38 this.contactForm(); 39 this.commentsForm(); 40 this.mobileMenu(); 41 }, 42 43 newJqueryMethods: function() { 44 // **********************************************************************// 45 // ! Force Full width element 46 // **********************************************************************// 47 jQuery.fn.etFullWidth = function ( options ) { 48 //var settings = $.extend({ 49 // type: "default" 50 //}, options ); 51 52 var $this = jQuery(this); 53 54 var extraPadding = 15; 55 var extraMargin = 0; 56 57 if(jQuery('body').hasClass('header-vertical-enable') && jQuery(window).width() > 979) { 58 extraMargin = jQuery('.header-type-vertical').outerWidth(); 59 } 60 61 $this.css({ 62 'left': -jQuery('.header .container').offset().left-extraPadding+extraMargin, 63 'width': jQuery(window).width()-extraMargin, 64 'visibility': 'visible' 65 }); 66 67 jQuery(window).resize(function(){ 68 if(jQuery(window).width() < 980) { 69 extraMargin = 0; 70 } 71 $this.css({ 72 'left': -jQuery('.header .container').offset().left-extraPadding+extraMargin, 73 'width': jQuery(window).width()-extraMargin, 74 'visibility': 'visible' 75 }); 76 }); 77 78 return this; 79 } 80 81 // **********************************************************************// 82 // ! Force 100% heigh element 83 // **********************************************************************// 84 jQuery.fn.etFullHeight = function ( options ) { 85 //var settings = $.extend({ 86 // type: "default" 87 //}, options ); 88 89 var $this = jQuery(this); 90 91 92 $this.css({ 93 'min-height': jQuery(window).height() 94 }); 95 96 jQuery(window).resize(function(){ 97 $this.css({ 98 'min-height': jQuery(window).height() 99 }); 100 }); 101 102 return this; 103 } 104 105 }, 106 107 nanoScroll: function() { 108 var scrollWidget = $('.shop-filters-area .sidebar-widget'); 109 scrollWidget.each(function() { 110 var content = $(this).find('> ul, > div, > form'); 111 if(content.height() > 260) { 112 $(this).addClass('nano-scroll-apply'); 113 content.addClass('widget-content'); 114 $(this).nanoScroller({ 115 contentClass: 'widget-content', 116 preventPageScrolling: true 117 }); 118 } 119 }); 120 }, 121 122 fragmentsRefresh: function() { 123 // **********************************************************************// 124 // ! Update cart fragments 125 // **********************************************************************// 126 $.ajax( { 127 url: etConfig.ajaxurl, 128 type: 'POST', 129 data: { action: 'et_refreshed_fragments' }, 130 success: function( data ) { 131 if ( data && data.fragments ) { 132 $.each( data.fragments, function( key, value ) { 133 $( "." + key ).replaceWith( value ); 134 }); 135 } 136 } 137 } ); 138 }, 139 affixJSInit: function() { 140 etTheme.affixJS(); 141 142 }, 143 affixJS: function() { 144 145 if($(window).width() < 992) return; 146 147 $('.fixed-product-block').each(function() { 148 var el = $(this), 149 parent = el.parent(), 150 heightOffsetEl = $('.product-images'), 151 parentHeight = heightOffsetEl.outerHeight(); 152 153 if( parent.outerHeight() > parentHeight) return; 154 155 $(window).resize(function() { 156 parentHeight = heightOffsetEl.outerHeight(); 157 el.css('max-width', parent.width()); 158 parent.height(parentHeight); 159 }); 160 161 $(window).resize(); 162 163 $(this).stick_in_parent(); 164 165 }); 166 }, 167 168 onePageMenu: function() { 169 // **********************************************************************// 170 // ! One page hash navigation 171 // **********************************************************************// 172 173 // Click on menu item with hash 174 var menu = $('.menu'); 175 menu.each(function() { 176 var that = $(this); 177 var links = $(this).find('a'); 178 if(!that.parent().hasClass('one-page-menu')) return; 179 links.click(function(e){ 180 if($(this).attr('href').split('#')[0] == window.location.href.split('#')[0]) { 181 e.preventDefault(); 182 var hash = $(this).attr('href').split('#')[1]; 183 184 changeActiveItem(hash); 185 scrollToId(hash); 186 } 187 }); 188 }); 189 190 $('[data-scroll-to]').click(function() { 191 var hash = $(this).attr('data-scroll-to'); 192 changeActiveItem(hash); 193 scrollToId(hash); 194 }); 195 196 // if loaded page with hash 197 var windowHash = window.location.hash.split('#')[1]; 198 199 if(window.location.hash.length > 1) { 200 setTimeout(function(){ 201 scrollToId(windowHash); 202 }, 600); 203 } 204 205 function scrollToId(id){ 206 var offset = 130; 207 var position = 0; 208
209 if(id != 'top'){ 210 if($('[data-anchor="'+id+'"]').length < 1) { 211 return; 212 } 213 position = $('[data-anchor="'+id+'"]').offset().top - offset; 214 } 215 216 217 if($(window).width() < 992) { 218 $('body').removeClass('show-nav'); 219 } 220 221 $('html, body').stop().animate({ 222 scrollTop: position 223 }, 1000, function() { 224 changeActiveItem(id); 225 }); 226 } 227 228 function changeActiveItem(hash) { 229 var itemId; 230 var menu = $('.menu'); 231 if(!menu.parent().hasClass('one-page-menu')) return; 232 233 menu.find('.current-menu-item').removeClass('current-menu-item'); 234 235 if(hash == 'top') { 236 menu.each(function() { 237 $(this).find('li').first().addClass('current-menu-item'); 238 }); 239 return; 240 } 241 242 menu.find('li').each(function() { 243 if($(this).find('>a').attr('href')) { 244 var thisHash = $(this).find('>a').attr('href').split('#')[1]; 245 if(thisHash == hash) { 246 itemId = $(this).attr('id'); 247 } 248 } 249 }); 250 251 $('.'+itemId).addClass('current-menu-item'); 252 } 253 254 255 $(window).scroll(function() { 256 if($(window).scrollTop() < 200) { 257 changeActiveItem('top'); 258 } 259 }); 260 261 // change active link on scroll 262 $('[data-anchor]').waypoint(function() { 263 var id = $(this).attr('data-anchor'); 264 changeActiveItem(id); 265 }, { offset: 150 }); 266 267 }, 268 configureHeightAndWidth: function() { 269 // **********************************************************************// 270 // ! 100% height 271 // **********************************************************************// 272 $('.full-height').etFullHeight(); 273 $('.st-pusher').etFullHeight(); 274 275 $(window).resize(function() { 276 $('.copyright-bottom').css({ 277 'marginTop': -$('.copyright-bottom').height(), 278 'marginBottom': 0 279 }).prev().css({ 280 'paddingBottom': $('.copyright-bottom').height()+20 281 }); 282 }); 283 284 $('.cta-block.style-fullwidth').etFullWidth(); 285 $('.element-full-width').etFullWidth(); 286 }, 287 breadcrumbs: function() { 288 // **********************************************************************// 289 // ! Breadcrumbs 290 // **********************************************************************// 291 292 /*$('.bc-type-8').css({ 293 'marginTop': - $('.header-wrapper').outerHeight() 294 });*/ 295 296 297 // **********************************************************************// 298 // ! Parallax Breadcrumbs 299 // **********************************************************************// 300 if($(window).width() > 1200) { 301 $(function() { 302 var data0 = 'opacity:1;-webkit-transform: scale(1);-moz-transform: scale(1);transform: scale(1);'; 303 var data300 = 'opacity:0.3;-webkit-transform: scale(0.8);-moz-transform: scale(0.8);transform: scale(0.8);'; 304 $('.bc-type-7, .bc-type-8').find('.container').attr('data-0', data0).attr('data-300', data300); 305 var s = skrollr.init(); 306 }); 307 }; 308 309 }, 310 311 headerHeight: function(action) { 312 // **********************************************************************// 313 // ! Page wrapper offset for fixed header 314 // **********************************************************************// 315 316 if(action == 'unset') { 317 $('.fixNav-enabled .page-wrapper').attr('style', ''); 318 $('.fixNav-enabled .header-wrapper').attr('style', ''); 319 return; 320 } 321 322 $('.fixNav-enabled .page-wrapper').css('padding-top', $('.header-wrapper').height()); 323 $('.fixNav-enabled .header-wrapper').css('position', 'absolute'); 324 325 $(function() { 326 $('.fixNav-enabled.breadcrumbs-type-7 .page-wrapper').css('padding-top', $('.header-wrapper').height()); 327 }); 328 }, 329 330 fixedHeader: function() { 331 332 // **********************************************************************// 333 // ! Fixed header 334 // **********************************************************************// 335 336 if($(window).width() > 1200) { 337 var fixedHeader = (function() { 338 339 if(!$('body').hasClass('fixNav-enabled')) return; 340 341 var docElem = document.documentElement, 342 wrapper = document.querySelector( '.template-content' ), 343 didScroll = false, 344 changeHeaderOn = $('.header-wrapper').height()+100; 345 346 if($('.header-wrapper').hasClass('header-vertical')) { 347 changeHeaderOn = 300; 348 } 349 if($('.home .header-wrapper').hasClass('header-type-9')) { 350 changeHeaderOn = $(window).height(); 351 } 352
353 function init() { 354 window.addEventListener( 'scroll', function( event ) { 355 if( !didScroll ) { 356 didScroll = true; 357 setTimeout( scrollPage, 250 ); 358 } 359 }, false ); 360 } 361 362 function scrollPage() { 363 var sy = scrollY(); 364 365 if ( sy >= changeHeaderOn ) { 366 if(!$('.template-content').hasClass('fixed-active') && (!$('.header-wrapper').hasClass('slider-overlap') || $('body').hasClass('breadcrumbs-type-9') || $('body').hasClass('breadcrumbs-type-default')) ) 367 etTheme.headerHeight('set'); 368 classie.add( wrapper, 'fixed-active' ); 369 setTimeout( function() { 370 classie.add( wrapper, 'fixed-active-animate' ); 371 },250); 372 } 373 else { 374 classie.remove( wrapper, 'fixed-active' ); 375 classie.remove( wrapper, 'fixed-active-animate' ); 376 etTheme.headerHeight('unset'); 377 } 378 didScroll = false; 379 } 380 381 function scrollY() { 382 return window.pageYOffset || docElem.scrollTop; 383 } 384 385 init(); 386 387 })(); 388 389 $(function() { 390 if ($('.home .header-wrapper').hasClass('header-vertical') || $('.home .header-wrapper').hasClass('header-type-9') ) { 391 $('.page-wrapper').css('padding-top', 0); 392 } 393 }); 394 $(function() { 395 $('.fixed-icon').click(function() { 396 $('.template-content').toggleClass('show-fixed'); 397 return false; 398 }); 399 }); 400 $(document).click(function(e) { 401 var target = e.target; 402 if (!$(target).is('.header-wrapper') && !$(target).parents().is('.header-wrapper')) { 403 $('.template-content').removeClass('show-fixed'); 404 } 405 }); 406 } 407 408 }, 409 mediaelementplayer: function() { 410 // **********************************************************************// 411 // ! Media Elements with JS 412 // **********************************************************************// 413 414 $('video:not(.et-section-video, .tp-caption video)').mediaelementplayer({ 415 success: function(player, node) { 416 $('#' + node.id + '-mode').html('mode: ' + player.pluginType); 417 } 418 }); 419 }, 420 windowsPhoneFix: function() { 421 // **********************************************************************// 422 // ! Windows Phone Responsive Fix 423 // **********************************************************************// 424 if ("-ms-user-select" in document.documentElement.style && navigator.userAgent.match(/IEMobile\/10\.0/)) { 425 var msViewportStyle = document.createElement("style"); 426 msViewportStyle.appendChild( 427 document.createTextNode("@-ms-viewport{width:auto!important}") 428 ); 429 document.getElementsByTagName("head")[0].appendChild(msViewportStyle); 430 } 431 }, 432 popup: function() { 433 var et_popup_closed = $.cookie('etheme_popup_closed'); 434 $('.etheme-popup').magnificPopup({ 435 items: { 436 src: '#etheme-popup', 437 type: 'inline' 438 }, 439 removalDelay: 300, //delay removal by X to allow out-animation 440 callbacks: { 441 beforeOpen: function() { 442 this.st.mainClass = 'my-mfp-slide-bottom'; 443 }, 444 beforeClose: function() { 445 if($('#showagain:checked').val() == 'do-not-show') 446 $.cookie('etheme_popup_closed', 'do-not-show', { expires: 1, path: '/' } ); 447 }, 448 } 449 // (optionally) other options 450 }); 451 452 if(et_popup_closed != 'do-not-show' && $('.etheme-popup').length > 0 && $('body').hasClass('open-popup')) { 453 $('.etheme-popup').magnificPopup('open'); 454 } 455 }, 456 searchPopup: function() { 457 // **********************************************************************// 458 // ! Search popup 459 // **********************************************************************// 460 $('.popup-with-form').magnificPopup({ 461 type: 'inline', 462 closeBtnInside: true, 463 preloader: false, 464 midClick: true, 465 removalDelay: 300, 466 focus: '#Modalsearch', 467 mainClass: 'my-mfp-slide-bottom effect-delay2', 468 callbacks: { 469 beforeOpen: function() { 470 if($(window).width() < 700) { 471 this.st.focus = false;
472 } else { 473 this.st.focus = '#Modalsearch'; 474 } 475 }, 476 open: function() { 477 $('#searchModal').addClass(''); 478 } 479 } 480 }); 481 482 // focus on search input for dropdown type 483 $('.search-with-form').on('mouseover', function() { 484 $(this).find('input').focus(); 485 }).on('touchstart click', '.popup-with-form', function() { 486 $('.search-with-form').find('input').focus(); 487 }); 488 489 490 $('.popup-btn').magnificPopup({ 491 type:'inline', 492 midClick: true // Allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source in href. 493 }); 494 }, 495 imagesLightbox: function() { 496 // **********************************************************************// 497 // ! Images lightbox 498 // **********************************************************************// 499 $("a[rel^='lightboxGall']").magnificPopup({ 500 type:'image', 501 gallery:{ 502 enabled:true 503 } 504 }); 505 506 507 $('.images-popups-gallery').each(function() { // the containers for all your galleries 508 $(this).magnificPopup({ 509 delegate: "a[data-rel^='gallery']", // the selector for gallery item 510 type: 'image', 511 image: { 512 verticalFit: false 513 }, 514 gallery: { 515 enabled:true 516 }, 517 titleSrc: 'title' 518 }); 519 }); 520 521 $("a[rel='lightbox'], a[rel='pphoto']").magnificPopup({ 522 type:'image', 523 closeBtnInside: true, 524 preloader: false, 525 midClick: true, 526 removalDelay: 300, 527 callbacks: { 528 beforeOpen: function() { 529 this.st.mainClass = 'my-mfp-slide-bottom effect-delay2'; 530 } 531 } 532 }); 533 }, 534 animateCounter: function(el) { 535 // **********************************************************************// 536 // ! Animated Counters 537 // **********************************************************************// 538 var initVal = parseInt(el.text()); 539 var finalVal = el.data('value'); 540 if(finalVal <= initVal) return; 541 var intervalTime = 1; 542 var time = 200; 543 var step = parseInt((finalVal - initVal)/time.toFixed()); 544 if(step < 1) { 545 step = 1; 546 time = finalVal - initVal; 547 } 548 var firstAdd = (finalVal - initVal)/step - time; 549 var counter = parseInt((firstAdd*step).toFixed()) + initVal; 550 var i = 0; 551 var interval = setInterval(function(){ 552 i++; 553 counter = counter + step; 554 el.text(counter); 555 if(i == time) { 556 clearInterval(interval); 557 } 558 }, intervalTime); 559 }, 560 loadInView: function() { 561 // **********************************************************************// 562 // ! Load in view 563 // **********************************************************************// 564 565 var counters = $('.animated-counter'); 566 567 counters.each(function(){ 568 $(this).waypoint(function(){ 569 etTheme.animateCounter($(this)); 570 }, { offset: '100%' }); 571 }); 572 573 var progressBars = $('.progress-bars'); 574 progressBars.waypoint(function() { 575 i = 0; 576 $(this).find('.progress-bar').each(function () { 577 i++; 578 579 var el = $(this); 580 var width = $(this).data('width'); 581 setTimeout(function(){ 582 el.find('div').animate({ 583 'width' : width + '%' 584 },400); 585 el.find('span').css({ 586 'opacity' : 1 587 }); 588 },i*300, "easeOutCirc"); 589 590 }); 591 }, { offset: '85%' }); 592 }, 593 cleanSpaces: function() { 594 // **********************************************************************// 595 // ! Remove some br and p 596 // **********************************************************************// 597 $('.toggle-element ~ br').remove(); 598 $('.toggle-element ~ p').remove(); 599 $('.block-with-ico h5').next('p').remove(); 600 $('.tab-content .row-fluid').next('p').remove(); 601 $('.tab-content .row-fluid').prev('p').remove(); 602 }, 603 contentProdImages: function() { 604 // **********************************************************************// 605 // ! Products grid images slider 606 // **********************************************************************// 607 $('.hover-effect-slider').each(function() { 608 var slider = $(this); 609 var index = 0; 610 var autoSlide;
611 var imageLink = slider.find('.product-content-image'); 612 var imagesList = imageLink.data('images'); 613 imagesList = imagesList.split(","); 614 var arrowsHTML = '<div class="sm-arrow arrow-left">left</div><div class="sm-arrow arrow-right">right</div>'; 615 var counterHTML = '<div class="slider-counter"><span class="current-index">1</span>/<span class="slides-count">' + imagesList.length + '</span></div>'; 616 617 if(imagesList.length > 1) { 618 slider.prepend(arrowsHTML); 619 //slider.prepend(counterHTML); 620 621 // Previous image on click on left arrow 622 slider.find('.arrow-left').click(function(event) { 623 if(index > 0) { 624 index--; 625 } else { 626 index = imagesList.length-1; // if the first item set it to last 627 } 628 imageLink.find('img').attr('src', imagesList[index]).attr('srcset', imagesList[index]); // change image src 629 slider.find('.current-index').text(index + 1); // update slider counter 630 }); 631 632 // Next image on click on left arrow 633 slider.find('.arrow-right').click(function(event) { 634 if(index < imagesList.length - 1) { 635 index++; 636 } else { 637 index = 0; // if the last image set it to first 638 } 639 imageLink.find('img').attr('src', imagesList[index]).attr('srcset', imagesList[index]);// change image src 640 slider.find('.current-index').text(index + 1);// update slider counter 641 }); 642 643 644 } 645 646 }); 647 }, 648 wishlist: function() { 649 // **********************************************************************// 650 // ! Wishlist 651 // **********************************************************************// 652 $('.yith-wcwl-add-button.show').each(function(){ 653 var wishListText = $(this).find('a').text(); 654 $(this).find('a').attr('data-hover',wishListText); 655 }); 656 }, 657 mainNavigation: function() { 658 // **********************************************************************// 659 // ! Main Navigation plugin 660 // **********************************************************************// 661 $.fn.et_menu = function ( options ) { 662 var methods = { 663 init: function(el) { 664 methods.el = el; 665 666 $(window).resize(function() { 667 methods.setOffsets(); 668 methods.sideMenu(); 669 }); 670 671 methods.setOffsets(); 672 673 el.find('a').has('.nav-item-tooltip').hover(function() { 674 var newContent = ''; 675 var tooltip = $(this).find('.nav-item-tooltip'); 676 var src = tooltip.find('>div').first().attr('data-src'); 677 if(src.length > 10) { 678 newContent = '<img src="' + src + '" />'; 679 tooltip.html(newContent); 680 } 681 }); 682 683 }, 684 setOffsets: function() { 685 686 if($('body').hasClass('rtl')) return; 687 688 methods.el.find('.item-design-full-width > .nav-sublist-dropdown').each(function() { 689 690 // calculate positions and move the menus once and on desktop only 691 if ($("body").prop("clientWidth")>976 && !$(this).hasClass('w-positioned')) { 692 693 var $this=$(this), 694 $menu=$('#menu-menu'), 695 menuWidth=$menu.width(), 696 menuLeft=$menu.offset().left, 697 offsetLeft=$this.offset().left, 698 mWidth=$this.width(), 699 lleft=menuLeft+(menuWidth-mWidth)/2, 700 correction=0, 701 cleft=-1*(offsetLeft-lleft)+correction; 702 703 $(this).addClass('w-positioned'); 704 705 $(this).css({ 706 'left': cleft, 707 'marginLeft': 0 708 }); 709 } 710 711 }); 712 }, 713 sideMenu: function() { 714 if($(window).height() < 800) { 715 $('.header-wrapper').addClass('header-scrolling'); 716 } else { 717 $('.header-wrapper').removeClass('header-scrolling'); 718 } 719 } 720 }; 721 722 var settings = $.extend({ 723 type: "default" 724 }, options ); 725 726 methods.init(this); 727 728 729 return this; 730 } 731 732 // First Type of column Menu 733 $('.menu-main-container .menu:not(.header-type-vertical .menu)').et_menu({ 734 type: "default" 735 }); 736 737 }, 738 backToTop: function() { 739 // **********************************************************************// 740 // ! "Top" button 741 // **********************************************************************// 742 743 var scroll_timer; 744 var displayed = false;
745 var $message = $('.back-top'); 746 747 $(window).scroll(function () { 748 window.clearTimeout(scroll_timer); 749 scroll_timer = window.setTimeout(function () { 750 if($(window).scrollTop() <= 0) { 751 displayed = false; 752 $message.addClass('bounceOut').removeClass('bounceIn'); 753 } 754 else if(displayed == false) { 755 displayed = true; 756 $message.stop(true, true).removeClass('bounceOut').addClass('bounceIn').click(function () { $message.addClass('bounceOut').removeClass('bounceIn'); }); 757 } 758 }, 400); 759 }); 760 761 $('.back-top').click(function(e) { 762 $('html, body').animate({scrollTop:0}, 600); 763 return false; 764 }); 765 }, 766 portfolio: function() { 767 // **********************************************************************// 768 // ! Portfolio 769 // **********************************************************************// 770 771 var $portfolio = $('.portfolio'); 772 773 $portfolio.imagesLoaded( function() { 774 if ($('.portfolio-item')[0]) { 775 776 var portfolioGrid = $(this); 777 portfolioGrid.isotope({ 778 itemSelector: '.portfolio-item' 779 }); 780 $(window).smartresize(function(){ 781 portfolioGrid.isotope({ 782 itemSelector: '.portfolio-item' 783 }); 784 }); 785 786 portfolioGrid.parent().find('.portfolio-filters a').click(function(){ 787 var selector = $(this).attr('data-filter'); 788 portfolioGrid.parent().find('.portfolio-filters a').removeClass('active'); 789 if(!$(this).hasClass('active')) { 790 $(this).addClass('active'); 791 } 792 portfolioGrid.isotope({ filter: selector }); 793 return false; 794 }); 795 } 796 }); 797 798 799 800 setTimeout(function(){ 801 $('.portfolio').addClass('with-transition'); 802 $('.portfolio-item').addClass('with-transition'); 803 $(window).resize(); 804 },500); 805 }, 806 isotope: function() { 807 // **********************************************************************// 808 // ! Blog isotope 809 // **********************************************************************// 810 811 var $blog = $('.blog-masonry'); 812 813 $blog.isotope({ 814 itemSelector: '.post-grid' 815 }); 816 817 818 $(window).smartresize(function(){ 819 $blog.isotope({ 820 itemSelector: '.post-grid' 821 }); 822 }); 823 824 825 // **********************************************************************// 826 // ! Other elements isotope 827 // **********************************************************************// 828 829 var $container = $('.isotope-container'); 830 831 var $isotope = $('.et_isotope'); 832 833 $isotope.each(function() { 834 var isotope = $(this); 835 isotope.isotope({ 836 itemSelector: '.et_isotope-item' 837 }); 838 839 $(window).smartresize(function(){ 840 isotope.isotope({ 841 itemSelector: '.et_isotope-item' 842 }); 843 }); 844 845 setTimeout(function(){ 846 isotope.addClass('with-transition'); 847 isotope.find('.et_isotope-item').addClass('with-transition');; 848 },500); 849 }); 850 851 $container.each(function() { 852 var container = $(this); 853 var isotope = container.find('.et_isotope'); 854 container.find('.et_categories_filter a').data('isotope', isotope).click(function(e){ 855 e.preventDefault(); 856 var isotope = $(this).data('isotope'); 857 $(this).parent().parent().find('.active').removeClass('active'); 858 $(this).addClass('active'); 859 isotope.isotope({filter: $(this).attr('data-filter')}); 860 }); 861 }); 862 }, 863 testimonials: function() { 864 // **********************************************************************// 865 // ! Testimonials Gallery 866 // **********************************************************************// 867 868 $(".testimonials-slider").each(function() { 869 var navigation = ($(this).data('navigation') == 1), 870 interval = $(this).data('interval'); 871 872 $(this).owlCarousel({ 873 items:1, 874 lazyLoad : true, 875 autoPlay: interval, 876 navigation: navigation, 877 navigationText:false, 878 rewindNav: true, 879 itemsCustom: [[0, 1], [479,1], [619,1], [768,1], [1200, 1], [1600, 1]] 880 }); 881 }); 882 }, 883 woocommerce: function() { 884 // **********************************************************************// 885 // ! WooCommerce 886 // **********************************************************************// 887 888 $('.woocommerce-review-link').click(function() { 889 $('#tab_reviews').click(); 890 }); 891 892 // **********************************************************************// 893 // ! Product variations images 894 // **********************************************************************// 895 896 $('form.variations_form').on( 'found_variation', function( event, variation ) { 897 var $variation_form = $(this); 898 var $product = $(this).closest( '.product' ); 899 var $product_img = $product.find( '.woocommerce-main-image img:eq(0)' ); 900 var $product_link = $product.find( '.woocommerce-main-image' ); 901 var $lighbox_link = $product.find( '.product-lightbox-btn' ).first(); 902 903 var o_src = $product_img.attr('data-o_src'); 904 var o_title = $product_img.attr('data-o_title'); 905 var o_href = $product_link.attr('data-o_href'); 906 907 var variation_image = variation.image_src; 908 var variation_link = variation.image_link; 909 var variation_title = variation.image_title; 910 911 $product_link.attr('href', variation_image); 912 913 if ($('.main-images').hasClass('zoom-enabled')) { 914 if($(window).width() > 768 && variation_image.length > 5 && variation_link.length > 5){ 915 $product_link.swinxyzoom('load', variation_image, variation_link); 916 } 917 $product_link.attr('href', variation_link); 918 } else{ 919 920 $product_link.attr('href', variation_link); 921 } 922 if( variation_link.length > 5 ) { 923 $lighbox_link.attr('href', variation_link); 924 } 925 926 var owlMain = $(".main-images").data('owlCarousel'); 927 if( typeof owlMain != 'undefined') { 928 owlMain.goTo(0); 929 } 930 931 }) 932 // Reset product image 933 .on( 'reset_image', function( event ) { 934 935 936 var $product = $(this).closest( '.product' ); 937 var $product_img = $product.find( '.woocommerce-main-image img:eq(0)' ); 938 var $product_link = $product.find( '.woocommerce-main-image' ); 939 var $lighbox_link = $product.find( '.product-lightbox-btn' ).first(); 940 941 942 var o_src = $product_img.attr('data-o_src'); 943 var o_href = $product_link.attr('data-o_href'); 944 945 $product_link.attr('href', o_href); 946 947 if ($('.main-images').hasClass('zoom-enabled')) { 948 if($(window).width() > 768 && typeof $product_img.attr('data-o_src') != 'undefined' && o_src.length > 5 && o_href.length > 5){ 949 $product_link.swinxyzoom('load', o_src, o_href); 950 } 951 952 $product_link.attr('href', o_href); 953 } else{ 954 $product_link.attr('href', o_href); 955 } 956 $lighbox_link.attr('href', o_href); 957 958 var owlMain = $(".main-images").data('owlCarousel'); 959 if( typeof owlMain != 'undefined') { 960 owlMain.goTo(0); 961 } 962 963 } ); 964 965 $( '.variations_form .variations select' ).change(); 966/*added here*/ 967$('.product-lightbox-btn').magnificPopup({ 968 type: 'image' 969 }); 970 }, 971 productsViewMode: function() { 972 // **********************************************************************// 973 // ! Products view switcher 974 // **********************************************************************// 975 var activeClass = 'switcher-active'; 976 var gridClass = 'products-grid'; 977 var listClass = 'products-list'; 978 $('.switchToList').click(function(){ 979 if(!$.cookie('products_page') || $.cookie('products_page') == 'grid'){ 980 switchToList(); 981 } 982 }); 983 $('.switchToGrid').click(function(){ 984 if(!$.cookie('products_page') || $.cookie('products_page') == 'list'){ 985 switchToGrid(); 986 } 987 }); 988 989 function switchToList(){ 990console.log("List Toggled"); 991 $('.switchToList').addClass(activeClass); 992 $('.switchToGrid').removeClass(activeClass); 993 $('.main-products-loop').fadeOut(300,function(){
994 $(this).removeClass(gridClass).addClass(listClass).fadeIn(300); 995$('.product .price').css("left","35%"); 996$('.product .price').css("bottom","30px"); 997 $.cookie('products_page', 'list', { expires: 3, path: '/' }); 998 }); 999 } 1000 1001 function switchToGrid(){ 1002console.log("Grid Toggled"); 1003 $('.switchToGrid').addClass(activeClass); 1004 $('.switchToList').removeClass(activeClass); 1005 $('.main-products-loop').fadeOut(300,function(){ 1006 $(this).removeClass(listClass).addClass(gridClass).fadeIn(300); 1007$('.product .price').css("left","50%"); 1008$('.product .price').css("bottom","55px"); 1009 $.cookie('products_page', 'grid', { expires: 3, path: '/' }); 1010 }); 1011 } 1012 }, 1013 checkViewMode: function() { 1014 var activeClass = 'switcher-active'; 1015 if($.cookie('products_page') == 'grid') { 1016 $('.main-products-loop .products-loop').removeClass('products-list').addClass('products-grid'); 1017 $('.switchToGrid').addClass(activeClass); 1018 }else if($.cookie('products_page') == 'list') { 1019 $('.main-products-loop .products-loop').removeClass('products-grid').addClass('products-list'); 1020 $('.switchToList').addClass(activeClass); 1021 }else{ 1022 if(etConfig.view_mode_default == 'list_grid' || etConfig.view_mode_default == 'list') { 1023 $('.switchToList').addClass(activeClass); 1024 }else{ 1025 $('.switchToGrid').addClass(activeClass); 1026 } 1027 } 1028 }, 1029 1030 isIE: function () { 1031 if (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0) { 1032 return true; 1033 } 1034 return false; 1035 }, 1036 1037 addToCart: function(data, $thisbutton, showEmodal) { 1038 var modalWindow = $('.etheme-simple-product').eModal(); 1039 1040 if(showEmodal) { 1041 modalWindow.eModal('showModal'); 1042 } 1043 1044 if ( etTheme.isIE() ) { 1045 $thisbutton.addClass('adding-to-cart'); 1046 } 1047 1048 // Ajax action 1049 $.post( etConfig.ajaxurl, data, function( response ) { 1050 1051 if(showEmodal) { 1052 1053 var productImageSrc; 1054 1055 if($('.images img, .product-images img').length > 0) { 1056 productImageSrc = $('.images img, .product-images img').first().attr('src'); 1057 } else { 1058 productImageSrc = $('.product-thumbnails img').first().attr('src'); 1059 } 1060 1061 var productName = $('.product_title').first().text(); 1062 1063 var addText = etConfig.successfullyAdded 1064 1065 if (response.error == true) {addText = etConfig.warningAdded}; 1066 1067 modalWindow.eModal('endLoading') 1068 .eModal('setTitle',productName) 1069 .eModal('addImage', productImageSrc) 1070 .eModal('addText', addText) 1071 .eModal('addBtn',{ 1072 title: etConfig.contBtn, 1073 href: 'javascript:void(0);', 1074 cssClass: 'btn filled', 1075 hideOnClick: true 1076 }) 1077 .eModal('addBtn',{ 1078 title: etConfig.checkBtn, 1079 href: etConfig.checkoutUrl, 1080 cssClass: 'btn filled active' 1081 }); 1082 } 1083 1084 if ( ! response ) 1085 return false; 1086 1087 var this_page = window.location.toString(); 1088 1089 this_page = this_page.replace( 'add-to-cart', 'added-to-cart' ); 1090 1091 if ( response.error && response.product_url ) { 1092 window.location = response.product_url; 1093 return false;
1094 } 1095 1096 // Redirect to cart option 1097 if ( woocommerce_params.cart_redirect_after_add == 'yes' ) { 1098 1099 window.location = woocommerce_params.cart_url; 1100 return false; 1101 1102 } else { 1103 1104 $thisbutton.parent().find('#floatingCirclesG').remove(); 1105 1106 var fragments = response.fragments; 1107 var cart_hash = response.cart_hash; 1108 1109 if ( etTheme.isIE() ) { 1110 $thisbutton.removeClass('adding-to-cart'); 1111 } 1112 1113 setTimeout(function() { 1114 $thisbutton.parent().parent().removeClass('loading'); 1115 $thisbutton.removeClass('added'); 1116 }, 3000) 1117 1118 // Cart widget load 1119 $('#cartModal').replaceWith(fragments.cart_modal); 1120 $('.widget_shopping_cart').replaceWith($(fragments.top_cart).find('.widget_shopping_cart')); 1121 //$('.shopping-container').replaceWith(fragments.top_cart); 1122 1123 $('body').trigger('cart_widget_refreshed'); 1124 1125 // Unblock 1126 $( '.widget_shopping_cart, .updating' ).stop( true ).css( 'opacity', '1' ).unblock(); 1127 1128 // Cart page elements 1129 $( '.shop_table.cart' ).load( this_page + ' .shop_table.cart:eq(0) > *', function() { 1130 1131 $( '.shop_table.cart' ).stop( true ).css( 'opacity', '1' ).unblock(); 1132 1133 $( 'body' ).trigger( 'cart_page_refreshed' ); 1134 }); 1135 1136 $( '.cart_totals' ).load( this_page + ' .cart_totals:eq(0) > *', function() { 1137 $( '.cart_totals' ).stop( true ).css( 'opacity', '1' ).unblock(); 1138 }); 1139 1140 // Trigger event so themes can refresh other areas 1141 $('body').trigger( 'added_to_cart', [ fragments, cart_hash ] ); 1142 return true; 1143 } 1144 }); 1145 }, 1146 ajaxAddToCartInit: function() { 1147 1148 $('.etheme-simple-product, .ajax-cart-enable .variations_form .single_add_to_cart_button').live('click', function(e) { 1149 e.preventDefault(); 1150 // AJAX add to cart request 1151 var $thisbutton = $(this); 1152 1153 if ($thisbutton.is('.single_add_to_cart_button, .etheme-simple-product, .product_type_downloadable, .product_type_virtual')) { 1154 1155 $('#top-cart').addClass('updating'); 1156 1157 var form = $('form.cart'); 1158 1159 var formAction = form.attr('action'); 1160 1161 var variation = {}; 1162 form.find('select').each(function() { 1163 var key = $(this).attr('name'); 1164 var value = $(this).val(); 1165 variation[key] = value; 1166 }); 1167 1168 var data = { 1169 action: 'et_woocommerce_add_to_cart', 1170 product_id: form.find('[name="add-to-cart"]').val(), 1171 quantity: form.find('.qty').val(), 1172 variation_id: form.find('[name="variation_id"]').val(), 1173 variation: variation 1174 }; 1175 1176 etTheme.addToCart(data, $thisbutton, true); 1177 1178 return false; 1179 1180 } else { 1181 return true; 1182 } 1183 1184 }); 1185 1186 if ( !etTheme.isIE() ) { 1187 [].slice.call( document.querySelectorAll( '.progress-button' ) ).forEach( function( bttn ) { 1188 new ProgressButton( bttn, { 1189 callback : function( instance ) { 1190 var progress = 0, 1191 interval = setInterval( function() { 1192 progress = Math.min( progress + Math.random() * 0.01, 1 ); 1193 instance._setProgress( progress ); 1194 1195 if( progress === 1 ) { 1196 instance._stop(1); 1197 clearInterval( interval ); 1198 } 1199 }, 5 ); 1200 } 1201 } ); 1202 } ); 1203 } 1204 1205 // Ajax add to cart (on list page) 1206 $('.etheme_add_to_cart_button').live('click', function() { 1207 1208 // AJAX add to cart request 1209 var $thisbutton = $(this); 1210 1211 if ($thisbutton.is('.product_type_simple, .product_type_downloadable, .product_type_virtual')) { 1212 1213 if (!$thisbutton.attr('data-product_id')) return true; 1214 1215 var data = { 1216 action: 'et_woocommerce_add_to_cart', 1217 product_id: $thisbutton.attr('data-product_id'), 1218 quantity: $thisbutton.attr('data-quantity') 1219 }; 1220 1221 etTheme.addToCart(data, $thisbutton, false); 1222 1223 return false;
1224 1225 } else { 1226 return true; 1227 } 1228 1229 }); 1230 }, 1231 quickView: function() { 1232 // **********************************************************************// 1233 // ! AJAX Quick View 1234 // **********************************************************************// 1235 $(document.body).on('click', '.show-quickly, .show-quickly-btn', (function() { 1236 var $thisbutton = $(this); 1237 var $productCont = $(this).parent().parent().parent(); 1238 var prodid = $thisbutton.data('prodid'); 1239 1240 var kg_product_name = $(this).parent().parent().parent().find('.product-details .product-title').text(); 1241 var kg_price = $(this).parent().parent().parent().find('.product-details .price').text(); 1242 var kg_image = $(this).parent().parent().find('img').attr('src'); 1243 var kg_product_desc = $(this).parent().parent().parent().find('.product-details .kg_product_desc').html(); 1244 var kg_product_link = $(this).parent().parent().find('.product-content-image').attr('href'); 1245 //console.log($(this).parent().parent().parent().find('.product-details .product-title').text()); 1246 1247 var magnificPopup; 1248 $.ajax({ 1249 url: '/shop/static/quickview.html', 1250 method: 'POST', 1251 data: { 1252 'action': 'et_product_quick_view', 1253 'prodid': prodid 1254 }, 1255 dataType: 'html', 1256 beforeSend: function() { 1257 $productCont.addClass('loading'); 1258 $productCont.append('<div id="floatingCirclesG"><div class="f_circleG" id="frotateG_01"></div><div class="f_circleG" id="frotateG_02"></div><div class="f_circleG" id="frotateG_03"></div><div class="f_circleG" id="frotateG_04"></div><div class="f_circleG" id="frotateG_05"></div><div class="f_circleG" id="frotateG_06"></div><div class="f_circleG" id="frotateG_07"></div><div class="f_circleG" id="frotateG_08"></div></div>'); 1259 }, 1260 complete: function() { 1261 $productCont.find('#floatingCirclesG').remove(); 1262 $productCont.removeClass('loading'); 1263 }, 1264 success: function(response){ 1265 1266 $.magnificPopup.open({ 1267 items: { src: '<div class="quick-view-popup mfp-with-anim"><div class="doubled-border">' + response + '</div></div>' }, 1268 type: 'inline', 1269 removalDelay: 300, //delay removal by X to allow out-animation 1270 callbacks: { 1271 beforeOpen: function() { 1272 this.st.mainClass = 'my-mfp-slide-bottom'; 1273 } 1274 } 1275 }, 0); 1276 /////////////////////////////////////// Set data in popup ////////////////////////////////// 1277 jQuery('.kg_product_name').text(kg_product_name); 1278 jQuery('.kg_price').text(kg_price); 1279 jQuery('.kg_image').attr('src',kg_image); 1280 jQuery('.kg_product_desc').html(kg_product_desc); 1281 jQuery('.kg_product_link').attr('href',kg_product_link); 1282 /////////////////////////////////////// Set data in popup ////////////////////////////////// 1283 1284 $(function() { 1285 if(jQuery('.variations_form').length > 0) 1286 { 1287 $('.variations_form').wc_variation_form(); 1288 $('.variations_form .variations select').change(); 1289 } 1290 }); 1291 $('.images').addClass('shown'); 1292 }, 1293 error: function() { 1294 $.magnificPopup.open({ 1295 items: { 1296 src: '<div class="quick-view-popup mfp-with-anim"><div class="doubled-border">Error with AJAX request</div></div>' 1297 }, 1298 type: 'inline', 1299 removalDelay: 500, //delay removal by X to allow out-animation 1300 callbacks: { 1301 beforeOpen: function() { 1302 this.st.mainClass = 'mfp-zoom-in-to-left-out'; 1303 } 1304 } 1305 }, 0); 1306 } 1307 }); 1308 1309 })); 1310 }, 1311 searchform: function() { 1312 // **********************************************************************// 1313 // ! Search form 1314 // **********************************************************************// 1315 1316 var searchBlock = $('.search.hide-input'); 1317 var searchForm = searchBlock.find('#searchform'); 1318 var searchBtn = searchForm.find('.button'); 1319 var searchInput = searchForm.find('input[type="text"]'); 1320 1321 searchBtn.click(function(e) { 1322 e.preventDefault(); 1323 searchInput.fadeIn(200).focus(); 1324 $('body').addClass('search-input-shown'); 1325 1326 // Hide search input on click 1327 $(document).click(function(e) { 1328 var target = e.target; 1329 if (!$(target).is('.search.hide-input') && !$(target).parents().is('.search.hide-input')) { 1330 searchInput.fadeOut(200); 1331 $('body').removeClass('search-input-shown'); 1332 } 1333 }); 1334 1335 }); 1336 }, 1337 tabs: function() { 1338 // **********************************************************************// 1339 // ! Tabs 1340 // **********************************************************************// 1341 1342 var tabs = $('.tabs'); 1343 $('.tabs > p > a').unwrap('p'); 1344 1345 var leftTabs = $('.left-bar, .right-bar'); 1346 var newTitles; 1347 1348 leftTabs.each(function(){ 1349 var currTab = $(this); 1350 //currTab.find('> a.tab-title').each(function(){ 1351 newTitles = currTab.find('> a.tab-title').clone().removeClass('tab-title').addClass('tab-title-left'); 1352 //}); 1353 1354 newTitles.first().addClass('opened'); 1355 1356 1357 var tabNewTitles = $('<div class="left-titles"></div>').prependTo(currTab); 1358 tabNewTitles.html(newTitles); 1359 1360 currTab.find('.tab-content').css({ 1361 'minHeight' : tabNewTitles.height() 1362 }); 1363 }); 1364 1365 1366 tabs.each(function(){ 1367 var currTab = $(this); 1368 1369 currTab.find('.tab-title').first().addClass('opened').next().show(); 1370 1371 currTab.find('.tab-title, .tab-title-left').click(function(e){ 1372 1373 e.preventDefault(); 1374 1375 var tabId = $(this).attr('id'); 1376 var time = 250; 1377 1378 if($(this).hasClass('opened')){ 1379 if(currTab.hasClass('accordion') || ($(window).width() < 767 && !currTab.hasClass('products-tabs'))){ 1380 $(this).removeClass('opened'); 1381 $('#content_'+tabId).slideUp(time); 1382 } 1383 }else{ 1384 currTab.find('.tab-title, .tab-title-left').each(function(){ 1385 var tabId = $(this).attr('id'); 1386 $(this).removeClass('opened'); 1387 if(currTab.hasClass('accordion') || ($(window).width() < 767 && !currTab.hasClass('products-tabs'))) { 1388 $('#content_'+tabId).slideUp(time); 1389 } else { 1390 $('#content_'+tabId).hide(); 1391 } 1392 }); 1393 1394 1395 if(currTab.hasClass('accordion') || ($(window).width() < 767 && !currTab.hasClass('products-tabs'))){ 1396 setTimeout(function(){ 1397 $('#content_'+tabId).addClass('tab-content').slideDown(time); // Fix it 1398 },1); 1399 } else { 1400 $('#content_'+tabId).show(); 1401 } 1402 $(this).addClass('opened'); 1403 } 1404 }); 1405 }); 1406 }, 1407 categoriesAccordion: function() { 1408 // **********************************************************************// 1409 // ! Categories Accordion 1410 // **********************************************************************// 1411 1412 $.fn.etAccordionMenu = function ( options ) { 1413 //var settings = $.extend({ 1414 // type: "default" 1415 //}, options ); 1416 1417 var $this = $(this); 1418 1419 var plusIcon = '+'; 1420 var minusIcon = '–'; 1421 1422 var etCats = $('.product-categories'); 1423 $this.addClass('with-accordion') 1424 var openerHTML = '<div class="open-this">'+plusIcon+'</div>'; 1425 1426 $this.find('li').has('.children, .nav-sublist-dropdown').has('li').addClass('parent-level0').prepend(openerHTML); 1427 1428 if($this.find('.current-cat.parent-level0, .current-cat, .current-cat-parent').length > 0) { 1429 $this.find('.current-cat.parent-level0, .current-cat-parent').find('.open-this').html(minusIcon).parent().addClass('opened').find('ul.children').show(); 1430 } else { 1431 $this.find('>li').first().find('.open-this').html(minusIcon).parent().addClass('opened').find('ul.children').show(); 1432 } 1433 1434 $this.find('.open-this').click(function() { 1435 if($(this).parent().hasClass('opened')) { 1436 $(this).html(plusIcon).parent().removeClass('opened').find('> ul, >
1436 div.nav-sublist-dropdown').slideUp(200); 1437 }else { 1438 $(this).html(minusIcon).parent().addClass('opened').find('> ul, > div.nav-sublist-dropdown').slideDown(200); 1439 } 1440 }); 1441 1442 return this; 1443 } 1444 1445 if(etConfig.catsAccordion) { 1446 $('.product-categories').etAccordionMenu(); 1447 } 1448 }, 1449 toggles: function() { 1450 // **********************************************************************// 1451 // ! Toggle elements 1452 // **********************************************************************// 1453 1454 var etoggle = $('.toggle-block'); 1455 var etoggleEl = etoggle.find('.toggle-element'); 1456 1457 var plusIcon = '+'; 1458 var minusIcon = '–'; 1459 1460 //etoggleEl.first().addClass('opened').find('.open-this').html(minusIcon).parent().parent().find('.toggle-content').show(); 1461 1462 etoggleEl.click(function(e) { 1463 e.preventDefault(); 1464 if($(this).hasClass('opened')) { 1465 $(this).removeClass('opened').find('.open-this').html(plusIcon).parent().parent().find('.toggle-content').slideUp(200); 1466 }else { 1467 if($(this).parent().hasClass('noMultiple')){ 1468 $(this).parent().find('.toggle-element').removeClass('opened').find('.open-this').html(plusIcon).parent().parent().find('.toggle-content').slideUp(200); 1469 } 1470 $(this).addClass('opened').find('.open-this').html(minusIcon).parent().parent().find('.toggle-content').slideDown(200); 1471 } 1472 }); 1473 }, 1474 closeParentBtn: function() { 1475 // **********************************************************************// 1476 // ! Alerts 1477 // **********************************************************************// 1478 var closeParentBtn = $('.close-parent'); 1479 1480 closeParentBtn.click(function(e){ 1481 closeParent(this); 1482 }); 1483 1484 function closeParent(el) { 1485 $(el).parent().slideUp(100); 1486 } 1487 }, 1488 contactForm: function() { 1489 // **********************************************************************// 1490 // ! Contact Form ajax 1491 // **********************************************************************// 1492 1493 var eForm = $('#contact-form'); 1494 var spinner = $('.spinner'); 1495 1496 $('.required-field').focus(function(){ 1497 $(this).removeClass('validation-failed'); 1498 }); 1499 1500 eForm.on('click', '#submit', function(e){ 1501 e.preventDefault(); 1502 $('#contactsMsgs').html(''); 1503 spinner.show(); 1504 var errmsg; 1505 errmsg = ''; 1506 1507 eForm.find('.required-field').each(function(){ 1508 if($(this).val() == '') { 1509 $(this).addClass('validation-failed'); 1510 } 1511 }); 1512 1513 if(errmsg){ 1514 $('#contactsMsgs').html('<p class="error">' + errmsg + '</p>'); 1515 spinner.hide(); 1516 }else{ 1517 1518 var url = eForm.attr('action'); 1519 var data = eForm.serialize(); 1520 1521 data += '&action=et_send_msg_action'; 1522 1523 $.ajax({ 1524 url: etConfig.ajaxurl, 1525 method: 'GET', 1526 data: data, 1527 error: function(data) { 1528 $('#contactsMsgs').html('<p class="error">Error while ajax request<span class="close-parent"></span></p>'); 1529 spinner.hide(); 1530 }, 1531 success : function(data){ 1532 if (data.status == 'success') { 1533 $('#contactsMsgs').html('<p class="success">' + data.msg + '<span class="close-parent"></span></p>'); 1534 eForm.find("input[type=text], textarea").val(""); 1535 }else{ 1536 $('#contactsMsgs').html('<p class="error">' + data.msg + '<span class="close-parent"></span></p>'); 1537 } 1538 spinner.hide(); 1539 etTheme.closeParentBtn(); 1540 } 1541 }); 1542 1543 } 1544 1545 }); 1546 }, 1547 commentsForm: function() { 1548 // **********************************************************************// 1549 // ! Custom Comment Form Validation 1550 // **********************************************************************// 1551 var commentForm = $('#commentform'); 1552 1553 commentForm.on('click', '#submit', function(e){ 1554 $('#commentsMsgs').html(''); 1555 1556 commentForm.find('.required-field').each(function(){ 1557 if($(this).val() == '') { 1558 $(this).addClass('validation-failed'); 1559 e.preventDefault(); 1560 } 1561 }); 1562 1563 }); 1564 }, 1565 mobileMenu: function() { 1566 // **********************************************************************// 1567 // ! Mobile Menu 1568 // **********************************************************************// 1569 $('.navbar-toggle').toggle(function(){ 1570 $('.mobile-menu-wrapper').slideDown(200); 1571 },function(){ 1572 $('.mobile-menu-wrapper').slideUp(200); 1573 }); 1574 1575 var navList = $('.mobile-menu-wrapper .menu'); 1576 var opener = '<span class="open-child">(open)</span>'; 1577 1578 navList.find('li:has(ul)',this).each(function() { 1579 $(this).prepend(opener); 1580 }); 1581 1582 navList.on('click', '.open-child', function(){ 1583 if ($(this).parent().hasClass('over')) { 1584 $(this).parent().removeClass('over').find('>ul').slideUp(200); 1585 }else{ 1586 $(this).parent().parent().find('>li.over').removeClass('over').find('>ul').slideUp(200); 1587 $(this).parent().addClass('over').find('>ul').slideDown(200); 1588 } 1589 }); 1590 1591 $(function() { 1592 $('.navbar-toggle').click(function() { 1593 $(this).toggleClass('show-nav'); 1594 return false;
1595 }); 1596 }); 1597 }, 1598 }; 1599 1600 etTheme.newJqueryMethods(); 1601 1602 $(document).ready(function(){ 1603 etTheme.init(); 1604 basketSync(); 1605 }); 1606 1607 function basketSync() { 1608 /*$.get( "/shop/static/minibasket.html", function( data ) { 1609 var $container=$('.shopping-container'); 1610 1611 if ($container.length>0) { 1612 $container.empty(); 1613 $container.append(data); 1614 } 1615 });*/ 1616 1617 } 1618 1619})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.