1document.addEventListener('click', function (e) { 2 const button = e.target.closest('.js-poll-vote'); 3 if (!button) return; 4 5 const wrapper = button.closest('.acf-poll-box'); 6 if (!wrapper) return; 7 8 if (wrapper.classList.contains('is-loading')) return; 9 10 const pollId = wrapper.dataset.pollId; 11 const answerIndex = button.dataset.answerIndex; 12 13 if (!pollId || typeof answerIndex === 'undefined') return; 14 15 wrapper.classList.add('is-loading'); 16 17 const formData = new FormData(); 18 formData.append('action', 'basketa_submit_poll_vote'); 19 formData.append('nonce', BasketaPoll.nonce); 20 formData.append('poll_id', pollId); 21 formData.append('answer_index', answerIndex); 22 23 fetch(BasketaPoll.ajax_url, { 24 method: 'POST', 25 body: formData, 26 credentials: 'same-origin' 27 }) 28 .then(function (response) { 29 return response.json(); 30 }) 31 .then(function (data) { 32 33 wrapper.classList.remove('is-loading'); 34 35 if (!data.success) { 36 37 alert( 38 data.data && data.data.message 39 ? data.data.message 40 : BasketaPoll.error 41 ); 42 43 return; 44 } 45 46 if (data.data && data.data.html) { 47 wrapper.outerHTML = data.data.html; 48 } 49 50 }) 51 .catch(function () { 52 alert(BasketaPoll.error); 53 wrapper.classList.remove('is-loading'); 54 }); 55});
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.