1(function (e) { 2 'use strict'; 3 var n = window.AFTHRAMPES_JS || {}; 4 ((n.stickyMenu = function () { 5 e(window).scrollTop() > 350 6 ? e('#masthead').addClass('nav-affix') 7 : e('#masthead').removeClass('nav-affix'); 8 }), 9 (n.mobileMenu = { 10 init: function () { 11 (this.toggleMenu(), this.menuMobile(), this.menuArrow()); 12 }, 13 toggleMenu: function () { 14 e('#masthead').on('click', '.toggle-menu', function (event) { 15 var ethis = e('.main-navigation .menu .menu-mobile'); 16 if (ethis.css('display') == 'block') { 17 ethis.slideUp('300'); 18 } else { 19 ethis.slideDown('300'); 20 } 21 e('.ham').toggleClass('exit'); 22 e('body.aft-sticky-header').toggleClass('aft-sticky-header-revealed'); 23 }); 24 25 e('#masthead .main-navigation ').on( 26 'click', 27 '.menu-mobile a button', 28 function (event) { 29 event.preventDefault(); 30 var ethis = e(this), 31 eparent = ethis.closest('li'); 32 33 if (eparent.find('> .children').length) { 34 var esub_menu = eparent.find('> .children'); 35 } else { 36 var esub_menu = eparent.find('> .sub-menu'); 37 } 38 39 if (esub_menu.css('display') == 'none') { 40 esub_menu.slideDown('300'); 41 ethis.addClass('active'); 42 } else { 43 esub_menu.slideUp('300'); 44 ethis.removeClass('active'); 45 } 46 47 return false; 48 } 49 ); 50 }, 51 menuMobile: function () { 52 if (e('.main-navigation .menu > ul').length) { 53 var ethis = e('.main-navigation .menu > ul'), 54 eparent = ethis.closest('.main-navigation'), 55 pointbreak = eparent.data('epointbreak'), 56 window_width = window.innerWidth; 57 58 if (typeof pointbreak == 'undefined') { 59 pointbreak = 991; 60 } 61 62 if (pointbreak >= window_width) { 63 ethis.addClass('menu-mobile').removeClass('menu-desktop'); 64 e('.main-navigation .toggle-menu').css('display', 'block'); 65 } else { 66 ethis 67 .addClass('menu-desktop') 68 .removeClass('menu-mobile') 69 .css('display', ''); 70 e('.main-navigation .toggle-menu').css('display', 'none'); 71 } 72 } 73 }, 74 menuArrow: function () { 75 if (e('#masthead .main-navigation div.menu > ul').length) { 76 e('#masthead .main-navigation div.menu > ul .sub-menu') 77 .parent('li') 78 .find('> a') 79 .append( 80 '<button class="covernews-icon-angle-down" aria-label="down">' 81 ); 82 e('#masthead .main-navigation div.menu > ul .children') 83 .parent('li') 84 .find('> a') 85 .append( 86 '<button class="covernews-icon-angle-down" aria-label="down">' 87 ); 88 } 89 }, 90 }), 91 (n.DataBackground = function () { 92 var pageSection = e('.data-bg'); 93 pageSection.each(function (indx) { 94 if (e(this).attr('data-background')) { 95 e(this).css( 96 'background-image', 97 'url(' + e(this).data('background') + ')' 98 ); 99 } 100 }); 101 102 e('.bg-image').each(function () { 103 var src = e(this).children('img').attr('src'); 104 e(this) 105 .css('background-image', 'url(' + src + ')') 106 .children('img') 107 .hide(); 108 }); 109 }), 110 (n.setInstaHeight = function () { 111 e('.insta-slider-block').each(function () { 112 var img_width = e(this) 113 .find('.insta-item .af-insta-height') 114 .eq(0) 115 .innerWidth(); 116 117 e(this).find('.insta-item .af-insta-height').css('height', img_width); 118 }); 119 }), 120 (n.Offcanvas = function () { 121 if (typeof jQuery.fn.sidr === 'function') { 122 e('#sidr').addClass('aft-mobile-off-canvas'); 123 var offCanvasElement = document.querySelector('.aft-mobile-off-canvas'); 124 if (offCanvasElement) { 125 n.trapFocus(offCanvasElement); 126 } 127 128 e('.offcanvas-nav').sidr({ 129 speed: 300, 130 side: 'left', 131 displace: false, 132 }); 133 e('.sidr-class-sidr-button-close').on('click', function () { 134 e.sidr('close', 'sidr'); 135 }); 136 } 137 }), 138 (n.trapFocus = function (element) { 139 var focusableEls = element.querySelectorAll( 140 'a[href]:not([disabled]), button:not([disabled]), textarea:not([disabled]), input[type="text"]:not([disabled]), input[type="radio"]:not([disabled]), input[type="checkbox"]:not([disabled]), select:not([disabled])' 141 ), 142 firstFocusableEl = focusableEls[0], 143 lastFocusableEl = focusableEls[focusableEls.length - 1], 144 KEYCODE_TAB = 9; 145 146 element.addEventListener('keydown', function (e) { 147 var isTabPressed = e.key === 'Tab' || e.keyCode === KEYCODE_TAB; 148 149 if (!isTabPressed) { 150 return; 151 } 152 153 if (e.shiftKey) { 154 /* shift + tab */ if (document.activeElement === firstFocusableEl) {
155 lastFocusableEl.focus(); 156 e.preventDefault(); 157 } 158 } /* tab */ else { 159 if (document.activeElement === lastFocusableEl) { 160 firstFocusableEl.focus(); 161 e.preventDefault(); 162 } 163 } 164 }); 165 }), 166 /* Slick Slider */ 167 (n.SlickCarousel = function () { 168 e('.aft-banner-carousel') 169 .not('.slick-initialized') 170 .slick({ 171 slidesToShow: 3, 172 slidesToScroll: 1, 173 autoplay: true, 174 autoplaySpeed: 12000, 175 infinite: true, 176 nextArrow: 177 '<span class="slide-icon slide-icon-1 slide-next icon-right covernews-icon-angle-right"></span>', 178 prevArrow: 179 '<span class="slide-icon slide-icon-1 slide-prev icon-left covernews-icon-angle-left"></span>', 180 rtl: rtl_slick(), 181 responsive: [ 182 { 183 breakpoint: 991, 184 settings: { 185 slidesToShow: 2, 186 }, 187 }, 188 { 189 breakpoint: 768, 190 settings: { 191 slidesToShow: 2, 192 }, 193 }, 194 195 { 196 breakpoint: 480, 197 settings: { 198 slidesToShow: 1, 199 }, 200 }, 201 ], 202 }); 203 e('.aft-banner-slider') 204 .not('.slick-initialized') 205 .slick({ 206 slidesToShow: 1, 207 slidesToScroll: 1, 208 autoplay: true, 209 autoplaySpeed: 12000, 210 infinite: true, 211 nextArrow: 212 '<span class="slide-icon slide-icon-1 slide-next icon-right covernews-icon-angle-right"></span>', 213 prevArrow: 214 '<span class="slide-icon slide-icon-1 slide-prev icon-left covernews-icon-angle-left"></span>', 215 appendArrows: e('.af-main-navcontrols'), 216 rtl: rtl_slick(), 217 }); 218 function rtl_slick() { 219 if (e('body').hasClass('rtl')) { 220 return true; 221 } else { 222 return false; 223 } 224 } 225 226 e('.posts-slider').slick({ 227 slidesToShow: 1, 228 slidesToScroll: 1, 229 autoplay: true, 230 autoplaySpeed: 10000, 231 infinite: true, 232 nextArrow: 233 '<i class="slide-icon slide-icon-1 slide-next icon-right covernews-icon-angle-right"></i>', 234 prevArrow: 235 '<i class="slide-icon slide-icon-1 slide-prev icon-left covernews-icon-angle-left"></i>', 236 rtl: rtl_slick(), 237 }); 238 239 e('.classic-mode .trending-posts-carousel') 240 .not('.slick-initialized') 241 .slick({ 242 autoplay: true, 243 vertical: true, 244 slidesToShow: 5, 245 slidesToScroll: 1, 246 verticalSwiping: true, 247 autoplaySpeed: 10000, 248 infinite: true, 249 nextArrow: 250 '<i class="slide-icon slide-icon-1 slide-next covernews-icon-angle-down"></i>', 251 prevArrow: 252 '<i class="slide-icon slide-icon-1 slide-prev covernews-icon-angle-up"></i>', 253 appendArrows: e('.af-trending-navcontrols'), 254 responsive: [ 255 { 256 breakpoint: 1834, 257 settings: { 258 slidesToShow: 5, 259 }, 260 }, 261 { 262 breakpoint: 991, 263 settings: { 264 slidesToShow: 5, 265 }, 266 }, 267 { 268 breakpoint: 768, 269 settings: { 270 slidesToShow: 3, 271 }, 272 }, 273 274 { 275 breakpoint: 480, 276 settings: { 277 slidesToShow: 3, 278 }, 279 }, 280 ], 281 }); 282 283 e('#aft-trending-story-five .trending-posts-carousel') 284 .not('.slick-initialized') 285 .slick({ 286 autoplay: true, 287 vertical: true, 288 slidesToShow: 5, 289 slidesToScroll: 1, 290 verticalSwiping: true, 291 autoplaySpeed: 10000, 292 infinite: true, 293 nextArrow: 294 '<i class="slide-icon slide-icon-1 slide-next covernews-icon-angle-down"></i>', 295 prevArrow: 296 '<i class="slide-icon slide-icon-1 slide-prev covernews-icon-angle-up"></i>',
297 appendArrows: e('.af-trending-navcontrols'), 298 responsive: [ 299 { 300 breakpoint: 1834, 301 settings: { 302 slidesToShow: 5, 303 }, 304 }, 305 { 306 breakpoint: 991, 307 settings: { 308 slidesToShow: 5, 309 }, 310 }, 311 { 312 breakpoint: 768, 313 settings: { 314 slidesToShow: 3, 315 }, 316 }, 317 318 { 319 breakpoint: 480, 320 settings: { 321 slidesToShow: 3, 322 }, 323 }, 324 ], 325 }); 326 327 e('#aft-trending-story-horizontal .trending-posts-carousel') 328 .not('.slick-initialized') 329 .slick({ 330 autoplay: true, 331 slidesToShow: 4, 332 slidesToScroll: 1, 333 autoplaySpeed: 10000, 334 rtl: rtl_slick(), 335 infinite: true, 336 nextArrow: 337 '<i class="slide-icon slide-icon-1 slide-next covernews-icon-angle-down"></i>', 338 prevArrow: 339 '<i class="slide-icon slide-icon-1 slide-prev covernews-icon-angle-up"></i>', 340 appendArrows: e('.af-trending-navcontrols'), 341 responsive: [ 342 { 343 breakpoint: 1834, 344 settings: { 345 slidesToShow: 3, 346 }, 347 }, 348 { 349 breakpoint: 769, 350 settings: { 351 slidesToShow: 2, 352 }, 353 }, 354 355 { 356 breakpoint: 480, 357 settings: { 358 slidesToShow: 1, 359 }, 360 }, 361 ], 362 }); 363 364 e('.trending-posts-carousel') 365 .not('.slick-initialized') 366 .slick({ 367 autoplay: true, 368 vertical: true, 369 slidesToShow: 4, 370 slidesToScroll: 1, 371 verticalSwiping: true, 372 autoplaySpeed: 10000, 373 infinite: true, 374 nextArrow: 375 '<i class="slide-icon slide-icon-1 slide-next covernews-icon-angle-down"></i>', 376 prevArrow: 377 '<i class="slide-icon slide-icon-1 slide-prev covernews-icon-angle-up"></i>', 378 appendArrows: e('.af-trending-navcontrols'), 379 responsive: [ 380 { 381 breakpoint: 1834, 382 settings: { 383 slidesToShow: 4, 384 }, 385 }, 386 { 387 breakpoint: 991, 388 settings: { 389 slidesToShow: 4, 390 }, 391 }, 392 { 393 breakpoint: 768, 394 settings: { 395 slidesToShow: 3, 396 }, 397 }, 398 399 { 400 breakpoint: 480, 401 settings: { 402 slidesToShow: 3, 403 }, 404 }, 405 ], 406 }); 407 408 e('.trending-posts-vertical-carousel').slick({ 409 autoplay: true, 410 vertical: true, 411 slidesToShow: 5, 412 slidesToScroll: 1, 413 verticalSwiping: true, 414 autoplaySpeed: 10000, 415 infinite: true, 416 nextArrow: 417 '<i class="slide-icon slide-icon-1 slide-next covernews-icon-angle-down"></i>', 418 prevArrow: 419 '<i class="slide-icon slide-icon-1 slide-prev covernews-icon-angle-up"></i>', 420 }); 421 422 e('.editors-picks-carousel') 423 .not('.slick-initialized') 424 .slick({ 425 autoplay: true, 426 vertical: true, 427 slidesToShow: 4, 428 slidesToScroll: 1, 429 verticalSwiping: true, 430 autoplaySpeed: 10000, 431 infinite: true, 432 nextArrow: 433 '<i class="slide-icon slide-icon-1 slide-next covernews-icon-angle-down"></i>', 434 prevArrow: 435 '<i class="slide-icon slide-icon-1 slide-prev covernews-icon-angle-up"></i>', 436 appendArrows: e('.af-editors-picks-navcontrols'), 437 responsive: [ 438 { 439 breakpoint: 1834, 440 settings: { 441 slidesToShow: 4, 442 }, 443 }, 444 { 445 breakpoint: 991, 446 settings: { 447 slidesToShow: 4, 448 }, 449 }, 450 { 451 breakpoint: 768, 452 settings: { 453 slidesToShow: 3, 454 }, 455 }, 456 457 { 458 breakpoint: 480, 459 settings: { 460 slidesToShow: 3, 461 }, 462 }, 463 ], 464 }); 465 466 e('#primary .posts-carousel') 467 .not('.slick-initialized') 468 .slick({ 469 slidesToShow: 3, 470 slidesToScroll: 1, 471 autoplay: true, 472 autoplaySpeed: 10000, 473 infinite: true, 474 rtl: rtl_slick(), 475 nextArrow: 476 '<i class="slide-icon slide-icon-1 slide-next icon-right covernews-icon-angle-right"></i>', 477 prevArrow: 478 '<i class="slide-icon slide-icon-1 slide-prev icon-left covernews-icon-angle-left"></i>', 479 responsive: [ 480 { 481 breakpoint: 991, 482 settings: { 483 slidesToShow: 3, 484 slidesToScroll: 3, 485 }, 486 }, 487 { 488 breakpoint: 768, 489 settings: { 490 slidesToShow: 2, 491 slidesToScroll: 2, 492 }, 493 }, 494 495 { 496 breakpoint: 480, 497 settings: { 498 slidesToShow: 1, 499 slidesToScroll: 1, 500 }, 501 }, 502 ], 503 }); 504 505 e('#sidr .posts-carousel') 506 .not('.slick-initialized') 507 .slick({ 508 slidesToShow: 1, 509 slidesToScroll: 1, 510 autoplay: true, 511 autoplaySpeed: 10000, 512 infinite: true, 513 rtl: rtl_slick(), 514 nextArrow: 515 '<i class="slide-icon slide-icon-1 slide-next icon-right covernews-icon-angle-right"></i>', 516 prevArrow: 517 '<i class="slide-icon slide-icon-1 slide-prev icon-left covernews-icon-angle-left"></i>', 518 responsive: [ 519 { 520 breakpoint: 991, 521 settings: { 522 slidesToShow: 3, 523 slidesToScroll: 3, 524 }, 525 }, 526 { 527 breakpoint: 768, 528 settings: { 529 slidesToShow: 2, 530 slidesToScroll: 2, 531 }, 532 }, 533 534 { 535 breakpoint: 480, 536 settings: { 537 slidesToShow: 1, 538 slidesToScroll: 1, 539 }, 540 }, 541 ], 542 }); 543 544 e('#secondary .posts-carousel').not('.slick-initialized').slick({ 545 slidesToShow: 1, 546 slidesToScroll: 1, 547 autoplay: true, 548 autoplaySpeed: 10000, 549 infinite: true, 550 rtl: rtl_slick(), 551 nextArrow: 552 '<i class="slide-icon slide-icon-1 slide-next icon-right covernews-icon-angle-right"></i>', 553 prevArrow: 554 '<i class="slide-icon slide-icon-1 slide-prev icon-left covernews-icon-angle-left"></i>', 555 }); 556 557 e('.gallery-columns-1').slick({ 558 slidesToShow: 1, 559 slidesToScroll: 1, 560 fade: true, 561 autoplay: true, 562 autoplaySpeed: 10000, 563 infinite: true, 564 nextArrow: 565 '<i class="slide-icon slide-icon-1 slide-next covernews-icon-angle-right"></i>', 566 prevArrow: 567 '<i class="slide-icon slide-icon-1 slide-prev covernews-icon-angle-left"></i>', 568 dots: true, 569 }); 570 }), 571 (n.Preloader = function () { 572 e(window).on('load', function () { 573 e('#loader-wrapper').fadeOut(); 574 e('#af-preloader').delay(500).fadeOut('slow'); 575 }); 576 }), 577 (n.Search = function () { 578 e(window).on('load', function () { 579 e('.af-search-click').on('click', function () { 580 e('#af-search-wrap').toggleClass('af-search-toggle'); 581 }); 582 }); 583 }), 584 (n.searchReveal = function () { 585 e(window).on('load', function () { 586 jQuery('.search-icon').on('click', function (event) { 587 event.preventDefault(); 588 jQuery('.search-overlay').toggleClass('reveal-search'); 589 }); 590 }); 591 }), 592 // (n.Offcanvas = function () { 593 // e('.offcanvas-nav').sidr({ 594 // side: 'left', 595 // }); 596 597 // e('.sidr-class-sidr-button-close').on('click', function () { 598 // e.sidr('close', 'sidr'); 599 // }); 600 // }), 601 // SHOW/HIDE SCROLL UP // 602 (n.show_hide_scroll_top = function () { 603 if (e(window).scrollTop() > e(window).height() / 2) { 604 e('#scroll-up').fadeIn(300); 605 } else { 606 e('#scroll-up').fadeOut(300); 607 } 608 }), 609 (n.scroll_up = function () { 610 e('#scroll-up').on('click', function () { 611 e('html, body').animate( 612 { 613 scrollTop: 0, 614 }, 615 800 616 ); 617 return false;
618 }); 619 }), 620 (n.MagnificPopup = function () { 621 e('div.zoom-gallery').magnificPopup({ 622 delegate: 'a.insta-hover', 623 type: 'image', 624 closeOnContentClick: false, 625 closeBtnInside: false, 626 mainClass: 'mfp-with-zoom mfp-img-mobile', 627 image: { 628 verticalFit: true, 629 titleSrc: function (item) { 630 return item.el.attr('title'); 631 }, 632 }, 633 gallery: { 634 enabled: true, 635 }, 636 zoom: { 637 enabled: true, 638 duration: 300, 639 opener: function (element) { 640 return element.find('img'); 641 }, 642 }, 643 }); 644 645 e('.gallery').each(function () { 646 e(this).magnificPopup({ 647 delegate: 'a', 648 type: 'image', 649 gallery: { 650 enabled: true, 651 }, 652 zoom: { 653 enabled: true, 654 duration: 300, 655 opener: function (element) { 656 return element.find('img'); 657 }, 658 }, 659 }); 660 }); 661 662 e('.wp-block-gallery').each(function () { 663 e(this).magnificPopup({ 664 delegate: 'a', 665 type: 'image', 666 gallery: { 667 enabled: true, 668 }, 669 zoom: { 670 enabled: true, 671 duration: 300, 672 opener: function (element) { 673 return element.find('img'); 674 }, 675 }, 676 }); 677 }); 678 }), 679 (n.jQueryMarqueeRight = function () { 680 e('.marquee.flash-slide-right').marquee({ 681 //duration in milliseconds of the marquee 682 // speed: 80000, 683 //gap in pixels between the tickers 684 gap: 0, 685 //time in milliseconds before the marquee will start animating 686 delayBeforeStart: 0, 687 //'left' or 'right' 688 //direction: 'right', 689 //true or false - should the marquee be duplicated to show an effect of continues flow 690 duplicated: true, 691 pauseOnHover: true, 692 startVisible: true, 693 }); 694 }), 695 (n.jQueryMarquee = function () { 696 e('.marquee.flash-slide-left').marquee({ 697 //duration in milliseconds of the marquee 698 // duration: 80000, 699 //gap in pixels between the tickers 700 gap: 0, 701 //time in milliseconds before the marquee will start animating 702 delayBeforeStart: 0, 703 //'left' or 'right' 704 //direction: 'left', 705 //true or false - should the marquee be duplicated to show an effect of continues flow 706 duplicated: true, 707 pauseOnHover: true, 708 startVisible: true, 709 }); 710 }), 711 (n.VideoSlider = function () { 712 e('.video-slider').sliderPro({ 713 width: '100%', 714 height: 460, 715 arrows: true,
716 buttons: false, 717 fullScreen: false, 718 thumbnailWidth: 160, 719 thumbnailHeight: 112, 720 thumbnailsPosition: 'right', 721 autoplay: false, 722 fadeArrows: false, 723 loop: true, 724 breakpoints: { 725 1920: { 726 thumbnailWidth: 180, 727 thumbnailHeight: 100, 728 height: 510, 729 width: 906, 730 }, 731 1600: { 732 thumbnailWidth: 140, 733 thumbnailHeight: 80, 734 height: 390, 735 width: 700, 736 }, 737 1366: { 738 thumbnailWidth: 140, 739 thumbnailHeight: 80, 740 height: 442, 741 width: 786, 742 }, 743 1024: { 744 thumbnailWidth: 142, 745 thumbnailHeight: 80, 746 height: 295, 747 width: 523, 748 }, 749 800: { 750 height: 423, 751 thumbnailsPosition: 'bottom', 752 thumbnailWidth: 142, 753 thumbnailHeight: 80, 754 }, 755 500: { 756 height: 270, 757 thumbnailsPosition: 'bottom', 758 thumbnailWidth: 142, 759 thumbnailHeight: 80, 760 }, 761 425: { 762 height: 230, 763 thumbnailsPosition: 'bottom', 764 thumbnailWidth: 142, 765 thumbnailHeight: 80, 766 }, 767 375: { 768 height: 200, 769 thumbnailsPosition: 'bottom', 770 thumbnailWidth: 142, 771 thumbnailHeight: 80, 772 }, 773 }, 774 }); 775 jQuery('.sp-next-arrow').addClass('covernews-icon-angle-right'); 776 jQuery('.sp-previous-arrow').addClass('covernews-icon-angle-left'); 777 }), 778 (n.VideoSliderHorizontal = function () { 779 e('.video-slider-horizontal').sliderPro({ 780 width: '100%', 781 height: 460, 782 arrows: true,
783 buttons: false, 784 fullScreen: false, 785 thumbnailWidth: 160, 786 thumbnailHeight: 112, 787 thumbnailsPosition: 'bottom', 788 autoplay: false, 789 fadeArrows: false, 790 loop: true, 791 breakpoints: { 792 1920: { 793 thumbnailWidth: 200, 794 thumbnailHeight: 100, 795 height: 624, 796 }, 797 1600: { 798 thumbnailWidth: 142, 799 thumbnailHeight: 80, 800 height: 467, 801 }, 802 1366: { 803 thumbnailWidth: 142, 804 thumbnailHeight: 110, 805 height: 506, 806 }, 807 1024: { 808 thumbnailWidth: 142, 809 thumbnailHeight: 110, 810 height: 376, 811 }, 812 800: { 813 height: 423, 814 thumbnailsPosition: 'bottom', 815 thumbnailWidth: 142, 816 thumbnailHeight: 110, 817 }, 818 500: { 819 height: 239, 820 thumbnailsPosition: 'bottom', 821 thumbnailWidth: 142, 822 thumbnailHeight: 110, 823 }, 824 375: { 825 height: 199, 826 thumbnailsPosition: 'bottom', 827 thumbnailWidth: 142, 828 thumbnailHeight: 110, 829 }, 830 }, 831 }); 832 jQuery('.sp-next-arrow').addClass('covernews-icon-angle-right'); 833 jQuery('.sp-previous-arrow').addClass('covernews-icon-angle-left'); 834 }), 835 (n.CopyLink = function () { 836 e('.aft-copy-to-clipboard').on('click', function () { 837 const $this = e(this); 838 const link = window.location.href; 839 840 // Copy to clipboard 841 const textarea = document.createElement('textarea'); 842 textarea.value = link; 843 document.body.appendChild(textarea); 844 textarea.select(); 845 document.execCommand('copy'); 846 document.body.removeChild(textarea); 847 848 // Remove existing message 849 e('.aft-copy-toast').remove(); 850 851 // Get message from data attribute 852 const msg = $this.attr('data-copy-msg') || 'Link copied!'; 853 854 // Create toast 855 const $toast = e( 856 '<div class="aft-copy-toast" aria-live="polite"></div>' 857 ).text(msg); 858 e('body').append($toast); 859 860 // Position near the icon 861 const offset = $this.offset(); 862 if (offset) { 863 $toast.css({ 864 top: offset.top - 35, 865 left: offset.left, 866 position: 'absolute', 867 display: 'none', 868 }); 869 } else { 870 // Fallback center if offset fails 871 $toast.css({ 872 position: 'fixed', 873 top: '20px', 874 left: '50%', 875 transform: 'translateX(-50%)', 876 display: 'none', 877 }); 878 } 879 880 // Show message 881 $toast 882 .fadeIn(200) 883 .delay(1200) 884 .fadeOut(600, function () { 885 e(this).remove(); 886 }); 887 }); 888 889 // Keyboard support 890 e('.aft-copy-to-clipboard').on('keydown', function (event) { 891 if (event.key === 'Enter') { 892 e(this).trigger('click'); 893 } 894 }); 895 })); 896 897 n.BookmarkPost = function () { 898 e('.aft-bookmark-post').on('click keydown', function (event) { 899 if (event.type === 'keydown' && event.key !== 'Enter') return; 900 901 const $icon = e(this); 902 const isLoggedIn = 903 $icon.data('user-logged-in') === 1 || 904 $icon.data('user-logged-in') === '1'; 905 const postId = $icon.data('post-id'); 906 const loginMsg = $icon.data('login-msg') || 'Please log in.'; 907 908 if (!isLoggedIn) { 909 // Show floating toast or alert 910 showCopyToast($icon, loginMsg); 911 return; 912 } 913 914 // Logged-in: perform AJAX toggle 915 e.ajax({ 916 url: covernews_ajax.ajax_url, 917 type: 'POST', 918 data: { 919 action: 'toggle_bookmark', 920 post_id: postId, 921 nonce: covernews_ajax.nonce, 922 }, 923 success: function (response) { 924 if (response.success) { 925 $icon.toggleClass('bookmarked'); 926 const msg = $icon.hasClass('bookmarked') 927 ? 'Bookmarked!' 928 : 'Removed!'; 929 showCopyToast($icon, msg); 930 } 931 }, 932 }); 933 }); 934 935 function showCopyToast($el, msg) { 936 e('.aft-copy-toast').remove(); 937 938 const $toast = e( 939 '<div class="aft-copy-toast" aria-live="polite"></div>' 940 ).text(msg); 941 e('body').append($toast); 942 943 const offset = $el.offset(); 944 if (offset) { 945 $toast.css({ 946 top: offset.top - 35, 947 left: offset.left, 948 position: 'absolute', 949 display: 'none', 950 }); 951 } else { 952 $toast.css({ 953 position: 'fixed', 954 top: '20px', 955 left: '50%', 956 transform: 'translateX(-50%)', 957 display: 'none', 958 }); 959 } 960 961 $toast 962 .fadeIn(200) 963 .delay(1500) 964 .fadeOut(600, function () { 965 e(this).remove(); 966 }); 967 } 968 }; 969 970 n.PrintPage = function () { 971 e('.aft-print-page').on('click keydown', function (event) { 972 if (event.type === 'keydown' && event.key !== 'Enter') return; 973 window.print(); 974 }); 975 }; 976 977 n.reading_progress_bar = function () { 978 if (!e('body').hasClass('single-post')) return; // â Only run on single post 979 980 e(window).on('scroll', function () { 981 var scrollTop = e(window).scrollTop(), 982 docHeight = e(document).height() - e(window).height(), 983 scrollPercent = (scrollTop / docHeight) * 100; 984
985 e('#reading-progress-bar').css('width', scrollPercent + '%'); 986 }); 987 }; 988 (e(function () { 989 (n.mobileMenu.init(), 990 n.DataBackground(), 991 n.setInstaHeight(), 992 n.MagnificPopup(), 993 n.scroll_up(), 994 n.Offcanvas()); 995 }), 996 e('.aft-void-menu').on('click', function (event) { 997 event.preventDefault(); 998 })); 999 (e(window).on('scroll', function () { 1000 (n.stickyMenu(), n.show_hide_scroll_top()); 1001 }), 1002 e(window).on('resize', function () { 1003 n.mobileMenu.menuMobile(); 1004 }), 1005 e(window).on('load', function () { 1006 e('#loader-wrapper').fadeOut(); 1007 e('#af-preloader').delay(500).fadeOut('slow'); 1008 1009 e('.af-search-click').on('click', function () { 1010 e('#af-search-wrap').toggleClass('af-search-toggle'); 1011 }); 1012 1013 e('.search-icon').on('click', function (event) { 1014 event.preventDefault(); 1015 e('.search-overlay').toggleClass('reveal-search'); 1016 }); 1017 1018 if (typeof e.fn.sliderPro == 'function') { 1019 (n.VideoSlider(), n.VideoSliderHorizontal()); 1020 } 1021 1022 if (typeof e.fn.marquee == 'function') { 1023 (n.jQueryMarquee(), n.jQueryMarqueeRight()); 1024 } 1025 1026 // console.log(slick); 1027 1028 if (typeof e.fn.slick == 'function') { 1029 n.SlickCarousel(); 1030 } 1031 n.CopyLink(); 1032 n.BookmarkPost(); 1033 n.PrintPage(); 1034 n.reading_progress_bar(); 1035 })); 1036})(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.