1document.addEventListener('DOMContentLoaded', () => { 2 const MAX_TRIES = 60; // 60 * 250ms = 15s 3 const INTERVAL = 250; 4 let tries = 0; 5 6 function addButtons() { 7 const acceptButton = document.querySelector('#cpnb-accept-btn'); 8 if (!acceptButton) return false; 9 10 // prevent duplicates 11 if (document.querySelector('#cpnb-subscription-btn') || document.querySelector('#cpnb-login-btn')) { 12 return true; 13 } 14 15 const subscriptionButton = document.createElement('span'); 16 subscriptionButton.id = 'cpnb-subscription-btn'; 17 subscriptionButton.role = 'button'; 18 subscriptionButton.tabIndex = 0; 19 subscriptionButton.setAttribute('aria-label', 'Rifiuta e abbonati'); 20 subscriptionButton.className = 'cpnb-button cpnb-button-ok'; 21 subscriptionButton.style.backgroundColor = '#04509a'; 22 subscriptionButton.style.marginLeft = '10px'; 23 subscriptionButton.textContent = 'Rifiuta e abbonati'; 24 subscriptionButton.addEventListener('click', () => (window.location.href = '/abbonarsi.html')); 25 26 const loginButton = document.createElement('span'); 27 loginButton.id = 'cpnb-login-btn'; 28 loginButton.role = 'button'; 29 loginButton.tabIndex = 0; 30 loginButton.setAttribute('aria-label', 'Sei già abbonato? Accedi'); 31 loginButton.className = 'cpnb-button cpnb-button-ok'; 32 loginButton.style.backgroundColor = '#5f5f5f'; 33 loginButton.style.marginLeft = '10px'; 34 loginButton.textContent = 'Sei già abbonato? Accedi'; 35 loginButton.addEventListener('click', () => (window.location.href = '/area-abbonati.html')); 36 37 acceptButton.insertAdjacentElement('afterend', subscriptionButton); 38 subscriptionButton.insertAdjacentElement('afterend', loginButton); 39 40 return true; 41 } 42 43 const timer = setInterval(() => { 44 tries++; 45 if (addButtons() || tries >= MAX_TRIES) { 46 clearInterval(timer); 47 if (tries >= MAX_TRIES) console.warn('cpnb accept button not found after retries'); 48 } 49 }, INTERVAL); 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.