1// LATAM geo-hint banner controller (aerodata#392). The server renders the 2// banner (hidden) only for anonymous visitors from LATAM / price-sensitive 3// countries, off the /pt/latam/ + /es/latam/ pages themselves. This script 4// reveals it unless it was recently dismissed, and persists the dismiss in 5// localStorage for 30 days â same pattern as pwa_install_banner.js. 6(function() { 7 'use strict'; 8 9 var STORAGE_KEY = 'latam_banner_dismissed'; 10 var DISMISS_MS = 30 * 24 * 60 * 60 * 1000; // 30 days 11 12 function wasRecentlyDismissed() { 13 try { 14 var raw = localStorage.getItem(STORAGE_KEY); 15 if (!raw) return false; 16 var t = parseInt(raw, 10); 17 if (!t || isNaN(t)) return false; 18 return (Date.now() - t) < DISMISS_MS; 19 } catch (e) { 20 // localStorage blocked (private mode, ITP) â fail closed: don't nag. 21 return true; 22 } 23 } 24 25 function persistDismiss() { 26 try { localStorage.setItem(STORAGE_KEY, String(Date.now())); } catch (e) { /* noop */ } 27 } 28 29 function init() { 30 var banner = document.getElementById('latam-geo-banner'); 31 if (!banner) return; // server chose not to render it 32 if (wasRecentlyDismissed()) return; 33 34 banner.style.display = ''; 35 36 var close = document.getElementById('latam-geo-banner-close'); 37 if (close) { 38 close.addEventListener('click', function() { 39 banner.style.display = 'none'; 40 persistDismiss(); 41 }); 42 } 43 } 44 45 if (document.readyState === 'loading') { 46 document.addEventListener('DOMContentLoaded', init); 47 } else { 48 init(); 49 } 50})();
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.