1(function( $ ) { 2 'use strict'; 3 $(document).on('click', '.perch-button', function() { 4 var button = $(this); 5 var post_id = button.attr('data-post-id'); 6 var security = button.attr('data-nonce'); 7 var iscomment = button.attr('data-iscomment'); 8 var allbuttons; 9 if ( iscomment === '1' ) { /* Comments can have same id */ 10 allbuttons = $('.perch-comment-button-'+post_id); 11 } else { 12 allbuttons = $('.perch-button-'+post_id); 13 } 14 var icon_old_class = button.find('i').attr('class'); 15 var icon_loader_class = button.attr('data-icon_loader_class'); 16 var icon_like_class = button.attr('data-icon_like_class'); 17 var icon_unlike_class = button.attr('data-icon_unlike_class'); 18 19 20 var loader = allbuttons.next('#perch-loader'); 21 if (post_id !== '') { 22 $.ajax({ 23 type: 'POST', 24 url: pplv.ajaxurl, 25 data : { 26 action : 'process_simple_like', 27 post_id : post_id, 28 nonce : security, 29 is_comment : iscomment, 30 }, 31 beforeSend:function(){ 32 button.find('i').attr('class', icon_loader_class); 33 }, 34 success: function(response){ 35 var icon = response.icon; 36 var count = response.count; 37 allbuttons.html(icon+count); 38 39 button.find('i').attr('class', icon_old_class); 40 41 if(response.status === 'unliked') { 42 var like_text = pplv.like; 43 allbuttons.prop('title', like_text); 44 allbuttons.removeClass('liked'); 45 button.find('i').attr('class', icon_unlike_class); 46 } else { 47 var unlike_text = pplv.unlike; 48 allbuttons.prop('title', unlike_text); 49 allbuttons.addClass('liked'); 50 button.find('i').attr('class', icon_like_class); 51 } 52 53 54 } 55 }); 56 57 } 58 return false; 59 }); 60})( 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.