1(function ($) { 2 "use strict"; 3 4 var $window = $(window); 5 6 function debounce(func, wait, immediate) { 7 var timeout; 8 return function () { 9 var context = this, 10 args = arguments; 11 var later = function () { 12 timeout = null; 13 if (!immediate) func.apply(context, args); 14 }; 15 var callNow = immediate && !timeout; 16 clearTimeout(timeout); 17 timeout = setTimeout(later, wait); 18 if (callNow) func.apply(context, args); 19 }; 20 } 21 22 function rtl_slick() { 23 if ($("body").hasClass("rtl")) { 24 return true; 25 } else { 26 return false; 27 } 28 } 29 30 $window.on("elementor/frontend/init", function () { 31 var ModuleHandler = elementorModules.frontend.handlers.Base; 32 33 var PostMarquee = ModuleHandler.extend({ 34 onInit: function () { 35 ModuleHandler.prototype.onInit.apply(this, arguments); 36 this.wrapper = this.$element.find(".elespare-flash-wrap"); 37 this.run(); 38 }, 39 40 getDefaultSettings: function () { 41 var pauseticker = false; 42 if (this.getElementSettings("_pause_on_hover") == "yes") { 43 pauseticker = true; 44 } 45 return { 46 //duration in milliseconds of the marquee 47 speed: this.getElementSettings("_animation_speed"), 48 //gap in pixels between the tickers 49 gap: 0, 50 //time in milliseconds before the marquee will start animating 51 delayBeforeStart: 0, 52 //'left' or 'right' 53 // direction: 'right', 54 //true or false - should the marquee be duplicated to show an effect of continues flow 55 duplicated: true, 56 pauseOnHover: pauseticker, 57 startVisible: true, 58 }; 59 }, 60 getDefaultElements: function () { 61 return { 62 $container: this.findElement(this.getSettings("container")), 63 }; 64 }, 65 run: function () { 66 var filter_wrap = this.wrapper.find(".marquee.elespare-flash-side"); 67 68 filter_wrap.marquee(this.getDefaultSettings()); 69 }, 70 }); 71 72 var PostCarousel = ModuleHandler.extend({ 73 onInit: function () { 74 ModuleHandler.prototype.onInit.apply(this, arguments); 75 this.run(); 76 }, 77 getDefaultSettings: function () { 78 return { 79 autoplay: false, 80 arrows: false, 81 checkVisible: false, 82 container: ".elespare-posts-wrap", 83 dots: false, 84 infinite: true, 85 rows: 0, 86 slidesToShow: 3, 87 prevArrow: $("<div />") 88 .append(this.findElement(".slick-prev").clone().show()) 89 .html(), 90 nextArrow: $("<div />") 91 .append(this.findElement(".slick-next").clone().show()) 92 .html(), 93 }; 94 }, 95 getDefaultElements: function () { 96 return { 97 $container: this.findElement(this.getSettings("container")), 98 }; 99 }, 100 onElementChange: debounce(function () { 101 this.elements.$container.slick("unslick"); 102 this.run(); 103 }, 200), 104 105 getSlickSettings: function () { 106 var autoplaycarousel = false; 107 if (this.getElementSettings("autoplay") == "yes") { 108 autoplaycarousel = true; 109 } 110 111 var settings = { 112 infinite: !!this.getElementSettings("loop"), 113 autoplay: autoplaycarousel, 114 autoplaySpeed: this.getElementSettings("autoplay_speed"), 115 speed: this.getElementSettings("animation_speed"), 116 centerMode: !!this.getElementSettings("center"), 117 slidesToScroll: 1, 118 rtl: rtl_slick(), 119 }; 120 121 switch (this.getElementSettings("navigation")) { 122 case "arrow": 123 settings.arrows = true; 124 break; 125 case "dots": 126 settings.dots = true; 127 break; 128 case "both": 129 settings.arrows = true; 130 settings.dots = true; 131 break; 132 } 133 // var blockname = this.elements.$container.attr('data-blockname'); 134 135 settings.slidesToShow = 136 parseInt(this.getElementSettings("slides_to_show")) || 1; 137 138 settings.slidesToShow = 139 parseInt(this.getElementSettings("slides_to_show")) || 1; 140 settings.responsive = [ 141 { 142 breakpoint: elementorFrontend.config.breakpoints.lg, 143 settings: { 144 slidesToShow: 145 parseInt(this.getElementSettings("slides_to_show_tablet")) || 146 settings.slidesToShow, 147 }, 148 }, 149 { 150 breakpoint: elementorFrontend.config.breakpoints.md, 151 settings: { 152 slidesToShow: 153 parseInt(this.getElementSettings("slides_to_show_mobile")) || 154 parseInt(this.getElementSettings("slides_to_show_tablet")) || 155 settings.slidesToShow, 156 }, 157 }, 158 ]; 159 160 return $.extend({}
160, this.getSettings(), settings); 161 }, 162 163 run: function () { 164 this.elements.$container 165 .not(".slick-initialized") 166 .slick(this.getSlickSettings()); 167 }, 168 }); 169 170 //Masonry 171 var PostMasonry = ModuleHandler.extend({ 172 onInit: function () { 173 ModuleHandler.prototype.onInit.apply(this, arguments); 174 this.run(); 175 }, 176 getLayoutMode: function () { 177 var layout = "even"; 178 return layout === "even" ? "masonry" : layout; 179 }, 180 181 getDefaultSettings: function () { 182 return { 183 itemSelector: ".elespare-posts-masonry-item-wrapper", 184 percentPosition: true, 185 layoutMode: this.getLayoutMode(), 186 }; 187 }, 188 189 getDefaultElements: function () { 190 return { 191 $container: this.findElement(".elespare-isotope"), 192 }; 193 }, 194 195 run: function () { 196 var self = this; 197 self.elements.$container.isotope(self.getDefaultSettings()); 198 }, 199 }); 200 //------- 201 var MainBannerOne = ModuleHandler.extend({ 202 onInit: function () { 203 ModuleHandler.prototype.onInit.apply(this, arguments); 204 this.run(); 205 }, 206 getDefaultSettings: function () { 207 return { 208 autoplay: true, 209 arrows: true, 210 checkVisible: false, 211 container: ".elespare-carousel-wrap", 212 dots: false, 213 infinite: true, 214 rows: 0, 215 slidesToShow: 1, 216 prevArrow: $("<div />") 217 .append(this.findElement(".slick-prev").clone().show()) 218 .html(), 219 nextArrow: $("<div />") 220 .append(this.findElement(".slick-next").clone().show()) 221 .html(), 222 }; 223 }, 224 getDefaultElements: function () { 225 return { 226 $container: this.findElement(this.getSettings("container")), 227 }; 228 }, 229 onElementChange: debounce(function () { 230 this.elements.$container.slick("unslick"); 231 this.run(); 232 }, 200), 233 234 getSlickSettings: function () { 235 var autoplaybanner = false; 236 if (this.getElementSettings("_autoplay") == "yes") { 237 autoplaybanner = true; 238 } 239 240 var bannersettings = { 241 infinite: !!this.getElementSettings("_loop"), 242 autoplay: autoplaybanner, 243 autoplaySpeed: this.getElementSettings("_autoplay_speed"), 244 speed: this.getElementSettings("_animation_speed"), 245 slidesToScroll: 1, 246 rtl: rtl_slick(), 247 }; 248 249 bannersettings.slidesToShow = 250 parseInt(this.elements.$container.attr("data-num")) || 1; 251 bannersettings.responsive = [ 252 { 253 breakpoint: elementorFrontend.config.breakpoints.lg, 254 settings: { 255 slidesToShow: 1, 256 }, 257 }, 258 { 259 breakpoint: elementorFrontend.config.breakpoints.md, 260 settings: { 261 slidesToShow: 1, 262 }, 263 }, 264 ]; 265 266 return $.extend({}, this.getSettings(), bannersettings); 267 }, 268 269 run: function () { 270 this.elements.$container 271 .not(".slick-initialized") 272 .slick(this.getSlickSettings()); 273 }, 274 }); 275 276 var MainBannerTwo = ModuleHandler.extend({ 277 onInit: function () { 278 ModuleHandler.prototype.onInit.apply(this, arguments); 279 this.run(); 280 }, 281 getDefaultSettings: function () { 282 return { 283 autoplay: true, 284 arrows: true, 285 checkVisible: false, 286 container: ".elespare-carousel-wrap", 287 dots: false, 288 infinite: true, 289 rows: 0, 290 slidesToShow: 1, 291 prevArrow: $("<div />") 292 .append(this.findElement(".slick-prev").clone().show()) 293 .html(), 294 nextArrow: $("<div />") 295 .append(this.findElement(".slick-next").clone().show()) 296 .html(), 297 }; 298 }, 299 getDefaultElements: function () { 300 return { 301 $container: this.findElement(this.getSettings("container")), 302 }; 303 }, 304 onElementChange: debounce(function () { 305 this.elements.$container.slick("unslick"); 306 this.run(); 307 }, 200), 308 309 getSlickSettings: function () { 310 var autoplaybanner = false; 311 if (this.getElementSettings("_autoplay") == "yes") { 312 autoplaybanner = true; 313 } 314 315 var bannersettings = { 316 infinite: !!this.getElementSettings("_loop"), 317 autoplay: autoplaybanner, 318 autoplaySpeed: this.getElementSettings("_autoplay_speed"), 319 speed: this.getElementSettings("_animation_speed"), 320 slidesToScroll: 1, 321 rtl: rtl_slick(), 322 }; 323 324 bannersettings.slidesToShow = 325 parseInt(this.elements.$container.attr("data-num")) || 1; 326 bannersettings.responsive = [ 327 { 328 breakpoint: elementorFrontend.config.breakpoints.lg, 329 settings: { 330 slidesToShow: 1, 331 }, 332 }, 333 { 334 breakpoint: elementorFrontend.config.breakpoints.md, 335 settings: { 336 slidesToShow: 1, 337 }, 338 }, 339 ]; 340 341 return $.extend({}
341, this.getSettings(), bannersettings); 342 }, 343 344 run: function () { 345 this.elements.$container 346 .not(".slick-initialized") 347 .slick(this.getSlickSettings()); 348 }, 349 }); 350 //----- 351 //Post banner slider 352 var PostBannerCarousel = ModuleHandler.extend({ 353 onInit: function () { 354 ModuleHandler.prototype.onInit.apply(this, arguments); 355 this.run(); 356 }, 357 getDefaultSettings: function () { 358 return { 359 autoplay: true, 360 arrows: true, 361 checkVisible: false, 362 container: ".elespare-carousel-wrap", 363 dots: false, 364 infinite: true, 365 rows: 0, 366 slidesToShow: 1, 367 prevArrow: $("<div />") 368 .append(this.findElement(".slick-prev").clone().show()) 369 .html(), 370 nextArrow: $("<div />") 371 .append(this.findElement(".slick-next").clone().show()) 372 .html(), 373 }; 374 }, 375 getDefaultElements: function () { 376 return { 377 $container: this.findElement(this.getSettings("container")), 378 }; 379 }, 380 onElementChange: debounce(function () { 381 this.elements.$container.slick("unslick"); 382 this.run(); 383 }, 200), 384 385 getSlickSettings: function () { 386 var autoplaybanner = false; 387 if (this.getElementSettings("_autoplay") == "yes") { 388 autoplaybanner = true; 389 } 390 391 var bannersettings = { 392 infinite: !!this.getElementSettings("_loop"), 393 autoplay: autoplaybanner, 394 autoplaySpeed: this.getElementSettings("_autoplay_speed"), 395 speed: this.getElementSettings("_animation_speed"), 396 slidesToScroll: 1, 397 rtl: rtl_slick(), 398 }; 399 400 var parent_class = 401 this.elements.$container.parents(".elementor-column"); 402 403 var admin_attr = parent_class.attr("data-col"); 404 405 if ( 406 admin_attr <= 33 || 407 parent_class.hasClass("elementor-col-33") || 408 parent_class.hasClass("elementor-col-20") || 409 parent_class.hasClass("elementor-col-16") 410 ) { 411 bannersettings.slidesToShow = 1; 412 } else { 413 bannersettings.slidesToShow = 414 parseInt(this.elements.$container.attr("data-num")) || 1; 415 } 416 417 bannersettings.responsive = [ 418 { 419 breakpoint: elementorFrontend.config.breakpoints.lg, 420 settings: { 421 slidesToShow: 1, 422 }, 423 }, 424 { 425 breakpoint: elementorFrontend.config.breakpoints.md, 426 settings: { 427 slidesToShow: 1, 428 }, 429 }, 430 ]; 431 432 return $.extend({}, this.getSettings(), bannersettings); 433 }, 434 435 run: function () { 436 this.elements.$container 437 .not(".slick-initialized") 438 .slick(this.getSlickSettings()); 439 }, 440 }); 441 442 var PostBannerTrendings = ModuleHandler.extend({ 443 onInit: function () { 444 ModuleHandler.prototype.onInit.apply(this, arguments); 445 this.run(); 446 }, 447 getDefaultSettings: function () { 448 return { 449 autoplay: true, 450 arrows: false, 451 checkVisible: false, 452 container: ".elespare-trending-wrap", 453 dots: false, 454 infinite: true, 455 vertical: true, 456 verticalSwiping: true, 457 rows: 0, 458 slidesToShow: 3, 459 }; 460 }, 461 getDefaultElements: function () { 462 return { 463 $container: this.findElement(this.getSettings("container")), 464 }; 465 }, 466 onElementChange: debounce(function () { 467 this.elements.$container.slick("unslick"); 468 this.run(); 469 }, 200), 470 471 getSlickSettings: function () { 472 var slide_to_show = this.getElementSettings("trending_slides_to_show"); 473 474 var parent_class = 475 this.elements.$container.parents(".elementor-column"); 476 var widget_name = parent_class 477 .find(".elementor-widget-main-banner-1") 478 .attr("data-widget_type"); 479 var widget_name_banner_2 = parent_class 480 .find(".elementor-widget-main-banner-2") 481 .attr("data-widget_type"); 482 483 var verticals = true; 484 var admin_attr = parent_class.attr("data-col"); 485 486 if ( 487 widget_name == "main-banner-1.default" || 488 widget_name_banner_2 == "main-banner-2.default" 489 ) { 490 if (admin_attr == "66" || parent_class.hasClass("elementor-col-66")) { 491 verticals = false; 492 slide_to_show = 2; 493 } else if ( 494 admin_attr == "50" || 495 parent_class.hasClass("elementor-col-50") 496 ) { 497 verticals = false; 498 slide_to_show = 2; 499 } else if ( 500 admin_attr == "33" || 501 parent_class.hasClass("elementor-col-33") 502 ) { 503 verticals = false;
504 slide_to_show = 1; 505 } else if ( 506 admin_attr == "25" || 507 parent_class.hasClass("elementor-col-25") 508 ) { 509 verticals = false; 510 slide_to_show = 1; 511 } else { 512 verticals = false; 513 slide_to_show = this.getElementSettings("trending_slides_to_show"); 514 } 515 } 516 517 var autoplayverticale = false; 518 if (this.getElementSettings("trending_autoplay") == "yes") { 519 autoplayverticale = true; 520 } 521 522 var verticalsettings = { 523 infinite: !!this.getElementSettings("trending_loop"), 524 autoplay: autoplayverticale, 525 autoplaySpeed: this.getElementSettings("trending_autoplay_speed"), 526 speed: this.getElementSettings("trending_animation_speed"), 527 slidesToShow: slide_to_show, 528 slidesToScroll: 1, 529 vertical: verticals, 530 rtl: rtl_slick(), 531 }; 532 533 verticalsettings.responsive = [ 534 { 535 breakpoint: elementorFrontend.config.breakpoints.lg, 536 settings: { 537 slidesToShow: 538 parseInt( 539 this.getElementSettings("trending_slides_to_show_tablet") 540 ) || verticalsettings.slidesToShow, 541 vertical: false, 542 }, 543 }, 544 { 545 breakpoint: elementorFrontend.config.breakpoints.md, 546 settings: { 547 slidesToShow: 548 parseInt( 549 this.getElementSettings("trending_slides_to_show_mobile") 550 ) || 551 parseInt(this.getElementSettings("slides_to_show_tablet")) || 552 verticalsettings.slidesToShow, 553 vertical: false, 554 }, 555 }, 556 ]; 557 558 return $.extend({}, this.getSettings(), verticalsettings); 559 }, 560 561 run: function () { 562 this.elements.$container 563 .not(".slick-initialized") 564 .slick(this.getSlickSettings()); 565 }, 566 }); 567 568 var PostBannerVerticaleTrendings = ModuleHandler.extend({ 569 onInit: function () { 570 ModuleHandler.prototype.onInit.apply(this, arguments); 571 this.run(); 572 }, 573 getDefaultSettings: function () { 574 return { 575 autoplay: true, 576 arrows: false, 577 checkVisible: false, 578 container: ".elespare-trending-wrap", 579 dots: false, 580 infinite: true, 581 vertical: true, 582 verticalSwiping: true, 583 rows: 0, 584 slidesToShow: 3, 585 }; 586 }, 587 getDefaultElements: function () { 588 return { 589 $container: this.findElement(this.getSettings("container")), 590 }; 591 }, 592 onElementChange: debounce(function () { 593 this.elements.$container.slick("unslick"); 594 this.run(); 595 }, 200), 596 597 getSlickSettings: function () { 598 var slide_to_show = 3; 599 600 var autoplayverticale = false; 601 if (this.getElementSettings("trending_autoplay") == "yes") { 602 autoplayverticale = true; 603 } 604 605 var parent_class = this.elements.$container.parents( 606 ".elementor-element.elementor-widget-post-banner" 607 ); 608 var widget_name = parent_class.attr("data-widget_type"); 609 if (widget_name == "post-banner.default") { 610 if ( 611 parent_class 612 .find(".elespare-banner-one-wrap") 613 .hasClass("banner-style-4") || 614 parent_class 615 .find(".elespare-banner-one-wrap") 616 .hasClass("banner-style-5") || 617 parent_class 618 .find(".elespare-banner-one-wrap") 619 .hasClass("banner-style-6") 620 ) { 621 slide_to_show = 4; 622 } 623 } 624 625 var verticalsettings = { 626 infinite: !!this.getElementSettings("trending_loop"), 627 autoplay: autoplayverticale, 628 autoplaySpeed: this.getElementSettings("trending_autoplay_speed"), 629 speed: this.getElementSettings("trending_animation_speed"), 630 slidesToShow: slide_to_show, 631 slidesToScroll: 1, 632 vertical: true, 633 verticalSwiping: true, 634 // rtl: rtl_slick() 635 }; 636 637 verticalsettings.responsive = [ 638 { 639 breakpoint: elementorFrontend.config.breakpoints.lg, 640 settings: { 641 slidesToShow: 1, 642 vertical: false, 643 verticalSwiping: false, 644 rtl: rtl_slick(), 645 }, 646 }, 647 { 648 breakpoint: elementorFrontend.config.breakpoints.md, 649 settings: { 650 slidesToShow: 1, 651 vertical: false, 652 verticalSwiping: false, 653 rtl: rtl_slick(), 654 }, 655 }, 656 ]; 657 658 return $.extend({}, this.getSettings(), verticalsettings); 659 }, 660 661 run: function () { 662 this.elements.$container 663 .not(".slick-initialized") 664 .slick(this.getSlickSettings()); 665 }, 666 }); 667 668 //Post Trending Carousel
669 var PostTrendingsCarousel = ModuleHandler.extend({ 670 onInit: function () { 671 ModuleHandler.prototype.onInit.apply(this, arguments); 672 this.run(); 673 }, 674 getDefaultSettings: function () { 675 return { 676 autoplay: false, 677 arrows: false, 678 checkVisible: false, 679 container: ".elespare-trending-wrap", 680 dots: false, 681 infinite: true, 682 vertical: false, 683 verticalSwiping: false, 684 rows: 0, 685 slidesToShow: 3, 686 }; 687 }, 688 getDefaultElements: function () { 689 return { 690 $container: this.findElement(this.getSettings("container")), 691 }; 692 }, 693 onElementChange: debounce(function () { 694 this.elements.$container.slick("unslick"); 695 this.run(); 696 }, 200), 697 698 getSlickSettings: function () { 699 var verticals = false; 700 var slide_to_show = 3; 701 var parent_class = 702 this.elements.$container.parents(".elementor-column"); 703 var rtl = rtl_slick(); 704 705 var admin_attr = parent_class.attr("data-col"); 706 707 if (parent_class.hasClass("elementor-col-66")) { 708 verticals = false; 709 slide_to_show = 2; 710 rtl = rtl_slick(); 711 } 712 if (parent_class.hasClass("elementor-col-50")) { 713 verticals = false; 714 slide_to_show = 2; 715 rtl = rtl_slick(); 716 } 717 if (parent_class.hasClass("elementor-col-33")) { 718 verticals = true; 719 slide_to_show = 5; 720 rtl = false; 721 } 722 if (parent_class.hasClass("elementor-col-25")) { 723 verticals = true; 724 slide_to_show = 2; 725 rtl = false; 726 } 727 if (parent_class.hasClass("elementor-col-16")) { 728 verticals = true; 729 slide_to_show = 2; 730 rtl = false; 731 } 732 733 if (admin_attr == "66") { 734 verticals = false; 735 slide_to_show = 2; 736 rtl = rtl_slick(); 737 } 738 if (admin_attr == "50") { 739 verticals = false; 740 slide_to_show = 2; 741 rtl = rtl_slick(); 742 } 743 744 if (admin_attr == "33") { 745 verticals = true; 746 slide_to_show = 5; 747 rtl = false; 748 } 749 if (admin_attr == "25") { 750 verticals = true; 751 slide_to_show = 2; 752 rtl = false; 753 } 754 if (admin_attr == "16") { 755 verticals = true; 756 slide_to_show = 2; 757 rtl = false; 758 } 759 760 var verticalsettings = { 761 infinite: !!this.getElementSettings("trending_loop"), 762 autoplay: !!this.getElementSettings("trending_autoplay"), 763 autoplaySpeed: this.getElementSettings("trending_autoplay_speed"), 764 speed: this.getElementSettings("trending_animation_speed"), 765 slidesToShow: slide_to_show, 766 slidesToScroll: 1, 767 vertical: verticals, 768 rtl: rtl, 769 }; 770 771 verticalsettings.responsive = [ 772 { 773 breakpoint: elementorFrontend.config.breakpoints.lg, 774 settings: { 775 slidesToShow: 2, 776 vertical: false, 777 verticalSwiping: false, 778 rtl: rtl_slick(), 779 }, 780 }, 781 { 782 breakpoint: elementorFrontend.config.breakpoints.md, 783 settings: { 784 slidesToShow: 5, 785 vertical: true, 786 verticalSwiping: true, 787 rtl: false, 788 }, 789 }, 790 ]; 791 792 return $.extend({}, this.getSettings(), verticalsettings); 793 }, 794 795 run: function () { 796 this.elements.$container 797 .not(".slick-initialized") 798 .slick(this.getSlickSettings()); 799 }, 800 }); 801 802 //Tabs 803 var PostTab = ModuleHandler.extend({ 804 onInit: function () { 805 ModuleHandler.prototype.onInit.apply(this, arguments); 806 this.wrapper = this.$element.find(".elespare-post-tab"); 807 this.run(); 808 }, 809 810 run: function () { 811 var filter_wrap = this.wrapper.find(".elespare-post-tab-filter"), 812 filter = filter_wrap.find("li"), 813 event = this.wrapper.data("event"), 814 args = this.wrapper.data("query-args"); 815 filter.on( 816 event, 817 debounce(function (e) { 818 e.preventDefault(); 819 var $self = $(this), 820 term_id = $self.data("term"), 821 $wrapper = $self.closest(".elespare-post-tab"), 822 content = $wrapper.find(".elespare-post-tab-content"), 823 loading = content.find(".elespare-post-tab-loading"), 824 tab_item = content.find(".elespare-post-tab-item-wrapper"), 825 $content_exist = false; 826 827 if (0 === loading.length) { 828 filter.removeClass("active"); 829 tab_item.removeClass("active"); 830 $self.addClass("active"); 831 832 tab_item.each(function () { 833 var $self = $(this), 834 $content_id = $self.data("term"); 835 if (term_id === $content_id) { 836 $self.addClass("active"), ($content_exist = true); 837 } 838 }); 839 840 if (false === $content_exist) { 841 $.ajax({ 842 url: ElespareLocalize.ajax_url, 843 type: "POST", 844 data: { 845 action: "elespare_post_tab_action", 846 security: ElespareLocalize.nonce, 847 post_tab_query: args, 848 term_id: term_id, 849 }, 850 beforeSend: function () { 851 content.append( 852 '<span class="elespare-post-tab-loading"><span class="elespare-roller"><span></span><span></span><span></span><span></span></span></span>' 853 ); 854 }, 855 success: function (response) { 856 content.find(".elespare-post-tab-loading").remove(); 857 content.append(response); 858 }, 859 error: function (error) {}, 860 }); 861 } 862 } 863 }, 200) 864 ); 865 }, 866 }); 867 868 var SearchForm = ModuleHandler.extend({ 869 onInit: function () { 870 ModuleHandler.prototype.onInit.apply(this, arguments); 871 this.wrapper = this.$element.find(".elespare-search-wrapper"); 872 this.run(); 873 }, 874 run: function () { 875 var searchContainer = this.wrapper.find(".elespare-search--toggle"); 876 var btn = this.wrapper.find(".elespare-search-icon--toggle"); 877 var close = this.wrapper.find(".elespare--site-search-close"); 878 var dropdown_click = this.wrapper.find( 879 ".elespare-search-dropdown-toggle" 880 ); 881 882 btn.on("click", function () { 883 searchContainer.addClass("show"); 884 dropdown_click.toggleClass("show"); 885 }); 886 887 close.on("click", function () { 888 searchContainer.removeClass("show"); 889 }); 890 891 const $menu = this.wrapper.find(".elespare-search-dropdown-toggle"); 892 893 $(document).mouseup((e) => { 894 if ( 895 !$menu.is(e.target) && // if the target of the click isn't the container... 896 $menu.has(e.target).length === 0 897 ) { 898 // ... nor a descendant of the container 899 $menu.removeClass("show"); 900 } 901 }); 902 903 $(document).on("keydown", function (e) { 904 if (e.keyCode === 27) { 905 // ESC 906 searchContainer.removeClass("show"); 907 } 908 }); 909 }, 910 }); 911 912 var NavMenu = ModuleHandler.extend({ 913 onInit: function () { 914 ModuleHandler.prototype.onInit.apply(this, arguments); 915 this.wrapper = this.$element.find(".elespare-navigation-wrapper"); 916 this.run(); 917 }, 918 919 run: function () { 920 var toggle = this.wrapper.find(".elespare-menu-toggle"); 921 var nav = this.wrapper.find(".elespare-moblie-ham-menu");
922 var overlay = this.wrapper.find(".elespare-overlay"); 923 var close = this.wrapper.find(".elespare--close-menu-side-bar"); 924 var main = this.wrapper.find(".elespare-main-navigation"); 925 var desktop_subnav = main.find("ul >.menu-item-has-children>a"); 926 var sub = main.find(".sub-menu"); 927 if ( 928 this.wrapper.hasClass("vertical") || 929 this.wrapper.hasClass("horizontal") 930 ) { 931 sub.each(function (index) { 932 $(this).wrap('<div class="elespare-menu-child">'); 933 }); 934 } 935 936 sub 937 .parents("li") 938 .find("> a") 939 .append('<button class="elespare-dropdwon-toggle">'); 940 nav 941 .find("ul >.menu-item-has-children>a") 942 .parents("li") 943 .find("> a") 944 .append('<button class="elespare-dropdwon-toggle">'); 945 946 if ( 947 this.wrapper.hasClass("vertical") || 948 this.wrapper.hasClass("horizontal") 949 ) { 950 var submenu_op = this.wrapper.data("opt"); 951 var cl_event = "click"; 952 if (submenu_op == "sub-hover") { 953 cl_event = "hover"; 954 } 955 desktop_subnav.on(cl_event, function (e) { 956 e.preventDefault(); 957 958 var item = $(this).siblings(".elespare-menu-child"); 959 if ( 960 desktop_subnav 961 .parents(".elespare-navigation-wrapper") 962 .hasClass("horizontal") 963 ) { 964 $(this) 965 .closest("ul") 966 .find(".elespare-menu-child") 967 .not(item) 968 .removeClass("active"); 969 } 970 if (item.hasClass("active")) { 971 item.removeClass("active"); 972 $(this).removeClass("up"); 973 $(this).removeClass(submenu_op); 974 } else { 975 item.addClass("active"); 976 $(this).addClass("up"); 977 $(this).addClass(submenu_op); 978 } 979 }); 980 981 if (this.wrapper.hasClass("sub-click")) { 982 $(document).on("click", function (e) { 983 var elebodyclick = $(".sub-click"); 984 if ( 985 !elebodyclick.is(e.target) && // if the target of the click isn't the container... 986 elebodyclick.has(e.target).length === 0 987 ) { 988 // ... nor a descendant of the container 989 elebodyclick 990 .parents(".elespare-main-navigation") 991 .find(".elespare-menu-child") 992 .removeClass("active"); 993 } 994 }); 995 } 996 } 997 998 // Show Menu Mobile 999 1000 toggle.on("click", function (e) { 1001 e.preventDefault(); 1002 if (nav.hasClass("show")) { 1003 nav.removeClass("show"); 1004 overlay.removeClass("show"); 1005 toggle.removeClass("elespare-nav-menu-toggle"); 1006 } else { 1007 nav.addClass("show"); 1008 overlay.addClass("show"); 1009 toggle.addClass("elespare-nav-menu-toggle"); 1010 } 1011 }); 1012 1013 // Close menu mobile when click overlay 1014 overlay.on("click", function (e) { 1015 nav.removeClass("show"); 1016 overlay.removeClass("show"); 1017 }); 1018 1019 // Close menu mobile when click icon close 1020 close.on("click", function (e) { 1021 nav.removeClass("show"); 1022 overlay.removeClass("show"); 1023 }); 1024 1025 // Close menu mobile when click ESC 1026 $(document).on("keyup", function (e) { 1027 if (e.keyCode === 27) { 1028 nav.removeClass("show"); 1029 overlay.removeClass("show"); 1030 } 1031 }); 1032 1033 /* MOBILE MENU */ 1034 1035 var btn = nav.find( 1036 "ul >.menu-item-has-children>a .elespare-dropdwon-toggle" 1037 ); 1038 1039 btn.on("click", function (e) { 1040 e.preventDefault(); 1041 var item = $(this).parent("a").siblings("ul.sub-menu"); 1042 var active = item.hasClass("active"); 1043 if (active) { 1044 item.removeClass("active"); 1045 $(this).removeClass("up"); 1046 item.slideUp(300); 1047 } else { 1048 item.addClass("active"); 1049 item.slideDown(300); 1050 $(this).addClass("up"); 1051 } 1052 }); 1053 1054 // for Testing 1055 1056 $(".sub-menu .menu-item-has-children").on("hover", function () { 1057 var width = $(this).offset().left, 1058 windowWidth = $(window).width(), 1059 range = windowWidth - width; 1060 1061 if (range < 400) { 1062 $(this).find(".elespare-menu-child").css({ top: "100%" }); 1063 $(this) 1064 .find(".sub-menu") 1065 .css({ left: "auto", top: "100%", right: "50%" }); 1066 } 1067 }); 1068 1069 if (main.hasClass("primary-menu")) { 1070 main.removeClass("primary-menu"); 1071 } 1072 }, 1073 }); 1074 1075 //Tabs 1076 elementorFrontend.hooks.addAction( 1077 "frontend/element_ready/post-tabs.default", 1078 function ($scope) { 1079 elementorFrontend.elementsHandler.addHandler(PostTab, { 1080 $element: $scope, 1081 }); 1082 } 1083 ); 1084 //Masonry 1085 1086 elementorFrontend.hooks.addAction( 1087 "frontend/element_ready/post-masonry.default", 1088 function ($scope) { 1089 elementorFrontend.elementsHandler.addHandler(PostMasonry, { 1090 $element: $scope, 1091 }); 1092 } 1093 ); 1094 1095 //Carousel 1096 elementorFrontend.hooks.addAction( 1097 "frontend/element_ready/post-carousel.default", 1098 function ($scope) { 1099 elementorFrontend.elementsHandler.addHandler(PostCarousel, { 1100 $element: $scope, 1101 }); 1102 } 1103 ); 1104 1105 //slider 1106 elementorFrontend.hooks.addAction( 1107 "frontend/element_ready/post-slider.default", 1108 function ($scope) { 1109 elementorFrontend.elementsHandler.addHandler(PostCarousel, { 1110 $element: $scope, 1111 }); 1112 } 1113 ); 1114 //Marquee 1115 1116 elementorFrontend.hooks.addAction( 1117 "frontend/element_ready/post-flash.default", 1118 function ($scope) { 1119 elementorFrontend.elementsHandler.addHandler(PostMarquee, { 1120 $element: $scope, 1121 }); 1122 } 1123 ); 1124 1125 //banner -1 1126 elementorFrontend.hooks.addAction( 1127 "frontend/element_ready/post-banner.default", 1128 function ($scope) { 1129 elementorFrontend.elementsHandler.addHandler(PostBannerCarousel, { 1130 $element: $scope, 1131 }); 1132 } 1133 ); 1134 //banner -2 1135 elementorFrontend.hooks.addAction( 1136 "frontend/element_ready/post-banner-2.default", 1137 function ($scope) { 1138 elementorFrontend.elementsHandler.addHandler(PostBannerCarousel, { 1139 $element: $scope, 1140 }); 1141 } 1142 ); 1143 //--------------------------- 1144 elementorFrontend.hooks.addAction( 1145 "frontend/element_ready/main-banner-1.default", 1146 function ($scope) { 1147 elementorFrontend.elementsHandler.addHandler(MainBannerOne, { 1148 $element: $scope, 1149 }); 1150 } 1151 ); 1152 //MainBannerTrendings banner1 1153 elementorFrontend.hooks.addAction( 1154 "frontend/element_ready/main-banner-1.default", 1155 function ($scope) { 1156 elementorFrontend.elementsHandler.addHandler(PostBannerTrendings, { 1157 $element: $scope, 1158 }); 1159 } 1160 ); 1161 //MainBannerTrendings banner2 1162 1163 elementorFrontend.hooks.addAction( 1164 "frontend/element_ready/main-banner-2.default", 1165 function ($scope) { 1166 elementorFrontend.elementsHandler.addHandler(MainBannerTwo, { 1167 $element: $scope, 1168 }); 1169 } 1170 ); 1171 //MainBannerTrendings banner1 1172 elementorFrontend.hooks.addAction( 1173 "frontend/element_ready/main-banner-2.default", 1174 function ($scope) { 1175 elementorFrontend.elementsHandler.addHandler(PostBannerTrendings, { 1176 $element: $scope, 1177 }); 1178 } 1179 ); 1180 1181 //------------------- 1182 //PostBannerTrendings banner1 1183 elementorFrontend.hooks.addAction( 1184 "frontend/element_ready/post-banner.default", 1185 function ($scope) { 1186 elementorFrontend.elementsHandler.addHandler( 1187 PostBannerVerticaleTrendings, 1188 { 1189 $element: $scope, 1190 } 1191 ); 1192 } 1193 ); 1194 1195 //PostBannerTrendings banner 2 1196 elementorFrontend.hooks.addAction( 1197 "frontend/element_ready/post-banner-2.default", 1198 function ($scope) { 1199 elementorFrontend.elementsHandler.addHandler(PostBannerTrendings, { 1200 $element: $scope, 1201 }); 1202 } 1203 ); 1204 1205 //PostsTrendingsCarousel 1206 elementorFrontend.hooks.addAction( 1207 "frontend/element_ready/post-trending-carousel.default", 1208 function ($scope) { 1209 elementorFrontend.elementsHandler.addHandler(PostTrendingsCarousel, { 1210 $element: $scope, 1211 }); 1212 } 1213 ); 1214 //Serach Form 1215 elementorFrontend.hooks.addAction( 1216 "frontend/element_ready/search-from.default", 1217 function ($scope) { 1218 elementorFrontend.elementsHandler.addHandler(SearchForm, { 1219 $element: $scope, 1220 }); 1221 } 1222 ); 1223 1224 //Horizontal Nav Menu 1225 1226 elementorFrontend.hooks.addAction( 1227 "frontend/element_ready/elespare-nav-horziontal-menu.default", 1228 function ($scope) { 1229 elementorFrontend.elementsHandler.addHandler(NavMenu, { 1230 $element: $scope, 1231 }); 1232 } 1233 ); 1234 //Vertical Nav Menu 1235 elementorFrontend.hooks.addAction( 1236 "frontend/element_ready/elespare-nav-vertical-menu.default", 1237 function ($scope) { 1238 elementorFrontend.elementsHandler.addHandler(NavMenu, { 1239 $element: $scope, 1240 }); 1241 } 1242 ); 1243 1244 //Expandable Nav Menu 1245 elementorFrontend.hooks.addAction( 1246 "frontend/element_ready/elespare-nav-expanded-menu.default", 1247 function ($scope) { 1248 elementorFrontend.elementsHandler.addHandler(NavMenu, { 1249 $element: $scope, 1250 }); 1251 } 1252 ); 1253 }); 1254})(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.