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-element"); 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 } else { 516 verticals = false; 517 } 518 519 var autoplayverticale = false; 520 if (this.getElementSettings("trending_autoplay") == "yes") { 521 autoplayverticale = true; 522 } 523 524 var verticalsettings = { 525 infinite: !!this.getElementSettings("trending_loop"), 526 autoplay: autoplayverticale, 527 autoplaySpeed: this.getElementSettings("trending_autoplay_speed"), 528 speed: this.getElementSettings("trending_animation_speed"), 529 slidesToShow: slide_to_show, 530 slidesToScroll: 1, 531 vertical: verticals, 532 rtl: rtl_slick(), 533 }; 534 535 verticalsettings.responsive = [ 536 { 537 breakpoint: elementorFrontend.config.breakpoints.lg, 538 settings: { 539 slidesToShow: 540 parseInt( 541 this.getElementSettings("trending_slides_to_show_tablet") 542 ) || verticalsettings.slidesToShow, 543 vertical: false, 544 }, 545 }, 546 { 547 breakpoint: elementorFrontend.config.breakpoints.md, 548 settings: { 549 slidesToShow: 550 parseInt( 551 this.getElementSettings("trending_slides_to_show_mobile") 552 ) || 553 parseInt(this.getElementSettings("slides_to_show_tablet")) || 554 verticalsettings.slidesToShow, 555 vertical: false, 556 }, 557 }, 558 ]; 559 560 return $.extend({}, this.getSettings(), verticalsettings); 561 }, 562 563 run: function () { 564 this.elements.$container 565 .not(".slick-initialized") 566 .slick(this.getSlickSettings()); 567 }, 568 }); 569 570 var PostBannerVerticaleTrendings = ModuleHandler.extend({ 571 onInit: function () { 572 ModuleHandler.prototype.onInit.apply(this, arguments); 573 this.run(); 574 }, 575 getDefaultSettings: function () { 576 return { 577 autoplay: true, 578 arrows: false, 579 checkVisible: false, 580 container: ".elespare-trending-wrap", 581 dots: false, 582 infinite: true, 583 vertical: true, 584 verticalSwiping: true, 585 rows: 0, 586 slidesToShow: 3, 587 }; 588 }, 589 getDefaultElements: function () { 590 return { 591 $container: this.findElement(this.getSettings("container")), 592 }; 593 }, 594 onElementChange: debounce(function () { 595 this.elements.$container.slick("unslick"); 596 this.run(); 597 }, 200), 598 599 getSlickSettings: function () { 600 var slide_to_show = 3; 601 602 var autoplayverticale = false; 603 if (this.getElementSettings("trending_autoplay") == "yes") { 604 autoplayverticale = true; 605 } 606 607 var parent_class = this.elements.$container.parents( 608 ".elementor-element.elementor-widget-post-banner" 609 ); 610 var widget_name = parent_class.attr("data-widget_type"); 611 if (widget_name == "post-banner.default") { 612 if ( 613 parent_class 614 .find(".elespare-banner-one-wrap") 615 .hasClass("banner-style-4") || 616 parent_class 617 .find(".elespare-banner-one-wrap") 618 .hasClass("banner-style-5") || 619 parent_class 620 .find(".elespare-banner-one-wrap") 621 .hasClass("banner-style-6") 622 ) { 623 slide_to_show = 4; 624 } 625 } 626 627 var verticalsettings = { 628 infinite: !!this.getElementSettings("trending_loop"), 629 autoplay: autoplayverticale, 630 autoplaySpeed: this.getElementSettings("trending_autoplay_speed"), 631 speed: this.getElementSettings("trending_animation_speed"), 632 slidesToShow: slide_to_show, 633 slidesToScroll: 1, 634 vertical: true, 635 verticalSwiping: true, 636 // rtl: rtl_slick() 637 }; 638 639 verticalsettings.responsive = [ 640 { 641 breakpoint: elementorFrontend.config.breakpoints.lg, 642 settings: { 643 slidesToShow: 2, 644 vertical: false, 645 verticalSwiping: false, 646 rtl: rtl_slick(), 647 }, 648 }, 649 { 650 breakpoint: elementorFrontend.config.breakpoints.md, 651 settings: { 652 slidesToShow: 1, 653 vertical: false, 654 verticalSwiping: false, 655 rtl: rtl_slick(), 656 }, 657 }, 658 ]; 659 660 return $.extend({}
660, this.getSettings(), verticalsettings); 661 }, 662 663 run: function () { 664 this.elements.$container 665 .not(".slick-initialized") 666 .slick(this.getSlickSettings()); 667 }, 668 }); 669 670 //Post Trending Carousel 671 var PostTrendingsCarousel = ModuleHandler.extend({ 672 onInit: function () { 673 ModuleHandler.prototype.onInit.apply(this, arguments); 674 this.run(); 675 }, 676 getDefaultSettings: function () { 677 return { 678 autoplay: false, 679 arrows: false, 680 checkVisible: false, 681 container: ".elespare-trending-wrap", 682 dots: false, 683 infinite: true, 684 vertical: false, 685 verticalSwiping: false, 686 rows: 0, 687 slidesToShow: 3, 688 }; 689 }, 690 getDefaultElements: function () { 691 return { 692 $container: this.findElement(this.getSettings("container")), 693 }; 694 }, 695 onElementChange: debounce(function () { 696 this.elements.$container.slick("unslick"); 697 this.run(); 698 }, 200), 699 700 getSlickSettings: function () { 701 var verticals = false; 702 var slide_to_show = 3; 703 var parent_class = 704 this.elements.$container.parents(".elementor-column"); 705 var rtl = rtl_slick(); 706 707 var admin_attr = parent_class.attr("data-col"); 708 709 if (parent_class.hasClass("elementor-col-66")) { 710 verticals = false; 711 slide_to_show = 2; 712 rtl = rtl_slick(); 713 } 714 if (parent_class.hasClass("elementor-col-50")) { 715 verticals = false; 716 slide_to_show = 2; 717 rtl = rtl_slick(); 718 } 719 if (parent_class.hasClass("elementor-col-33")) { 720 verticals = true; 721 slide_to_show = 5; 722 rtl = false; 723 } 724 if (parent_class.hasClass("elementor-col-25")) { 725 verticals = true; 726 slide_to_show = 2; 727 rtl = false; 728 } 729 if (parent_class.hasClass("elementor-col-16")) { 730 verticals = true; 731 slide_to_show = 2; 732 rtl = false; 733 } 734 735 if (admin_attr == "66") { 736 verticals = false; 737 slide_to_show = 2; 738 rtl = rtl_slick(); 739 } 740 if (admin_attr == "50") { 741 verticals = false; 742 slide_to_show = 2; 743 rtl = rtl_slick(); 744 } 745 746 if (admin_attr == "33") { 747 verticals = true; 748 slide_to_show = 5; 749 rtl = false; 750 } 751 if (admin_attr == "25") { 752 verticals = true; 753 slide_to_show = 2; 754 rtl = false; 755 } 756 if (admin_attr == "16") { 757 verticals = true; 758 slide_to_show = 2; 759 rtl = false; 760 } 761 762 var verticalsettings = { 763 infinite: !!this.getElementSettings("trending_loop"), 764 autoplay: !!this.getElementSettings("trending_autoplay"), 765 autoplaySpeed: this.getElementSettings("trending_autoplay_speed"), 766 speed: this.getElementSettings("trending_animation_speed"), 767 slidesToShow: slide_to_show, 768 slidesToScroll: 1, 769 vertical: verticals, 770 rtl: rtl, 771 }; 772 773 verticalsettings.responsive = [ 774 { 775 breakpoint: elementorFrontend.config.breakpoints.lg, 776 settings: { 777 slidesToShow: 2, 778 vertical: false, 779 verticalSwiping: false, 780 rtl: rtl_slick(), 781 }, 782 }, 783 { 784 breakpoint: elementorFrontend.config.breakpoints.md, 785 settings: { 786 slidesToShow: 5, 787 vertical: true, 788 verticalSwiping: true, 789 rtl: false, 790 }, 791 }, 792 ]; 793 794 return $.extend({}, this.getSettings(), verticalsettings); 795 }, 796 797 run: function () { 798 this.elements.$container 799 .not(".slick-initialized") 800 .slick(this.getSlickSettings()); 801 }, 802 }); 803 804 //Tabs 805 var PostTab = ModuleHandler.extend({ 806 onInit: function () { 807 ModuleHandler.prototype.onInit.apply(this, arguments); 808 this.wrapper = this.$element.find(".elespare-post-tab"); 809 this.run(); 810 }, 811 812 run: function () { 813 var filter_wrap = this.wrapper.find(".elespare-post-tab-filter"), 814 filter = filter_wrap.find("li"), 815 event = this.wrapper.data("event"), 816 args = this.wrapper.data("query-args"); 817 filter.on( 818 event, 819 debounce(function (e) { 820 e.preventDefault(); 821 var $self = $(this), 822 term_id = $self.data("term"), 823 $wrapper = $self.closest(".elespare-post-tab"), 824 content = $wrapper.find(".elespare-post-tab-content"), 825 loading = content.find(".elespare-post-tab-loading"), 826 tab_item = content.find(".elespare-post-tab-item-wrapper"), 827 $content_exist = false;
828 829 if (0 === loading.length) { 830 filter.removeClass("active"); 831 tab_item.removeClass("active"); 832 $self.addClass("active"); 833 834 tab_item.each(function () { 835 var $self = $(this), 836 $content_id = $self.data("term"); 837 if (term_id === $content_id) { 838 $self.addClass("active"), ($content_exist = true); 839 } 840 }); 841 842 if (false === $content_exist) { 843 $.ajax({ 844 url: ElespareLocalize.ajax_url, 845 type: "POST", 846 data: { 847 action: "elespare_post_tab_action", 848 security: ElespareLocalize.nonce, 849 post_tab_query: args, 850 term_id: term_id, 851 }, 852 beforeSend: function () { 853 content.append( 854 '<span class="elespare-post-tab-loading"><span class="elespare-roller"><span></span><span></span><span></span><span></span></span></span>' 855 ); 856 }, 857 success: function (response) { 858 content.find(".elespare-post-tab-loading").remove(); 859 content.append(response); 860 }, 861 error: function (error) {}, 862 }); 863 } 864 } 865 }, 200) 866 ); 867 }, 868 }); 869 870 var SearchForm = ModuleHandler.extend({ 871 onInit: function () { 872 ModuleHandler.prototype.onInit.apply(this, arguments); 873 this.wrapper = this.$element.find(".elespare-search-wrapper"); 874 this.run(); 875 }, 876 run: function () { 877 var searchContainer = this.wrapper.find(".elespare-search--toggle"); 878 var btn = this.wrapper.find(".elespare-search-icon--toggle"); 879 var close = this.wrapper.find(".elespare--site-search-close"); 880 var dropdown_click = this.wrapper.find( 881 ".elespare-search-dropdown-toggle" 882 ); 883 884 btn.on("click", function () { 885 searchContainer.addClass("show"); 886 dropdown_click.toggleClass("show"); 887 }); 888 889 close.on("click", function () { 890 searchContainer.removeClass("show"); 891 }); 892 893 const $menu = this.wrapper.find(".elespare-search-dropdown-toggle"); 894 895 $(document).mouseup((e) => { 896 if ( 897 !$menu.is(e.target) && // if the target of the click isn't the container... 898 $menu.has(e.target).length === 0 899 ) { 900 // ... nor a descendant of the container 901 $menu.removeClass("show"); 902 } 903 }); 904 905 $(document).on("keydown", function (e) { 906 if (e.keyCode === 27) { 907 // ESC 908 searchContainer.removeClass("show"); 909 } 910 }); 911 }, 912 }); 913 914 var NavMenu = ModuleHandler.extend({ 915 onInit: function () { 916 ModuleHandler.prototype.onInit.apply(this, arguments); 917 this.wrapper = this.$element.find(".elespare-navigation-wrapper"); 918 this.run(); 919 }, 920 921 run: function () { 922 var toggle = this.wrapper.find(".elespare-menu-toggle"); 923 var nav = this.wrapper.find(".elespare-moblie-ham-menu"); 924 var overlay = this.wrapper.find(".elespare-overlay"); 925 var close = this.wrapper.find(".elespare--close-menu-side-bar"); 926 var main = this.wrapper.find(".elespare-main-navigation"); 927 var desktop_subnav = main.find("ul >.menu-item-has-children>a"); 928 var sub = main.find(".sub-menu"); 929 if ( 930 this.wrapper.hasClass("vertical") || 931 this.wrapper.hasClass("horizontal") 932 ) { 933 sub.each(function (index) { 934 $(this).wrap('<div class="elespare-menu-child">'); 935 }); 936 } 937 938 sub 939 .parents("li") 940 .find("> a") 941 .append('<button class="elespare-dropdwon-toggle">'); 942 nav 943 .find("ul >.menu-item-has-children>a") 944 .parents("li") 945 .find("> a") 946 .append('<button class="elespare-dropdwon-toggle">'); 947 948 if ( 949 this.wrapper.hasClass("vertical") || 950 this.wrapper.hasClass("horizontal") 951 ) { 952 var submenu_op = this.wrapper.data("opt"); 953 var cl_event = "click"; 954 if (submenu_op == "sub-hover") { 955 cl_event = "hover"; 956 } 957 desktop_subnav.on(cl_event, function (e) { 958 e.preventDefault(); 959 960 var item = $(this).siblings(".elespare-menu-child"); 961 if ( 962 desktop_subnav 963 .parents(".elespare-navigation-wrapper") 964 .hasClass("horizontal") 965 ) { 966 $(this) 967 .closest("ul") 968 .find(".elespare-menu-child") 969 .not(item) 970 .removeClass("active"); 971 } 972 if (item.hasClass("active")) { 973 item.removeClass("active"); 974 $(this).removeClass("up"); 975 $(this).removeClass(submenu_op); 976 } else { 977 item.addClass("active"); 978 $(this).addClass("up"); 979 $(this).addClass(submenu_op); 980 } 981 }); 982 983 if (this.wrapper.hasClass("sub-click")) { 984 $(document).on("click", function (e) { 985 var elebodyclick = $(".sub-click"); 986 if ( 987 !elebodyclick.is(e.target) && // if the target of the click isn't the container... 988 elebodyclick.has(e.target).length === 0 989 ) { 990 // ... nor a descendant of the container 991 elebodyclick 992 .parents(".elespare-main-navigation") 993 .find(".elespare-menu-child") 994 .removeClass("active"); 995 } 996 }); 997 } 998 } 999 1000 // Show Menu Mobile 1001 1002 toggle.on("click", function (e) { 1003 e.preventDefault(); 1004 if (nav.hasClass("show")) { 1005 nav.removeClass("show"); 1006 overlay.removeClass("show"); 1007 toggle.removeClass("elespare-nav-menu-toggle"); 1008 } else { 1009 nav.addClass("show"); 1010 overlay.addClass("show"); 1011 toggle.addClass("elespare-nav-menu-toggle"); 1012 } 1013 }); 1014 1015 // Close menu mobile when click overlay 1016 overlay.on("click", function (e) { 1017 nav.removeClass("show"); 1018 overlay.removeClass("show"); 1019 }); 1020 1021 // Close menu mobile when click icon close 1022 close.on("click", function (e) { 1023 nav.removeClass("show"); 1024 overlay.removeClass("show"); 1025 }); 1026 1027 // Close menu mobile when click ESC 1028 $(document).on("keyup", function (e) { 1029 if (e.keyCode === 27) { 1030 nav.removeClass("show"); 1031 overlay.removeClass("show"); 1032 } 1033 }); 1034 1035 /* MOBILE MENU */ 1036 1037 var btn = nav.find( 1038 "ul >.menu-item-has-children>a .elespare-dropdwon-toggle" 1039 ); 1040 1041 btn.on("click", function (e) { 1042 e.preventDefault(); 1043 var item = $(this).parent("a").siblings("ul.sub-menu"); 1044 var active = item.hasClass("active"); 1045 if (active) { 1046 item.removeClass("active"); 1047 $(this).removeClass("up"); 1048 item.slideUp(300); 1049 } else { 1050 item.addClass("active"); 1051 item.slideDown(300); 1052 $(this).addClass("up"); 1053 } 1054 }); 1055 1056 // for Testing 1057 1058 $(".sub-menu .menu-item-has-children").on("hover", function () { 1059 var width = $(this).offset().left, 1060 windowWidth = $(window).width(), 1061 range = windowWidth - width; 1062 1063 if (range < 400) { 1064 $(this).find(".elespare-menu-child").css({ top: "100%" }); 1065 $(this) 1066 .find(".sub-menu") 1067 .css({ left: "auto", top: "100%", right: "50%" }); 1068 } 1069 }); 1070 1071 if (main.hasClass("primary-menu")) { 1072 main.removeClass("primary-menu"); 1073 } 1074 }, 1075 }); 1076 1077 //Tabs 1078 elementorFrontend.hooks.addAction( 1079 "frontend/element_ready/post-tabs.default", 1080 function ($scope) { 1081 elementorFrontend.elementsHandler.addHandler(PostTab, { 1082 $element: $scope, 1083 }); 1084 } 1085 ); 1086 //Masonry 1087 1088 elementorFrontend.hooks.addAction( 1089 "frontend/element_ready/post-masonry.default", 1090 function ($scope) { 1091 elementorFrontend.elementsHandler.addHandler(PostMasonry, { 1092 $element: $scope, 1093 }); 1094 } 1095 ); 1096 1097 //Carousel 1098 elementorFrontend.hooks.addAction( 1099 "frontend/element_ready/post-carousel.default", 1100 function ($scope) { 1101 elementorFrontend.elementsHandler.addHandler(PostCarousel, { 1102 $element: $scope, 1103 }); 1104 } 1105 ); 1106 1107 //slider 1108 elementorFrontend.hooks.addAction( 1109 "frontend/element_ready/post-slider.default", 1110 function ($scope) { 1111 elementorFrontend.elementsHandler.addHandler(PostCarousel, { 1112 $element: $scope, 1113 }); 1114 } 1115 ); 1116 //Marquee 1117 1118 elementorFrontend.hooks.addAction( 1119 "frontend/element_ready/post-flash.default", 1120 function ($scope) { 1121 elementorFrontend.elementsHandler.addHandler(PostMarquee, { 1122 $element: $scope, 1123 }); 1124 } 1125 ); 1126 1127 //banner -1 1128 elementorFrontend.hooks.addAction( 1129 "frontend/element_ready/post-banner.default", 1130 function ($scope) { 1131 elementorFrontend.elementsHandler.addHandler(PostBannerCarousel, { 1132 $element: $scope, 1133 }); 1134 } 1135 ); 1136 //banner -2 1137 elementorFrontend.hooks.addAction( 1138 "frontend/element_ready/post-banner-2.default", 1139 function ($scope) { 1140 elementorFrontend.elementsHandler.addHandler(PostBannerCarousel, { 1141 $element: $scope, 1142 }); 1143 } 1144 ); 1145 //--------------------------- 1146 elementorFrontend.hooks.addAction( 1147 "frontend/element_ready/main-banner-1.default", 1148 function ($scope) { 1149 elementorFrontend.elementsHandler.addHandler(MainBannerOne, { 1150 $element: $scope, 1151 }); 1152 } 1153 ); 1154 //MainBannerTrendings banner1 1155 elementorFrontend.hooks.addAction( 1156 "frontend/element_ready/main-banner-1.default", 1157 function ($scope) { 1158 elementorFrontend.elementsHandler.addHandler(PostBannerTrendings, { 1159 $element: $scope, 1160 }); 1161 } 1162 ); 1163 //MainBannerTrendings banner2 1164 1165 elementorFrontend.hooks.addAction( 1166 "frontend/element_ready/main-banner-2.default", 1167 function ($scope) { 1168 elementorFrontend.elementsHandler.addHandler(MainBannerTwo, { 1169 $element: $scope, 1170 }); 1171 } 1172 ); 1173 //MainBannerTrendings banner1 1174 // elementorFrontend.hooks.addAction( 1175 // "frontend/element_ready/main-banner-2.default", 1176 // function ($scope) { 1177 // elementorFrontend.elementsHandler.addHandler(PostBannerTrendings, { 1178 // $element: $scope, 1179 // }); 1180 // } 1181 // ); 1182 1183 //------------------- 1184 //PostBannerTrendings banner1 1185 elementorFrontend.hooks.addAction( 1186 "frontend/element_ready/post-banner.default", 1187 function ($scope) { 1188 elementorFrontend.elementsHandler.addHandler( 1189 PostBannerVerticaleTrendings, 1190 { 1191 $element: $scope, 1192 } 1193 ); 1194 } 1195 ); 1196 1197 //PostBannerTrendings banner 2 1198 // elementorFrontend.hooks.addAction( 1199 // "frontend/element_ready/post-banner-2.default", 1200 // function ($scope) { 1201 // elementorFrontend.elementsHandler.addHandler(PostBannerTrendings, { 1202 // $element: $scope, 1203 // }); 1204 // } 1205 // ); 1206 1207 //PostsTrendingsCarousel 1208 elementorFrontend.hooks.addAction( 1209 "frontend/element_ready/post-trending-carousel.default", 1210 function ($scope) { 1211 elementorFrontend.elementsHandler.addHandler(PostTrendingsCarousel, { 1212 $element: $scope, 1213 }); 1214 } 1215 ); 1216 //Serach Form 1217 elementorFrontend.hooks.addAction( 1218 "frontend/element_ready/search-from.default", 1219 function ($scope) { 1220 elementorFrontend.elementsHandler.addHandler(SearchForm, { 1221 $element: $scope, 1222 }); 1223 } 1224 ); 1225 1226 //Horizontal Nav Menu 1227 1228 elementorFrontend.hooks.addAction( 1229 "frontend/element_ready/elespare-nav-horziontal-menu.default", 1230 function ($scope) { 1231 elementorFrontend.elementsHandler.addHandler(NavMenu, { 1232 $element: $scope, 1233 }); 1234 } 1235 ); 1236 //Vertical Nav Menu 1237 elementorFrontend.hooks.addAction( 1238 "frontend/element_ready/elespare-nav-vertical-menu.default", 1239 function ($scope) { 1240 elementorFrontend.elementsHandler.addHandler(NavMenu, { 1241 $element: $scope, 1242 }); 1243 } 1244 ); 1245 1246 //Expandable Nav Menu 1247 elementorFrontend.hooks.addAction( 1248 "frontend/element_ready/elespare-nav-expanded-menu.default", 1249 function ($scope) { 1250 elementorFrontend.elementsHandler.addHandler(NavMenu, { 1251 $element: $scope, 1252 }); 1253 } 1254 ); 1255 }); 1256})(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.