1(function ($) { 2 const container = $('#reviewnews-reactions'); 3 if (!container.length) return; 4 5 container.find('button').on('click keydown', function (event) { 6 if (event.type === 'keydown' && event.key !== 'Enter') return; 7 8 const btn = $(this); 9 const reaction = btn.data('reaction'); 10 const postID = container.data('postid'); 11 12 // console.log('here we go'); 13 14 if (localStorage.getItem('reviewnews_reacted_' + postID + '_' + reaction)) { 15 showReactionToast(btn, reviewnewsReactions.alreadyReactedMsg || 'You already reacted.'); 16 return; 17 } 18 19 $.post(reviewnewsReactions.ajax_url, { 20 action: 'reviewnews_react', 21 nonce: reviewnewsReactions.nonce, 22 post_id: postID, 23 reaction: reaction 24 }, function (response) { 25 if (response.success) { 26 // Mark as reacted 27 localStorage.setItem('reviewnews_reacted_' + postID + '_' + reaction, '1'); 28 29 const counts = response.data.counts; 30 const total = response.data.total; 31 32 // Update each button percentage 33 container.find('button').each(function () { 34 const key = $(this).data('reaction'); 35 const count = counts[key] || 0; 36 const percentage = total > 0 ? Math.round((count / total) * 100) : 0; 37 $(this).find('.reaction-percentage').text(percentage + '%'); 38 }); 39 40 showReactionToast(btn, reviewnewsReactions.thankYouMsg || 'Thanks for reacting!'); 41 } else { 42 showReactionToast(btn, reviewnewsReactions.errorMsg || 'Error occurred.'); 43 } 44 }); 45 }); 46 47 function showReactionToast($target, message) { 48 const $toast = $('<div class="reviewnews-toast reviewnews-reaction-toast"></div>').text(message); 49 $('body').append($toast); 50 51 const offset = $target.offset(); 52 if (offset) { 53 $toast.css({ 54 top: offset.top - 40, 55 left: offset.left, 56 }); 57 } 58 59 setTimeout(() => $toast.fadeOut(300, () => $toast.remove()), 2000); 60 } 61})(jQuery);
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.