PageSourceSearch

https://svm31.ru/wp-content/plugins/posts-like-dislike/js/pld-frontend.js?ver=1.1.6

js svm31.ru collected 2026-10-05 03:42:03 UTC 4,695 bytes, 113 lines download raw bytes

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

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.