1(function($){ 2 3 "use strict"; 4 5 // Yes / No 6 $("#wthf-yes-no span").click(function(){ 7 8 // Getting value 9 var value = parseInt($(this).attr("data-value")); 10 var postID = $("#was-this-helpful").attr("data-post-id"); 11 12 // Cant send ajax 13 if(getCookie("helpful_id_"+postID)){ 14 return false; 15 } 16 17 // Send Ajax 18 $.post(ajaxurl, {action: "wthf_ajax", id: postID, val: value, nonce: nonce_wthf}).done(function(data){ 19 setCookie("helpful_id_"+postID, "1"); 20 }); 21 22 // Disable and show a thank message 23 setTimeout(function(){ 24 $("#was-this-helpful").addClass("wthf-disabled"); 25 }, 20); 26 27 }); 28 29 30 // Set Cookie 31 function setCookie(name, value) { 32 var expires = ""; 33 var date = new Date(); 34 date.setTime(date.getTime() + (365*24*60*60*1000)); 35 expires = "; expires=" + date.toUTCString(); 36 document.cookie = name + "=" + (value || "") + expires + "; path=/"; 37 } 38 39 40 // Get Cookie 41 function getCookie(name) { 42 var nameEQ = name + "="; 43 var ca = document.cookie.split(';'); 44 for(var i=0;i < ca.length;i++) { 45 var c = ca[i]; 46 while (c.charAt(0)==' ') c = c.substring(1,c.length); 47 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); 48 } 49 return null; 50 } 51 52 53})(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.