PageSourceSearch

https://gid.cherinfo.ru/assets/cd137f34/js2/common.js

js cherinfo.ru collected 2026-10-02 06:04:57 UTC 40,306 bytes, 1,063 lines download raw bytes

1function UserScripts(options)
2{
3	var $this = this;
4
5	this.settings = {
6		domains: {},
7		poorv:{
8			active: false,
9			loaded: false,
10			css: '',
11			font:0,
12			color:0,
13			images:0,
14			kerning:0,
15			interval:0
16		}
17	};
18	
19	$.extend(this.settings,options);
20	
21	//Скролл верхней строки меню
22	var nav = $('#nav');
23	var fixed = false;
24	// Новый год
25	var ny = $('body').hasClass('ny');
26	
27	//Sticky
28	var a = document.querySelector('.sticky-scroll'), b = null, K = null, Z = 0, P = 147, N = 20;  
29	// если у P ноль заменить на число, то блок будет прилипать до того, как верхний край окна браузера дойдёт до верхнего края элемента, если у N — нижний край дойдёт до нижнего края элемента. Может быть отрицательным числом
30	
31	if (a) {
32		window.addEventListener('scroll', Ascroll, false);
33		document.body.addEventListener('scroll', Ascroll, false);
34	
35		function Ascroll() {
36		  var Ra = a.getBoundingClientRect(),
37		      R1bottom = document.querySelector('.sticky-main').getBoundingClientRect().bottom;
38		  if (Ra.bottom < R1bottom) {
39		    if (b == null) {
40		      var Sa = getComputedStyle(a, ''), s = '';
41		      for (var i = 0; i < Sa.length; i++) {
42		        if (Sa[i].indexOf('overflow') == 0 || Sa[i].indexOf('padding') == 0 || Sa[i].indexOf('border') == 0 || Sa[i].indexOf('outline') == 0 || Sa[i].indexOf('box-shadow') == 0 || Sa[i].indexOf('background') == 0) {
43		          s += Sa[i] + ': ' +Sa.getPropertyValue(Sa[i]) + '; '
44		        }
45		      }
46		      b = document.createElement('div');
47		      b.className = 'stop';
48		      b.style.cssText = s + ' box-sizing: border-box; width: ' + a.offsetWidth + 'px;';
49		      a.insertBefore(b, a.firstChild);
50		      var l = a.childNodes.length;
51		      for (var i = 1; i < l; i++) {
52		        b.appendChild(a.childNodes[1]);
53		      }
54		      a.style.height = b.getBoundingClientRect().height + 'px';
55		      a.style.padding = '0';
56		      a.style.border = '0';
57		    }
58		    var Rb = b.getBoundingClientRect(),
59		        Rh = Ra.top + Rb.height,
60		        W = document.documentElement.clientHeight,
61		        R1 = Math.round(Rh - R1bottom),
62		        R2 = Math.round(Rh - W);
63		    if (Rb.height > W) {
64		      if (Ra.top < K) {  // скролл вниз
65		        if (R2 + N > R1) {  // не дойти до низа
66		          if (Rb.bottom - W + N <= 0) {  // подцепиться
67		            b.className = 'sticky';
68		            b.style.top = W - Rb.height - N + 'px';
69		            Z = N + Ra.top + Rb.height - W;
70		          } else {
71		            b.className = 'stop';
72		            b.style.top = - Z + 'px';
73		          }
74		        } else {
75		          b.className = 'stop';
76		          b.style.top = - R1 +'px';
77		          Z = R1;
78		        }
79		      } else {  // скролл вверх
80		        if (Ra.top - P < 0) {  // не дойти до верха
81		          if (Rb.top - P >= 0) {  // подцепиться
82		            b.className = 'sticky';
83		            b.style.top = P + 'px';
84		            Z = Ra.top - P;
85		          } else {
86		            b.className = 'stop';
87		            b.style.top = - Z + 'px';
88		          }
89		        } else {
90		          b.className = '';
91		          b.style.top = '';
92		          Z = 0;
93		        }
94		      }
95		      K = Ra.top;
96		    } else {
97		      if ((Ra.top - P) <= 0) {
98		        if ((Ra.top - P) <= R1) {
99		          b.className = 'stop';
100		          b.style.top = - R1 +'px';
101		        } else {
102		          b.className = 'sticky';
103		          b.style.top = P + 'px';
104		        }
105		      } else {
106		        b.className = '';
107		        b.style.top = '';
108		      }
109		    }
110		    window.addEventListener('resize', function() {
111		      a.children[0].style.width = getComputedStyle(a, '').width
112		    }, false);
113		  }
114		}
115	}
116		
117	function check_fix() {
118		 var scrolled = window.pageYOffset || document.documentElement.scrollTop;
119		 
120		 var navbar_open = $('#navbar.navbar-collapse').hasClass('in');
121		 
122		 if (scrolled>45 && !fixed && !navbar_open) {
123			 nav.addClass('fix');
124			 $('body > .button-up').addClass('fix');
125			 fixed = true;
126			 P = 122;
127			 if ($(window).width() < '760'){
128					$('.header-info').hide();
129				//	$('body > .header-info').height(105);
130			}
131			 if(ny){ 
132				 $('body.ny > .ny-wrap').addClass('ny-fix');
133			 } 
134		 }
135		 else if (scrolled<=45 && fixed) {
136			 nav.removeClass('fix');
137			 $('body > .button-up').removeClass('fix');
138			 fixed = false;
139			 P = 147;
140			//	$('body > .header-info').height(151);
141				$('.header-info').show();
142			 if(ny){ 
143				 $('body.ny > .ny-wrap').removeClass('ny-fix');
144			 } 
145		 }
146	  
147	}
148	
149	check_fix();
150	window.onscroll = check_fix;
151	
152	$('.button-up').click( function(){
153		$("html, body").animate({ scrollTop: 0 }, {});
154		// option - {duration: 1000, easing: 'easeInOutQuart'} easing: 'easeInOutQuart' - the option causes an error!
155		return false;
156	});
157	
158	//Поиск
159	$('.a-search').click( function(){
160		$('.menu').css('display', 'none');
161		$('.nav-search').css('display', 'none');
162		$('.menu-search').css('display', 'block').animate({opacity: 1}, 250, function(){
163			$('.menu-search input').focus();
164		});
165		return false;
166	});
167	$('.a-search-cancel').click( function(){
168		$('.menu-search').animate({opacity: 0}, 250, function(){
169			$('.menu-search').css('display', 'none');
170			$('.menu').css('display', 'block');
171			$('.nav-search').css('display', 'block');
172		});
173		return false;
174	});
175	
176	//Опрос
177	$('.vote-result').each( function(i, vote){
178		drawVote(vote);
179	});
180	
181	//политика конфиденциальности
182	$('body').on('click', '.show-politics', function(e){
183		e.preventDefault();
184		
185		var pmodal = new dkmodal({
186			width: '800px'
187		});
188		
189		pmodal.form({
190			title:'Согласие на обработку персональных данных',
191			url:'/site/politics',
192			buttons:[{
193				type:'dismiss',
194				caption:'Закрыть'
195			}]
196		});
197	});	
198	
199	//подписка с инпута
200	$('#subscribe-input-group').on('click', '.subscribe-button', function(e){
201		e.preventDefault();
202		$this.subscribeDoSub( $('#subscribe-input-group') );
203	})
204	.on('keyup', 'input', function(e){
205		$('.error', $(this).parent()).css('display','none'); 
206		if(e.which==13){
207			$this.subscribeDoSub( $('#subscribe-input-group') );
208		}
209	});
210	
211	function drawVote( $parent )
212	{
213		var ctx = $(".chart", $parent).get(0).getContext("2d");
214		var data = new Array();
215		/*Chart.defaults.global.tooltipFontSize = 11;
216		Chart.defaults.global.tooltipCaretSize = 0;*/
217		$('.vote-data li', $parent).each( function(index){
218			var obj = {};
219			var item = $(this);
220			obj.value = item.data('value');
221			obj.color = item.data('color');
222			obj.label = item.data('text');
223			obj.highlight = darkerColor(item.data('color'),0.05);
224			data.push(obj);
225		});
226		var myDoughnutChart = new Chart(ctx).Doughnut(data,{
227			tooltipFontSize: 12,
228			tooltipTemplate: "<%=label%>"
229		});
230	}
231	
232	$('.do-vote').click( function(){
233		var id = $(this).data('id');
234		var vote = $('#idvote_'+id);
235		var url = $(this).attr('href');
236		var view = $(this).data('view');
237		var type = $(this).data('type');
238		var res=[];
239		//var res = $('input[type=checkbox]:checked', vote).val();
240		$('input[type='+type+']:checked', vote).each(function(){
241			res.push($(this).val());			
242		});
243		
244		if (res.length) {
245			$.ajax({
246				url: url,
247				method: 'POST',
248				data: {aw: res, _csrf: $('meta[name="csrf-token"]').attr("content"), view: view},
249				dataType:'html',
250				cache:false
251			}).done(
252				function(result,textStatus){
253					vote.animate({opacity:0}
253,250,function(){
254						vote.html(result);
255						vote.animate({opacity:1},250, function(){
256							drawVote(vote);
257						});
258					});
259				}
260			).fail(
261				function(){
262					alert('Не удалось проголосовать!');
263				}
264			);
265		}
266		return false;
267	});
268	
269	//Видео youtube
270	if(typeof $.fancybox == 'function') {
271		$('.youtube-video').fancybox({
272			maxWidth	: 800,
273			maxHeight	: 600,
274			fitToView	: false,
275			width		: '70%',
276			height		: '70%',
277			autoSize	: false,
278			closeClick	: false,
279			openEffect	: 'none',
280			closeEffect	: 'none',
281			padding: 0
282		});
283		
284		//fancybox links
285		$("a.zoom").fancybox({
286			openEffect	: 'elastic',
287			closeEffect	: 'elastic',
288			helpers : {
289				title : {
290					type : 'inside'
291				},
292			}
293		});
294	}
295	
296	//Рисунки в тексте
297	$('img.wide').each( function(i, item){
298		if ($(item).attr('title') && $(item).attr('title').trim()!='') {
299			$(item).after('<div style="width:100%" class="img-title">' + $(item).attr('title') +'</div>');
300		}
301	});
302	
303	//Городские объекты
304	var head_city_timer;
305	
306	var CityObjects = [
307		{
308	    	image: 'arh_most.jpg',
309	    	title: 'Архангельский мост',
310	    	text: 'Мост построили за тысячу дней. Его длина — 1132 метра, высота — 119. На мосту шесть полос по 4,5 метра каждая. Для подсветки сооружения установили 2988 светильников.'
311	    },
312	    {
313	    	image: 'ledovy.jpg',
314	    	title: 'Ледовый дворец',
315	    	text: 'Крупнейшая площадка области на 5685 зрителей. Во дворце проходят игры чемпионата КХЛ, ледовые шоу и концерты, в том числе ежегодный рок-фестиваль «Время колокольчиков» памяти Башлачёва.'
316	    },
317	    {
318	    	image: 'galskie.jpg',
319	    	title: 'Музей «Усадьба Гальских»',
320	    	text: 'Единственная в области полностью сохранившаяся дворянская усадьба XIX века. Гальские были в родстве с Тургеневыми и Толстыми. Усадьба — это «живой» музей с интерактивными экскурсиями и программами.'
321	    },
322	    {
323	    	image: 'most.jpg',
324	    	title: 'Октябрьский мост',
325	    	text: 'Главный символ Череповца. Проезжая часть моста подвешена на вантах, несущую поддерживают пилоны. Высота главного пилона — 84 метра, силуэт его напоминает букву А. Длина моста — 800 метров.'
326	    },
327	    {
328	    	image: 'chram.jpg',
329	    	title: 'Храм Рождества Христова',
330	    	text: 'Воссоздан по образу существовавшей на этом месте церкви Рождества Христова, построенной в 1789 году и разрушенной в 1932-м. В храме хранится частица мантии Серафима Саровского.'
331	    },
332	    {
333	    	image: 'dm.jpg',
334	    	title: 'Дворец металлургов',
335	    	text: 'Крупнейшее культурное учреждение области. Интерьеры отделаны мрамором, фойе украшают люстры из хрусталя, стилизованные под старинные шахтерские лампы. Большой зал вмещает 1000 зрителей.'
336	    },
337	    {
338	    	image: 'almaz.jpg',
339	    	title: 'Спортивно-концертный зал «Алмаз»',
340	    	text: 'Первая крытая площадка с искусственным льдом в области, открыта в 1970 году. В «Алмазе» проходят детские и любительские хоккейные турниры. База одноименной хоккейной команды.'
341	    },
342	    {
343	    	image: 'vereschagin.jpg',
344	    	title: 'Бюст Василия Верещагина',
345	    	text: 'Установлен в 1957 году на улице имени художника. На постаменте изображена палитра, обрамленная лавровым венком и кистями знамен. Надпись гласит: «Замечательному русскому художнику-баталисту».'
346	    },
347	    {
348	    	image: 'af.jpg',
349	    	title: 'Памятник Афанасию и Феодосию Череповецким',
350	    	text: 'Установлен у подножия Соборной горки. Афанасий и Феодосий — ученики Сергия Радонежского, основатели Воскресенского монастыря, почитаются как покровители Череповца.'
351	    },
352	    {
353	    	image: 'sobor.jpg',
354	    	title: 'Собор Воскресения Христова',
355	    	text: 'Старейшее каменное здание Череповца. Входил в подворье Воскресенского монастыря, основанного в 1362 году. После революции собор был закрыт. РПЦ возвращен в 1946 году.'
356	    },
357	    {
358	    	image: 'milutin.jpg',
359	    	title: 'Памятник Милютину',
360	    	text: 'Иван Милютин почти полвека руководил городом. Его стараниями уездный город превратился в центр культуры и образования. В 1886 году горожане присвоили Милютину звание почетного гражданина Череповца.'
361	    },
362	    {
363	    	image: 'teatr.jpg',
364	    	title: 'Камерный театр',
365	    	text: 'Расположен в историческом центре, входит в ансамбль зданий, образующих восьмигранную площадь — один из первых подобных объектов в дореволюционной России. Здание венчает башня с курантами.'
366	    },
367	    {
368	    	image: 'milutinpark.webp',
369	    	title: 'Милютинский парк',
370	    	text: 'Заложен в 1894 году Иваном Милютиным. В XIX веке в парке высадили редкие растения, в 1950-х установили аттракционы. В 2022 году восстановили дендропарк, сделали пруд и новые площадки.'
371	    }, 
372	    {
373	    	image: 'komsomolets.jpg',
374	    	title: 'Кинотеатр «Комсомолец»',
375	    	text: 'Построен в 1957 году. «Комсомолец» — яркий пример сталинской архитектуры. Хорошо сохранились внутренние интерьеры здания: лепнина, потолки с росписью, кованые светильники и люстры.'
376	    },
377	    {
378	    	image: 'fosagro.jpg',
379	    	title: 'Череповецкий производственный кластер группы «ФосАгро»',
380	    	text: 'Является крупнейшим в России экспортером фосфорсодержащих удобрений. Поставки идут в  страны Западной Европы, Азии, Америки, Африки.'
381	    },
382	    {
383	    	image: 'zavod.jpg',
384	    	title: 'Металлургический завод «Северсталь»',
385	    	text: 'Второй по величине сталелитейный завод России. На «Северстали» работают 50 тысяч череповчан. Годовой объем производства стали — 11 млн тонн. Завод поставляет продукцию в 60 стран мира.'
386	    }
387	];
388	
389	function show_head_city(i) {
390		if (i<0 || i>16) return ;
391		
392		clearTimeout(head_city_timer);
393		if(i==1) $('#head_city .head-city-prev').hide(); else $('#head_city .head-city-prev').show();
394		if(i==16) $('#head_city .head-city-next').hide(); else $('#head_city .head-city-next').show();
395		$('#head_city .head-city-prev').unbind('click').click(function(){
396			show_head_city(i-1);
397		});
398		$('#head_city .head-city-next').unbind('click').click(function(){
399			show_head_city(i+1);
400		});
401		
402		var Data = CityObjects[i-1];
403		$('#head_city .head-city-img img').attr('src', $this.settings.domains.store + '/header/' + Data.image );
404		$('#head_city .head-city-title-text').text( Data.title );
405		$('#head_city .head-city-text').text( Data.text );
406		
407		var Object = $('#head_city_'+i);
408		
409		if ($('#head_city').css('display')=='block'){
410			$('#head_city').stop().animate({left:parseInt(Object.css('left'))+(parseInt(Object.css('width'))/2)-120},300);
411		}
412		else{
413			head_city_timer=setTimeout(function(){
414				$('#head_city').css('left',parseInt(Object.css('left'))+(parseInt(Object.css('width'))/2)-120).show();
415			},200);
416		}
417	}
418	
419	$('.city-objects .one').each(function(){
420		$(this).hover(function(){
421			show_head_city( parseInt($(this).data('id')));
422		},function(){
423			clearTimeout(head_city_timer);
424			head_city_timer=setTimeout(function(){$('#head_city').hide();},1000);
425		});
426	});
427	
428	$('#head_city').hover(function(){
429		clearTimeout(head_city_timer);
430	},function(){
431		head_city_timer=setTimeout(function(){$('#head_city').hide();},1000);
432	});
433	
434	
435	//Аккордеон
436	$('.a-fade').click( function(){
437		var div = $(this).parent().next('.div-fade');
438		if ($(this).hasClass('fade-up')) {
439			div.slideUp(300);
440			$(this).removeClass('fade-up');
441		}
442		else {
443			$(this).addClass('fade-up');
444			div.slideDown(300);
445		}
446		return false;
447	});
448	
449	//переход на мобильную версию
450	$('#to-mobile').click( function(){
451		$.ajax({
452			url:'/site/to-mobile',
453			dataType: 'json',
454			success: function(json){
455				document.location.href = json.href;
456			},
457			error: function(){
458				document.location.href = $this.settings.domains.mobile;
459			}
460		});
461		return false;
462	});
463	
464	//Csrf
465	function getCsrf()
466	{
467		return $('meta[name="csrf-token"]').attr("content");
468	}
469	
470	//подписка на рассылку
471	this.subscribeDoSub = function( container )
472	{
473		if ( $('.subscribe-button', container).prop('disabled') ) {
474			return false;
475		}
476		
477		if (!subscribeCheckEmail( container )){
478			$this.show_message('Ошибка в электронном адресе');
479			$('input', container)
480			return false;
481		}
482		
483		var text = $('.subscribe-button', container).html();
484		$('.subscribe-button', container).prop('disabled', true).html('<i class="fa fa-cog fa-spin"></i>');
485		
486		$.ajax({
487			method:"POST",
488			url:"/subscription/join",
489			data:{email: $("input", container).val().trim(),_csrf:getCsrf()},
490			dataType:"json",
491			success:function(json){
492				
493				if (json.status=='validate'){
494					$('.subscribe-button', container).prop('disabled', false).html(text);
495					$this.show_message('Ошибка в электронном адресе');
496				}
497				else if(json.status=='already'){
498					$('.subscribe-button', container).prop('disabled', false).html(text);
499					$this.show_message('Адрес уже подписан на рассылку');
500				}
501				else if (json.status=='success'){
502					$this.show_message('Вам выслано письмо для подтверждения подписки');
503					$('.error', container).fadeOut(1000);
504					setTimeout(function(){
505						$('.subscribe-button', container).prop('disabled', false).html(text);
506						$("input", container).val('');
507						$('.error', container).removeClass('success');
508					},1000)
509				}
510			}
511		});
512		return false;
513	}
514	
515	function subscribeCheckEmail( container )
516	{
517		var email = $("input", container).val().trim();
518		if (email=='') {
519			return false;
520		}
521		var r = /^[\w\.\d-_]+@[\w\.\d-_]+\.\w{2,6}$/i;
522		if ( !r.test(email) ) {
523			return false;	
524		}
525		else {
526			return true;
527		}
528	}
529	
530	//сообщение
531	this.show_message = function(message)
532	{
533		$('body').append('<div class="show-message"><button type="button" class="close">×</button>'+ message + '</div>');
534		$('.show-message').animate({'opacity':1},300);
535		$('.show-message .close').click( function(){
536			$('.show-message').animate({'opacity':0},300, function(){
537				$('.show-message').remove();
538			});
539		});
540		setTimeout(
541			function(){
542				$('.show-message').animate({'opacity':0},300, function(){
543					$('.show-message').remove();
544				});
545			},3500
546		);
547	}
548	
549	//Версия для слабовидящих
550	$('#poorv-a').click( function(){
551		if ($this.settings.poorv.active){
552			$this.poorvTurnOff();
553		}
554		else {
555			$this.poorvTurnOn();
556		}
557		return false;
558	});
559	
560	$('#poorv-turn-off').click( function(){
561		$this.poorvTurnOff();
562	});
563	
564	$('.btn-poorv-more').click( function(){
565		var input = $('input', $(this));
566		if (!input.prop('checked')) {
567			$('#poorv-options').css('display', 'block');
568		}
569		else {
570			$('#poorv-options').css('display', 'none');
571		}
572	});
573	
574	$('#poorv-panel label.btn-poorv').click( function(){
575		var input = $('input', $(this));
576		if(input.length) {
577			var name = input.attr('name').split('-')[1];
578			var val = input.val();
579			$('body').removeClass('poorv-' + name + '-' + $this.settings.poorv[name]);
580			$this.settings.poorv[name] = val;
581
582			if (val > 0) {
583				var date = new Date(new Date().getTime() + 3000 * 24 * 60 * 60 * 1000);
584				document.cookie = "poorv-" + name + "=" + val + "; domain=" + $this.settings.domains.base + "; path=/; expires=" + date.toUTCString();
585				$('body').addClass('poorv-' + name + '-' + val);
586			} else {
587				var date = new Date(new Date().getTime() - 24 * 60 * 60 * 1000);
588				document.cookie = "poorv-" + name + "=0; domain=" + $this.settings.domains.base + "; path=/; expires=" + date.toUTCString();
589			}
590		}
591	});
592	
593	this.onStartPoorv = function() {
594		$('.lenta-cont').each( function(i, obj){
595			$(obj).attr('data-height', $(obj).css('height'));
596			$('.lenta-news', $(obj)).css('height','auto');
597			$(obj).css('height', 'auto');
598		} );
599	};
600	
601	this.onEndPoorv = function() {
602		$('.lenta-cont').each( function(i, obj){
603			$(obj).css('height', $(obj).attr('data-height'));
604			$('.lenta-news', $(obj)).css('height',(parseInt($(obj).attr('data-height'))-5)+'px' );
605		} );
606	};
607	
608	this.poorvTurnOn = function(){
609		$('#poorv-panel').slideDown(300);
610		$this.settings.poorv.active = true;
611		if (!$this.settings.poorv.loaded) {
612			this.lazyLoadCss($this.settings.poorv.css);
613			$this.settings.poorv.loaded = true;
614		}
615		var date = new Date(new Date().getTime() + 3000 * 24 * 60 * 60 * 1000);
616		document.cookie = "poorv=1; domain="+$this.settings.domains.base+"; path=/; expires=" + date.toUTCString();
617		$('body').addClass('poorv');
618		$this.onStartPoorv();
619	};
620	
621	this.poorvTurnOff = function(){
622		$('#poorv-panel').slideUp(300);
623		$this.settings.poorv.active = false;
624		var date = new Date(new Date().getTime() - 24 * 60 * 60 * 1000);
625	    document.cookie = "poorv=0; domain="+$this.settings.domains.base+"; path=/; expires=" + date.toUTCString();
626	    $('body').removeClass('poorv');
627	    $this.onEndPoorv();
628	}
629	
630	this.lazyLoadCss = function(url) {
631		var link = document.createElement("link");
632	    link.setAttribute("rel", "stylesheet");
633	    link.setAttribute("type", "text/css");
634	    link.setAttribute("href", url);
635		document.getElementsByTagName("head")[0].appendChild(link);
636	};
637	
638	this.lazyLoadJs = function (url) {
639	    var d = window.document,
640	        b = d.body, /* appends at end of body, but you could use other methods to put where you want */
641	        e = d.createElement("script");
642	    
643	    e.async = true;
644	    e.src = url;
645	    b.appendChild(e);
646	}
647	
648	if ($this.settings.poorv.active) {
649		$this.onStartPoorv();
650	}
651	
652	//Клипбоард
653	$(document).ready( function(){
654		var article = document.querySelector('article');
655		var hdAdmin = $("body").hasClass("admin-detected");
656		if (article) {
657			article.addEventListener('copy', function(e){
658				if(hdAdmin) {
659					var isAgree = true;
660				}else{
661					var isAgree = confirm("При использовании материалов сайта cherinfo™ обязательной является прямая, открытая для индексации гиперссылка на страницу, с которой материал заимствован. Гиперссылка должна размещаться непосредственно в тексте, воспроизводящем оригинальный материал cherinfo™, до или после цитируемого блока!");
662				}
663				if(isAgree){
664					var text = window.getSelection();
665					var text = text.toString();
666					//console.log(text);
667					if (text.length > 40) {
668						e.clipboardData.setData('text/plain', text + '\n\nИсточник: ' + location.href);
669						e.preventDefault();
670					}
671					//console.log(text.length);
672				}else{
673					e.stopPropagation();
674					e.preventDefault();
675					e.clipboardData.setData('text', '');
676				}
677			});
678		}
679	});
680
681};
682
683//Затеменение цвета
684var pad = function(num, totalChars) {
685  var pad = '0';
686  num = num + '';
687  while (num.length < totalChars) {
688      num = pad + num;
689  }
690  return num;
691};
692
693//Ratio is between 0 and 1
694var changeColor = function(color, ratio, darker) {
695  var difference = Math.round(ratio * 255) * (darker ? -1 : 1),
696      minmax     = darker ? Math.max : Math.min,
697      decimal    = color.replace(
698          /^#?([a-z0-9][a-z0-9])([a-z0-9][a-z0-9])([a-z0-9][a-z0-9])/i,
699          function() {
700              return parseInt(arguments[1], 16) + ',' +
701                  parseInt(arguments[2], 16) + ',' +
702                  parseInt(arguments[3], 16);
703          }
704      ).split(/,/);
705  return [
706      '#',
707      pad(minmax(parseInt(decimal[0], 10) + difference, 0).toString(16), 2),
708      pad(minmax(parseInt(decimal[1], 10) + difference, 0).toString(16), 2),
709      pad(minmax(parseInt(decimal[2], 10) + difference, 0).toString(16), 2)
710  ].join('');
711};
712var lighterColor = function(color, ratio) {
713  return changeColor(color, ratio, false);
714};
715var darkerColor = function(color, ratio) {
716  return changeColor(color, ratio, true);
717};
718
719$(document).ready(function(){
720	$(document).keydown(function (e) {
721		if ((e.ctrlKey && e.keyCode == 13) || (e.metaKey && e.keyCode == 13)) {
722			e.preventDefault();
723			var text = "";
724		    if (window.getSelection) {
725		        text = window.getSelection().toString();
726		    } else if (document.selection && document.selection.type != "Control") {
727		        text = document.selection.createRange().text;
728		    }
729		    
730		    if (text.trim()=='') {
731		    	UserScript.show_message('Выделите фрагмент текста с ошибкой');
732		    	return ;
733		    }
734		    if (text.length>500) {
735		    	UserScript.show_message('Выделенный фрагмент текста слишком большой');
736		    	return ;
737		    }
738		    
739		    var m = new dkmodal();
740		    m.message({
741		    	title:'Нашли ошибку?',
742		    	html: '<form>\
743		    		<label class="control-label">Фрагмент текста с ошибкой:</label>\
744		    		<p style="color:#333;font-size:15px;font-weight:600">'+text+'</p>\
745		    		<label class="control-label">Комментарий:</label>\
746		    		<textarea class="form-control" name="error_comment" placeholder="Здесь можно объяснить, в чём ошибка"></textarea>\
747		    		<input type="hidden" name="error_text" value="'+text+'" />\
748		    		<input type="hidden" name="error_page" value="'+location.href+'" />\
749		    		<input type="hidden" name="_csrf" value="'+$('meta[name="csrf-token"]').attr("content")+'" />\
750		    	</form>',
751		    	buttons: [
752		    	    {
753		    	    	type:'submit',
754		    	    	caption:'Отправить',
755		    	    	url:'/post/typo',
756		    	    	loading:'Отправляю, ждите',
757		    	    	afterSave: function(){
758		    	    		UserScript.show_message('Спасибо! Мы исправим ошибку.');
759		    	    	}
760		    	    },
761		    	    {
762		    	    	type:'dismiss',
763		    	    	caption:'Отмена',
764		    	    	className:'btn-default'
765		    	    }
766		    	]
767		    });
768		}
769	});
770	
771    $('.container > .section').each(function(indx){
772        var hi = $(this).height();
773            if (hi < 2) {
774                $(this).css('margin',0);
775            }  
776          //  console.log(hi);
777    });
778
779	//Убираем отступ, в случае если виджет скрыт, то отступ у следующего виджета будет отсутствовать
780
781	var idWidgetSpace;
782
783	$('.widget').each(function(indx){
784
785		if(indx == idWidgetSpace) {
786			$(this).css('margin-top',0);
787		}
788
789		var hig = $(this).height();
790            if (hig < 2) {
791				idWidgetSpace = indx + 1;
792            }  
793
794    });
795
796    function windowSize(){
797    	var row2_is_hide = $('.row2-top3').is(':hidden');
798    	
799    	if ($(window).width() <= '520'){
800    		
801    		var pn = window.location.pathname.search(/\w+/g);
802    		var newshead = $( '<div class="lenta-title" id="main-lenta-title"><a href="'+location.href+'news">Новости</a>' +
803				'<div style="width: 40px;"><span id="btn-news-play-mobile" class="fa fa-volume-up" onclick="playPause();yaCounter32186889.reachGoal(\'TARGET_NEWS_PLAY\');"></span></div>' );
804    		var is_news_mobile = $('div').is('#news-mobile');
805    		var is_bn_emergency = $('div').is('#bn-emergency');
806    		
807    		
808    		if ( (pn<0) && (is_news_mobile) && (!($('#news-mobile').find('div').length)) ) {	
809    			$.ajax({
810    				url: '/news?mobile=1',
811    				//	data: '',
812    				dataType: 'html',
813    				method: 'get'
814    			}).error(function(){
815    				alert('Сервер не отвечает');
816    			}).done( function(html){
817    				$('#news-mobile').append(newshead);
818    				$('#news-mobile').append(html);
819    			});
820    		}
821    		if (is_bn_emergency){
822    			$('#bn-emergency').removeClass('in');
823			}
824
825    	//}
826    	// Banner clock 
827    		
828    	}else{
829    		if ($('.col-reklama-main a').is('#banner-fkgs-clock')){
830    		
831    			var bannerFkgs = document.getElementById("banner-fkgs-clock");
832    			
833    	    	if (bannerFkgs) {
834    	     
835    	    		var toDate = 1653944399000;
836
837    	        	function getRemaining(endtime){
838    	                var t = endtime - Date.parse(new Date());
839    	              //  var seconds = Math.floor( (t/1000) % 60 );
840    	                var minutes = Math.floor( (t/1000/60) % 60 );
841    	                var hours = Math.floor( (t/(1000*60*60)) % 24 );
842    	                var days = Math.floor( t/(1000*60*60*24) );
843    	                return {
844    	                    'total': t,
845    	                    'days': days,
846    	                    'hours': hours,
847    	                    'minutes': minutes,
848    	                 //   'seconds': seconds
849    	                };
850    	            }
851    	        	
852    	        	function iniClock(id, endtime){
853    	                var cl = document.getElementById(id);
854    	                var day1 = cl.querySelector('.day1');
855    	                var day2 = cl.querySelector('.day2');
856    	                var dayTxt = cl.querySelector('.day-text');
857    	                var timeTxt = cl.querySelector('.time-text');
858    	                var hours1 = cl.querySelector('.hours1');
859    	                var hours2 = cl.querySelector('.hours2');
860    	                var timeDelimiter = cl.querySelector('.time-delimiter');
861    	                var minutes1 = cl.querySelector('.minutes1');
862    	                var minutes2 = cl.querySelector('.minutes2');
863    	              //  var seconds = cl.querySelector('.seconds');
864    	              
865    	                 var intrvl = setInterval(updClock,1000);
866    	                
867    	                 function updClock(){
868    	                    var t = getRemaining(endtime);
869    	                    if(t.total<=0){
870    	                        clearInterval(intrvl);
871    	                        timeTxt.innerHTML = 'закончено';
872	                    		hours1.innerHTML = '0';
873	                    		hours2.innerHTML = '0';
874	                    		minutes1.innerHTML = '0';
875	                    		minutes2.innerHTML = '0';
876    	                    }else{
877    	                    	if (t.days>0){
878    	                    		var dd = ('0' + t.days).slice(-2);
879    	                    		day1.innerHTML = dd.slice(-2,-1);
880    	                    		day2.innerHTML = dd.slice(-1);
881    	                    		dayTxt.innerHTML = 'дней осталось';
882    	                    	}else{
883    	                    		cl.querySelector('.clockDays').style.display = 'none';
884    	                    		cl.querySelector('.clockTime').style.display = 'block';
885    	                    		timeDelimiter.classList.toggle('delimiter-hide');
886    	                    		timeTxt.innerHTML = 'осталось';
887    	                    		var hh = ('0' + t.hours).slice(-2);
888    	                    		hours1.innerHTML = hh.slice(-2,-1);
889    	                    		hours2.innerHTML = hh.slice(-1);
890    	                    		timeDelimiter.innerHTML = ':';
891    	                    		var mm = ('0' + t.minutes).slice(-2);
892    	                    		minutes1.innerHTML = mm.slice(-2,-1);
893    	                    		minutes2.innerHTML = mm.slice(-1);
894    	                    	//	seconds.innerHTML = ' : '+('0' + t.seconds).slice(-2);
895    	                    	}
896    	                    }
897    	                   // console.log(t);
898    	                }
899    	            }
900    	        	
901    	        	iniClock('clockToDate', toDate);
902
903    	        }
904    	    }
905    	}
906    	// Banner clock end ------------------------------------------------------------
907    	
908    	if (row2_is_hide){
909    		$('.section-hidden > .row').addClass('row-mobile').removeClass('row');
910			$('.section-alarm > .row').addClass('row-mobile').removeClass('row');
911            if (!$('div').is('.col-top3-clone')){
912                var trans_col = $('.row2-top3').find('.col-top3').clone().addClass('col-top3-clone');
913                $('.row2-top3').find('.col-top3').hide();
914                $('.row2-top3').closest('.col-sm-4').after(trans_col);    
915            }
916            if (!$('div').is('.col-reklama-main-clone')){
917            	var col_reklama_main = $('.row-mobile').find('.col-reklama-main');
918            	var col_reklama_main_widget = col_reklama_main.find('.widget');
919            	
920            	if ($(col_reklama_main_widget).length >1){
921            		$(col_reklama_main_widget).each( function(index, element){
922            			if ($(this).height() > 300 ){
923            				var div_add = '<div class="widget widget-add-hidden">'; 
924            				$(this).after(div_add );
925            			}
926            		})
927            	}
928            	var col_reklama_clone = col_reklama_main.clone().addClass('col-reklama-main-clone').removeClass('col-reklama-main');
929            	$('.row-mobile').find('.col-reklama-main').after(col_reklama_clone);
930            }
931            
932        } else {
933        	if ($('div').is('.col-reklama-main-clone')){
934                $('.col-reklama-main-clone').remove();
935                var widget_add_hidden = $('.row-mobile').find('.col-reklama-main .widget-add-hidden');
936                widget_add_hidden.remove(); 
937            }
938            $('.section-hidden > .row-mobile').addClass('row').removeClass('row-mobile');
939			$('.section-alarm > .row-mobile').addClass('row').removeClass('row-mobile');
940
941            if ($('div').is('.col-top3-clone')){
942                $('.col-top3-clone').remove();
943                $('.row2-top3').find('.col-top3').show();
944            }
945        }
946// transfer banner gu
947    	
948    	function transfer_posGU(is_mobile,widget_source,target_pos){
949    		var widget = $('#'+widget_source).parent();
950    		var widget_parent_target = widget.closest('.row').find(target_pos);
951    		if (widget_parent_target){
952    			if (is_mobile){
953    				widget.removeClass('widget-pos-mobile '+widget_source);
954	    				widget_parent_target.append(widget);
955    			}else{
956    				widget.addClass('widget-pos-mobile '+widget_source);
957    				widget_parent_target.after(widget);
958    			}
959    		} 
960		}
961    	
962    	if ($('.col-nomobile iframe').is('#widgetPosId')){
963    		
964			var is_pos_mobile = $('div').is('.widget-pos-mobile.widgetPosId');
965
966    		if ($(window).width() <= '976'){
967    			if (!is_pos_mobile){ transfer_posGU(is_pos_mobile,'widgetPosId','.col-mobile .mayor-header'); }
968   	    	}else{
969   	    		if (is_pos_mobile){ transfer_posGU(is_pos_mobile,'widgetPosId','.col-nomobile'); }
970   	    	}
971    	}
972    	
973    	if ($('.col-nomobile div').is('#js-show-iframe-wrapper')){
974    		var is_pos_mobile = $('div').is('.widget-pos-mobile.js-show-iframe-wrapper');
975
976    		if ($(window).width() <= '976'){
977    			if (!is_pos_mobile){ transfer_posGU(is_pos_mobile,'js-show-iframe-wrapper','.col-mobile .mayor-header'); }
978   	    	}else{
979   	    		if (is_pos_mobile){ transfer_posGU(is_pos_mobile,'js-show-iframe-wrapper','.col-nomobile'); }
980   	    	}
981    	}
982    	
983    
984    }
985  
986    $(window).on('load resize',windowSize);
987    
988 // page download ajax
989    
990    function load_news(t, page, m, type)
991	{
992		t.html('');
993		t.addClass('div-loader');
994			$.ajax({
995			url: '/'+type+'?page='+page+'&mobile='+m,
996			method:'GET',
997			dataType:'html',
998			success: function(html) {
999				t.replaceWith(html);
1000			}
1001		});
1002	}
1003
1004
1005    $('.content').on('click', '.more-news', function(e){
1006        e.preventDefault();
1007		var page = $(this).data('page');
1008		var type = $(this).data('type');
1009		var m = $(this).data('m');
1010		if (m) window.history.pushState({}, document.title, '/');
1011		var t = $(this).parent();
1012		load_news(t, page, m, type);
1013	});
1014 // for iframe's banners   
1015	function listener(event) {
1016		var orgHost = document.location.protocol+'//st.'+document.location.host;
1017   	    if (event.origin !== orgHost) {return;}
1018		var data = event.data;
1019		var arrData = [];
1020		if (typeof data === 'string' || data instanceof String){
1021			arrData = data.split(';');
1022			if ( arrData.length == 2 && parseInt(arrData[1],10)>0 ) {
1023	   	   	    $( "iframe."+arrData[0] ).each(function( index ) {
1024	   	   		    $( this ).parent().css('height', arrData[1]);
1025	   	    	    $( this ).css('height', arrData[1]);
1026	   	        });
1027	   	    } 
1028		}
1029   	}
1030    if (window.addEventListener) {
1031    	window.addEventListener("message", listener);
1032    }else{
1033    // IE8
1034    	window.attachEvent("onmessage", listener);
1035    }
1036
1037// for cookie-informed
1038// 	$("#cookie_close_btn").on( "click", function() {
1039// 		$(".cookie-inform").css("display","none");
1040// 		let date = new Date(Date.now() + (60 * 1000 * 60 * 24 * 100));
1041// 		document.cookie = "cookie_informed=true; expires=" + date;
1042// 	} );
1043
1044	// $("#cookie_informed_btn").on( "click", function() {
1045	// 	$(".cookie-inform").css("display","none");
1046	// 	let date = new Date(Date.now() + (24 * 60 * 60 * 1000));
1047	// 	document.cookie = "cookie_informed=true; expires=" + date;
1048	// } );
1049
1050	if (document.cookie.indexOf('cookie_informed=true') === -1) {
1051		$(".cookie-inform").show();
1052	}
1053
1054	$("#cookie_informed_btn").on("click", function() {
1055		$(".cookie-inform").hide();
1056		let date = new Date();
1057		date.setDate(date.getDate() + 7);
1058
1059		document.cookie = "cookie_informed=true; expires=" + date.toUTCString() +
1060			"; path=/; domain=.cherinfo.ru";
1061	});
1062
1063});

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.