1jQuery(document).ready(function ($) { 2 $(".pint-thumb").on("click", function () { 3 const isUseful = $(this).hasClass("pint-thumb-up"); 4 const postId = $("body") 5 .attr("class") 6 .match(/postid-(\d+)/)[1]; 7 8 // Disable both buttons while processing 9 $(".pint-thumb").css("pointer-events", "none"); 10 11 $.ajax({ 12 url: "/wp-json/pint/v1/post-usefulness/" + postId, 13 method: "POST", 14 data: JSON.stringify({ is_useful: isUseful }), 15 contentType: "application/json", 16 beforeSend: function (xhr) { 17 xhr.setRequestHeader("X-WP-Nonce", wpApiSettings.nonce); 18 }, 19 success: function (response) { 20 if (response.success) { 21 // Add active class to clicked button 22 $(".pint-thumb").removeClass("active"); 23 $(this).addClass("active"); 24 25 // Show thank you message as toast 26 const Toast = Swal.mixin({ 27 toast: true, 28 position: "top-end",
29 showConfirmButton: false, 30 timer: 2000, 31 timerProgressBar: true, 32 }); 33 34 Toast.fire({ 35 icon: "success", 36 title: "¡Gracias por tu valoración!", 37 }); 38 } 39 }.bind(this), 40 error: function () { 41 const Toast = Swal.mixin({ 42 toast: true, 43 position: "top-end", 44 showConfirmButton: false, 45 timer: 4000, 46 timerProgressBar: true, 47 }); 48 49 Toast.fire({ 50 icon: "info", 51 title: "Ya valoraste este artÃculo", 52 confirmButtonColor: "#007bff", 53 }); 54 }, 55 complete: function () { 56 // Re-enable buttons 57 $(".pint-thumb").css("pointer-events", "auto"); 58 }, 59 }); 60 }); 61});
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.