1/** 2 * Omnipress WooCommerce JS 3 */ 4 5(function () { 6 7 // Append Quantity Increment / Decrement Buttons 8 function gadgethub_add_inc_dec() { 9 // select all quantity div 10 const qtyDiv = document.querySelectorAll('.quantity'); 11 12 qtyDiv.forEach(wrap => { 13 const incdecWrap = document.createElement('div'); 14 incdecWrap.className = 'op-qty-incdec-wrap'; 15 incdecWrap.innerHTML = ` 16 <div class="op-btn-qty q_inc">+</div> 17 <div class="op-btn-qty q_dec">-</div> 18 `; 19 wrap.appendChild(incdecWrap); 20 }); 21 } 22 23 // Handle IncDec values 24 function gadgethub_handle_quantity() { 25 26 const qtyWrapper = document.querySelectorAll('.quantity'); 27 28 qtyWrapper.forEach((el) => { 29 const incdecBox = el.querySelector('.op-qty-incdec-wrap'); 30 const input = el.querySelector('.qty'); 31 32 incdecBox.addEventListener('click', (e) => { 33 if (!e.target.classList.contains('op-btn-qty')) return; 34 35 let oldValue = parseInt(input.value); 36 37 if (isNaN(oldValue)) { 38 oldValue = 0; 39 } 40 41 input.value = e.target.classList.contains('q_inc') ? oldValue + 1 : Math.max(oldValue - 1, 0); 42 input.dispatchEvent(new Event('change', { bubbles: true })); 43 }); 44 45 }); 46 47 } 48 49 50 window.addEventListener('load', function () { 51 52 gadgethub_add_inc_dec(); 53 gadgethub_handle_quantity(); 54 55 document.addEventListener('mousemove', function () { 56 if (!document.querySelector('.op-btn-qty')) { 57 gadgethub_add_inc_dec(); 58 gadgethub_handle_quantity(); 59 } 60 }); 61 62 // Change Product add to cart button text 63 const atcBtns = document.querySelectorAll('.add_to_cart_button'); 64 if (atcBtns !== null) { 65 atcBtns.forEach((atcBtn) => { 66 atcBtn.addEventListener('click', function () { 67 atcBtn.innerHTML = 'added to cart'; 68 }); 69 }); 70 } 71 72 }); 73 74})();
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.