1/* 2 * Floating discovery pill behaviour. 3 * Slides in 2.5s after load, stays dismissable for 7 days via localStorage. 4 * Hides on the target landing page itself and on screens under 900px. 5 */ 6 7(function () { 8 'use strict'; 9 10 // Key is versioned so a redesigned widget isn't silently suppressed for 11 // users who dismissed the previous version â bump the suffix when the 12 // widget changes meaningfully. 13 var DISMISS_KEY = 'qrrq_fp_dismissed_at_v2'; 14 var DISMISS_TTL = 7 * 24 * 60 * 60 * 1000; // 7 days 15 var TARGET_PATH = '/qrrq-static-vs-dynamic-qr'; 16 17 var wrap = document.getElementById('qrrqFloatingPromo'); 18 if (!wrap) return; 19 20 // Skip on the target page (user is already there). 21 if ((window.location.pathname || '').indexOf(TARGET_PATH) >= 0) return; 22 23 // Defensive desktop check (CSS already hides <900px). 24 if (window.innerWidth < 900) return; 25 26 // Respect a recent dismissal. 27 try { 28 var dismissedAt = parseInt(localStorage.getItem(DISMISS_KEY), 10); 29 if (dismissedAt && (Date.now() - dismissedAt) < DISMISS_TTL) return; 30 } catch (e) { /* localStorage may be disabled â continue */ } 31 32 // Reveal after 2.5s so it doesn't compete with the hero animation on load. 33 setTimeout(function () { 34 wrap.classList.add('is-visible'); 35 wrap.setAttribute('aria-hidden', 'false'); 36 }, 2500); 37 38 // Dismiss button â closes and stores a 7-day suppression flag. 39 var closeBtn = document.getElementById('qrrqFpClose'); 40 if (closeBtn) { 41 closeBtn.addEventListener('click', function (ev) { 42 ev.preventDefault(); 43 ev.stopPropagation(); 44 wrap.classList.remove('is-visible'); 45 wrap.setAttribute('aria-hidden', 'true'); 46 try { localStorage.setItem(DISMISS_KEY, String(Date.now())); } catch (e) { /* noop */ } 47 }); 48 } 49})();
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.