PageSourceSearch

https://cdn.iz.ru/profiles/portal/themes/purple/js/page-photo.js?tlrtsy

js iz.ru collected 2026-09-27 20:54:38 UTC 16,378 bytes, 396 lines download raw bytes

1
2	// if (typeof viewsUpdater == "undefined")
3	// {
4	// 	function viewsUpdater() {
5	// 		console.log('page_photo');
6	// 		if (window.location.host == 'iz.ru')
7	// 		{
8	// 		  var timer, incrInterval;
9	// 		  var viewsCounters = jQuery('.article_page__left__top__views__label');
10
11	// 		  if (viewsCounters.length) {
12	// 		    timer = window.setInterval(function() {
13	// 		      jQuery(viewsCounters).each(function(){
14	// 		        var current_counter_block = jQuery(this);
15	// 		        if (current_counter_block.offset().top > jQuery(window).scrollTop() - Number(jQuery(window).height()) * 0.25 && current_counter_block.offset().top < Number(jQuery(window).height()) + Number(jQuery(window).scrollTop())  ) {
16
17	// 		          var pathname_url = jQuery(this).parents(".inside_page").attr('data-url');
18
19	// 		          if (pathname_url != undefined && pathname_url != 'undefined' && pathname_url.match(/undefined/gi) == null)
20	// 		          {
21	// 		            pathname_url = pathname_url.replace("http://iz.dev", "").replace("http://a.iz.ru", "").replace("http://dev.iz.ru", "").replace("https://iz.ru", "")
22
23	// 		            if (1==1) {
24	// 		              $.get('/_views' + pathname_url, function(data) {
25	// 		                  if(data) {
26	// 		                      var current = Number(data)
27	// 		                          , start = Number(current_counter_block.text())
28	// 		                          , diff = current - start;
29	// 		                      if (diff <= 24) {
30	// 		                          current_counter_block.text(current);
31	// 		                      } else {
32	// 		                          var incr = Math.round(diff/24);
33
34	// 		                          if(incr<1) {
35	// 		                              incr = 1;
36	// 		                          }
37
38	// 		                          var incrInterval = window.setInterval(function(){
39	// 		                              if ((start += incr) < current) {
40	// 		                                  current_counter_block.text(start);
41	// 		                              } else {
42	// 		                                  current_counter_block.text(current);
43	// 		                                  window.clearInterval(incrInterval);
44	// 		                              }
45	// 		                          }, 50);
46	// 		                      }
47	// 		                  }
48	// 		              });
49	// 		            }
50	// 		          }
51	// 		        }
52
53	// 		      });
54	// 		    }, 2000);
55	// 		  }
56	// 		}
57	// 	};
58	// }
59
60function getParameterUrlByName(name, url) {
61	if (!url) url = window.location.href;
62	name = name.replace(/[\[\]]/g, "\\$&");
63	var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
64	results = regex.exec(url);
65	if (!results) return null;
66	if (!results[2]) return '';
67	return decodeURIComponent(results[2].replace(/\+/g, " "));
68}
69
70// основная галерея фотографий
71var big_photos_list__inside = jQuery('.big_photos_list__inside');
72
73function build_slider() {
74	// Прогружаем картинки, не вошедшие в lazyload
75	var $owlImages = big_photos_list__inside.find('img[data-src!=""]');
76	$owlImages.each(function(index) {
77		var $this = jQuery(this),
78            attrSRC = $this.attr('src');
79			if (attrSRC && attrSRC.match(/data:/)) {
80                let dataSrc = $this.data('src');
81
82                // ucr.io
83                // if (dataSrc.search('//cdn.iz.ru') !== -1) {
84                //     let resize = window.outerWidth < 361 ? '' : '';
85                //     dataSrc = 'https://iz-photo.ucr.io/' + resize + '-/format/auto/-/progressive/yes/-/quality/lightest/' + dataSrc.replace('//cdn.iz.ru', 'https://iz.ru'); // ucr.io url
86                // }
87				$this.attr('src', dataSrc);
88			}
89	});
90
91	big_photos_list__inside = big_photos_list__inside.owlCarousel({
92		items: 1,
93		loop: false,
94		margin: 0,
95		autoplay: false,
96		autoplayTimeout: 5000,
97		autoplayHoverPause: true,
98		nav: true,
99		rewind: true,
100		lazyLoad:true,
101		responsiveRefreshRate: 200,
102		smartSpeed: 800,
103			navText: ["<div class='go_to_prev'><div class='icon'></div></div>","<div class='go_to_next'><div class='icon'></div></div>"]
104	});
105
106	// выравниваем кнопки в каруселе по центру картинки
107	jQuery('.article_page__left .big_photos_list .go_to_next, .article_page__left .big_photos_list .go_to_prev').css('top', (jQuery('.article_page__left .big_photos_list .big_photo__img').height() / 2 ) +  'px');
108}
109
110jQuery(window).on('orientationchange', function(){
111	var $bigPhotosList = jQuery('.article_page__left .big_photos_list__inside .big_photo__img');
112	if ($bigPhotosList.length) {
113		setTimeout(function() {
114			jQuery('.article_page__left .big_photos_list .go_to_next, .article_page__left .big_photos_list .go_to_prev').css('top', ($bigPhotosList.height() / 2 ) +  'px');
115		}, 600);
116	}
117});
118
119jQuery('.big_photos_list__inside').on('changed.owl.carousel', function(event) {
120	var item_block = jQuery('.big_photos_list__inside .big_photo').eq(event.item.index);
121
122	var item_block_img_url = '';
123	if (item_block.find('img').attr('data-original-src') != undefined) {
124		item_block_img_url = item_block.find('img').attr('data-original-src');
125	} else {
126		item_block_img_url = item_block.find('img').attr('src');
127	}
128	item_block_img_url = item_block_img_url.replace('http://portal', '//cdn.iz.ru').replace('http://dev.iz.ru', '//cdn.iz.ru').replace('http://a.iz.ru', '//cdn.iz.ru')
129	item_block_img_url = 'https:' + item_block_img_url;
130	jQuery('meta[name="twitter:image"]').attr('content', item_block_img_url);
131	jQuery('meta[property="og:image"]').attr('content', item_block_img_url);
132	jQuery('.ya-share2').attr('data-image', item_block_img_url);
133
134	// var tt = jQuery('meta[property="og:image"]').prop('content');
135	// jQuery('.page-content.active .share_bottom2__inside .ya-share2').updateContent({
136	// 	url: tt
137	// });
138
139});
140
141// расставляем номера слайдов в фотогалерее
142jQuery(".big_photos_list").each(function(index__photos) {
143	var count_photos_in_gallery = jQuery(".big_photos_list").eq(index__photos).find(jQuery(".big_photo__img")).length;
144	jQuery(".big_photos_list").eq(index__photos).find(jQuery(".big_photo__img")).each(function(index){
145		jQuery(this).find('.big_photo__img__full_screen').attr("data-number", index+1);
146		jQuery(this).append('<div class="big_photo__img__numbers_bottom">'+(index+1)+'/'+count_photos_in_gallery+'</div>')
147	});
148});
149
150if ( jQuery(".popup__gallery__slides__inside").length > 0 ) {
151	// функция для перерасчета ширин всплывающей галереи
152	function check_sizes() {
153		// выравниваем кнопки в каруселе по центру картинки
154		jQuery('.article_page__left .big_photos_list .go_to_next, .article_page__left .big_photos_list .go_to_prev').css('top', (jQuery('.article_page__left .big_photos_list .big_photo__img').height() / 2 ) +  'px');
155
156	    var window_height = jQuery(window).height();
157	    var item__photo = window_height - 125;
158	    var item__img = item__photo/100*90;
159		if (!after768()) {
160		} else {
161    		jQuery(".popup__gallery__slides__inside").width(jQuery(window).width()/100*80);}
162	}
163
164	// при ресайзе окна обновлем выоту боков галереи
165	jQuery(window).resize(function(){
166	    check_sizes();
167	});
168	check_sizes();
169
170	// кнопка закрыть попап
171    jQuery(".popup__gallery__close").click(function(){
172        jQuery(".popup__gallery").removeClass("active");
173        window.location.hash = "";
174    });
175
176    // если нажали ESC то закрываем полноэкеранный режим
177	jQuery(document).keydown(function(e) {
178	    if( e.keyCode === 27 ) {
179			jQuery(".popup__gallery").removeClass("active");
180			window.location.hash = "";
181	        return false;
182	    }
183	});
184
185    // если кликаем по фону в попапе то скрываем его
186    jQuery('.popup__gallery').click(function(e){
187        if ( !jQuery(e.target).closest('.popup__gallery__slides__inside__item').length && !jQuery(e.target).closest('.popup__gallery__share').length && !jQuery(e.target).closest('.owl-prev').length && !jQuery(e.target).closest('.owl-next').length ){
188            jQuery(this).removeClass("active");
189            window.location.hash = "";
190        }
191    });
192
193    // функция построения попапа с галереей
194	function show_gallery(number_photo) {
195		// number_photo - номер картинки которую нужно показать сразу в попае
196		// блок в котором будет слайдер с фотками
197		var popup__gallery = jQuery('.popup__gallery__slides__inside');
198
199		// если слайдер не установлен то инициализируем его
200		if ( jQuery(".popup__gallery").hasClass("activated") == false ) {
201			var photos = ''; // в этой строке будут все пункты галереи
202			var count_photos = 0; // общее кол-во фоток
203			jQuery(".article_page__left .big_photo").each(function(index){
204				if (typeof jQuery(this).find("img").attr("src") != "undefined") {
205					count_photos = Number(count_photos) + 1;
206				}
207			});
208			jQuery(".article_page__left .big_photo").each(function(index){
209				// делаем разметку
210				if (typeof jQuery(this).find("img").attr("src") != "undefined") {
211
212					var srcAttr = jQuery(this).find("img").attr("src"),
213							dataSrcAttr = jQuery(this).find("img").attr("data-src"),
214							parseSrc = srcAttr.indexOf('image/png;base64') != -1 && '' != dataSrcAttr ? dataSrcAttr : srcAttr ;
215
216					photos += '<div class="popup__gallery__slides__inside__item">'+
217					  '<div class="popup__gallery__slides__inside__item__photo">'+
218					    '<div class="display_table">'+
219					      '<div class="display_table__cell">'+
220					        '<img src="' + parseSrc + '"  alt="">'+
221					      '</div>'+
222					      '</div>'+
223					  '</div>'+
224					  '<div class="popup__gallery__slides__inside__item__author">'+
225					    jQuery(this).find(".big_photo__source_photo").text()+
226					  '</div>'+
227					  '<div class="popup__gallery__slides__inside__item__counter">'+
228					    (Number(index) + 1) +'/'+ count_photos +
229					  '</div>'+
230					  '<div class="clearfix"></div>'+
231					  '<div class="popup__gallery__slides__inside__item__description">'+
232					    jQuery(this).find(".big_photo__description").text()+
233					  '</div>'+
234					'</div>';
235				}
236			});
237			jQuery('.popup__gallery__slides__inside').html(photos); // вставляем собранные пункты в блок
238			popup__gallery = jQuery('.popup__gallery__slides__inside'); // переопределяем переменную
239			// инициализируем галаерю
240
241			// Прогружаем картинки, не вошедшие в lazyload
242			var $owlImages = popup__gallery.find('img[data-src!=""]');
243			$owlImages.each(function(index) {
244				var $this = jQuery(this),
245				attrSRC = $this.attr('src');
246				if (attrSRC && attrSRC.match(/data:/)) {
247					$this.attr('src', $this.data('src'));
248				}
249			});
250
251			popup__gallery.owlCarousel({
252				items: 1,
253				loop: false,
254				margin: 0,
255				autoplay: false,
256				nav: true,
257				lazyLoad:true,
258				smartSpeed: 600,
259			  	navText: ["<div class='go_to_prev'><div class='icon'></div></div>","<div class='go_to_next'><div class='icon'></div></div>"]
260			});
261			jQuery(".popup__gallery").addClass("activated");
262			popup__gallery.on('changed.owl.carousel', function(property) {
263				window.location.hash = "show-photo=" + property.item.index;
264			});
265		}
266
267		popup__gallery.trigger('to.owl.carousel', [number_photo-1]); // перелистываем сразу галерею к той картинке на которую кликнули
268
269		jQuery(".popup__gallery").addClass("active"); // показываем галерею
270	}
271
272	jQuery(".big_photos_list__btns__item").click(function() {
273
274		if (jQuery(this).hasClass("active") == false) {
275			jQuery(".big_photos_list__btns__item").removeClass("active");
276			jQuery(this).addClass("active")
277			if (jQuery(this).attr("data-type") == "list") {
278				//ga('send', 'event', 'gallery', 'list-button');
279
280				big_photos_list__inside.trigger('destroy.owl.carousel').removeClass('owl-carousel owl-loaded');
281
282				try {
283
284                    // jQuery("img[data-src][src *= base64]").each(function () {
285                    //     let dataSrc = jQuery(this).data('src');
286                    //     // ucr.io
287                    //     if (dataSrc.search('//cdn.iz.ru') !== -1) {
288                    //         let resize = window.outerWidth < 361 ? '' : '';
289                    //         jQuery(this).attr('data-src', 'https://iz-photo.ucr.io/' + resize + '-/format/auto/-/progressive/yes/-/quality/lightest/' + dataSrc.replace('//cdn.iz.ru', 'https://iz.ru')); // ucr.io url
290                    //     }
291                    // });
292
293					jQuery("img[data-src][src *= base64]")
294						.filter(function(){
295							return jQuery(this).parents('.owl-carousel').length <= 0;
296						}).lazyload({
297							data_attribute: 'src',
298							load : function()
299							{
300
301								setTimeout(function() {
302									jQuery(window).trigger('scroll');
303									jQuery(document).trigger('scroll');
304								}, 400);
305							}
306						});
307				} catch(err){};
308
309			} else {
310				jQuery('.big_photos_list__inside').addClass("owl-carousel");
311				build_slider();
312				//ga('send', 'event', 'gallery', 'slider-button');
313			}
314		}
315	});
316}
317	jQuery(document).ready(function(){
318
319
320	    if (jQuery(window).width()>=768) {
321	      var left_column_padding = jQuery(".article_page__left").css("padding-right").replace("px", "");
322	      if (jQuery(window).width() >= 812) {
323		      var right_column = jQuery(".article_page__right").width();
324		  }
325	      var main_margins = jQuery(".page-content .block-container-margins").css("margin-right").replace("px", "");
326	      var total = Number(main_margins) * 2 + Number(right_column) + Number(left_column_padding);
327	      var main_area = jQuery(".page-content .block-container").width();
328	      var total_area = main_area - total;
329
330	      if (total_area > 900) jQuery(".big_photos_list").width(900);
331	      else jQuery(".big_photos_list").width(total_area);
332
333	      console.log('total_area');
334	      console.log(total_area);
335	      jQuery(".article_page__left").width(total_area);
336	    }
337
338		if (jQuery("html").hasClass("landscape")){
339			jQuery("html.landscape .popup__gallery__slides .owl-item img").css('height', jQuery(window).height()+'px', 'important');
340		}
341		build_slider();
342	});
343
344
345	jQuery(window).on("resize", function(){
346		jQuery("html.landscape .popup__gallery__slides .owl-item img").css('height', jQuery(window).height()+'px', 'important');
347		jQuery("html.portrait .popup__gallery__slides .owl-item img").css('height', 'auto', 'important');
348	});
349
350	jQuery(window).on("load", function(){
351		check_shares_block();
352		build_slider();
353		if (jQuery('.slider-block2__inside').length > 0) {
354			var slider_block2__inside = jQuery('.slider-block2__inside');
355			setTimeout(function(){
356				slider_block2__inside.parent().width(jQuery(".text-article__inside").width());
357
358				// Прогружаем картинки, не вошедшие в lazyload
359				var $owlImages = slider_block2__inside.find('img[data-src!=""]');
360				$owlImages.each(function(index) {
361					var $this = jQuery(this),
362                        attrSRC = $this.attr('src');
363						if (attrSRC && attrSRC.match(/data:/)) {
364							$this.attr('src', $this.data('src'));
365						}
366				});
367
368				slider_block2__inside.owlCarousel({
369					items: 1,
370					loop: false,
371					margin: 0,
372					autoplay: false,
373					autoplayTimeout: 7000,
374					autoplayHoverPause: true,
375					nav: true,
376					lazyLoad:true,
377					navText: ["<div class='go_to_prev'><div class='icon'></div></div>","<div class='go_to_next'><div class='icon'></div></div>"]
378				});
379			}, 0);
380		}
381
382		// проверяем нужно ли показывать сразу галерею в зависимости от хеша
383		var hash = window.location.hash;
384		if (hash.length > 1) {
385			hash = hash.replace("#", "");
386			hash = hash.split("=");
387			if (hash[0] == "show-photo") {
388				jQuery('.big_photo__img__full_screen').trigger("click");
389				show_gallery(Number(hash[1]) + 1);
390			}
391		}
392		// if (typeof started_viewsUpdater == "undefined" || started_viewsUpdater == 0) viewsUpdater();
393	});
394
395	jQuery(window).on("scroll", function() {
396	});

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.