1var appStart = function ($) { 2 3 var screenWidth = $(window).width(); 4 function videoPlayer() { 5 const players = Plyr.setup('.js-player', 6 { 7 youtube: { 8 noCookie: true, 9 rel: 0, 10 modestbranding: 1 11 }}); 12 } 13 // handle Preloader OnClick 14 function handlePreloaderOnClick() { 15 16 } 17 18 // RTL to LTR ------------ 19 var initRtlToggle = function () { 20 const btn = document.getElementById('rtlToggleBtn'); 21 const link = document.getElementById('mainStylesheet'); 22 const body = document.body; 23 24 if (!btn || !link) return; 25 26 btn.addEventListener('click', () => { 27 body.classList.toggle('rtl'); 28 if (body.classList.contains('rtl')) { 29 btn.classList.add('active'); 30 link.href = 'assets/css/main-rtl.css' 31 } else { 32 btn.classList.remove('active'); 33 link.href = 'assets/css/main.css' 34 } 35 }); 36 } 37 38 // ====== Dark / Light Theme Switcher ====> 39 function Theme_dark_light() { 40 const switchers = $('.dark-mode-switch'); 41 const dhtml = $("html"); 42 43 const storedDarkMode = localStorage.getItem('dark-mode') === 'true'; 44 if (storedDarkMode) { 45 dhtml.addClass('dark-mode'); 46 switchers.find('i').removeClass('fa-moon-o').addClass('fa-sun-o'); 47 } 48 49 switchers.on('click', function () { 50 const isDarkMode = dhtml.toggleClass('dark-mode').hasClass('dark-mode'); 51 localStorage.setItem('dark-mode', isDarkMode); 52 53 // Update all buttons' icons 54 switchers.find('i').each(function () { 55 if (isDarkMode) { 56 // $(":root").css("--sp-primary", "#005db8"); 57 $(":root").css("--dark-1", "#000000"); 58 $(":root").css("--dark-2", "#222222"); 59 $(this).removeClass('fa-moon-o').addClass('fa-sun-o'); 60 } else { 61 // $(":root").css("--sp-primary", "#003366"); 62 $(":root").css("--dark-1", "#ffffff"); 63 $(":root").css("--dark-2", "#F5F5F5"); 64 $(this).removeClass('fa-sun-o').addClass('fa-moon-o'); 65 } 66 }); 67 }); 68 } 69 70 // Handle Search Toggle ============ 71 var handleSearchToggle = function () { 72 const toggleButton = document.querySelector('.header-search-toggle'); 73 const searchBox = document.querySelector('.header-search-popup'); 74 const closeButton = document.querySelector('.header-search-close'); 75 const body = document.querySelector('body'); 76 77 if (toggleButton && searchBox) { 78 toggleButton.addEventListener('click', function () { 79 searchBox.classList.add('header-search-active'); 80 body.classList.add('fixed'); 81 }); 82 document.addEventListener('click', function (e) { 83 if (!searchBox.contains(e.target) && !toggleButton.contains(e.target)) { 84 searchBox.classList.remove('header-search-active'); 85 body.classList.remove('fixed'); 86 } 87 }); 88 if (closeButton) { 89 closeButton.addEventListener('click', function () { 90 searchBox.classList.remove('header-search-active'); 91 body.classList.remove('fixed'); 92 }); 93 } 94 } else { 95 console.log('Search toggle elements are missing!'); 96 } 97 }; 98 99 // Handle Toggler Mobile Menu ============ 100 var handleTogglerMobileMenu = function () { 101 const menuToggler = document.querySelector('.menu-toggle'); 102 103 if (menuToggler) { 104 const body = document.querySelector('body'); 105 const menuClose = document.querySelector('.menu-close'); 106 const target = menuToggler.getAttribute('data-target'); 107 const targetElement = document.querySelector(target); 108 109 const toggleMenu = () => { 110 if (window.innerWidth <= 991) { 111 menuToggler.addEventListener('click', openMenu); 112 menuClose.addEventListener('click', closeMenu); 113 } else { 114 menuToggler.removeEventListener('click', openMenu); 115 menuClose.removeEventListener('click', closeMenu); 116 menuToggler.classList.remove('open'); 117 body.classList.remove('fixed'); 118 targetElement.classList.remove('show'); 119 } 120 }; 121 const openMenu = () => { 122 menuToggler.classList.add('open'); 123 body.classList.add('fixed'); 124 targetElement.classList.add('show'); 125 }; 126 const closeMenu = () => { 127 menuToggler.classList.remove('open'); 128 body.classList.remove('fixed'); 129 targetElement.classList.remove('show'); 130 }; 131 toggleMenu(); 132 window.addEventListener('resize', toggleMenu); 133 } 134 } 135 136 // handleStickyHeader ============= 137 var handleStickyHeader = function () { 138 if ($(".sticky-nav").length > 0) { 139 var navbar = $(".sticky-nav"); 140 var navbarOffset = navbar.offset().top; 141 $(window).on("scroll", function () { 142 var scrollTop = $(window).scrollTop(); 143 if (scrollTop > navbarOffset) { 144 navbar.addClass("sticky-menu"); 145 } else { 146 navbar.removeClass("sticky-menu"); 147 } 148 }); 149 } 150 } 151 152 // handle Header Menu ============ 153 var handleHeaderMenu = function () { 154 if ($(window).width() <= 991) { 155 jQuery('.menu-wrap li > a, .dropdown-menu li > a') 156 .off("click keypress") 157 .on("click keypress", function (e) { 158 if (e.type === "keypress" && e.key !== "Enter") return; 159 // handleMenus(e, jQuery(this)); 160 }); 161 jQuery('.tabindex').attr("tabindex", "0"); 162 163 jQuery('.mobile-toggler button') 164 .off('click') 165 .on('click', function (e) { 166 e.preventDefault(); 167 console.log(11); 168 let parentLi = jQuery(this).closest('li'); 169 let dropdown = parentLi.find('.dropdown-menu').first(); 170 if (parentLi.hasClass('open')) { 171 dropdown.slideUp('slow', function () { 172 jQuery(this).css('display', 'none'); 173 }); 174 parentLi.removeClass('open'); 175 } else { 176 parentLi.siblings('li').removeClass('open') 177 .children('.dropdown-menu, .mega-menu').slideUp('slow').css('display', 'none'); 178 dropdown.css('display', 'block').slideDown(); 179 parentLi.addClass('open'); 180 } 181 }); 182 } else { 183 jQuery('.tabindex').removeAttr("tabindex"); 184 jQuery('.dropdown-menu, .mega-menu').removeAttr('style'); 185 jQuery('.menu-wrap li').removeClass('open'); 186 } 187 }; 188 189 // handle Breaking News ============ 190 var handleBreakingNewsSlider = function () { 191 jQuery(document).ready(function ($) { 192 $(".breaking-news-slider").each(function () { 193 var $slider = $(this); 194 $slider.owlCarousel({ 195 autoWidth: true, 196 loop: true, 197 margin: 10, 198 autoplay: true, 199 autoplayTimeout: 5000, 200 autoplaySpeed: 5000, 201 autoplayHoverPause: true, 202 smartSpeed: 1000, 203 nav: false, 204 dots: false, 205 autoHeight: true, 206 slideTransition: 'linear', 207 navText: ["<i class='fa fa-chevron-left'></i>", "<i class='fa fa-chevron-right'></i>"], 208 responsive: { 209 575: { 210 nav: true 211 }, 212 991: { 213 margin: 15 214 } 215 } 216 }); 217 setInterval(function () { 218 if ($(window).width() >= 575) { 219 $slider.find(".owl-nav").removeClass("disabled"); 220 } 221 }, 0); 222 }); 223 }); 224 }; 225 226 // handle Latest News ============ 227 var handleLatestNewsSlider = function () {
228 if (jQuery('.news-slider').length > 0) { 229 jQuery(document).ready(function ($) { 230 entertainmentNews= $(".news-slider").owlCarousel({ 231 center: true, 232 items: 1, 233 loop: true, 234 margin: 5, 235 autoplay: true, 236 autoplayTimeout: 3000, 237 autoplayHoverPause: true, 238 smartSpeed: 1000, 239 nav: true, 240 dots: false, 241 autoHeight: true, 242 navText: ["<i class='fa fa-chevron-left'></i>", "<i class='fa fa-chevron-right'></i>"], 243 }); 244 }); 245 } 246 } 247 248 // handle sport News ============ 249 var handleSportNewsSlider = function () { 250 if (jQuery('.sport-news-slider').length > 0) { 251 jQuery(document).ready(function ($) { 252 sportNews= $(".sport-news-slider").owlCarousel({ 253 center: true, 254 items: 1, 255 loop: true, 256 margin: 5, 257 autoplay: true, 258 autoplayTimeout: 3000, 259 autoplayHoverPause: true, 260 smartSpeed: 1000, 261 nav: true, 262 dots: false, 263 autoHeight: true, 264 navText: ["<i class='fa fa-chevron-left'></i>", "<i class='fa fa-chevron-right'></i>"], 265 }); 266 }); 267 } 268 } 269 270// handle fashion News ============ 271 var handleFashionNewsSlider = function () { 272 if (jQuery('.fashion-news-slider').length > 0) { 273 jQuery(document).ready(function ($) { 274 fashionNews= $(".fashion-news-slider").owlCarousel({ 275 center: true, 276 items: 1, 277 loop: true, 278 margin: 5, 279 autoplay: true, 280 autoplayTimeout: 3000, 281 autoplayHoverPause: true, 282 smartSpeed: 1000, 283 nav: true, 284 dots: false, 285 autoHeight: true, 286 navText: ["<i class='fa fa-chevron-left'></i>", "<i class='fa fa-chevron-right'></i>"], 287 }); 288 }); 289 } 290 } 291 292 // handle Filter Slider ============ 293 var handleFilterSlider = function () { 294 jQuery(document).ready(function ($) { 295 $(".tab-filter-slider").each(function () { 296 var $slider = $(this); 297 $slider.owlCarousel({ 298 loop: false, 299 margin: 30, 300 autoplay: false, 301 autoplayTimeout: 3000, 302 autoplayHoverPause: true, 303 smartSpeed: 1000, 304 nav: true, 305 dots: false, 306 autoWidth:true, 307 autoHeight: true, 308 navText: ["<i class='fa fa-chevron-left'></i>", "<i class='fa fa-chevron-right'></i>"] 309 }); 310 311 setInterval(function () { 312 $slider.find(".owl-nav").removeClass("disabled"); 313 }, 0); 314 }); 315 }); 316 }; 317 318 // handle Zodiac Filter ============ 319 320 var handleSetupZodiacFilter = function () { 321 const zodiacItems = document.querySelectorAll('.zodiac-item'); 322 const posts = document.querySelectorAll('.post-astrology'); 323 324 zodiacItems.forEach(item => { 325 item.addEventListener('click', () => { 326 zodiacItems.forEach(i => i.classList.remove('active')); 327 item.classList.add('active'); 328 const selectedSign = item.querySelector('.zodiac-label').textContent.trim(); 329 posts.forEach(post => { 330 post.classList.remove('show'); 331 post.style.display = 'none'; 332 }); 333 posts.forEach(post => { 334 const postSign = post.getAttribute('data-sign'); 335 if (postSign === selectedSign) { 336 post.style.display = 'block'; 337 requestAnimationFrame(() => { 338 post.classList.add('show'); 339 }); 340 } 341 }); 342 }); 343 });
344 345 // Default trigger on first zodiac item if no active one is set 346 const activeItem = document.querySelector('.zodiac-item.active'); 347 if (activeItem) { 348 activeItem.click(); 349 } else if (zodiacItems.length > 0) { 350 zodiacItems[0].classList.add('active'); 351 zodiacItems[0].click(); 352 } 353}; 354 355 356 // handle toggle Tabs ============ 357 var handleToggleTabs = function () { 358 const buttons = document.querySelectorAll('.news-top-btn button'); 359 const tabs = [document.getElementById('popular-1'), document.getElementById('popular-2')]; 360 361 buttons.forEach((button, index) => { 362 button.addEventListener('click', () => { 363 buttons.forEach(btn => btn.classList.remove('active')); 364 button.classList.add('active'); 365 tabs.forEach(tab => tab.classList.add('d-none')); 366 tabs[index].classList.remove('d-none'); 367 }); 368 }); 369 } 370 371 // handle Post Slider ============ 372 var handlePostSlider = function () { 373 if (jQuery('.post-slider').length > 0) { 374 jQuery(document).ready(function ($) { 375 var owl = $(".post-slider").owlCarousel({ 376 items: 4, 377 loop: true, 378 margin: 25, 379 autoplay: true, 380 autoplayTimeout: 3000, 381 autoplayHoverPause: true, 382 smartSpeed: 1000, 383 nav: false, 384 dots: false, 385 autoHeight: true, 386 navText: ["<i class='fa fa-chevron-left'></i>", "<i class='fa fa-chevron-right'></i>"], 387 responsive: { 388 0: { 389 items: 1 390 }, 391 450: { 392 items: 2 393 }, 394 768: { 395 items: 3 396 }, 397 991: { 398 items: 4 399 } 400 } 401 }); 402 }); 403 } 404 } 405 406 // handle Web Store Slider ============ 407 var handleWebStoreSlider = function () { 408 if (jQuery('.web-store-slider').length > 0) { 409 jQuery(document).ready(function ($) { 410 $('.web-store-slider').each(function () { 411 var $slider = $(this); 412 var owl = $slider.owlCarousel({ 413 items: 1, 414 loop: true, 415 margin: 12, 416 autoplay: true, 417 autoplayTimeout: 3000, 418 autoplayHoverPause: true, 419 smartSpeed: 1000, 420 nav: false, 421 dots: false, 422 autoHeight: true, 423 responsive: { 424 0: { 425 items: 1 426 }, 427 768: { 428 items: 2 429 } 430 } 431 }); 432 433 var container = $(this).closest('.slider-wrapper').prev(); 434 container.find('.custom-prev').off('click').on('click', function () { 435 owl.trigger('prev.owl.carousel'); 436 }); 437 container.find('.custom-next').off('click').on('click', function () { 438 owl.trigger('next.owl.carousel'); 439 }); 440 }); 441 }); 442 } 443 }; 444 // handle Web Store Slider ============ 445 var handleEditorSlider = function () { 446 if (jQuery('.editorz-slider').length > 0) { 447 jQuery(document).ready(function ($) { 448 $('.editorz-slider').each(function () { 449 var $slider = $(this); 450 var owl = $slider.owlCarousel({ 451 // items: 2, 452 loop: true, 453 margin: 12, 454 autoplay: true, 455 autoplayTimeout: 3000, 456 autoplayHoverPause: true, 457 smartSpeed: 1000, 458 nav: false, 459 dots: false, 460 autoHeight: true, 461 responsive: { 462 0: { 463 items: 1 464 }, 465 768: { 466 items: 2 467 } 468 } 469 }); 470 471 var container = $(this).closest('.slider-wrapper').prev(); 472 container.find('.custom-prev').off('click').on('click', function () { 473 owl.trigger('prev.owl.carousel'); 474 }); 475 container.find('.custom-next').off('click').on('click', function () { 476 owl.trigger('next.owl.carousel'); 477 }); 478 }); 479 }); 480 } 481 }; 482 483 // handle Team Slider ============ 484 var handleTeamSlider = function () { 485 if (jQuery('.team-slider').length > 0) { 486 jQuery(document).ready(function ($) { 487 $('.team-slider').each(function () { 488 var $slider = $(this); 489 var owl = $slider.owlCarousel({ 490 items: 1, 491 loop: true, 492 margin: 30, 493 autoplay: true, 494 autoplayTimeout: 3000, 495 autoplayHoverPause: true, 496 smartSpeed: 1000, 497 nav: false, 498 dots: false, 499 autoHeight: true, 500 responsive: { 501 575: { 502 items: 2 503 }, 504 768: { 505 items: 3 506 }, 507 991: { 508 items: 4 509 } 510 } 511 }); 512 var container = $(this).closest('.slider-wrapper').prev(); 513 container.find('.custom-prev').off('click').on('click', function () { 514 owl.trigger('prev.owl.carousel'); 515 }); 516 container.find('.custom-next').off('click').on('click', function () { 517 owl.trigger('next.owl.carousel'); 518 }); 519 }); 520 }); 521 } 522 }; 523 524 // handle Awarads Slider ============ 525 var handleAwaradsSlider = function () { 526 if (jQuery('.awards-slider').length > 0) { 527 jQuery(document).ready(function ($) { 528 $('.awards-slider').each(function () { 529 var $slider = $(this); 530 var owl = $slider.owlCarousel({ 531 items: 1, 532 loop: false, 533 margin: 25, 534 autoplay: true, 535 autoplayTimeout: 3000, 536 autoplayHoverPause: true, 537 smartSpeed: 1000, 538 nav: false, 539 dots: false, 540 autoHeight: true, 541 responsive: { 542 575: { 543 items: 2 544 }, 545 768: { 546 items: 3 547 }, 548 991: { 549 items: 4 550 } 551 } 552 }); 553 var container = $(this).closest('.slider-wrapper').prev(); 554 container.find('.custom-prev').off('click').on('click', function () { 555 owl.trigger('prev.owl.carousel'); 556 }); 557 container.find('.custom-next').off('click').on('click', function () { 558 owl.trigger('next.owl.carousel'); 559 }); 560 }); 561 }); 562 } 563 }; 564 565 // handle Timeline Slider ============ 566 var handleTimelineSlider = function () { 567 if (jQuery('.timeline-slider').length > 0) { 568 jQuery(document).ready(function ($) { 569 $('.timeline-slider').each(function () { 570 var $slider = $(this); 571 var owl = $slider.owlCarousel({ 572 items: 1, 573 loop: true, 574 margin: 50, 575 autoplay: true, 576 autoplayTimeout: 3000, 577 autoplayHoverPause: true, 578 smartSpeed: 1000, 579 nav: false, 580 dots: false, 581 autoHeight: true, 582 responsive: { 583 575: { 584 items: 1, 585 margin: 10, 586 }, 587 991: { 588 items: 2, 589 margin: 50 590 } 591 } 592 }); 593 594 var container = $(this).closest('.slider-wrapper').prev(); 595 container.find('.custom-prev').off('click').on('click', function () { 596 owl.trigger('prev.owl.carousel'); 597 }); 598 container.find('.custom-next').off('click').on('click', function () { 599 owl.trigger('next.owl.carousel'); 600 }); 601 }); 602 }); 603 } 604 }; 605 606 // handle Information Slider ============ 607 var handleInformationSlider = function () {
608 if (jQuery('.information-slider').length > 0) { 609 jQuery(document).ready(function ($) { 610 $('.information-slider').each(function () { 611 var $slider = $(this); 612 var owl = $slider.owlCarousel({ 613 items: 1, 614 loop: false, 615 margin: 25, 616 autoplay: true, 617 autoplayTimeout: 3000, 618 autoplayHoverPause: true, 619 smartSpeed: 1000, 620 nav: false, 621 dots: false, 622 autoHeight: true, 623 responsive: { 624 575: { 625 items: 2 626 }, 627 768: { 628 items: 3 629 }, 630 991: { 631 items: 4 632 } 633 } 634 }); 635 var container = $(this).closest('.slider-wrapper').prev(); 636 container.find('.custom-prev').off('click').on('click', function () { 637 owl.trigger('prev.owl.carousel'); 638 }); 639 container.find('.custom-next').off('click').on('click', function () { 640 owl.trigger('next.owl.carousel'); 641 }); 642 }); 643 }); 644 } 645 }; 646 647 // handle Previously Missed Slider ============ 648 var handlePreviouslyMissedSlider = function () { 649 if (jQuery('.previously-missed-slider').length > 0) { 650 jQuery(document).ready(function ($) { 651 $('.previously-missed-slider').each(function () { 652 var $slider = $(this); 653 var owl = $slider.owlCarousel({ 654 items: 1, 655 loop: true, 656 margin: 20, 657 autoplay: true, 658 autoplayTimeout: 3000, 659 autoplayHoverPause: true, 660 smartSpeed: 1000, 661 nav: false, 662 dots: false, 663 autoHeight: true, 664 responsive: { 665 575: { 666 items: 2 667 }, 668 991: { 669 items: 3 670 } 671 } 672 }); 673 var container = $(this).closest('.slider-wrapper').prev(); 674 container.find('.custom-prev').off('click').on('click', function () { 675 owl.trigger('prev.owl.carousel'); 676 }); 677 container.find('.custom-next').off('click').on('click', function () { 678 owl.trigger('next.owl.carousel'); 679 }); 680 }); 681 }); 682 } 683 }; 684 685 // handle Post Carousel Slider ============ 686 var handlePostCarouselSlider = function () { 687 if (jQuery('.post-carousel > .swiper-wrapper').length > 0) { 688 jQuery(document).ready(function ($) { 689 $('.post-carousel > .swiper-wrapper').each(function (index) { 690 var $slider = $(this); 691 var owl = $slider.owlCarousel({ 692 items: 1, 693 loop: true, 694 margin: 20, 695 autoplay: true, 696 autoplayTimeout: 3000, 697 autoplayHoverPause: true, 698 smartSpeed: 1000, 699 nav: false, 700 dots: false, 701 autoHeight: true, 702 responsive: { 703 0: { 704 items: 1 705 }, 706 768: { 707 items: 2 708 } 709 } 710 }); 711 var container = $(this).closest('.slider-wrapper').prev(); 712 container.find('.custom-prev').off('click').on('click', function () { 713 owl.trigger('prev.owl.carousel'); 714 }); 715 container.find('.custom-next').off('click').on('click', function () { 716 owl.trigger('next.owl.carousel'); 717 }); 718 }); 719 }); 720 } 721 }; 722 723 // handle Above Social Slider ============ 724 var handleAboveSocialSlider = function () { 725 if (jQuery('.above-social-slider').length > 0) { 726 jQuery(document).ready(function ($) { 727 var owl = $(".above-social-slider").owlCarousel({ 728 items: 6, 729 loop: true, 730 margin: 20, 731 autoplay: true, 732 autoplayTimeout: 3000, 733 autoplayHoverPause: true, 734 smartSpeed: 1000, 735 nav: false, 736 dots: false, 737 autoHeight: true, 738 navText: ["<i class='fa fa-chevron-left'></i>", "<i class='fa fa-chevron-right'></i>"], 739 responsive: { 740 0: { 741 items: 2 742 }, 743 450: { 744 items: 4 745 }, 746 650: { 747 items: 5 748 }, 749 992: { 750 items: 6 751 } 752 } 753 }); 754 }); 755 } 756 } 757 758 /* Magnific Video Popup =============== */ 759 var MagnificVideoPopup = function () { 760 if ($.fn.magnificPopup) { 761 $(".popup-youtube, .popup-vimeo").magnificPopup({ 762 disableOn: 700, 763 type: 'iframe', 764 mainClass: 'mfp-fade', 765 removalDelay: 160, 766 preloader: false, 767 fixedContentPos: true, 768 iframe: { 769 patterns: { 770 youtube: { 771 index: 'youtube.com/', 772 id: function (url) { 773 var match = url.match(/[\\?&]v=([^&#]*)/); 774 return match ? match[1] : null; 775 }, 776 src: 'https://www.youtube.com/embed/%id%?autoplay=1' 777 }, 778 vimeo: { 779 index: 'vimeo.com/', 780 id: function (url) { 781 var match = url.match(/vimeo.com\/(\d+)/); 782 return match ? match[1] : null; 783 }, 784 src: 'https://player.vimeo.com/video/%id%?autoplay=1' 785 } 786 } 787 } 788 }); 789 } else { 790 console.error("Magnific Popup is not loaded!"); 791 } 792 } 793 794 // Function to Plyr ================== 795 // var plyrMasterVideo = function () { 796 // $('.plyrMasterVideo').each(function (index, element) { 797 // var playerElement = $(element).find('video')[0]; 798 // if (playerElement) { 799 // new Plyr(playerElement); // no need to pass options again 800 // } 801 // }); 802 // }; 803 var plyrMasterVideo = function () { 804 $('.plyrMasterVideo').each(function (index, element) { 805 var videoElement = $(element).find('video')[0]; 806 if (videoElement) { 807 new Plyr(videoElement); 808 } else if ($(element).data('plyr-provider') === 'youtube') { 809 new Plyr(element); 810 } 811 }); 812 }; 813 814 // handle Widget Video Slider ============ 815 var handleWidgetVideoSlider = function () { 816 if (jQuery('.widget_video_carousel').length > 0) { 817 jQuery(document).ready(function ($) { 818 var owl = $(".widget_video_carousel").owlCarousel({ 819 items: 1, 820 loop: false, 821 margin: 10, 822 autoplay: true, 823 autoplayTimeout: 3000, 824 autoplayHoverPause: true, 825 smartSpeed: 1000, 826 nav: true, 827 dots: false, 828 autoHeight: true, 829 navText: ["<i class='fa fa-chevron-left'></i>", "<i class='fa fa-chevron-right'></i>"], 830 }); 831 }); 832 } 833 } 834 835 // handle Trap Focus ============ 836 var handleTrapFocus = function (focusDelay = 0) { 837 let $containers = $('.docker-widget-popup, .header-search-popup'); 838 839 $containers.each(function () { 840 let $container = $(this); 841 let tabbable = $container 842 .find('select, input, textarea, button, a, [href], [tabindex]:not
842([tabindex="-1"])') 843 .filter(':visible'); 844 845 if (tabbable.length === 0) return; 846 847 let firstTabbable = tabbable.first(); 848 let lastTabbable = tabbable.last(); 849 850 setTimeout(() => { 851 firstTabbable.focus(); 852 }, focusDelay); 853 854 firstTabbable.off('keydown.trap').on('keydown.trap', function (e) { 855 if (e.which === 9 && e.shiftKey) { 856 e.preventDefault(); 857 lastTabbable.focus(); 858 } 859 }); 860 861 lastTabbable.off('keydown.trap').on('keydown.trap', function (e) { 862 if (e.which === 9 && !e.shiftKey) { 863 e.preventDefault(); 864 firstTabbable.focus(); 865 } 866 }); 867 }); 868 } 869 870 // Counter Number ============ 871 var counter = function () { 872 if (jQuery('.counter').length) { 873 jQuery('.counter').counterUp({ 874 delay: 100, 875 time: 5000 876 }); 877 } 878 } 879 880 // handle skill Bar ============= 881 var handleSkillBar = function () { 882 $(".progress-bar").each(function () { 883 let $this = $(this); 884 if (isScrolledIntoView($this) && !$this.hasClass("animated")) { 885 $this.addClass("animated"); 886 let percent = $this.attr("data-percent"); 887 let progressFill = $this.find(".progress-fill"); 888 let progressText = $this.find(".circle-fill"); 889 let countBar = $this.find(".count-bar"); 890 progressFill.animate({ width: percent }, 3000); 891 progressText.animate({ left: percent }, 3000); 892 $({ countNum: 0 }).animate({ countNum: parseInt(percent) }, { 893 duration: 3000, 894 easing: 'linear', 895 step: function () { 896 countBar.text(Math.floor(this.countNum)); 897 }, 898 complete: function () { 899 countBar.text(this.countNum); 900 } 901 }); 902 } 903 }); 904 }; 905 // Scroll START function--- 906 function isScrolledIntoView(element) { 907 let windowHeight = $(window).height(); 908 let elementTop = $(element).offset().top; 909 let scrollTop = $(window).scrollTop(); 910 return elementTop < (scrollTop + windowHeight - 50); 911 } 912 913 // handle Box Hover ============= 914 var handleBoxHover = function () { 915 const boxHover = document.querySelectorAll('.box-hover'); 916 if (boxHover) { 917 boxHover.forEach(function (element) { 918 element.addEventListener('mouseenter', function () { 919 const selector = element.parentElement.parentElement; 920 selector.querySelectorAll('.box-hover').forEach(function (element) { 921 element.classList.remove('active'); 922 }); 923 element.classList.add('active'); 924 }); 925 }); 926 } 927 } 928 929 // handle Load More ============= 930 var handleLoadMore = function () { 931 const itemsToShow = 4; 932 const hiddenItemsOnLoad = document.querySelectorAll('.hidden-item'); 933 for (let i = 0; i < itemsToShow && i < hiddenItemsOnLoad.length; i++) { 934 hiddenItemsOnLoad[i].classList.remove('hidden-item'); 935 }
936 const loadMoreBtn = document.querySelector('.load-more-btn'); 937 if (loadMoreBtn) { 938 loadMoreBtn.addEventListener('click', function () { 939 const refreshIcon = loadMoreBtn.querySelector('.fa-refresh'); 940 if (refreshIcon) { 941 refreshIcon.classList.add('loading-icon'); 942 } 943 setTimeout(() => { 944 const hiddenItems = document.querySelectorAll('.hidden-item'); 945 for (let i = 0; i < itemsToShow && i < hiddenItems.length; i++) { 946 hiddenItems[i].classList.remove('hidden-item'); 947 } 948 if (document.querySelectorAll('.hidden-item').length === 0) { 949 loadMoreBtn.innerHTML = 'No More'; 950 } 951 if (refreshIcon) { 952 refreshIcon.classList.remove('loading-icon'); 953 } 954 }, 1000); 955 }); 956 } 957 }; 958 959 960 // handle CustomTab ============ 961 var handleCustomTab = function () { 962 document.querySelectorAll(".toggle-group").forEach(group => { 963 const toggles = group.querySelectorAll(".clcik-toggle"); 964 const groupName = group.getAttribute("data-group"); 965 const sections = document.querySelectorAll(`.custom-tab[data-group='${groupName}']`); 966 toggles.forEach(toggle => { 967 toggle.addEventListener("click", function () { 968 toggles.forEach(el => el.classList.remove("active")); 969 sections.forEach(sec => sec.classList.remove("active")); 970 971 this.classList.add("active"); 972 document.getElementById(this.getAttribute("data-target")).classList.add("active"); 973 }); 974 }); 975 // Default Active State 976 if (toggles.length > 0) { 977 toggles[0].classList.add("active"); 978 sections[0].classList.add("active"); 979 } 980 }); 981 }; 982 983 // handle Grid List Toggle ============ 984 var handleGridListToggle = function () { 985 if (jQuery('.gridlistToggle').length > 0) { 986 document.querySelectorAll('.gridlistToggle').forEach(button => { 987 button.addEventListener('click', function () { 988 const layout = this.getAttribute('data-layout'); 989 document.querySelectorAll('.gridlistToggle').forEach(btn => { 990 btn.classList.remove('active'); 991 }); 992 document.querySelectorAll(`.gridlistToggle[data-layout="${layout}"]`).forEach(btn => { 993 btn.classList.add('active'); 994 }); 995 document.querySelectorAll('.posts').forEach(postList => { 996 postList.classList.remove('grid2', 'grid3', 'list'); 997 postList.classList.add(layout); 998 }); 999 }); 1000 }); 1001 } 1002 }; 1003 1004 1005 // Scroll To Top ============ 1006 var handleScrollIndicator = function () { 1007 const scrollTop = document.documentElement.scrollTop || document.body.scrollTop; 1008 const scrollProgress = document.querySelectorAll('.scrollup'); 1009 1010 if (scrollProgress.length > 0) { 1011 scrollProgress.forEach(el => { 1012 if (scrollTop > 200) { 1013 el.classList.add('is-active'); 1014 } else { 1015 el.classList.remove('is-active'); 1016 } 1017 1018 // Add click listener 1019 el.addEventListener('click', function () { 1020 window.scrollTo({ 1021 top: 0, 1022 behavior: 'smooth' 1023 }); 1024 }); 1025 }); 1026 const scrollHeight = document.documentElement.scrollHeight; 1027 const windowHeight = document.documentElement.clientHeight; 1028 const maxScrollTop = scrollHeight - windowHeight; 1029 const scrollPercentage = (scrollTop / (maxScrollTop - 200)) * 100; 1030 const scrollPoint = document.querySelector('.scroll-point'); 1031 if (scrollPoint) { 1032 scrollPoint.style.height = Math.min(scrollPercentage, 100) + '%'; 1033 } 1034 } 1035 } 1036 1037 // handle Weather Widget ========== 1038 var initWeatherWidget = function () {
1039 //const apiKey = "5b27a6ef3547402582e62007222306"; 1040 const apiKey = "66078b6cc6f4a920e0e653b41e1cb6ee"; 1041 const city = "london"; 1042 1043 fetch(`https://api.OpenWeatherMap.org/v1/current.json?key=${apiKey}&q=${city}&aqi=yes`) 1044 .then(response => response.json()) 1045 .then(data => { 1046 const { 1047 current: { 1048 temp_c, 1049 air_quality 1050 }, 1051 location: { name, localtime } 1052 } = data; 1053 1054 const pm25 = air_quality.pm2_5; 1055 const pm10 = air_quality.pm10; 1056 const epaIndex = air_quality["us-epa-index"]; 1057 // Helper: Get AQI Category 1058 function getAQICategory(index) { 1059 switch (index) { 1060 case 1: return "Satisfactory"; 1061 case 2: return "Moderate"; 1062 case 3: return "Unhealthy for Sensitive Groups"; 1063 case 4: return "Unhealthy"; 1064 case 5: return "Very Unhealthy"; 1065 case 6: return "Hazardous"; 1066 default: return "Unknown"; 1067 } 1068 } 1069 1070 document.querySelector('#temp').textContent = temp_c+' â'; 1071 document.querySelector('#cityName').textContent = name; 1072 document.querySelector('#aqi').textContent = `${epaIndex.toFixed(1)}`; 1073 document.querySelector('#aqiCategory').textContent = `${getAQICategory(epaIndex)}`; 1074 // document.querySelector('#aqi').textContent = `PM2.5: ${pm25.toFixed(1)}, PM10: ${pm10.toFixed(1)}, AQI (EPA): ${epaIndex}`; 1075 1076 let localTime = new Date(localtime.replace(' ', 'T')); 1077 function updateClock() { 1078 localTime.setSeconds(localTime.getSeconds() + 1); 1079 document.querySelector('.widget-date-time .time').textContent = localTime.toLocaleTimeString(); 1080 } 1081 updateClock(); 1082 setInterval(updateClock, 1000); 1083 const day = localTime.getDate();
1084 const month = localTime.toLocaleString('default', { month: 'long' }); 1085 const year = localTime.getFullYear(); 1086 document.querySelector('.widget-date-time .day').textContent = day; 1087 document.querySelector('.widget-date-time .month').textContent = month; 1088 document.querySelector('.widget-date-time .year').textContent = year; 1089 }) 1090 .catch(error => { 1091 // console.error("Error fetching weather or AQI:", error); 1092 }); 1093 1094 }; 1095 1096 var initWeatherWidget1 = function () { 1097 const apiKey = "66078b6cc6f4a920e0e653b41e1cb6ee"; 1098 const lat = 25.1825; 1099 const lon = 75.8391; 1100 1101 // AQI Fetch 1102 fetch(`https://api.openweathermap.org/data/2.5/air_pollution?lat=${lat}&lon=${lon}&appid=${apiKey}`) 1103 .then(response => response.json()) 1104 .then(data => { 1105 const aqi = data.list[0].main.aqi; 1106 1107 function getAQICategory(index) { 1108 switch (index) { 1109 case 1: return "Good"; 1110 case 2: return "Fair"; 1111 case 3: return "Moderate"; 1112 case 4: return "Poor"; 1113 case 5: return "Very Poor"; 1114 default: return "Unknown"; 1115 } 1116 } 1117 1118 document.querySelector('#aqi').textContent = aqi; 1119 document.querySelector('#aqiCategory').textContent = getAQICategory(aqi); 1120 }) 1121 .catch(error => { 1122 console.error("Error fetching AQI:", error); 1123 }); 1124 1125} 1126 // handle Footer Content Widget ========== 1127 var handleFooterContent = function () { 1128 const isDesktop = window.innerWidth > 767; 1129 const footerWraps = document.querySelectorAll(".footer_content_wrap"); 1130 1131 footerWraps.forEach(wrap => { 1132 const content = wrap.querySelector(".footer_content:not(:has(.wp-block-heading))"); 1133 wrap.querySelectorAll(".collaps, .collapsd").forEach(icon => icon.remove()); 1134 1135 const newWrap = wrap.cloneNode(true); 1136 wrap.parentNode.replaceChild(newWrap, wrap); 1137 1138 const contentPanel = newWrap.querySelector(".footer_content:not(:has(.wp-block-heading))"); 1139 1140 if (isDesktop) { 1141 newWrap.classList.add("active"); 1142 if (contentPanel) { 1143 contentPanel.style.maxHeight = contentPanel.scrollHeight + "px"; 1144 } 1145 } else { 1146 const plusIcon = document.createElement("span"); 1147 plusIcon.className = "collaps"; 1148 plusIcon.innerHTML = "<i class='fa fa-plus-circle'></i>"; 1149 plusIcon.style.cursor = "pointer"; 1150 1151 const minusIcon = document.createElement("span"); 1152 minusIcon.className = "collapsd"; 1153 minusIcon.innerHTML = "<i class='fa fa-minus-circle'></i>"; 1154 minusIcon.style.cursor = "pointer"; 1155 1156 newWrap.insertBefore(minusIcon, newWrap.firstChild); 1157 newWrap.insertBefore(plusIcon, newWrap.firstChild); 1158 1159 newWrap.classList.remove("active"); 1160 contentPanel.style.maxHeight = "0"; 1161 contentPanel.style.overflow = "hidden"; 1162 contentPanel.style.transition = "max-height 0.4s ease"; 1163 1164 plusIcon.style.display = "inline"; 1165 minusIcon.style.display = "none"; 1166 1167 const toggle = () => { 1168 const isActive = newWrap.classList.contains("active"); 1169 newWrap.classList.toggle("active"); 1170 if (isActive) { 1171 contentPanel.style.maxHeight = "0"; 1172 plusIcon.style.display = "inline"; 1173 minusIcon.style.display = "none"; 1174 } else { 1175 contentPanel.style.maxHeight = contentPanel.scrollHeight + "px"; 1176 plusIcon.style.display = "none"; 1177 minusIcon.style.display = "inline"; 1178 } 1179 }; 1180 plusIcon.addEventListener("click", toggle); 1181 minusIcon.addEventListener("click", toggle); 1182 } 1183 }); 1184 } 1185 1186 // handle Ticker Slider ============ 1187 var handleTickerSlider = function () { 1188 jQuery(document).ready(function ($) { 1189 $(".ticker-slider").each(function () { 1190 var $slider = $(this); 1191 $slider.owlCarousel({ 1192 autoWidth: true, 1193 loop: true, 1194 margin: 15, 1195 autoplay: true, 1196 autoplayTimeout: 6000, 1197 autoplaySpeed: 6000, 1198 autoplayHoverPause: true, 1199 smartSpeed: 1000, 1200 nav: false, 1201 dots: false, 1202 autoHeight: true, 1203 slideTransition: 'linear', 1204 navText: ["<i class='fa fa-chevron-left'></i>", "<i class='fa fa-chevron-right'></i>"], 1205 responsive: { 1206 991: { 1207 margin: 30 1208 } 1209 } 1210 }); 1211 }); 1212 }); 1213 }; 1214 1215 // handle Masonry Filter ============ 1216 // var handleMasonryFilter = function() { 1217 // jQuery(document).ready(function ($) { 1218 // jQuery('.av-filter-init').mixItUp({ 1219 // selectors: { 1220 // target: '.tile', 1221 // filter: '.filter', 1222 // sort: '.sort-btn' 1223 // }, 1224 // animation: { 1225 // animateResizeContainer: false, 1226 // effects: 'fade scale' 1227 // } 1228 // }); 1229 // }); 1230 // }; 1231 1232 // handle Masonry Filter ============ 1233 var handleMasonryFilter = function() { 1234 const filterGroups = document.querySelectorAll('.filter-group'); 1235 filterGroups.forEach(group => { 1236 const filterLinks = group.querySelectorAll('.filter-container a'); 1237 const mixItems = group.querySelectorAll('.mix'); 1238 const owlItemsMap = new WeakMap(); 1239 1240 filterLinks.forEach(link => { 1241 link.addEventListener('click', (e) => { 1242 e.preventDefault(); 1243 filterLinks.forEach(l => l.classList.remove('active')); 1244 link.classList.add('active'); 1245 1246 const filter = link.getAttribute('data-filter'); 1247 1248 // OWL Filter 1249 handleOwlFilter(group, filter, owlItemsMap); 1250
1251 mixItems.forEach(item => { 1252 // item.classList.remove('show'); 1253 // if (filter === 'all' || item.classList.contains(filter)) { 1254 // item.classList.add('show'); 1255 // } 1256 if (filter === 'all' || item.classList.contains(filter)) { 1257 item.style.display = 'block'; 1258 item.classList.remove('zooming-out'); 1259 void item.offsetWidth; 1260 item.classList.add('show'); 1261 } else { 1262 item.classList.remove('show'); 1263 item.classList.add('zooming-out'); 1264 1265 setTimeout(() => { 1266 item.style.display = 'none'; 1267 item.classList.remove('zooming-out'); 1268 }, 300); 1269 } 1270 }); 1271 }); 1272 }); 1273 }); 1274 }; 1275 1276 // handle Post Tiny Slider ============ 1277 var handlePostTinySlider = function () { 1278 jQuery(function ($) { 1279 $(".post-list-vertical").each(function () { 1280 var itemsCount = $(this).data("items") || 3; 1281 var slider = tns({ 1282 container: this, 1283 items: itemsCount, 1284 axis: "vertical", 1285 swipeAngle: true, 1286 speed: 400, 1287 nav: false, 1288 controls: false, 1289 gutter: 15 1290 }); 1291 var $heading = $(this).closest(".vertical-wrapper").prevAll(".heading-default").first(); 1292 $heading.find(".custom-prev").off("click").on("click", function () { 1293 slider.goTo("prev"); 1294 }); 1295 $heading.find(".custom-next").off("click").on("click", function () { 1296 slider.goTo("next"); 1297 }); 1298 }); 1299 }); 1300 }; 1301 1302 // handle ZodiacTiny Slider ============ 1303 var handleZodiacTinySlider = function () { 1304 jQuery(function ($) { 1305 $(".zodiac-list-horizontal").each(function () { 1306 var itemsCount = $(this).data("items") || 4; 1307 var slider = tns({ 1308 container: this, 1309 loop: false, 1310 items: itemsCount, 1311 axis: "horizontal", 1312 swipeAngle: true, 1313 speed: 400, 1314 nav: false, 1315 controls: false, 1316 autoplay: true, 1317 autoplayTimeout: 3000, 1318 autoplayButtonOutput: false 1319 }); 1320 var $heading = $(this).closest(".row").prevAll(".heading-default").first(); 1321 $heading.find(".custom-prev").off("click").on("click", function () { 1322 slider.goTo("prev"); 1323 }); 1324 $heading.find(".custom-next").off("click").on("click", function () { 1325 slider.goTo("next"); 1326 }); 1327 }); 1328 }); 1329 }; 1330 1331document.addEventListener("DOMContentLoaded", function () { 1332 handleSetupZodiacFilter(); 1333 handleMasonryFilter(); 1334 1335 //Auto-click on default active filter link 1336 const defaultFilter = document.querySelector('.filter-group .filter-container a.active'); 1337 if (defaultFilter) { 1338 defaultFilter.click(); 1339 } 1340}); 1341 1342 function handleOwlFilter(group, filter, owlItemsMap) { 1343 const owlContainer = group.querySelector('.news-slider'); 1344 if (!owlContainer) return; 1345 1346 if (!owlItemsMap.has(group)) { 1347 const originalItems = Array.from(owlContainer.querySelectorAll('.news-item')).map(item => item.cloneNode(true)); 1348 owlItemsMap.set(group, originalItems); 1349 } 1350 1351 const originalOwlItems = owlItemsMap.get(group); 1352 1353 $(owlContainer).trigger('destroy.owl.carousel'); 1354 owlContainer.innerHTML = ''; 1355 1356 const filtered = originalOwlItems.filter(item => { 1357 return filter === 'all' || item.classList.contains(filter); 1358 }); 1359 1360 filtered.forEach(item => { 1361 owlContainer.appendChild(item.cloneNode(true)); 1362 }); 1363 1364 setTimeout(() => { 1365 handleLatestNewsSlider(); 1366 }, 100); 1367 } 1368 1369 //handleAnySliderFilter 1370 var handleAnySliderFilter = function() { 1371 $( '.tab-filter-slider' ).on( 'click', '.filter', function() { 1372 1373 var $item = $(this); 1374 var filter = $item.data( 'filter' ) 1375 1376 entertainmentNews.owlcarousel2_filter( filter ); 1377 1378 } ) 1379 }; 1380 1381 //Magnific 1382 jQuery(document).ready(function($) { 1383 $('.popup-youtube').magnificPopup({ 1384 type: 'iframe' 1385 });
1386 1387 const preloader = document.querySelector(".preloader"); 1388 const closeBtn = document.querySelector(".preloader__close-btn"); 1389 if (preloader) { 1390 setTimeout(() => { 1391 preloader.style.opacity = "0"; 1392 preloader.style.visibility = "hidden"; 1393 }, 5000); 1394 if (closeBtn) { 1395 closeBtn.addEventListener("click", () => { 1396 preloader.style.opacity = "0"; 1397 preloader.style.visibility = "hidden"; 1398 }); 1399 } 1400 } 1401}); 1402 1403 /* Function ============ */ 1404 return { 1405 init: function () { 1406 // handlePreloaderOnClick(); 1407 videoPlayer(); 1408 // handleAnySliderFilter(); 1409 Theme_dark_light(); 1410 handleSearchToggle(); 1411 initRtlToggle(); 1412 handleTogglerMobileMenu(); 1413 handleStickyHeader(); 1414 handleHeaderMenu(); 1415 handleBreakingNewsSlider(); 1416 handleLatestNewsSlider(); 1417 handleFilterSlider(); 1418 //handleSetupZodiacFilter(); 1419 handleToggleTabs(); 1420 handlePostSlider(); 1421 handleWebStoreSlider(); 1422 handleEditorSlider(); 1423 handleTeamSlider(); 1424 handleAwaradsSlider(); 1425 handleTimelineSlider(); 1426 handleInformationSlider(); 1427 handlePreviouslyMissedSlider(); 1428 handlePostCarouselSlider(); 1429 handleAboveSocialSlider(); 1430 MagnificVideoPopup(); 1431 plyrMasterVideo(); 1432 handleWidgetVideoSlider(); 1433 handleTrapFocus(); 1434 handleSkillBar(); 1435 handleBoxHover(); 1436 handleLoadMore(); 1437 handleCustomTab(); 1438 handleGridListToggle(); 1439 // initWeatherWidget(); 1440 // initWeatherWidget1(); 1441 handleFooterContent(); 1442 handleTickerSlider(); 1443 //handleMasonryFilter(); 1444 handleSportNewsSlider(); 1445 handleFashionNewsSlider(); 1446 handlePostTinySlider(); 1447 handleZodiacTinySlider(); 1448 }, 1449 1450 load: function () { 1451 counter(); 1452 handleSkillBar(); 1453 }, 1454 1455 resize: function () { 1456 screenWidth = $(window).width(); 1457 handleHeaderMenu(); 1458 handleFooterContent(); 1459 }, 1460 1461 scroll: function () { 1462 handleSkillBar(); 1463 handleScrollIndicator(); 1464 } 1465 } 1466}(jQuery); 1467 1468 1469/* Document.ready Start */ 1470document.addEventListener('DOMContentLoaded', function () { 1471 appStart.init(); 1472 1473 document.querySelectorAll('.post-items').forEach(item => { 1474 const hasBlogImg = item.querySelector('.featured-image .blog-img'); 1475 if (!hasBlogImg) { 1476 item.classList.add('no-img'); 1477 } 1478 }); 1479}); 1480/* Document.ready END */ 1481 1482/* Window Load START */ 1483window.addEventListener('load', function () { 1484 appStart.load(); 1485}); 1486/* Window Load END */ 1487 1488/* Window Resize START */ 1489window.addEventListener('resize', function () { 1490 appStart.resize(); 1491}); 1492/* Window Resize END */ 1493 1494/* Window Scroll START */ 1495window.addEventListener("scroll", function () { 1496 appStart.scroll(); 1497}); 1498/* Window Scroll END */
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.