1// source --> https://flyondrej.eu/wp-content/plugins/posts-like-dislike/js/pld-frontend.js?ver=1.1.6 2function pld_setCookie(cname, cvalue, exdays) { 3 var d = new Date(); 4 d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000)); 5 var expires = "expires=" + d.toUTCString(); 6 document.cookie = cname + "=" + cvalue + "; " + expires; 7} 8 9function pld_getCookie(cname) { 10 var name = cname + "="; 11 var ca = document.cookie.split(';'); 12 for (var i = 0; i < ca.length; i++) { 13 var c = ca[i]; 14 while (c.charAt(0) == ' ') { 15 c = c.substring(1); 16 } 17 if (c.indexOf(name) == 0) { 18 return c.substring(name.length, c.length); 19 } 20 } 21 return ""; 22} 23 24jQuery(document).ready(function ($) { 25 var ajax_flag = 0; 26 $('body').on('click', '.pld-like-dislike-trigger', function () { 27 if (ajax_flag == 0) { 28 var restriction = $(this).data('restriction'); 29 var post_id = $(this).data('post-id'); 30 var trigger_type = $(this).data('trigger-type'); 31 var selector = $(this); 32 var current_count = selector.closest('.pld-common-wrap').find('.pld-count-wrap').html(); 33 var already_liked = selector.data('already-liked'); 34 35 if (already_liked == 0) { 36 $.ajax({
37 type: 'post', 38 url: pld_js_object.admin_ajax_url, 39 data: { 40 post_id: post_id, 41 action: 'pld_post_ajax_action', 42 type: trigger_type, 43 _wpnonce: pld_js_object.admin_ajax_nonce 44 }, 45 beforeSend: function (xhr) { 46 ajax_flag = 1; 47 48 }, 49 success: function (res) { 50 ajax_flag = 0; 51 res = $.parseJSON(res); 52 if (res.success) { 53 var cookie_name = 'pld_' + post_id; 54 var latest_count = res.latest_count; 55 selector.closest('.pld-common-wrap').find('.pld-count-wrap').html(latest_count); 56 if (restriction != 'no') { 57 selector.closest('.pld-like-dislike-wrap').find('a').data('already-liked', 1); 58 selector.addClass('pld-undo-trigger'); 59 selector.closest('.pld-like-dislike-wrap').find('.pld-like-dislike-trigger').addClass('pld-prevent'); 60 } 61 } 62 } 63 64 }); 65 } 66 } 67 }); 68 69 70 $('.pld-like-dislike-wrap br,.pld-like-dislike-wrap p').remove(); 71 72 $('body').on('click', '.pld-undo-trigger', function () { 73 if (ajax_flag == 0) { 74 var selector = $(this); 75 var post_id = $(this).data('post-id'); 76 var trigger_type = $(this).data('trigger-type'); 77 var current_count = selector.closest('.pld-common-wrap').find('.pld-count-wrap').html(); 78 var like_dislike_flag = 1; 79 var already_liked = $(this).data('already-liked'); 80 var restriction_type = $(this).data('restriction'); 81 if (already_liked == 1) { 82 $.ajax({
83 type: 'post', 84 url: pld_js_object.admin_ajax_url, 85 data: { 86 post_id: post_id, 87 action: 'pld_post_undo_ajax_action', 88 type: trigger_type, 89 _wpnonce: pld_js_object.admin_ajax_nonce 90 }, 91 beforeSend: function (xhr) { 92 ajax_flag = 1; 93 }, 94 success: function (res) { 95 ajax_flag = 0; 96 res = $.parseJSON(res); 97 if (res.success) { 98 var latest_count = res.latest_count; 99 selector.closest('.pld-common-wrap').find('.pld-count-wrap').html(latest_count); 100 if (restriction_type != 'no') { 101 selector.closest('.pld-like-dislike-wrap').find('.pld-like-dislike-trigger').data('already-liked', 0); 102 selector.removeClass('pld-undo-trigger'); 103 selector.closest('.pld-like-dislike-wrap').find('.pld-like-dislike-trigger').removeClass('pld-prevent'); 104 } 105 } 106 } 107 108 }); 109 } 110 } 111 }); 112 113 114});
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.