1"use strict"; 2 3class BonusSystem { 4 sendUserCard = (maxBonus) => { 5 const form = document.querySelector('.bonus-system .form-bonus-system'); 6 const preloader = document.querySelector('.bonus-system .preloader-block'); 7 const inputCard = document.querySelector('input.user-card'); 8 9 const cardNumber = inputCard.value; 10 11 Main.setCookie('user-bonus-card', cardNumber, { 12 expires: 7, 13 path: '/', 14 secure: true, 15 domain: new URL(document.URL).hostname 16 }); 17 18 if (cardNumber === '') { 19 inputCard.placeholder = 'ÐаполниÑе Ð½Ð¾Ð¼ÐµÑ ÐºÐ°ÑÑÑ'; 20 inputCard.classList.add('error'); 21 return; 22 } 23 24 form.style.display = 'none'; 25 preloader.style.display = 'block'; 26 27 Main.createRequest('/local/include/card/find.card.php', { 28 card: cardNumber 29 }, response => { 30 const result = JSON.parse(response); 31 if (typeof result["message"] == 'undefined') { 32 Main.createRequest('/local/include/card/get.balance.php', { 33 card: result[0]["id"] 34 }, response => { 35 const result = JSON.parse(response); 36 37 const bonusSystem = document.querySelector('.bonus-system'); 38 39 if (typeof result["bonusInfo"]["active"] !== 'undefined') { 40 if (result["bonusInfo"]["active"] + result["bonusInfo"]["express"] > 0) { 41 const html = ` 42 <div class="bonus-system__content"> 43 <p class="caption"> 44 <img src="/local/templates/mobile_updates/images/bonus.png" alt=""> 45 ÐÑпиÑе деÑевле на <span>${(result["bonusInfo"]["active"] + result["bonusInfo"]["express"]) > maxBonus ? maxBonus : result["bonusInfo"]["active"] + result["bonusInfo"]["express"]} <i class="fas fa-ruble-sign"></i></span> 46 </p> 47 <p class="m-0">ÐолÑÑи ÑÐºÐ¸Ð´ÐºÑ Ð¿Ñи оплаÑе в ÑозниÑном магазине</p> 48 </div>`; 49 } else { 50 const html = ``; 51 bonusSystem.style.display = 'none'; 52 } 53 54 55 bonusSystem.textContent = ''; 56 bonusSystem.insertAdjacentHTML('beforeend', html); 57 } else { 58 inputCard.placeholder = 'ÐаÑÑа не найдена'; 59 inputCard.classList.add('error'); 60 inputCard.value = ''; 61 62 form.style.display = 'flex'; 63 preloader.style.display = 'none'; 64 } 65 }); 66 } else { 67 inputCard.placeholder = 'ÐаÑÑа не найдена'; 68 inputCard.classList.add('error'); 69 inputCard.value = ''; 70 71 form.style.display = 'flex'; 72 preloader.style.display = 'none'; 73 } 74 }); 75 } 76 77 setBonusCardNumber = () => { 78 const cardNumber = Main.getCookie('user-bonus-card'); 79 const inputCard = document.querySelector('input.user-card'); 80 81 if (inputCard) { 82 if (cardNumber || inputCard.value) { 83 const checkBonus = document.querySelector('.user-bonus-check'); 84 85 this.sendUserCard(checkBonus.dataset.maxBonus); 86 } 87 } 88 } 89 checkBalance = event => { 90 const target = event.target.closest('.user-bonus-check'); 91 92 if (!target) 93 return; 94 95 const maxBonus = target.dataset.maxBonus; 96 97 event.preventDefault(); 98 99 this.sendUserCard(maxBonus); 100 } 101 102 listeners = { 103 DOMContentLoaded: [ 104 this.setBonusCardNumber, 105 ], 106 click: [ 107 this.checkBalance 108 ], 109 } 110 111 constructor() { 112 Main.addElementListeners(document, this.listeners); 113 } 114} 115 116new BonusSystem();
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.