1// Requires popper.min.js, tippy-bundle.js 2 3document.addEventListener('DOMContentLoaded', function () { 4 initPriceInfo(); 5}); 6 7function initPriceInfo() { 8 const priceInfoElements = document.querySelectorAll('.price-info'); 9 10 priceInfoElements.forEach(function (el) { 11 const link = el.querySelector('.toggle-info'); 12 const button = link; 13 const pop = link.nextElementSibling; 14 const inputNumEl = el.closest('tr').querySelector('.input-num'); 15 16 // Ð¡Ð¾Ñ ÑанÑем ÑÑÑÐ»ÐºÑ Ð½Ð° handler Ð´Ð»Ñ Ð¾ÑиÑÑки 17 let clickHandler = null; 18 19 tippy(button, { 20 theme: 'light', 21 content: pop.innerHTML, 22 allowHTML: true, 23 trigger: 'click', 24 arrow: false, 25 interactive: true, 26 onShown(instance) { 27 const popup = instance.popper.querySelector('.price-info-popup'); 28 29 // Создаем handler 30 clickHandler = function (e) { 31 const btn = e.target.closest('li > .btn'); 32 if (!btn) return; 33 34 const li = btn.closest('li'); 35 const num = parseInt(li.dataset.min); 36 37 if (inputNumEl && inputNumEl.stepperInstance) { 38 inputNumEl.stepperInstance.input.value = num; 39 inputNumEl.stepperInstance._lastValue = String(num); 40 inputNumEl.stepperInstance.updateStates(); 41 inputNumEl.stepperInstance.updateButtons(); 42 inputNumEl.stepperInstance.updatePrice(); 43 } 44 45 instance.hide(); 46 }; 47 48 // ÐобавлÑем обÑабоÑÑик 49 popup.addEventListener('click', clickHandler); 50 }, 51 onHidden(instance) { 52 // УдалÑем обÑабоÑÑик пÑи закÑÑÑии попапа 53 const popup = instance.popper.querySelector('.price-info-popup'); 54 if (popup && clickHandler) { 55 popup.removeEventListener('click', clickHandler); 56 } 57 } 58 }); 59 }); 60}
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.