PageSourceSearch

https://bembimama.ru/wp-content/plugins/wordpress-23-related-posts-plugin/static/js/pinterest.js?ver=3.6.4

js bembimama.ru collected 2026-09-30 02:58:31 UTC 7,358 bytes, 250 lines download raw bytes

1(function () {
2	var ZemRPResponse = [];
3	if (window.jQuery) {
4		jQuery(function ($) {
5			window._wp_rp_request_id = window._wp_rp_request_id || ((new Date().getTime() % 60466176) / 60466176).toString(36).substr(2,5) + Math.random().toString(36).substr(2,10); // 60466176 = 36 ^ 5
6
7			var scrollTimeout = 0,
8				win = $(window),
9				fetching_first_time = window._wp_rp_num_rel_posts * 1 || 5,
10				fetching = fetching_first_time * 2,
11				is_first_time = true,
12				related = $('.wp_rp.related_post'),
13				loading = false,
14				stop = false,
15				originalRPHeight = 2 * related.outerHeight(true),
16
17				from = fetching_first_time,
18
19				push_stats = function (action, extra_params) {
20					var img = document.createElement('img');
21					var params = {
22							action: action,
23							post_id: window._wp_rp_post_id,
24							request_id: window._wp_rp_request_id,
25							_: (+new Date())
26						};
27					var ajax_query = [];
28					var ajax_url = window._wp_rp_static_base_url + 'stats.gif?';
29
30					if (extra_params) {
31						for (var attrname in extra_params) {
32							if (extra_params.hasOwnProperty(attrname)) {
33								params[attrname] = extra_params[attrname];
34							}
35						}
36					}
37
38					for(x in params) {
39						if (params.hasOwnProperty(x)) {
40							ajax_query.push(x + '=' + params[x]);
41						}
42					}
43
44					ajax_url += ajax_query.join('&');
45
46					img.src = ajax_url;
47				},
48				getNextSet = function () {
49					if (ZemRPResponse.length <= 0) {
50						$('#wp_rp_related_load_more').parent().remove();
51						return [];
52					}
53					var i = 0, result = [], next = {};
54					for (; i < (is_first_time ? fetching_first_time : fetching); i += 1) {
55						next = ZemRPResponse.shift();
56						if (next) {
57							result.push(next);
58						}
59					}
60					is_first_time = false;
61					return result;
62				},
63				fillList = function (cb) {
64					if (stop && ZemRPResponse.length <= 0) {
65						$('#wp_rp_related_load_more').parent().remove();
66					}
67					if (loading || stop) {
68						return;
69					}
70
71					loading = true;
72					$.getJSON(window._wp_rp_wp_ajax_url + '?action=wp_rp_load_articles&post_id=' + window._wp_rp_post_id + '&from=' + from + '&count=50&size=full', function (data) {
73						if (!data || !data.length || typeof(data) === 'string') {
74							stop = true;
75							if (ZemRPResponse.length <= 0) {
76								$('#wp_rp_related_load_more').parent().remove();
77							}
78						} else {
79							from += data.length;
80							$.each(data, function (i, newOne) {
81								ZemRPResponse.push(newOne);
82							});
83							if (cb) {
84								cb();
85							}
86						}
87						loading = false;
88					});
89				},
90				fetchRelated = function (cb) {
91					if (ZemRPResponse.length <= 0) {
92						fillList(function () {
93							cb(getNextSet());
94						});
95					} else if (ZemRPResponse.length <= (2 * fetching)) {
96						cb(getNextSet());
97						fillList();
98					} else {
99						cb(getNextSet());
100					}
101				},
102				loadMoreRelated = function () {
103					fetchRelated(function (data) {
104						setTimeout(function () {
105							$('#wp_rp_related_load_more')
106								.find('.zloader').hide().end()
107								.find('span').show();
108						}, 500);
109
110						var postContainer = $('.related_post.wp_rp'),
111							nextPosition = postContainer.find('li ul li').length,
112							prevImg = null,
113							columns = postContainer.find('.wp_rp_related_post_column'),
114							appendArticle = function (newElm, newImg) {
115								var shortest = $();
116
117								columns.each(function (i, column) {
118									column = $('ul', column);
119
120									if (shortest.height() === null || shortest.height() >= column.height()) {
121										shortest = column;
122									}
123								});
124
125								shortest.append(newElm);
126							},
127							loadArticle = function (i, newElm, prevImg, newImg) {
128								setTimeout(function () {
129									if (!prevImg || !prevImg.length || prevImg.data('zloaded')) {
130										appendArticle(newElm, newImg);
131									} else {
132										prevImg
133											.load(function () {appendArticle(newElm, newImg);})
134											.error(function () {appendArticle(newElm, newImg);});
135									}
136								}, 75 * i);
137							};
138
139						$.each(data, function (i, post) {
140							var newImg = $(post.img);
141							newImg
142								.load(function () {$(this).data('zloaded', true)})
143								.error(function () {$(this).data('zloaded', true)});
144
145							var newElm = $('<li data-position="' + nextPosition + '" data-poid="' + post.id + '"><a href="' + post.url + '" class="wp_rp_thumbnail"></a><a href="' + post.url + '" class="wp_rp_title">
145' + post.title + '</a></li>');
146							newElm.data('position', nextPosition);
147							newElm.data('poid', post.id);
148							newElm.find('.wp_rp_thumbnail').append(newImg);
149
150							nextPosition += 1;
151
152							loadArticle(i, newElm, prevImg, newImg);
153
154							prevImg = newImg;
155						});
156					});
157				},
158				scrollHandler = function () {
159					if (scrollTimeout) {
160						clearTimeout(scrollTimeout);
161					}
162					scrollTimeout = setTimeout(function () {
163						var postContainer = $('.related_post.wp_rp'),
164							fromBottom = postContainer.offset().top + postContainer.outerHeight(true) - win.scrollTop() - win.height();
165
166						if (fromBottom + 100 < originalRPHeight) { // before the user scrolls below this threshold, load more
167							loadMoreRelated();
168						}
169					}, 150);
170				},
171				initScrollHandler = function () {
172					scrollHandler();
173					$(window).bind('scroll.zloader', function () {
174						if (is_first_time) {
175							scrollHandler();
176						} else {
177							$(window).unbind('scroll.zloader');
178						}
179					});
180				},
181				preparseRelatedPosts = function () {
182					var max_left = -1,
183						columns = [],
184						column_count = 0;
185
186					related.find('li').each(function (i, column) {
187						column = $(column);
188						column.children().find('img').data('zloaded', true);
189
190						var id = column.data('poid');
191						var position = column.data('position');
192						var post_type = column.data('post-type');
193						var class_name = column.attr('class');;
194
195						var first = $('<li class="' + class_name + '" data-post-type="' + post_type + '" data-position="' + position + '" data-poid="' + id + '"></li>');
196						var left = column.offset().left;
197
198						if (left > max_left) {
199							max_left = left;
200							column_count += 1;
201						}
202
203						var column_idx = i % column_count;
204
205						first.append(column.children());
206
207						if (columns[column_idx]) {
208							columns[column_idx].find('ul').append(first);
209							column.remove();
210						} else {
211							column.empty();
212							column.attr('data-position', null);
213							column.attr('data-poid', null);
214							column.attr('data-post-type', null);
215
216							column.addClass('wp_rp_related_post_column');
217							column.addClass('wp_rp_special');
218
219							column.append('<ul></ul>');
220							column.find('ul').append(first);
221
222							columns[column_idx] = column;
223						}
224					});
225
226					initScrollHandler();
227				};
228
229
230			preparseRelatedPosts();
231			fillList();
232
233			related.append($('<li class="wp_rp_related_post_load_more wp_rp_special">' +
234						'<a id="wp_rp_related_load_more" href="#">' +
235							'<span>Load more posts</span>' +
236							'<img src="' + window._wp_rp_static_base_url + 'img/loading.gif" class="zloader" />' +
237						'</a>' +
238					'</li>'));
239
240			related.find('#wp_rp_related_load_more').click(function (ev) {
241				$('span', this).hide();
242				$('.zloader', this).show();
243
244				ev.preventDefault();
245				loadMoreRelated();
246				push_stats('pinterest-load-more');
247			});
248		});
249	}
250}());

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.