1class DzmCouponCopy{ 2 constructor() { 3 this.couponWrapper = [] 4 this.selectors = { 5 wrapperSelector: '[data-dzm-cc-wrapper]', 6 confirmSelector: '[data-dzm-cc-copy-confirmation]', 7 copyBtnSelector: '[data-dzm-cc-copy-btn]', 8 couponCodeSelector: '[data-dzm-cc-coupon-code]' 9 } 10 } 11 12 init(){ 13 this.couponWrapper = document.querySelectorAll(this.selectors.wrapperSelector) 14 15 this.couponWrapper.forEach(wrapper=>{ 16 let confi = wrapper.querySelector(this.selectors.confirmSelector) 17 let btn = wrapper.querySelector(this.selectors.copyBtnSelector) 18 let coupon = wrapper.querySelector(this.selectors.couponCodeSelector) 19 20 if(btn){ 21 btn.addEventListener('click',()=>{ 22 this.copyCoupon(coupon,confi) 23 }) 24 } 25 }) 26 } 27 28 copyCoupon(coupon, confi){ 29 console.log(coupon) 30 navigator.clipboard.writeText(coupon.innerText).then(r => { 31 confi.style.opacity = "1"; 32 setTimeout(()=>{ 33 confi.style.opacity = 0 34 },1200) 35 }) 36 37 } 38} 39 40document.addEventListener('DOMContentLoaded',()=>{ 41 (new DzmCouponCopy()).init() 42})
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.