1(function($, undefined) { 2 'use strict'; 3 4 $(function() { 5 if(!love_it_vars.logged_in) { 6 $('.love-it').each(function() { 7 if( $.cookie('loved-' + $(this).data('post-id')) ) { 8 $(this).parent().prepend( '<span class="loved"><span class="loved-text">' + love_it_vars.already_loved_message + '</span>'); 9 $(this).remove(); 10 } 11 }); 12 } 13 14 $('body').on('click', '.love-it', function() { 15 var $this = $(this); 16 17 var post_id = $this.data('post-id'); 18 var user_id = $this.data('user-id'); 19 var post_data = { 20 action: 'love_it', 21 item_id: post_id, 22 user_id: user_id, 23 love_it_nonce: love_it_vars.nonce 24 }; 25 26 if($this.hasClass('loved') || (!love_it_vars.logged_in && $.cookie('loved-' + post_id))) { 27 alert(love_it_vars.already_loved_message); 28 return false; 29 } 30 31 $.post(love_it_vars.ajaxurl, post_data, function(response) { 32 if(response === 'loved') { 33 $this.addClass('loved'); 34 var count_wrap = $this.next(); 35 var count = count_wrap.text(); 36 count_wrap.text(parseInt(count, 10) + 1); 37 38 if(!love_it_vars.logged_in) { 39 $.cookie('loved-' + post_id, 'yes', { expires: 1 }); 40 } 41 } else { 42 alert(love_it_vars.error_message); 43 } 44 }); 45 return false; 46 }); 47 }); 48})(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.