1/* Global variables */ 2"use strict"; 3var target = 9; 4var $document = jQuery(document), 5 $window = jQuery(window), 6 plugins = { 7 mainSlider: jQuery(".nivoSlider"), 8 categoryCarousel: jQuery(".category-carousel .container"), 9 testimonialsCarousel: jQuery(".testimonials-carousel"), 10 brandsCarousel: jQuery(".brands-carousel"), 11 textIconCarousel: jQuery(".text-icon-carousel"), 12 bulbCarousel: jQuery(".bulb-carousel"), 13 gallery: jQuery("#gallery"), 14 backToTop: jQuery(".back-to-top"), 15 submenu: jQuery("[data-submenu]"), 16 isotopeGallery: jQuery(".gallery-isotope"), 17 postGallery: jQuery(".blog-isotope"), 18 postCarousel: jQuery(".post-carousel"), 19 contactForm: jQuery("#contactform"), 20 contactFormBox: jQuery("#contactformBox"), 21 requestForm: jQuery("#requestform"), 22 requestFormPopup: jQuery("#requestformPopup"), 23 orderFormPopup: jQuery(".orderForm"), 24 googleMapFooter: jQuery("#footer-map"), 25 googleMap: jQuery("#map"), 26 stickyHeader: jQuery(".page-header.sticky"), 27 productImage: jQuery("#mainImage"), 28 prdCarousel: jQuery(".prd-carousel"), 29 counterBlock: jQuery(".counter-box"), 30 counterCarousel: jQuery(".counter-carousel"), 31 priceboxCarousel: jQuery(".price-box-carousel"), 32 newsCarousel: jQuery(".news-preview-carousel"), 33 testimonialsMoreLink: jQuery(".view-more-testimonials"), 34 testimonialsLength: jQuery(".testimonials-box"), 35 rtltrue: jQuery("body").hasClass("rtl"), 36 }, 37 shiftMenu = jQuery( 38 "#slidemenu, #page-content, body, .navbar, .navbar-header" 39 ), 40 $navbarToggle = jQuery(".navbar-toggle"), 41 $dropdown = jQuery(".dropdown-submenu, .dropdown"); 42 43/* Initialize All Scripts */ 44$document.ready(function ($) { 45 var classList = $("body").attr("class").split(/\s+/); 46 $.each(classList, function (index, item) { 47 if (item.indexOf("customwidget_") === 0) { 48 var targetclass = item; 49 if ($(".service-btn").hasClass(targetclass)) { 50 $(".service-btn").each(function () { 51 if ( 52 $(this).hasClass("empty-menu-widget") && 53 $(this).hasClass(targetclass) 54 ) { 55 } 56 $("." + targetclass).click(); 57 $("." + targetclass).removeClass("collapsed"); 58 }); 59 } else { 60 $(".service-list li").each(function () { 61 if ($(this).hasClass(targetclass)) { 62 $(this).addClass("active"); 63 $(this).find("a").addClass("active"); 64 $(this).closest(".ul_wapper").prev("a").click(); 65 $(this).closest(".ul_wapper").prev("a").removeClass("collapsed"); 66 } 67 }); 68 } 69 } 70 }); 71 72 var windowWidth = window.innerWidth || $window.width(); 73 var windowH = $window.height(); 74 75 // skew block hover effect 76 var $skewblock = $(".skew-wrapper"), 77 $skew = $(".skew", $skewblock); 78 79 if ($skewblock.length) { 80 $skew 81 .on("mouseenter", function () { 82 $skew.removeClass("active"); 83 $skew.removeClass("min"); 84 $skew.not(this).addClass("min"); 85 $(this).addClass("active"); 86 }) 87 .on("mouseleave", function () { 88 $skew.removeClass("active"); 89 $skew.removeClass("min"); 90 }); 91 } 92 93 //view more testimonial jquery 94 if (parseInt(plugins.testimonialsLength.length) > 9) { 95 jQuery(".view-more-testimonials").show(); 96 } else { 97 jQuery(".view-more-testimonials").hide(); 98 } 99 100 jQuery(".view-more-testimonials").on("click", function () { 101 jQuery(".view-more-testimonials").hide(); 102 jQuery(".more-loader").addClass("visible"); 103 104 setTimeout(function () { 105 var i = 0; 106 var j = 0; 107 jQuery(".testimonials-box").each(function () { 108 if (jQuery(this).is(":visible")) { 109 j++; 110 } else { 111 if (i < target) { 112 var h = jQuery(".testimonials-box:first-child") 113 .find(".text") 114 .height(); 115 jQuery(this).show(); 116 jQuery(this).find(".text").height(h); 117 i++; 118 } 119 } 120 }); 121 122 if (plugins.testimonialsLength.length == i + j) { 123 jQuery(".more-loader").removeClass("visible"); 124 jQuery(".view-more-testimonials").hide(); 125 } else { 126 jQuery(".more-loader").removeClass("visible"); 127 jQuery(".view-more-testimonials").show(); 128 } 129 }, 2000); 130 }); 131 132 /// for coupon popup 133 $(".print-link").on("click", function () { 134 var post_id = $(this).attr("data-id"); 135 var popupLoder = $("#popUpLoader_" + post_id); 136 popupLoder.addClass("visible"); 137 $(this).hide(); 138 $.ajax({ 139 type: "POST", 140 dataType: "html", 141 url: my_ajax_object.ajax_url, 142 data: { 143 action: "coupon_popup_ajax", 144 security: my_ajax_object.ajax_nonce_coupon_popup, 145 post_id: post_id, 146 }, 147 success: function (data) { 148 $("body").append(data); 149 $("#myModal").modal("show"); 150 popupLoder.removeClass("visible"); 151 $(".print-link").show(); 152 }, 153 error: function (jqXHR, textStatus, errorThrown) { 154 alert(errorThrown); 155 }, 156 }); 157 }); 158 159 160 $(".print-ele-link").on("click", function () { 161 var post_id = $(this).attr("data-id"); 162 var popupLoder = $("#popUpLoader_" + post_id); 163 popupLoder.addClass("visible"); 164 let htm = $(this).closest('.tt-coupons').clone() 165 166 $(this).hide(); 167 $.ajax({ 168 type: "POST", 169 dataType: "html", 170 url: my_ajax_object.ajax_url, 171 data: { 172 action: "coupon_popup_ajax", 173 security: my_ajax_object.ajax_nonce_coupon_popup, 174 post_id: post_id, 175 }, 176 success: function (data) { 177 $("body").append(data); 178 $("#couponForm").modal("show"); 179 let couponModal = $('#couponForm')
180 couponModal.find('.modal-body').html(htm) 181 popupLoder.removeClass("visible"); 182 $(".print-ele-link").show(); 183 }, 184 error: function (jqXHR, textStatus, errorThrown) { 185 alert(errorThrown); 186 }, 187 }); 188 }); 189 190 // menu hover effect 191 if (jQuery(".electric-btn").length) { 192 jQuery(".electric-btn").each(function () { 193 var $this = jQuery(this), 194 btntext = jQuery(".text", $this).text(); 195 var mask = '<div class="mask"><span>' + btntext + "</span></div>"; 196 for (var i = 0; i < 6; i++) { 197 $this.append(mask); 198 } 199 }); 200 } 201 202 // back to top 203 if (plugins.backToTop.length) { 204 var $button = plugins.backToTop; 205 $(window).on("scroll", function () { 206 if ($(this).scrollTop() >= 500) { 207 $button.addClass("visible"); 208 } else { 209 $button.removeClass("visible"); 210 } 211 }); 212 $button.on("click", function (e) { 213 e.preventDefault(); 214 $("body,html").animate( 215 { 216 scrollTop: 0, 217 }, 218 1000 219 ); 220 }); 221 } 222 223 // image popup 224 if (plugins.gallery.length) { 225 plugins.gallery.find("a.hover").magnificPopup({ 226 type: "image", 227 gallery: { 228 enabled: true, 229 }, 230 }); 231 } 232 233 if (plugins.mainSlider.length) { 234 if (typeof ajax_nivoslider != "undefined") { 235 plugins.mainSlider.nivoSlider({ 236 manualAdvance: false, 237 animSpeed: parseInt(ajax_nivoslider.anim_speed), 238 pauseTime: parseInt(ajax_nivoslider.pause_time), 239 pauseOnHover: JSON.parse(ajax_nivoslider.pause_on_hover), 240 effect: ajax_nivoslider.effect, 241 directionNav: JSON.parse(ajax_nivoslider.direction_nav), 242 prevText: ajax_nivoslider.prev_text, 243 nextText: ajax_nivoslider.next_text, 244 autoplay: ajax_nivoslider.autoplay, 245 controlNav: JSON.parse(ajax_nivoslider.control_nav), 246 }); 247 } 248 } 249 250 // testimonials carousel 251 if (plugins.testimonialsCarousel.length) { 252 if (typeof ajax_testimonial != "undefined") { 253 plugins.testimonialsCarousel.slick({ 254 mobileFirst: false, 255 slidesToShow: parseInt(ajax_testimonial.slides_to_show), 256 slidesToScroll: parseInt(ajax_testimonial.slides_to_scroll), 257 infinite: JSON.parse(ajax_testimonial.infinite), 258 autoplay: JSON.parse(ajax_testimonial.autoplay), 259 autoplaySpeed: parseInt(ajax_testimonial.autoplay_speed), 260 rtl: plugins.rtltrue, 261 arrows: JSON.parse(ajax_testimonial.arrows), 262 dots: JSON.parse(ajax_testimonial.dots), 263 }); 264 } 265 } 266 // products carousel 267 if (plugins.prdCarousel.length) { 268 plugins.prdCarousel.slick({ 269 slidesToShow: 4, 270 slidesToScroll: 1, 271 infinite: true, 272 dots: false, 273 arrows: true, 274 responsive: [ 275 { 276 breakpoint: 1299, 277 settings: { 278 dots: true, 279 arrows: false, 280 }, 281 }, 282 { 283 breakpoint: 991, 284 settings: { 285 slidesToShow: 3, 286 dots: true, 287 arrows: false, 288 }, 289 }, 290 { 291 breakpoint: 767, 292 settings: { 293 slidesToShow: 2, 294 dots: true, 295 arrows: false, 296 }, 297 }, 298 { 299 breakpoint: 480, 300 settings: { 301 slidesToShow: 1, 302 dots: true, 303 arrows: false, 304 }, 305 }, 306 ], 307 }); 308 } 309 // post carousel 310 if (plugins.postCarousel.length) { 311 plugins.postCarousel.slick({ 312 mobileFirst: false, 313 slidesToShow: 1, 314 slidesToScroll: 1, 315 infinite: true, 316 autoplay: false, 317 rtl: plugins.rtltrue, 318 autoplaySpeed: 2000, 319 arrows: false, 320 dots: true, 321 }); 322 } 323 324 // brands carousel 325 if (plugins.brandsCarousel.length) { 326 if (typeof ajax_brand != "undefined") { 327 plugins.brandsCarousel.slick({ 328 mobileFirst: false, 329 slidesToShow: parseInt(ajax_brand.slides_to_show), 330 slidesToScroll: parseInt(ajax_brand.slides_to_scroll), 331 infinite: JSON.parse(ajax_brand.infinite), 332 autoplay: JSON.parse(ajax_brand.autoplay), 333 autoplaySpeed: parseInt(ajax_brand.autoplay_speed), 334 rtl: plugins.rtltrue, 335 arrows: JSON.parse(ajax_brand.arrows), 336 dots: JSON.parse(ajax_brand.dots), 337 // variableWidth: !plugins.rtltrue, 338 responsive: [ 339 { 340 breakpoint: 991, 341 settings: { 342 slidesToShow: 5, 343 }, 344 }, 345 { 346 breakpoint: 767, 347 settings: { 348 slidesToShow: 3, 349 }, 350 }, 351 { 352 breakpoint: 480, 353 settings: { 354 slidesToShow: 1,
355 arrows: false, 356 }, 357 }, 358 ], 359 }); 360 } 361 } 362 // counter carousel 363 if (plugins.counterCarousel.length) { 364 if (typeof ajax_counterbox != "undefined") { 365 plugins.counterCarousel.slick({ 366 mobileFirst: false, 367 slidesToShow: parseInt(ajax_counterbox.slides_to_show), 368 slidesToScroll: parseInt(ajax_counterbox.slides_to_scroll), 369 infinite: JSON.parse(ajax_counterbox.infinite), 370 autoplay: JSON.parse(ajax_counterbox.autoplay), 371 autoplaySpeed: parseInt(ajax_counterbox.autoplay_speed), 372 arrows: JSON.parse(ajax_counterbox.arrows), 373 dots: JSON.parse(ajax_counterbox.dots), 374 responsive: [ 375 { 376 breakpoint: 991, 377 settings: { 378 slidesToShow: 2, 379 }, 380 }, 381 { 382 breakpoint: 767, 383 settings: { 384 slidesToShow: 2, 385 }, 386 }, 387 { 388 breakpoint: 480, 389 settings: { 390 slidesToShow: 1, 391 }, 392 }, 393 ], 394 }); 395 } 396 } 397 // bulb carousel 398 if (plugins.bulbCarousel.length) { 399 if (typeof ajax_bulb != "undefined") { 400 plugins.bulbCarousel.slick({ 401 mobileFirst: JSON.parse(ajax_bulb.mobile_first), 402 slidesToShow: parseInt(ajax_bulb.slides_to_show), 403 slidesToScroll: parseInt(ajax_bulb.slides_to_scroll), 404 infinite: JSON.parse(ajax_bulb.infinite), 405 autoplay: JSON.parse(ajax_bulb.autoplay), 406 autoplaySpeed: parseInt(ajax_bulb.autoplay_speed), 407 arrows: JSON.parse(ajax_bulb.arrows), 408 dots: JSON.parse(ajax_bulb.dots), 409 responsive: [ 410 { 411 breakpoint: 991, 412 settings: { 413 slidesToShow: 2, 414 }, 415 }, 416 { 417 breakpoint: 767, 418 settings: { 419 slidesToShow: 2, 420 }, 421 }, 422 { 423 breakpoint: 480, 424 settings: { 425 slidesToShow: 1, 426 }, 427 }, 428 ], 429 }); 430 } 431 } 432 // pricebox carousel 433 if (plugins.priceboxCarousel.length) { 434 var pri_obj = plugins.priceboxCarousel.data("slick"); 435 if (typeof pri_obj == "undefined") { 436 plugins.priceboxCarousel.slick({ 437 mobileFirst: false, 438 slidesToShow: 3, 439 slidesToScroll: 1, 440 infinite: true, 441 autoplay: true, 442 autoplaySpeed: 6000, 443 arrows: false, 444 dots: true, 445 responsive: [ 446 { 447 breakpoint: 991, 448 settings: { 449 slidesToShow: 1, 450 }, 451 }, 452 ], 453 }); 454 } 455 } 456 457 // news carousel 458 if (plugins.newsCarousel.length) { 459 if (typeof ajax_latestNews != "undefined") { 460 plugins.newsCarousel.slick({ 461 mobileFirst: false, 462 slidesToShow: parseInt(ajax_latestNews.slides_to_show), 463 slidesToScroll: parseInt(ajax_latestNews.slides_to_scroll), 464 infinite: JSON.parse(ajax_latestNews.infinite), 465 autoplay: JSON.parse(ajax_latestNews.autoplay), 466 autoplaySpeed: parseInt(ajax_latestNews.autoplay_speed), 467 arrows: JSON.parse(ajax_latestNews.arrows), 468 dots: JSON.parse(ajax_latestNews.dots), 469 rtl: plugins.rtltrue, 470 responsive: [ 471 { 472 breakpoint: 991, 473 settings: { 474 slidesToShow: 1, 475 }, 476 }, 477 ], 478 }); 479 } 480 } 481 // mobile carousel 482 function slickMobile(carousel, options) { 483 if ($(carousel).hasClass("custom-css-add-container")) { 484 $(carousel).closest(".custom-css-add").removeClass("custom-css-add"); 485 $(carousel).removeClass("custom-css-add-container"); 486 } 487 carousel.slick({ 488 mobileFirst: JSON.parse(options.mobile_first), 489 slidesToShow: parseInt(options.slides_to_show), 490 slidesToScroll: parseInt(options.slides_to_scroll), 491 infinite: JSON.parse(options.infinite), 492 autoplay: JSON.parse(options.autoplay), 493 autoplaySpeed: parseInt(options.autoplay_speed), 494 rtl: plugins.rtltrue, 495 arrows: JSON.parse(options.arrows), 496 dots: JSON.parse(options.dots), 497 498 responsive: [ 499 { 500 breakpoint: 767, 501 settings: "unslick", 502 }, 503 ], 504 }); 505 } 506 507 function startCarousel() { 508 if (plugins.categoryCarousel.length) { 509 if (typeof ajax_cat_car != "undefined") {
510 slickMobile(plugins.categoryCarousel, ajax_cat_car); 511 } 512 } 513 if (plugins.textIconCarousel.length) { 514 if (typeof ajax_text_icon != "undefined") { 515 slickMobile(plugins.textIconCarousel, ajax_text_icon); 516 } 517 } 518 } 519 if (windowWidth < 768) { 520 startCarousel(); 521 } 522 // END mobile carousel 523 524 // dropdown form 525 function popupForm(link) { 526 if ($(link).length) { 527 $(link).on("click", function (e) { 528 var $popup = $(this).next(); 529 var diff = 530 $(window).width() - $popup.offset().left - $popup.outerWidth(); 531 var maxH = $(document).height() - $popup.offset().top; 532 if (diff < 0) { 533 $popup.css({ 534 "margin-left": -$popup.width() * 0.5 + diff - 30, 535 }); 536 } 537 if ($popup.offset().left < 0) { 538 $popup.css({ 539 "margin-left": 540 -$popup.outerWidth() * 0.5 - $popup.offset().left + 10, 541 }); 542 } 543 $popup.find(".quote-form-inside").css({ 544 "max-height": maxH, 545 }); 546 $(".form-popup").not($popup).removeClass("opened"); 547 $(".form-popup").not($popup).css({ 548 "margin-left": "", 549 }); 550 $popup.toggleClass("opened"); 551 e.preventDefault(); 552 }); 553 $(document).on("click", function (event) { 554 if (!$(event.target).closest(".form-popup-wrap").length) { 555 if ($(".form-popup").hasClass("opened")) { 556 $(".form-popup").removeClass("opened"); 557 $(".form-popup").css({ 558 "margin-left": "", 559 }); 560 } 561 } 562 }); 563 } 564 } 565 // dropdown form 566 // submenu 567 568 // Isotope 569 if (plugins.isotopeGallery.length) { 570 var $gallery = plugins.isotopeGallery; 571 $gallery.imagesLoaded(function () { 572 setGallerySize(); 573 }); 574 $gallery.isotope({ 575 itemSelector: ".gallery__item", 576 masonry: { 577 columnWidth: ".gallery__item:not(.doubleW)", 578 }, 579 }); 580 jQuery(".view-more-gallery").on("click", function () { 581 var item; 582 var target = jQuery(this).attr("data-load"); 583 jQuery(this).hide(); 584 $.ajax({ 585 url: target, 586 success: function (data) { 587 jQuery("#galleryPreload").append(data); 588 jQuery("#galleryPreload > div").each(function () { 589 item = $(this); 590 $gallery.append(item).isotope("appended", item); 591 setGallerySize(); 592 }); 593 }, 594 }); 595 }); 596 isotopeFilters($gallery); 597 } 598 // Isotope Filters (for gallery) 599 600 function isotopeFilters(gallery) { 601 var gallery = jQuery(gallery); 602 if (gallery.length) { 603 var container = gallery; 604 var optionSets = jQuery(".filters-by-category .option-set"), 605 optionLinks = optionSets.find("a"); 606 optionLinks.on("click", function (e) { 607 var thisLink = jQuery(this); 608 if (thisLink.hasClass("selected")) return false; 609 var optionSet = thisLink.parents(".option-set"); 610 optionSet.find(".selected").removeClass("selected"); 611 thisLink.addClass("selected"); 612 var options = {}, 613 key = optionSet.attr("data-option-key"), 614 value = thisLink.attr("data-option-value"); 615 value = value === "false" ? false : value; 616 options[key] = value; 617 if (key === "layoutMode" && typeof changeLayoutMode === "function") 618 changeLayoutMode($this, options); 619 else { 620 container.isotope(options); 621 setGallerySize(); 622 } 623 return false; 624 }); 625 } 626 } 627 628 function setGallerySize() { 629 var windowW = window.innerWidth || $window.width(), 630 itemsInRow = 2; 631 if (windowW > 1199) { 632 itemsInRow = 4; 633 } else if (windowW > 767) { 634 itemsInRow = 4; 635 } else if (windowW > 480) { 636 itemsInRow = 2; 637 } 638 if( jQuery("#page-content").length){ 639 var containerW = jQuery("#page-content").width(); 640 } 641 if( jQuery("#tt-pageContent").length){ 642 var containerW = jQuery("#tt-pageContent").width(); 643 } 644 645 var galleryW = containerW / itemsInRow; 646 $gallery.find(".gallery__item").each(function () { 647 jQuery(this).css({ 648 width: galleryW + "px", 649 }); 650 }); 651 $gallery.isotope("layout"); 652 } 653 654 // Post Isotope 655 if (plugins.postGallery.length) { 656 var $postgallery = plugins.postGallery; 657 $postgallery.imagesLoaded(function () { 658 setPostSize(); 659 }); 660 $postgallery.isotope({ 661 itemSelector: ".blog-post", 662 masonry: { 663 gutter: 30, 664 columnWidth: ".blog-post:not(.doubleW)", 665 }, 666 }); 667 } 668 // Spinner 669 670 $(".widget ul").addClass("category-list"); 671 672 $(".cart .input-text.qty.text").spinner({ 673 spin: function (event, ui) { 674 $('.woocommerce-cart-form input[name="update_cart"]').prop( 675 "disabled", 676 false 677 ); 678 }, 679 }); 680 681 $(".header-cart").on("click", ".prd-sm-delete", function () { 682 $(this) 683 .closest(".prd-sm-item") 684 .append( 685 '<div class="loader-cart-delete"><img src="' + 686 my_ajax_object.loader_img + 687 '"></div>' 688 ); 689 var id = $(this).data("product_id"); 690 var qty = $(this).data("qty"); 691 $.ajax({ 692 type: "POST", 693 url: my_ajax_object.ajax_url, 694 data: { 695 action: "remove_item_from_cart", 696 product_id: id, 697 }, 698 success: function (res) { 699 if (res.fragments) { 700 $(".cart-contents").replaceWith(res.fragments["a.cart-contents"]); 701 $(".header-cart-dropdown").replaceWith( 702 res.fragments["div.header-cart-dropdown"] 703 ); 704 } 705 $(".loader-cart-delete").replaceWith(""); 706 }, 707 }); 708 }); 709 710 // Header Cart dropdown menu 711 function toggleCart(cart, drop) { 712 $(document).on("click", cart, function () { 713 $(cart).toggleClass("opened"); 714 }); 715 $(document).on("click", drop, function () { 716 $(cart).toggleClass("opened"); 717 }); 718 $(document).on("click", function (e) { 719 if ( 720 !$(e.target).closest(cart).length && 721 !$(e.target).closest(drop).length 722 ) { 723 if ($(cart).hasClass("opened")) { 724 $(cart).removeClass("opened"); 725 } 726 } 727 }); 728 } 729 730 $(document.body).on("added_to_cart", function (a, b, c, d) { 731 $("html, body").animate( 732 { 733 scrollTop: $(".header-cart").offset().top, 734 }, 735 2000 736 ); 737 }); 738 739 jQuery.fn.stickyHeader = function () { 740 var $header = this, 741 $body = $("body"), 742 headerOffset, 743 stickyH; 744 745 function setHeigth() { 746 jQuery(".stspace").remove(); 747 $header.removeClass("animated is-sticky fadeIn"); 748 $body.removeClass("hdr-sticky"); 749 headerOffset = $("#slidemenu", $header).offset().top; 750 stickyH = $header.height() + headerOffset; 751 } 752 setHeigth(); 753 var prevWindow = window.innerWidth || $(window).width(); 754 jQuery(window).on("resize", function () { 755 var currentWindow = window.innerWidth || $(window).width(); 756 if (currentWindow != prevWindow) { 757 setHeigth(); 758 prevWindow = currentWindow; 759 } 760 }); 761 jQuery(window).scroll(function () { 762 var st = getCurrentScroll(); 763 if (st > headerOffset) { 764 if (!$(".stspace").length) { 765 $header.after('<div class="stspace"></div>'); 766 jQuery(".stspace").css({ 767 height: $header.height() + "px", 768 }); 769 } 770 $header.addClass("is-sticky animated fadeIn"); 771 } else { 772 jQuery(".stspace").remove(); 773 $header.removeClass("animated is-sticky fadeIn"); 774 } 775 }); 776 777 function getCurrentScroll() { 778 return window.pageYOffset || document.documentElement.scrollTop; 779 } 780 }; 781 782 if (plugins.stickyHeader.length) { 783 jQuery(plugins.stickyHeader).stickyHeader(); 784 } 785 if (windowWidth < 769) { 786 startCarousel(); 787 } 788 function toggleNavbarMethod(windowWidth) { 789 if (windowWidth > 991) { 790 jQuery(".dropdown, .dropdown-submenu") 791 .on("mouseenter.toggleNavbarMethod", function () { 792 jQuery(this) 793 .find(".dropdown-menu") 794 .first() 795 .stop(true, true) 796 .fadeIn("fast"); 797 jQuery(this).toggleClass("open"); 798 }) 799 .on("mouseleave.toggleNavbarMethod", function () { 800 jQuery(this) 801 .find(".dropdown-menu") 802 .first() 803 .stop(true, true) 804 .fadeOut("fast"); 805 jQuery(this).toggleClass("open"); 806 }); 807 jQuery(".dropdown > a, .dropdown-submenu > a").on( 808 "click.toggleNavbarMethod", 809 function (e) { 810 e.preventDefault(); 811 e.stopPropagation(); 812 var url = $(this).attr("href"); 813 if (url) $(location).attr("href", url); 814 } 815 ); 816 } else { 817 jQuery(".dropdown > a, .dropdown-submenu > a").unbind( 818 ".toggleNavbarMethod" 819 ); 820 jQuery(".dropdown, .dropdown-submenu").unbind(".toggleNavbarMethod"); 821 jQuery(".dropdown > a > .ecaret, .dropdown-submenu > a > .ecaret").unbind( 822 ".toggleNavbarMethod" 823 ); 824 jQuery(".dropdown > a > .ecaret, .dropdown-submenu > a > .ecaret").on( 825 "click.toggleNavbarMethod", 826 function (e) { 827 e.preventDefault(); 828 var $li = jQuery(this).parent().parent("li"); 829 if ($li.hasClass("opened")) { 830 $li.find(".dropdown-menu").first().stop(true, true).slide
830Up(0); 831 $li.removeClass("opened"); 832 } else { 833 $li.find(".dropdown-menu").first().stop(true, true).slideDown(0); 834 $li.addClass("opened"); 835 } 836 } 837 ); 838 } 839 } 840 toggleNavbarMethod(windowWidth); 841 toggleCart(".header-cart", ".header-cart-dropdown"); 842 popupForm(".form-popup-link"); 843 844 // slide menu 845 var $slideNav = $("#slide-nav"), 846 toggler = ".navbar-toggle", 847 $pagewrapper = $("#page-content"), 848 $navigationwrapper = $(".navbar-header"), 849 $slidemenu = $("#slidemenu"), 850 menuwidth = "100%", 851 slidewidth = "270px", 852 menuneg = "-100%", 853 slideneg = "-270px"; 854 855 $slideNav.after($('<div id="navbar-height-col"></div>')); 856 $slideNav.on("click", toggler, function (e) { 857 var $this = $(this); 858 var $heightCol = $("#navbar-height-col"); 859 var selected = $this.hasClass("slide-active"); 860 $slidemenu.stop().animate({ 861 left: selected ? menuneg : "0px", 862 }); 863 $heightCol.stop().animate({ 864 left: selected ? slideneg : "0px", 865 }); 866 $pagewrapper.stop().animate({ 867 left: selected ? "0px" : slidewidth, 868 }); 869 $navigationwrapper.stop().animate({ 870 left: selected ? "0px" : slidewidth, 871 }); 872 $(toggler).toggleClass("slide-active"); 873 $slidemenu.toggleClass("slide-active"); 874 $pagewrapper.toggleClass("slide-active"); 875 $navigationwrapper.toggleClass("slide-active"); 876 $(".navbar, body").toggleClass("slide-active"); 877 }); 878 // END slide menu 879 // Post More 880 881 jQuery(".view-more-post").on("click", function ($) { 882 var item; 883 var target = $(this).attr("data-load"); 884 $(this).hide(); 885 $.ajax({ 886 url: target, 887 success: function (data) { 888 $("#postPreload").append(data); 889 if (plugins.postGallery.length) { 890 $("#postPreload > div").each(function () { 891 item = $(this); 892 $postgallery.append(item).isotope("appended", item); 893 setPostSize(); 894 }); 895 } 896 }, 897 }); 898 }); 899 900 function setPostSize() { 901 var windowW = window.innerWidth || $window.width(), 902 itemsInRow = 1; 903 if (windowW > 1199) { 904 itemsInRow = 3; 905 } else if (windowW > 767) { 906 itemsInRow = 2; 907 } else if (windowW > 480) { 908 itemsInRow = 1; 909 } 910 var containerW = $("#pageContent .container").width() - 60, 911 galleryW = containerW / itemsInRow; 912 $postgallery.find(".blog-post").each(function () { 913 if (windowW > 767) { 914 $(this).css({ 915 width: galleryW + "px", 916 }); 917 } else { 918 $(this).css({ 919 width: galleryW + 60 + "px", 920 }); 921 } 922 }); 923 924 setTimeout(function () { 925 $(".slick-initialized").slick("setPosition"); 926 $postgallery.isotope("layout"); 927 }, 100); 928 } 929 930 // slide mobile info 931 function slideMobileInfo(toggle, slide) { 932 var $toggle = $(toggle), 933 $slide = $(slide); 934 $toggle.on("click", function (e) { 935 if ($("body").hasClass("slide-active")) return false; 936 $(this).parent().toggleClass("open"); 937 $(this).toggleClass("open"); 938 $slide.slideToggle(300).toggleClass("open"); 939 }); 940 } 941 942 // datepicker 943 if ($(".datetimepicker").length) { 944 $(".datetimepicker").datetimepicker({ 945 format: "DD/MM/YYYY", 946 icons: { 947 time: "icon icon-clock", 948 date: "icon icon-calendar", 949 up: "icon icon-arrow_up", 950 down: "icon icon-arrow_down", 951 previous: "icon icon-arrow-left", 952 next: "icon icon-arrow-right", 953 today: "icon icon-today", 954 clear: "icon icon-trash", 955 close: "icon icon-cancel-music", 956 }, 957 }); 958 } 959 // number counter 960 961 if (plugins.counterBlock.length) { 962 function count(options) { 963 var $this = $(this); 964 options = $.extend({}, options || {}, $this.data("countToOptions") || {}); 965 $this.countTo(options); 966 } 967 plugins.counterBlock.each(function () { 968 var $this = $(this); 969 $this.waypoint( 970 function () { 971 $(".counter-box-number > span", $this).each(count); 972 $this.addClass("counted"); 973 this.destroy(); 974 }, 975 { 976 triggerOnce: true, 977 offset: "80%", 978 } 979 ); 980 }); 981 } 982 983 slideMobileInfo(".js-info-toggle", ".header-info-mobile"); 984 // Resize window events 985 $window.resize(function () { 986 var windowWidth = window.innerWidth || $window.width(); 987 if (windowWidth < 768) { 988 startCarousel(); 989 } else { 990 $(".category-carousel").addClass("custom-css-add"); 991 $(".category-carousel .container").addClass("custom-css-add-container"); 992 } 993 if (windowWidth > 767 && $navbarToggle.is(":hidden")) { 994 shiftMenu.removeClass("slide-active"); 995 } 996 setTimeout(function () { 997 if (plugins.isotopeGallery.length) { 998 setGallerySize(); 999 } 1000 if (plugins.postGallery.length) { 1001 setPostSize(); 1002 } 1003 }, 500); 1004 setTimeout(function () { 1005 $dropdown.removeClass("opened"); 1006 toggleNavbarMethod(windowWidth); 1007 }, 1000); 1008 }); 1009 1010 if (plugins.googleMapFooter.length) { 1011 var map_id = "footer-map"; 1012 google.maps.event.addDomListener(window, "load", init(map_id)); 1013 } 1014 1015 if (plugins.googleMap.length) { 1016 var map_id = "map"; 1017 google.maps.event.addDomListener(window, "load", init(map_id)); 1018 } 1019}); 1020 1021jQuery(window).load(function () { 1022 setTimeout(function () { 1023 jQuery("#loader-wrapper").fadeOut(500); 1024 }, 500); 1025}); 1026 1027jQuery(document).ready(function () { 1028 if (jQuery("body").hasClass("rtl")) { 1029 var $targets = document.querySelectorAll(".vc_row[data-vc-full-width]"); 1030 NodeList.prototype.forEach = Array.prototype.forEach;
1031 $targets.forEach(function ($target) { 1032 var $config = { attributes: true, childList: true, characterData: true }; 1033 var observer = new MutationObserver(function (mutations) { 1034 mutations.forEach(function (mutation) { 1035 if ( 1036 mutation.attributeName == "style" && 1037 $target.style.left.indexOf("-") != -1 1038 ) { 1039 var $right = $target.style.left; 1040 $target.style.left = "auto"; 1041 $target.style.right = $right; 1042 } 1043 }); 1044 }); 1045 observer.observe($target, $config); 1046 }); 1047 } 1048}); 1049 1050function init(map_id) { 1051 if (typeof electrician_gmap_vars == "undefined") { 1052 return false; 1053 } 1054 var mapOptions = { 1055 zoom: parseInt(electrician_gmap_vars.GMAP_ZOOM), 1056 scrollwheel: false, 1057 center: new google.maps.LatLng( 1058 electrician_gmap_vars.GMAP_LAT, 1059 electrician_gmap_vars.GMAP_LNG 1060 ), 1061 styles: [ 1062 { 1063 featureType: "water", 1064 elementType: "geometry", 1065 stylers: [ 1066 { 1067 color: "#e9e9e9", 1068 }, 1069 { 1070 lightness: 17, 1071 }, 1072 ], 1073 }, 1074 { 1075 featureType: "landscape", 1076 elementType: "geometry", 1077 stylers: [ 1078 { 1079 color: "#f5f5f5", 1080 }, 1081 { 1082 lightness: 20, 1083 }, 1084 ], 1085 }, 1086 { 1087 featureType: "road.highway", 1088 elementType: "geometry.fill", 1089 stylers: [ 1090 { 1091 color: "#ffffff", 1092 }, 1093 { 1094 lightness: 17, 1095 }, 1096 ], 1097 }, 1098 { 1099 featureType: "road.highway", 1100 elementType: "geometry.stroke", 1101 stylers: [ 1102 { 1103 color: "#ffffff", 1104 }, 1105 { 1106 lightness: 29, 1107 }, 1108 { 1109 weight: 0.2, 1110 }, 1111 ], 1112 }, 1113 { 1114 featureType: "road.arterial", 1115 elementType: "geometry", 1116 stylers: [ 1117 { 1118 color: "#ffffff", 1119 }, 1120 { 1121 lightness: 18, 1122 }, 1123 ], 1124 }, 1125 { 1126 featureType: "road.local", 1127 elementType: "geometry", 1128 stylers: [ 1129 { 1130 color: "#ffffff", 1131 }, 1132 { 1133 lightness: 16, 1134 }, 1135 ], 1136 }, 1137 { 1138 featureType: "poi", 1139 elementType: "geometry", 1140 stylers: [ 1141 { 1142 color: "#f5f5f5", 1143 }, 1144 { 1145 lightness: 21, 1146 }, 1147 ], 1148 }, 1149 { 1150 featureType: "poi.park", 1151 elementType: "geometry", 1152 stylers: [ 1153 { 1154 color: "#dedede", 1155 }, 1156 { 1157 lightness: 21, 1158 }, 1159 ], 1160 }, 1161 { 1162 elementType: "labels.text.stroke", 1163 stylers: [ 1164 { 1165 visibility: "on", 1166 }, 1167 { 1168 color: "#ffffff", 1169 }, 1170 { 1171 lightness: 16, 1172 }, 1173 ], 1174 }, 1175 { 1176 elementType: "labels.text.fill", 1177 stylers: [ 1178 { 1179 saturation: 36, 1180 }, 1181 { 1182 color: "#333333", 1183 }, 1184 { 1185 lightness: 40, 1186 }, 1187 ], 1188 }, 1189 { 1190 elementType: "labels.icon", 1191 stylers: [ 1192 { 1193 visibility: "off", 1194 }, 1195 ], 1196 }, 1197 { 1198 featureType: "transit", 1199 elementType: "geometry", 1200 stylers: [ 1201 { 1202 color: "#f2f2f2", 1203 }, 1204 { 1205 lightness: 19, 1206 }, 1207 ], 1208 }, 1209 { 1210 featureType: "administrative", 1211 elementType: "geometry.fill", 1212 stylers: [ 1213 { 1214 color: "#fefefe", 1215 }, 1216 { 1217 lightness: 20, 1218 }, 1219 ], 1220 }, 1221 { 1222 featureType: "administrative", 1223 elementType: "geometry.stroke", 1224 stylers: [ 1225 { 1226 color: "#fefefe", 1227 }, 1228 { 1229 lightness: 17, 1230 }, 1231 { 1232 weight: 1.2, 1233 }, 1234 ], 1235 }, 1236 ], 1237 }; 1238 var mapElement = document.getElementById(map_id); 1239 var map = new google.maps.Map(mapElement, mapOptions); 1240 var image = electrician_gmap_vars.GMAP_THEME_PATH + "/images/map-marker.png"; 1241 var marker = new google.maps.Marker({ 1242 position: new google.maps.LatLng( 1243 electrician_gmap_vars.GMAP_LAT, 1244 electrician_gmap_vars.GMAP_LNG 1245 ), 1246 map: map, 1247 icon: image, 1248 }); 1249} 1250/* Light YouTube Embeds by @labnol */ 1251/* Web: http://labnol.org/?p=27941 */ 1252document.addEventListener("DOMContentLoaded", function () { 1253 var div, 1254 n, 1255 v = document.getElementsByClassName("youtube-player"); 1256 for (n = 0; n < v.length; n++) { 1257 div = document.createElement("div"); 1258 div.setAttribute("data-id", v[n].dataset.id); 1259 div.innerHTML = labnolThumb(v[n].dataset.id); 1260 div.onclick = labnolIframe; 1261 v[n].appendChild(div); 1262 } 1263}); 1264 1265function labnolThumb(id) { 1266 //data image 1267 var thumb = '<img src="https://i.ytimg.com/vi/ID/hqdefault.jpg">', 1268 play = '<div class="play"></div>'; 1269 return thumb.replace("ID", id) + play; 1270} 1271 1272function labnolIframe() { 1273 var iframe = document.createElement("iframe"); 1274 var embed = "https://www.youtube.com/embed/ID?autoplay=1"; 1275 iframe.setAttribute("src", embed.replace("ID", this.dataset.id)); 1276 iframe.setAttribute("frameborder", "0"); 1277 iframe.setAttribute("allowfullscreen", "1"); 1278 this.parentNode.replaceChild(iframe, this); 1279}
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.