1( function( $ ) { 2 'use strict'; 3 $( document ).on( 'click', '[data-role="simple-like-button"]', function() { 4 var button = $( this ); 5 var post_id = button.attr( 'data-post-id' ); 6 var security = button.attr( 'data-nonce' ); 7 8 if ( post_id !== '' ) { 9 $.ajax({ 10 type: 'POST', 11 url: WPHaswellSimpleLike.ajaxurl, 12 data: { 13 action: 'process_simple_like', 14 post_id: post_id, 15 nonce: security 16 }, 17 beforeSend: function() { 18 button.addClass( 'loading' ); 19 }, 20 success: function( response ) 21 { 22 console.log( response ); 23 button.html( response.count ); 24 if ( response.status === 'unliked' ) 25 { 26 var like_text = WPHaswellSimpleLike.like; 27 button.prop( 'title', like_text ); 28 button.removeClass( 'liked' ); 29 } 30 else 31 { 32 var unlike_text = WPHaswellSimpleLike.unlike; 33 button.prop( 'title', unlike_text ); 34 button.addClass( 'liked' ); 35 } 36 button.removeClass( 'loading' ); 37 } 38 }); 39 40 } 41 return false; 42 }); 43})( 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.