PageSourceSearch

https://promzn.ru/wp-content/plugins/custom-blocks/js/client.js

js promzn.ru collected 2026-10-02 20:45:49 UTC 7,456 bytes, 207 lines download raw bytes

1var postids;
2chest = new Object;
3var containers = new Array();
4var reveal_close=false;
5var showing_modal_window=null;
6var show_modal=false;
7
8var custom_block = function (id, container_id, post)
9{
10    if (typeof (postids) == 'undefined')
11    {
12        postids = post;
13    }
14    if (typeof (chest[id]) == 'undefined')
15    {
16        chest[id] = new Object;
17    }
18    chest[id][container_id] = container_id;
19    containers.push(container_id);
20}
21
22jQuery(document).ready(function ($) {
23    var wordpress_poping = parseInt($.cookie('wordpress_poping'));
24    if (wordpress_poping)
25    {
26        $.cookie('wordpress_poping', wordpress_poping + 1, {expires: 1, path: '/'});
27    } else {
28        $.cookie('wordpress_poping', '1', {expires: 1, path: '/'});
29    }
30
31    function blocked_modal() {
32        if ($('.reveal-modal>p').length > 0) {
33            $.each($('.reveal-modal'), function (ind, ind_val) {
34                if ($(this).find('p').html().length<1)
35                {
36                    $('.reveal-modal').plainModal('close');
37                    reveal_close=true;
38                    showing_modal_window=false;
39                }
40            });
41        }
42        if (showing_modal_window===null)
43        {
44            showing_modal_window=true;
45            
46        }
47    }
48
49    if (containers.length > 0)
50    {
51        if (!Date.now) {
52            Date.now = function () {
53                return new Date().getTime();
54            }
55        }
56        var timestamp = Math.floor(Date.now() / 1000);
57        var date = new Date();
58        var now = date.getHours() + ':' + date.getMinutes();
59        $.ajax({
60            type: 'POST',
61            url: '/wp-admin/admin-ajax.php',
62            data: {
63                action: 'get_block',
64                chest: chest,
65                post_id: postids,
66                width: $(window).width(),
67                height: $(window).height(),
68                block: typeof n_o_a_d_b_l_o_c_k == 'undefined',
69                time: now
70            },
71            success: function (data) {
72                if (containers.length > 0)
73                {
74                    containers.forEach(function (items, i, arr) {
75                        var div = data[items]['text'];
76                        $('#custom-block-' + items).removeAttr("id").replaceWith(div);
77//                        $('#custom-block-' + items).click(function () {
78//                            var item = $(this);
79//                            $.post('/wp-admin/admin-ajax.php',
80//                                    {
81//                                        action: 'click_block',
82//                                        id: $(this).attr('rel'),
83//                                    }
84//                            );
85//
86//
87//                        });
88                    });
89                    set_new_cookie(data, chest);
90                    blocked_modal();
91                }
92
93            },
94            error: function (response) {
95            },
96            dataType: 'json'
97        });
98    } else {
99        blocked_modal();
100    }
101    $(document).on('click', '.' + ajax_object.class_block, function () {
102        $.post('/wp-admin/admin-ajax.php',
103                {
104                    action: 'click_block',
105                    id: $(this).attr('rel')
106                }
107        );
108    });
109
110
111    $(".image_onhover").each(function () {
112        var height = 0;
113        var width = 0;
114        $(this).find('img').each(function () {
115            if ($(this).attr('height') > height) {
116                height = $(this).attr('height');
117            }
118            if ($(this).width() > width) {
119                width = $(this).width();
120            }
121        });
122        var now_img_play = $(this).find('img.hovered_play_icon');
123        now_img_play.removeAttr("width")
124                .removeAttr("height")
125                .css({width: "", height: ""});
126        if (height > 0)
127        {
128            $(this).height(height);
129            $(this).find('.text-content-on-image').height(height);
130
131            var height_play = now_img_play.height();
132            if (height_play > 0)
133            {
134                var tmp = parseInt(height) / 2 - (parseInt(height_play) / 2);
135                now_img_play.css({top: tmp + "px"});
136            }
137
138        }
139        if (width > 0)
140        {
141            $(this).width(width);
142            $(this).find('.text-content-on-image').width(width);
143
144            var width_play = now_img_play.width();
145            if (width_play > 0)
146            {
147                var tmp = parseInt(width) / 2 - (parseInt(width_play) / 2);
148                now_img_play.css({left: tmp + "px"});
149            }
150        }
151    });
152
153    $("body").on("mouseenter", '.image_onhover', function () {
154        $(this).find('.hovered_play_icon').hide();
155    });
156    $("body").on("mouseout", '.image_onhover', function () {
157        $(this).find('.hovered_play_icon').show();
158    });
159
160    function set_new_cookie(data, chests) {
161        var count_add_to_wcs = new Object();
162        count_add_to_wcs.last = {};
163        $.each(chests, function (index_elem, elem) {
164            $.each(elem, function (index_code) {
165                if (data[index_code]['id'] !== '') {
166                    if (typeof (count_add_to_wcs[index_elem]) === 'undefined')
167                    {
168                        count_add_to_wcs[index_elem] = {};
169                    }
170                    count_add_to_wcs[index_elem][data[index_code]['id']] = 1;
171                    count_add_to_wcs.last[index_elem] = data[index_code]['id'];
172                }
173            });
174        });
175        if ($.cookie('wordpress_custom_setting'))
176        {
177            var cookies_getting = JSON.parse(window.atob($.cookie('wordpress_custom_setting')));
178            if (cookies_getting.length > 0)
179            {
180                var both_object = $.extend(true, cookies_getting, count_add_to_wcs);
181                $.each(both_object, function (index_elem) {
182                    $.each(both_object[index_elem], function (index_code) {
183                        if (index_elem !== 'last')
184                        {
185                            var summary = 0;
186                            if (typeof (count_add_to_wcs[index_elem]) !== 'undefined' && typeof (count_add_to_wcs[index_elem][index_code]) !== 'undefined')
187                            {
188                                summary++;
189                            }
190                            if (typeof (cookies_getting[index_elem]) !== 'undefined' && typeof (cookies_getting[index_elem][index_code]) !== 'undefined')
191                            {
192                                summary = summary + cookies_getting[index_elem][index_code];
193                            }
194                            if (typeof (count_add_to_wcs[index_elem]) === 'undefined')
195                            {
196                                count_add_to_wcs[index_elem] = {};
197                            }
198                            count_add_to_wcs[index_elem][index_code] = summary;
199                        }
200                    });
201                });
202            }
203        }
204        var save_to_cookie = JSON.stringify(count_add_to_wcs);
205        $.cookie('wordpress_custom_setting', window.btoa(save_to_cookie), {expires: 1, path: '/'});
206    }
207});

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.