1/** 2 * Blog Over Ticker JS 3 * EXACT copy of Bloglo ticker implementation using jQuery Marquee 4 * With Customizer partial refresh support 5 * 6 * @package Blog_Over 7 */ 8 9(function ($) { 10 11 // Track manual pause state (when user clicks pause button) 12 var isManuallyPaused = false; 13 14 // Initialize or reinitialize the ticker marquee 15 function initTicker() { 16 let htc = $(".ticker-slider-items"); 17 18 if (htc.length) { 19 // Reset manual pause state on init 20 isManuallyPaused = false; 21 22 // Destroy existing marquee if any (for reinit) 23 let existingMarquee = htc.find(".ticker-slider-wrap"); 24 if (existingMarquee.data('marquee')) { 25 existingMarquee.marquee('destroy'); 26 } 27 28 // Get settings from data attributes 29 let speed = htc.data('speed') || 50; 30 let direction = htc.data('direction') || 'left'; 31 let pauseOnHover = htc.data('pauseonhover') === true || htc.data('pauseonhover') === 'true'; 32 33 // RTL support 34 if ($("body").hasClass("rtl")) { 35 direction = (direction === 'left') ? 'right' : 'left'; 36 } 37 38 // Initialize marquee WITHOUT built-in pauseOnHover (we'll handle it manually) 39 let htcM = htc.find(".ticker-slider-wrap").marquee({ 40 speed: speed, 41 duration: 14000, 42 gap: 0, 43 delayBeforeStart: 0, 44 direction: direction, 45 duplicated: true, 46 startVisible: true, 47 pauseOnHover: false // We handle hover manually to respect manual pause 48 }); 49 50 // Remove previous handlers to avoid duplicates 51 htc.off("click", ".ticker-slider-pause"); 52 htc.find(".ticker-slider-box").off("mouseenter mouseleave"); 53 54 // Pause button click handler 55 htc.on("click", ".ticker-slider-pause", function () { 56 isManuallyPaused = !isManuallyPaused; 57 $(this).find("i").toggleClass("fa-pause fa-play"); 58 htcM.marquee("toggle"); 59 }); 60 61 // Custom hover handlers (only if pauseOnHover is enabled) 62 if (pauseOnHover) { 63 htc.find(".ticker-slider-box").on("mouseenter", function () { 64 // Only pause on hover if not already manually paused 65 if (!isManuallyPaused) { 66 htcM.marquee("pause"); 67 } 68 }).on("mouseleave", function () { 69 // Only resume on mouse leave if not manually paused 70 if (!isManuallyPaused) { 71 htcM.marquee("resume"); 72 } 73 }); 74 } 75 } 76 } 77 78 // Initialize on document ready 79 $(document).ready(function () { 80 initTicker(); 81 82 // Re-initialize after customizer partial refresh 83 if (typeof wp !== 'undefined' && wp.customize && wp.customize.selectiveRefresh) { 84 wp.customize.selectiveRefresh.bind('partial-content-rendered', function (placement) { 85 // Check if this is a ticker-related partial 86 if (placement.partial.id.indexOf('ticker') !== -1 || 87 (placement.container && placement.container.closest('.blog-over-ticker-slider').length)) { 88 // Slight delay to ensure DOM and styles are fully applied 89 setTimeout(function () { 90 initTicker(); 91 }, 250); 92 } 93 }); 94 } 95 }); 96 97 // Expose globally for manual refresh if needed 98 window.novaInitTicker = initTicker; 99 100})(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.