1( function( $ ) { 2 3 4 5 $( document ).ready(function() { 6 7 jQuery(".post-like a").on('click', function(e){ 8 e.preventDefault(); 9 10 var heart = jQuery(this); 11 12 // Retrieve post ID from data attribute 13 var post_id = heart.data("post_id"); 14 var post_grandparent = heart.parents().eq(1); 15 var post_name = post_grandparent.find('h3').text(); 16 var popupValue = post_id + ' - ' + post_name; 17 18 $.ajax({ 19 type: "post", 20 url: cookie_test_obj.ajaxurl, 21 data: { 22 'action': 'cookie_test', 23 'resource_id': post_id, 24 }, 25 success: function (data) { 26 // This outputs the result of the ajax request 27 var cookie_name = 'safespace-' + post_id; 28 var cookie_value = 'voted'; 29 var cookie_name_form = 'safespace-vote-form-' + post_id; 30 var cookie_value_form = 'seen'; 31 32 33 if(Cookies.get(cookie_name) !== cookie_value){ 34 //console.log('new cookie set'); 35 //console.log(data); 36 heart.addClass("voted"); 37 heart.siblings(".count").html(data); 38 $('.wpcf7-hidden.safespaceResource').val(popupValue); 39 if(Cookies.get(cookie_name_form) !== cookie_value_form){ 40 $('.safespace__popup__container').fadeIn(); 41 Cookies.set(cookie_name_form, cookie_value_form, { expires: 365 }); 42 } 43 Cookies.set(cookie_name, cookie_value, { expires: 365 }); 44 }else{ 45 //console.log('cookie was previously set'); 46 //console.log(data); 47 heart.removeClass("voted"); 48 heart.siblings(".count").html(data); 49 Cookies.remove(cookie_name); 50 } 51 52 53 }, 54 error: function (errorThrown) { 55 //console.log(errorThrown); 56 } 57 }); 58 59 }); 60 61 //console.log( "ready!" ); 62 $(".like_functionality_button").each(function(){ 63 var post_id = $(this).data("post_id"); 64 var cookie_name = 'safespace-' + post_id; 65 if(Cookies.get(cookie_name)) { 66 $(this).addClass("voted"); 67 } 68 }); 69 70 71 $('#privacy-alert').click(function(e){ 72 e.preventDefault(); 73 $(this).fadeOut(300,function(){ 74 $(this).remove(); 75 Cookies.set('privacy-policy', 'seen', { expires: 365 }); 76 }); 77 }); 78 }); 79 80 81} )( 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.