1// js/promos.js 2 3fetch('/admin/data/promos.json') 4 .then(res => res.json()) 5 .then(data => { 6 const container = document.querySelector('#promos .Promos__List'); 7 if (!container) return; 8 9 container.innerHTML = ''; // оÑиÑаем ÑÑаÑÑе акÑии 10 11 data.forEach(promo => { 12 if (!promo.visible) return; 13 14 const item = document.createElement('div'); 15 item.className = 'Promos__Item PromosItem'; 16 17 const priceHTML = 18 promo.priceType === 'A' 19 ? ` 20 <div class="PromosItem__Price"> 21 <div class="PromosItem__Price-Prices"> 22 <div class="PromosItem__Price-New">${promo.priceText}</div> 23 </div> 24 </div>` 25 : ` 26 <div class="PromosItem__Price"> 27 <div class="PromosItem__Price-Title T2"> 28 СÑоимоÑÑÑ<i>-${calculateDiscount(promo.oldPrice, promo.newPrice)}%</i> 29 </div> 30 <div class="PromosItem__Price-Prices"> 31 <div class="PromosItem__Price-New">${promo.newPrice} </div> 32 <div class="PromosItem__Price-Old">${promo.oldPrice} </div> 33 </div> 34 </div>`; 35 36 const quoteHTML = promo.quote 37 ? `<blockquote class="T2">${promo.quote.replace(/\n/g, '<br>')}</blockquote>` 38 : ''; 39 40 item.innerHTML = ` 41 <div class="PromosItem__Main"> 42 <div class="PromosItem__Title H2">${promo.title}</div> 43 <div class="PromosItem__Desc T2">${promo.desc}</div> 44 ${priceHTML} 45 </div> 46 <div class="PromosItem__Info"> 47 <div class="PromosItem__Text"> 48 <p class="T1">${promo.text}</p> 49 ${quoteHTML} 50 </div> 51 <div class="Promo__btnbox"> 52 <a href="https://max.ru/u/f9LHodD0cOIshagoyUMWCqzIDBf1Ctd63EFY13aYyI1-9cq6WVzDIIh6A-M" target="_blank" class="Button --Brand --Md PromosItem__Button"> 53 ${promo.buttonText} 54 </a> 55 <!--a href="https://t.me/Aryan_ewc" target="_blank" class="Button --Brand rounded"> 56 <img data-src="./images/icons/TelegramActButton_black.svg" src="./images/icons/TelegramActButton_black.svg" class="tgicon lazy loaded" alt="СвÑзаÑÑÑÑ Ñ Ð½Ð°Ð¼Ð¸ ÑеÑез Telegram" title="СвÑзаÑÑÑÑ Ñ Ð½Ð°Ð¼Ð¸ ÑеÑез Telegram"> 57 </a--> 58 </div> 59 </div>`; 60 61 container.appendChild(item); 62 }); 63 }); 64 65function calculateDiscount(oldPrice, newPrice) { 66 const clean = str => parseFloat(str.replace(/\s/g, '').replace(',', '.')); 67 const oldP = clean(oldPrice); 68 const newP = clean(newPrice); 69 if (!oldP || !newP) return 0; 70 return ((1 - newP / oldP) * 100).toFixed(1).replace('.', ','); 71}
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.