1jQuery(document).ready( function($) { 2 $('.love-it').on('click', function() { 3 var $this = $(this); 4 var post_id = $this.data('post-id'); 5 var user_id = $this.data('user-id'); 6 var data = { 7 action: 'love_it', 8 item_id: post_id, 9 user_id: user_id, 10 love_it_nonce: love_it_vars.nonce 11 }; 12 13 // don't allow the user to love the item more than once 14 if($this.hasClass('loved')) { 15 alert(love_it_vars.already_loved_message); 16 return false; 17 } 18 if(love_it_vars.logged_in == 'false' && $.cookie('loved-' + post_id)) { 19 alert(love_it_vars.already_loved_message); 20 return false; 21 } 22 23 $.post(love_it_vars.ajaxurl, data, function(response) { 24 var ajaxResponse = jQuery.trim(response); 25 if(ajaxResponse == 'loved') { 26 $this.addClass('loved'); 27 var count_wrap = $this.next(); 28 var count = count_wrap.text(); 29 count_wrap.text(parseInt(count) + 1); 30 if(love_it_vars.logged_in == 'false') { 31 $.cookie('loved-' + post_id, 'yes', { expires: 1 }); 32 } 33 } else { 34 alert(love_it_vars.error_message); 35 } 36 }); 37 return false; 38 }); 39});
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.