1document.addEventListener('DOMContentLoaded', () => { 2 const wrapper = document.querySelector('.widget_currency_rates_wrapper'); 3 if (!wrapper) return; 4 5 const select = wrapper.querySelector('.currency-select'); 6 const block = wrapper.querySelector('.currency-rates-widget'); 7 8 const show = ['USD', 'EUR', 'RUB', 'BYN', 'CNY', 'GBP']; 9 10 const loadRates = (base) => { 11 block.innerHTML = '<div class="currency-list">ÐагÑÑзка...</div>'; 12 13 fetch(`https://open.er-api.com/v6/latest/${base}`) 14 .then(r => r.json()) 15 .then(data => { 16 if (!data || data.result !== 'success') { 17 throw new Error('API error'); 18 } 19 20 const list = show 21 .filter(code => code !== base) 22 .map(code => { 23 const rate = data.rates[code]; 24 if (!rate) return ''; 25 return `<div><strong>${code}</strong><span>${rate.toFixed(4)}</span></div>`; 26 }) 27 .join(''); 28 29 block.innerHTML = `<div class="currency-list">${list}</div>`; 30 }) 31 .catch(() => { 32 block.innerHTML = '<div class="currency-list currency-error">ÐÑибка загÑÑзки даннÑÑ </div>'; 33 }); 34 }; 35 36 loadRates(select.value); 37 select.addEventListener('change', () => loadRates(select.value)); 38});
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.