1jQuery(document).ready(function(){ 2 jQuery('.menu_top > li').hover(function(){ 3 jQuery(this).children('ul.sub-menu').fadeIn(200); 4 }, function(){ 5 jQuery(this).children('ul.sub-menu').fadeOut(200); 6 }); 7 8 jQuery(".expand-course").on("click",function(){ 9 if(!jQuery(this).hasClass('expand-course-expanded')) 10 { 11 jQuery(this).closest('.courses_list').find('.course_unit').show(); 12 jQuery(this).closest('.course_units').css('overflow','visible'); 13 jQuery(this).text("Contract"); 14 jQuery(this).addClass('expand-course-expanded'); 15 } 16 else 17 { 18 jQuery(this).closest('.courses_list').find('.course_unit').hide(); 19 jQuery(this).closest('.course_units').css('overflow','hidden'); 20 jQuery(this).text("Click for all units"); 21 jQuery(this).removeClass('expand-course-expanded'); 22 } 23 }); 24 25 jQuery(".mobile-trigger").click(function(){ 26 if(jQuery(this).siblings(".dl-menu").hasClass("dl-menuopen")) 27 { 28 jQuery(this).siblings(".dl-menu").removeClass("dl-menuopen"); 29 } 30 else 31 { 32 jQuery(this).siblings(".dl-menu").addClass("dl-menuopen"); 33 } 34 }); 35 36 // Relocate the white .heading bar into the hamburger flyout on mobile only 37 (function () { 38 var mq = window.matchMedia('(max-width: 767px)'); 39 var $heading = jQuery('.main-menu > .heading'); 40 var $anchor = jQuery('<span class="heading-anchor" hidden></span>').insertAfter($heading); 41 42 function place(e) { 43 if (e.matches) { 44 jQuery('#menu-main-menu-mobile').before($heading); // above the dark flyout ul 45 } else { 46 $anchor.after($heading); // restore original spot 47 } 48 } 49 place(mq); 50 mq.addEventListener('change', place); 51 })(); 52 53 if ( jQuery('.upgrade-ineligible').length > 0 ) { 54 jQuery('form.variations_form.cart, .mobile-top-add-to-cart').fadeOut(200); 55 } 56 57 // The mobile top add-to-cart (functions.php rl_ha_mobile_top_add_to_cart) duplicates 58 // the variation form, which duplicates the <select> ids. Give the top copy unique ids 59 // (and retarget its labels) so the page has no duplicate ids and label taps focus the 60 // right control. WooCommerce's variation script keys off the select's name, not id, 61 // so this does not affect variation behavior. 62 jQuery('.mobile-top-add-to-cart .variations select').each(function () { 63 var $s = jQuery(this), id = $s.attr('id'); 64 if ( ! id ) { return; } 65 var newId = 'mtopcart-' + id; 66 $s.closest('tr').find('label[for="' + id + '"]').attr('for', newId); 67 $s.attr('id', newId); 68 }); 69 70 jQuery(window).scroll(function(){ 71 if (! jQuery("body").hasClass('page-template-page-rollover-video')) { 72 //if((jQuery("body").scrollTop() > 380 || jQuery("html").scrollTop() > 380) && jQuery("body").height() > 3000 ) 73 if((jQuery("body").scrollTop() > 380 || jQuery("html").scrollTop() > 380) ) 74 { 75 jQuery(".heading,.menu-new,.menu-new-mobile,html").addClass("stiky"); 76 } 77 else if(((jQuery("body").scrollTop() < 160) || (jQuery("html").scrollTop() < 160))) 78 { 79 jQuery(".heading,.menu-new,.menu-new-mobile,html").removeClass("stiky"); 80 } 81 add_header_custom_style(); 82 } 83 }); 84 85 if(jQuery(".single_course_page_content").size() > 0) 86 { 87 jQuery(".single_course_page_content img").each(function(){ 88 if(jQuery(this).attr("width") != undefined && jQuery(this).attr("width") != '') 89 { 90 jQuery(this).css("width",jQuery(this).attr("width")+"px"); 91 } 92// if(jQuery(this).attr("height") != undefined && jQuery(this).attr("height") != '') 93// { 94// jQuery(this).css("height",jQuery(this).attr("height")+"px"); 95// } 96 }); 97 } 98 99 jQuery(".list_slide_navigation ul li").on("click",function(){ 100 var container = jQuery(this).closest(".container-new"); 101 var index = jQuery(this).index(); 102 var new_top = -530 * index; 103 container.find(".list_slide").animate({top: new_top+"px"},250); 104 105 container.find(".list_slide_navigation ul li").removeClass("active"); 106 jQuery(this).addClass("active"); 107 }); 108 109 jQuery(".list_slide_navigation_left").on("click",function(){ 110 var container = jQuery(this).closest(".container-new"); 111 var current_index = container.find(".list_slide_navigation ul li.active").index(); 112 var index = current_index - 1; 113 if(index < 0) 114 { 115 index = container.find(".list_slide_navigation ul li").size() - 1; 116 } 117 var new_top = -530 * index; 118 container.find(".list_slide").animate({top: new_top+"px"},250); 119 120 container.find(".list_slide_navigation ul li").removeClass("active"); 121 jQuery(container.find(".list_slide_navigation ul li")[index]).addClass("active"); 122 }); 123 124 jQuery(".list_slide_navigation_right").on("click",function(){ 125 var container = jQuery(this).closest(".container-new"); 126 var current_index = container.find(".list_slide_navigation ul li.active").index(); 127 var index = current_index + 1; 128 if(index >= container.find(".list_slide_navigation ul li").size()) 129 { 130 index = 0; 131 } 132 var new_top = -530 * index; 133 container.find(".list_slide").animate({top: new_top+"px"},250); 134 135 container.find(".list_slide_navigation ul li").removeClass("active"); 136 jQuery(container.find(".list_slide_navigation ul li")[index]).addClass("active"); 137 }); 138}); 139 140function escapeRegExp(str) { 141 return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, "\\$1"); 142} 143//Shop 144 145var public_vars = public_vars || {}; 146 147;(function($, window, undefined){ 148 149 "use strict"; 150 151 public_vars.$body = $('body'); 152 public_vars.$mainSidebar = $('.main-sidebar'); 153 public_vars.$sidebarMenu = public_vars.$mainSidebar.find('.sidebar-menu'); 154
155 public_vars.$cartRibbon = public_vars.$body.find('.cart-ribbon .cart_content'); 156 157 public_vars.$headerCart = public_vars.$body.find('.header-cart'); 158 public_vars.$cartSubTotal = public_vars.$headerCart.find('.cart-sub-total .amount'); 159 public_vars.$cartItems = public_vars.$headerCart.find('.cart-items'); 160 161 public_vars.$topMainMenu = public_vars.$body.find('.main-menu-env li:has(> ul)'); 162 163 public_vars.$mobileMenu = public_vars.$body.find('.mobile-menu'); 164 165 public_vars.$stickyLogo = public_vars.$body.find('.logo-sticky'); 166 167 function updateCartItemsNumber(count) 168 { 169 $("#cart-count").html(count); 170 171 } 172 173 function updateHeaderCart(subtotal, cart_contents) 174 { 175 $("#cart-subtotal").html(subtotal); 176 177 } 178 179 $(document).ready(function() 180 { 181 // Product add to cart 182 $(".product .add-to-cart[data-id]").each(function(i, el) 183 { 184 var $this = $(el), 185 $product = $this.closest('.product'); 186 187 $this.tooltip(); 188 189 $this.on('click', function(ev) 190 { 191 ev.preventDefault(); 192 193 if($this.hasClass('added')) 194 return; 195 196 $product.addClass('is-loading'); 197 $this.tooltip('hide'); 198 199 // Data 200 var data = { 201 action: 'lab_add_to_cart', 202 product_id: $this.data('id') 203 }; 204 205 206 $.post(ajaxurl, data, function(resp) 207 { 208 $product.removeClass('is-loading'); 209 210 if(resp.success) 211 { 212 var $awrap = $this.parent(); 213 $awrap.addClass('added'); 214 $this.addClass('added'); 215 $this.tooltip('destroy'); 216 updateCartItemsNumber(resp.cart_items); 217 218 updateHeaderCart(resp.cart_subtotal, resp.cart_html); 219 220 setTimeout(function() 221 { 222 $awrap.removeClass('added'); 223 $this.removeClass('added'); 224 $this.tooltip(); 225 226 }, 1000 * 3); 227 228 $(document).trigger('added_to_cart', [$this, resp.cart_html]); 229 230 // Refresh Cart 231 $(".widget_shopping_cart").show(); 232 $(".widget_shopping_cart_content").html( resp.cart_html_frag ); 233 } 234 else 235 { 236 var $ec = $product.find('.error-container'); 237 238 $product.addClass('has-errors'); 239 $ec.html(''); 240 241 $.each(resp.error_msg, function(i, msg) 242 { 243 $ec.html( $('<span>').html(msg) ); 244 }); 245 246 setTimeout(function() 247 { 248 $product.removeClass('has-errors'); 249 }, 1000 * 2); 250 } 251 252 }, 'json'); 253 }); 254 255 if ( $this.data( 'toggle' ) == 'tooltip' ) { 256 if ( ('ontouchstart' in window) || (navigator.msMaxTouchPoints > 0) ) { 257 //$this.tooltip( 'destroy' ); 258 } 259 } 260 }); 261 262 // Main Image on Single Product 263 var $productImages = $( '.main-images.product-images' ); 264 265 if ( $productImages.length == 1 && $( '.yith_magnifier_thumbnail' ).length == 0 ) { 266 var $productThumbnails = $( '#image-thumbnails-carousel' ), 267 autoPlay = parseInt( $productThumbnails.data( 'autoplay' ) ); 268 269 $productImages.find( '.hidden' ).removeClass( 'hidden' ); 270 $productImages.find( 'a' ).data( 'is-general', true ); 271 272 // Main Images Slider 273 var $piSlider = $productImages.find( '#main-image-slider' ), 274 piOptions = { 275 items : 1, 276 navigation : true, 277 pagination : false, 278 singleItem : true, 279 autoHeight : true, 280 autoPlay : autoPlay ? autoPlay : false, 281 stopOnHover : true, 282 slideSpeed : 400 283 }; 284 if ($piSlider.owlCarousel) { 285 $piSlider.owlCarousel( piOptions ); 286 } 287 288 var piOwl = $piSlider.data( 'owlCarousel' ); 289 290 // Main Image Zoom 291 $productImages.find( '.zoom-image' ).on( 'click', function( ev ) { 292 ev.preventDefault(); 293 launchFullscreen( document.documentElement ); 294 }); 295 296 // Pause Owl Main Image Slider when Variation is Found 297 if ( $.isFunction( $piSlider.owlCarousel ) ) { 298 $( document ).on( 'found_variation', function( ev ) { 299 $piSlider.data( 'owlCarousel' ).stop(); 300 } ); 301 } 302 303 if ( $( 'body' ).hasClass( 'nivo-disabled' ) == false ) { 304 $piSlider.find(".woocommerce-main-image").nivoLightbox( { 305 effect: 'fadeScale' 306 } ); 307 } 308 309 // Thumbnails 310 var $thumbSlider = $productImages.find( '.slider-row' ); 311 if ($thumbSlider.owlCarousel) { 312 $thumbSlider.owlCarousel( { 313 items : 4, 314 lazyLoad : true, 315 navigation : true, 316 pagination : false, 317 itemsMobile : [ 479,4 ], 318 itemsTablet : [ 768,4 ] 319 } ); 320 } 321 322 // Thumbnails Hover Switch Main Image 323 $thumbSlider.find( '.product-thumb' ).each( function( i, el ) { 324 325 var $el = $( el ); 326 327 $el.hoverIntent( { 328 over : function() { 329 piOwl.goTo( i ); 330 }, 331 out : function(){}, 332 interval : 420 333 } ).on( 'click', function( ev ) { 334 ev.preventDefault(); 335 piOwl.goTo( i ); 336 } );; 337 338 } ); 339 340 // Variations selector 341 $( window ).load( function() { 342 343 jQuery( 'form.variations_form' ).on( 'found_variation', function( ev, variation ) { 344 showVariation( variation ); 345 } ).on( 'wc_additional_variation_images_frontend_lightbox', function( a ) { 346 var html = jQuery( '.images .thumbnails' ).html(); 347 showVariation( null, html ); 348 } ).on( 'reset_image', function() { 349 showVariation(); 350 } ); 351 352 var showVariation = function( variation, extra ) { 353 //piOwl.destroy(); 354 if ( $piSlider.data( 'owlCarousel' ) ) { 355 $piSlider.data( 'owlCarousel' ).destroy(); 356 } 357 358 // Remove Non-general images 359 if ( ! extra ) { 360 $piSlider.find( 'a' ).each( function( i, el ) { 361 var $el = $( el ); 362 363 if ( ! $el.data( 'is-general' ) ) { 364 $el.remove(); 365 } 366 }); 367 } 368 369 370 if ( variation ) { 371 // Variation has Image 372 if ( variation.image_src ) { 373 var $a = $( '<a>' ), 374 $img = $( '<img>' ); 375 376 $a.attr( { 377 'href' : variation.image_src, 378 'title' : variation.image_title, 379 'data-lightbox-gallery' : 'main-images' 380 } ).addClass( 'woocommerce-main-image' ); 381 382 $img.attr( { 383 src: variation.image_src 384 } ); 385 386 $a.append( $img ); 387 388 if ( $( '.zoom-image' ).length ) { 389 $a.append('<span class="zoom-image"><i class="glyphicon glyphicon-fullscreen"></i></span>'); 390 } 391 392 $piSlider.prepend( $a ) 393 } 394 } 395 396 if ( extra ) { 397 $piSlider.find( 'a' ).first().after( extra ); 398 399 400 if ( $( '.zoom-image' ).length ) { 401 $piSlider.find( 'a:not(a:has(.zoom-image))' ).addClass( 'woocommerce-main-image' ).append( '<span class="zoom-image"><i class="glyphicon glyphicon-fullscreen"></i></span>' ); 402 } 403 } 404 405 if ( $.isFunction( $.fn.nivoLightbox ) && $( 'body' ).hasClass( 'nivo-disabled' ) == false ) { 406 407 $piSlider.find( 'a' ).each( function( i, el ) { 408 var $el = $( el ); 409 410 if( ! $el.data( 'nivoLightbox' ) ) { 411 $el.nivoLightbox( { 412 effect : 'fade', 413 theme : 'default', 414 } ); 415 } 416 } ); 417 } 418 419 if ( $.isFunction( $piSlider.owlCarousel ) ) { 420 $piSlider.owlCarousel( piOptions ); 421 422 $piSlider.data( 'owlCarousel' ).stop() 423 } 424 } 425 426 } ); 427 } 428 }); 429 430})(jQuery, window); 431 432//Blog 433(function($,w){ 434 var page = 1; 435 $(document).ready(function(){ 436 437 var fix_heights = function(){ 438 if($(".gdlr-item.blog-full").size() > 0) 439 { 440 var height = 0; 441 $(".gdlr-item.blog-full").each(function(){ 442 if(height === 0) 443 { 444 height = $(this); 445 } 446 else 447 { 448 var new_height = $(this); 449 height.css('height', 'auto'); 450 new_height.css('height', 'auto'); 451 452 var h_value = height.outerHeight(); 453 var nh_value = new_height.outerHeight(); 454 var height_value = Math.max(h_value,nh_value); 455 456 height.height(height_value); 457 new_height.height(height_value); 458 height = 0; 459 } 460 }); 461 } 462 }; 463 464 fix_heights(); 465 $(window).resize(function() { 466 fix_heights(); 467 add_header_custom_style(); 468 }); 469 470 var getting_data = false;
471 $(w).scroll(function(){ 472 p = $(location).attr('href'); 473 //var count = (p.match(/is/g) || []).length; 474 475 if ( p == "https://theherbalacademy.com/blog/" ) 476 { 477 var scrolltop = $("html").scrollTop() || $("body").scrollTop(); 478 var spaceToBottom = $("body").height() - scrolltop; 479 if(spaceToBottom < 1705 && !getting_data) 480 { 481 getting_data = true; 482 page++; 483 $.ajax({ 484 url: "/ajax.php", 485 type: 'POST', 486 dataType: 'json', 487 data: {action: 'blog_posts', page: page} 488 }).done(function(response){ 489 if(response.posts.length > 0) 490 { 491 var last_post = $($(".gdlr-item.blog-full")[$(".gdlr-item.blog-full").length - 1]); 492 var post_size; 493 if(last_post.hasClass("column-blog-small")) 494 { 495 post_size = "small"; 496 } 497 else 498 { 499 post_size = "large"; 500 } 501 $.each(response.posts,function(index,value){ 502 var new_post = $(value); 503 new_post.addClass('column-blog-'+post_size); 504 if(post_size == 'large') 505 { 506 new_post.css({width:'64%'}); 507 if(index % 2 == 0) 508 post_size = 'small'; 509 } 510 else 511 { 512 new_post.css({width:'30%'}); 513 if(index % 2 == 0) 514 post_size = 'large'; 515 } 516 $(".blog-item-holder").append(new_post); 517 }); 518 setTimeout(function(){ 519 fix_heights(); 520 },2000); 521 getting_data = false; 522 } 523 }); 524 } 525 } 526 else if ((p.match(/https:\/\/theherbalacademy.com\/category\//g) || []).length > 0) 527 { 528 var cat = p.replace(new RegExp('https://theherbalacademy.com/category/(.*)/', 'g'), '\$1'); 529 530 var scrolltop = $("html").scrollTop() || $("body").scrollTop(); 531 var spaceToBottom = $("body").height() - scrolltop; 532 if(spaceToBottom < 1705 && !getting_data) 533 { 534 getting_data = true; 535 page++; 536 $.ajax({ 537 url: "/ajax.php", 538 type: 'POST', 539 dataType: 'json', 540 data: {action: 'category_posts', cat: cat, page: page} 541 }).done(function(response){ 542 if(response.posts.length > 0) 543 { 544 var last_post = $($(".gdlr-item.blog-full")[$(".gdlr-item.blog-full").length - 1]); 545 var post_size; 546 if(last_post.hasClass("column-blog-small")) 547 { 548 post_size = "small"; 549 } 550 else 551 { 552 post_size = "large"; 553 } 554 $.each(response.posts,function(index,value){ 555 var new_post = $(value); 556 new_post.addClass('column-blog-'+post_size); 557 if(post_size == 'large') 558 { 559 new_post.css({width:'64%'}); 560 if(index % 2 == 0) 561 post_size = 'small'; 562 } 563 else 564 { 565 new_post.css({width:'30%'}); 566 if(index % 2 == 0) 567 post_size = 'large'; 568 } 569 $(".blog-item-holder").append(new_post); 570 }); 571 setTimeout(function(){ 572 fix_heights(); 573 },2000); 574 getting_data = false;
575 } 576 }); 577 } 578 } 579 else if ((p.match(/https:\/\/theherbalacademy.com\/tag\//g) || []).length > 0) 580 { 581 var tag = p.replace(new RegExp('https://theherbalacademy.com/tag/(.*)/', 'g'), '\$1'); 582 583 var scrolltop = $("html").scrollTop() || $("body").scrollTop(); 584 var spaceToBottom = $("body").height() - scrolltop; 585 if(spaceToBottom < 1705 && !getting_data) 586 { 587 getting_data = true; 588 page++; 589 $.ajax({ 590 url: "/ajax.php", 591 type: 'POST', 592 dataType: 'json', 593 data: {action: 'tag_posts', tag: tag, page: page} 594 }).done(function(response){ 595 if(response.posts.length > 0) 596 { 597 var last_post = $($(".gdlr-item.blog-full")[$(".gdlr-item.blog-full").length - 1]); 598 var post_size; 599 if(last_post.hasClass("column-blog-small")) 600 { 601 post_size = "small"; 602 } 603 else 604 { 605 post_size = "large"; 606 } 607 $.each(response.posts,function(index,value){ 608 var new_post = $(value); 609 new_post.addClass('column-blog-'+post_size); 610 if(post_size == 'large') 611 { 612 new_post.css({width:'64%'}); 613 if(index % 2 == 0) 614 post_size = 'small'; 615 } 616 else 617 { 618 new_post.css({width:'30%'}); 619 if(index % 2 == 0) 620 post_size = 'large'; 621 } 622 $(".blog-item-holder").append(new_post); 623 }); 624 setTimeout(function(){ 625 fix_heights(); 626 },2000); 627 getting_data = false; 628 } 629 }); 630 } 631 } 632 else if ((p.match(/https:\/\/theherbalacademy.com\/\?s=/g) || []).length > 0) 633 { 634 var search = p.replace(new RegExp('https://theherbalacademy.com/(.*)&post_type=post', 'g'), '\$1'); 635 search = search.substr(3); 636 var scrolltop = $("html").scrollTop() || $("body").scrollTop(); 637 var spaceToBottom = $("body").height() - scrolltop; 638 if(spaceToBottom < 1705 && !getting_data) 639 { 640 var last_post = $($(".gdlr-item.blog-full")[$(".gdlr-item.blog-full").length - 1]) 641 getting_data = true; 642 page++; 643 $.ajax({ 644 url: "/ajax.php", 645 type: 'POST', 646 dataType: 'json', 647 data: {action: 'search_posts', search: search, page: page} 648 }).done(function(response){ 649 if(response.posts.length > 0) 650 { 651 var last_post = $($(".gdlr-item.blog-full")[$(".gdlr-item.blog-full").length - 1]); 652 var post_size; 653 if(last_post.hasClass("column-blog-small")) 654 { 655 post_size = "small"; 656 } 657 else 658 { 659 post_size = "large"; 660 } 661 $.each(response.posts,function(index,value){ 662 var new_post = $(value); 663 new_post.addClass('column-blog-'+post_size); 664 if(post_size == 'large') 665 { 666 new_post.css({width:'64%'}); 667 if(index % 2 == 0) 668 post_size = 'small'; 669 } 670 else 671 { 672 new_post.css({width:'30%'}); 673 if(index % 2 == 0) 674 post_size = 'large'; 675 } 676 $(".blog-item-holder").append(new_post); 677 }); 678 setTimeout(function(){ 679 fix_heights(); 680 },2000); 681 getting_data = false;
682 } 683 }); 684 } 685 } 686 }); 687 }); 688})(jQuery,window); 689 690(function ($) { 691 // this will hide the Related Subscriptions on review order/ty page sections if there are none listed. 692 jQuery(document).ready(function () { 693 if (!$('.related-sub-wrapper tr').hasClass('order')) { 694 $('.related-sub-wrapper').hide(); 695 } 696 }); 697 698})(jQuery); 699 700// adds nofollow to amazon links 701jQuery(document).ready(function ($) { 702 703 $('a[href^="https://amzn.to"]').each(function(){ 704 $(this).attr("rel", $(this).attr("rel") + " nofollow"); 705 }); 706 707 $('a[href^="https://amazon.com"]').each(function(){ 708 $(this).attr("rel", $(this).attr("rel") + " nofollow"); 709 }); 710 711}); 712 713// ha-shortcodes.php -- click event for alert if coupon applied or not 714function couponResult() { 715 jQuery(document).ready(function ($) { 716 if (window.location.href.indexOf("coupon-code") > -1) { 717 document.getElementById("couponResult").style.display = "block"; 718 } 719 }); 720} 721 722function add_header_custom_style() { 723 var top_heading = jQuery('.main-menu .heading').innerHeight(); 724 var desktop_menu = jQuery('.main-menu .menu-new').innerHeight(); 725 var mobile_menu = jQuery('.main-menu .menu-new-mobile').innerHeight(); 726 var admin_bar = jQuery('#wpadminbar').innerHeight(); 727 if (jQuery(window).width() <= 1200) { 728 if (jQuery("html").hasClass('stiky')) { 729 jQuery('.main-menu .heading').css({ top: '0px', }); 730 jQuery('.main-menu .menu-new-mobile').css({ top: top_heading + 'px' }); 731 } else { 732 jQuery('.main-menu .heading').css({ top: '0px' }); 733 jQuery('.main-menu .menu-new-mobile').css({ top: '0px' }); 734 } 735 } else { 736 if (jQuery("html").hasClass('stiky')) { 737 jQuery('.main-menu .heading').css({ top: admin_bar + 'px', }); 738 jQuery('.main-menu .menu-new-mobile').css({ top: top_heading + 'px' }); 739 } else { 740 jQuery('.main-menu .heading').css({ top: admin_bar + 'px' }); 741 jQuery('.main-menu .menu-new-mobile').css({ top: '0px' }); 742 } 743 } 744}
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.