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({}, 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({}, 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( 942 '<button class="elespare-dropdwon-toggle" aria-label="Toggle submenu">' 943 ); 944 nav 945 .find('ul >.menu-item-has-children>a') 946 .parents('li') 947 .find('> a') 948 .append( 949 '<button class="elespare-dropdwon-toggle" aria-label="Toggle submenu">' 950 ); 951 952 if ( 953 this.wrapper.hasClass('vertical') || 954 this.wrapper.hasClass('horizontal') 955 ) { 956 var submenu_op = this.wrapper.data('opt'); 957 var cl_event = 'click'; 958 if (submenu_op == 'sub-hover') { 959 cl_event = 'hover'; 960 } 961 desktop_subnav.on(cl_event, function (e) { 962 e.preventDefault(); 963 964 var item = $(this).siblings('.elespare-menu-child'); 965 if ( 966 desktop_subnav 967 .parents('.elespare-navigation-wrapper') 968 .hasClass('horizontal') 969 ) { 970 $(this) 971 .closest('ul') 972 .find('.elespare-menu-child') 973 .not(item) 974 .removeClass('active'); 975 } 976 if (item.hasClass('active')) { 977 item.removeClass('active'); 978 $(this).removeClass('up'); 979 $(this).removeClass(submenu_op); 980 } else { 981 item.addClass('active'); 982 $(this).addClass('up'); 983 $(this).addClass(submenu_op); 984 } 985 }); 986 987 if (this.wrapper.hasClass('sub-click')) { 988 $(document).on('click', function (e) { 989 var elebodyclick = $('.sub-click'); 990 if ( 991 !elebodyclick.is(e.target) && // if the target of the click isn't the container... 992 elebodyclick.has(e.target).length === 0 993 ) { 994 // ... nor a descendant of the container 995 elebodyclick 996 .parents('.elespare-main-navigation') 997 .find('.elespare-menu-child') 998 .removeClass('active'); 999 } 1000 }); 1001 } 1002 } 1003 1004 // Show Menu Mobile 1005 1006 toggle.on('click', function (e) { 1007 e.preventDefault(); 1008 if (nav.hasClass('show')) { 1009 nav.removeClass('show'); 1010 overlay.removeClass('show'); 1011 toggle.removeClass('elespare-nav-menu-toggle'); 1012 } else { 1013 nav.addClass('show'); 1014 overlay.addClass('show'); 1015 toggle.addClass('elespare-nav-menu-toggle'); 1016 } 1017 }); 1018 1019 // Close menu mobile when click overlay 1020 overlay.on('click', function (e) { 1021 nav.removeClass('show'); 1022 overlay.removeClass('show'); 1023 }); 1024 1025 // Close menu mobile when click icon close 1026 close.on('click', function (e) { 1027 nav.removeClass('show'); 1028 overlay.removeClass('show'); 1029 }); 1030 1031 // Close menu mobile when click ESC 1032 $(document).on('keyup', function (e) { 1033 if (e.keyCode === 27) { 1034 nav.removeClass('show'); 1035 overlay.removeClass('show'); 1036 } 1037 }); 1038 1039 /* MOBILE MENU */ 1040 1041 var btn = nav.find( 1042 'ul >.menu-item-has-children>a .elespare-dropdwon-toggle' 1043 ); 1044 1045 btn.on('click', function (e) { 1046 e.preventDefault(); 1047 var item = $(this).parent('a').siblings('ul.sub-menu'); 1048 var active = item.hasClass('active'); 1049 if (active) { 1050 item.removeClass('active'); 1051 $(this).removeClass('up'); 1052 item.slideUp(300); 1053 } else { 1054 item.addClass('active'); 1055 item.slideDown(300); 1056 $(this).addClass('up'); 1057 } 1058 }); 1059 1060 // for Testing 1061 1062 $('.sub-menu .menu-item-has-children').on('hover', function () { 1063 var width = $(this).offset().left, 1064 windowWidth = $(window).width(), 1065 range = windowWidth - width; 1066 1067 if (range < 400) { 1068 $(this).find('.elespare-menu-child').css({ top: '100%' }); 1069 $(this) 1070 .find('.sub-menu') 1071 .css({ left: 'auto', top: '100%', right: '50%' }); 1072 } 1073 }); 1074 1075 if (main.hasClass('primary-menu')) { 1076 main.removeClass('primary-menu'); 1077 } 1078 }, 1079 }); 1080 1081 //Tabs 1082 elementorFrontend.hooks.addAction( 1083 'frontend/element_ready/post-tabs.default', 1084 function ($scope) { 1085 elementorFrontend.elementsHandler.addHandler(PostTab, { 1086 $element: $scope, 1087 }); 1088 } 1089 ); 1090 //Masonry 1091 1092 elementorFrontend.hooks.addAction( 1093 'frontend/element_ready/post-masonry.default', 1094 function ($scope) { 1095 elementorFrontend.elementsHandler.addHandler(PostMasonry, { 1096 $element: $scope, 1097 }); 1098 } 1099 ); 1100 1101 //Carousel 1102 elementorFrontend.hooks.addAction( 1103 'frontend/element_ready/post-carousel.default', 1104 function ($scope) { 1105 elementorFrontend.elementsHandler.addHandler(PostCarousel, { 1106 $element: $scope, 1107 }); 1108 } 1109 ); 1110 1111 //slider 1112 elementorFrontend.hooks.addAction( 1113 'frontend/element_ready/post-slider.default', 1114 function ($scope) { 1115 elementorFrontend.elementsHandler.addHandler(PostCarousel, { 1116 $element: $scope, 1117 }); 1118 } 1119 ); 1120 //Marquee 1121 1122 elementorFrontend.hooks.addAction( 1123 'frontend/element_ready/post-flash.default', 1124 function ($scope) { 1125 elementorFrontend.elementsHandler.addHandler(PostMarquee, { 1126 $element: $scope, 1127 }); 1128 } 1129 ); 1130 1131 //banner -1 1132 elementorFrontend.hooks.addAction( 1133 'frontend/element_ready/post-banner.default', 1134 function ($scope) { 1135 elementorFrontend.elementsHandler.addHandler(PostBannerCarousel, { 1136 $element: $scope, 1137 }); 1138 } 1139 ); 1140 //banner -2 1141 elementorFrontend.hooks.addAction( 1142 'frontend/element_ready/post-banner-2.default', 1143 function ($scope) { 1144 elementorFrontend.elementsHandler.addHandler(PostBannerCarousel, { 1145 $element: $scope, 1146 }); 1147 } 1148 ); 1149 //--------------------------- 1150 elementorFrontend.hooks.addAction( 1151 'frontend/element_ready/main-banner-1.default', 1152 function ($scope) { 1153 elementorFrontend.elementsHandler.addHandler(MainBannerOne, { 1154 $element: $scope, 1155 }); 1156 } 1157 ); 1158 //MainBannerTrendings banner1 1159 elementorFrontend.hooks.addAction( 1160 'frontend/element_ready/main-banner-1.default', 1161 function ($scope) { 1162 elementorFrontend.elementsHandler.addHandler(PostBannerTrendings, { 1163 $element: $scope, 1164 }); 1165 } 1166 ); 1167 //MainBannerTrendings banner2 1168 1169 elementorFrontend.hooks.addAction( 1170 'frontend/element_ready/main-banner-2.default', 1171 function ($scope) { 1172 elementorFrontend.elementsHandler.addHandler(MainBannerTwo, { 1173 $element: $scope, 1174 }); 1175 } 1176 ); 1177 //MainBannerTrendings banner1 1178 // elementorFrontend.hooks.addAction( 1179 // "frontend/element_ready/main-banner-2.default", 1180 // function ($scope) { 1181 // elementorFrontend.elementsHandler.addHandler(PostBannerTrendings, { 1182 // $element: $scope, 1183 // }); 1184 // } 1185 // ); 1186 1187 //------------------- 1188 //PostBannerTrendings banner1 1189 elementorFrontend.hooks.addAction( 1190 'frontend/element_ready/post-banner.default', 1191 function ($scope) { 1192 elementorFrontend.elementsHandler.addHandler( 1193 PostBannerVerticaleTrendings, 1194 { 1195 $element: $scope, 1196 } 1197 ); 1198 } 1199 ); 1200 1201 //PostBannerTrendings banner 2 1202 // elementorFrontend.hooks.addAction( 1203 // "frontend/element_ready/post-banner-2.default", 1204 // function ($scope) { 1205 // elementorFrontend.elementsHandler.addHandler(PostBannerTrendings, { 1206 // $element: $scope, 1207 // }); 1208 // } 1209 // ); 1210 1211 //PostsTrendingsCarousel 1212 elementorFrontend.hooks.addAction( 1213 'frontend/element_ready/post-trending-carousel.default', 1214 function ($scope) { 1215 elementorFrontend.elementsHandler.addHandler(PostTrendingsCarousel, { 1216 $element: $scope, 1217 }); 1218 } 1219 ); 1220 //Serach Form 1221 elementorFrontend.hooks.addAction( 1222 'frontend/element_ready/search-from.default', 1223 function ($scope) { 1224 elementorFrontend.elementsHandler.addHandler(SearchForm, { 1225 $element: $scope, 1226 }); 1227 } 1228 ); 1229 1230 //Horizontal Nav Menu 1231 1232 elementorFrontend.hooks.addAction( 1233 'frontend/element_ready/elespare-nav-horziontal-menu.default', 1234 function ($scope) { 1235 elementorFrontend.elementsHandler.addHandler(NavMenu, { 1236 $element: $scope, 1237 }); 1238 } 1239 ); 1240 //Vertical Nav Menu 1241 elementorFrontend.hooks.addAction( 1242 'frontend/element_ready/elespare-nav-vertical-menu.default', 1243 function ($scope) { 1244 elementorFrontend.elementsHandler.addHandler(NavMenu, { 1245 $element: $scope, 1246 }); 1247 } 1248 ); 1249 1250 //Expandable Nav Menu 1251 elementorFrontend.hooks.addAction( 1252 'frontend/element_ready/elespare-nav-expanded-menu.default', 1253 function ($scope) { 1254 elementorFrontend.elementsHandler.addHandler(NavMenu, { 1255 $element: $scope, 1256 }); 1257 } 1258 ); 1259 }); 1260})(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.