PageSourceSearch

https://svpressa-nn.ru/wp-content/themes/wpmfc-theme/js/custom.js

js svpressa-nn.ru collected 2026-10-06 05:17:14 UTC 7,123 bytes, 241 lines download raw bytes

1jQuery(document).ready(function($) {
2	// window.onbeforeunload = function (evt) {
3		// var message = "Document 'foo' is not saved. You will lost the changes if you leave the page.";
4		// if (typeof evt == "undefined") {
5			// evt = window.event;
6		// }
7		// if (evt) {
8			// evt.returnValue = message;
9		// }
10		// return message;
11	// }
12
13	$('.main_text table ').wrap('<div class="table-responsive"></div>');
14	
15	win_width= $(window).width();
16	
17	$('[data-toggle="tooltip"]').tooltip();
18	
19    var $allVideos = $("iframe[src^='http://player.vimeo.com'], iframe[src^='https://player.vimeo.com'], iframe[src^='//player.vimeo.com'], iframe[src^='http://www.youtube.com'], iframe[src^='https://www.youtube.com'], iframe[src^='//www.youtube.com'], object, embed");
20    var main_text_block= $(".main_text");
21	var new_width = $(main_text_block).width();	
22	
23	$allVideos.each(function() {
24		console.log($(this).width()+'-'+new_width);
25		if($(this).width()> new_width) {
26		  $(this) 
27			.attr('data-aspectRatio', this.height / this.width)
28			.removeAttr('height')
29			.removeAttr('width');
30		}
31	
32	});
33	
34	$(window).resize(function() {
35	$allVideos.each(function() {
36		var $el = $(this);
37		if($el.attr('data-aspectRatio')) {
38			console.log('1');
39			$el.width(new_width).height(new_width * $el.attr('data-aspectRatio'));  
40		}
41	});
42	
43	}).resize();
44	
45	$(window).resize(function(){
46		if((win_width<= 1200&& $(window).width()> 1200)|| (win_width> 1200&& $(window).width()<= 1200)) {
47			location.reload();
48		}
49	});
50	
51	
52	if(win_width <= 1200){
53		// $('.single_articel').find('div.wp-caption').each(function(){
54			// $(this).css({'width': '100%'});
55		// });
56		
57		$('#site_left_menu').css({'opacity': '1'});
58		
59		$('.responsive_tabs').tabCollapse();
60		
61		$(document).mouseup(function (e) {
62			var container = $("#menu-glavnoe-menyu").parent('nav');
63			if (container.has(e.target).length === 0 && $(container).hasClass('in')){
64				$('.navbar-toggle').click();
65			}
66		});
67
68		$("#site_left_menu").mmenu({
69			classes: 'mm-slide',
70			counters: {
71				add: true,
72				update: true
73			},
74			header: {
75				add: true,
76				update: true,
77				title: 'Меню сайта'
78			},
79			dragOpen: {
80				open: true
81			}
82		});
83		
84		$('#site_main_menu').remove();
85		
86	}else {
87		$('#click-menu').remove();
88		
89		$('ul > .current-menu-item > a').each(function(){
90			active_text= $(this).html();
91			$(this).replaceWith('<span>'+active_text+'</span>');
92		});
93		
94		$('#site_main_menu').css({'opacity': '1'});
95		$('#site_left_menu, #left_menu_call').remove();
96		
97		$('#fixed_header').affix({
98			offset: {
99				top: 180
100			}
101		});
102	
103	}
104	
105	$('.carousel').carousel({  
106	  interval: 6000 
107	});
108
109	//$.cookie('show_other_hide', null);
110	
111	$('.single_articel').find('table').addClass('table table-striped table-condensed');
112	
113	$('.search_form_button').click(function(){
114		if(!$('#searchform_head input').val().length) {
115			$('#searchform_head').toggleClass('head_form_active');
116		} else {
117			$('#searchform_head').submit();
118		}
119	});
120	
121	$(document).click(function(event){
122		if (!$(event.target).closest(".search_form_button").length && !$(event.target).closest("#searchform_head").length) {
123			$('#searchform_head').removeClass('head_form_active');
124			$('#searchform_head input').val('');
125		}
126	});	
127	
128    $('.smooth_scroll a[href^="#"], #toc_container a[href^="#"], #scroll_to_top_button').click(function() {
129        var target = $(this).attr('href');
130        $('html, body').animate({scrollTop: $(target).offset().top-120}, 500);
131        return false;
132    });
133	
134	$('form[role="search"]').submit(function(event){
135		if(!$(this).find('input[type=text]').val().length){
136			//alert('Введите поисковый запрос!');
137			$(this).find('input[type=text]').css({'border': '1px solid #FF0000'});
138			return false;
139		} else {
140			return true;
141		}
142	});
143	
144	$('aside .widget_wysija:first').addClass('subscribe_widget');
145
146	switch(show_other_pos_num){
147		case 1:
148		case 3:
149		case 5:
150		case 6:
151			var show_other_pos_wrap= {'right': '-330px'}
152			var show_other_pos_wrap_show= {'right': '0px'}
153			var show_other_pos_butt= {'left': '-29px'}
154			var show_other_arrow= 'fa fa-angle-left';
155			
156			var left_side_share_top= {'top': '35%'}
157			break
158		case 2:
159		case 4:
160			var show_other_pos_wrap= {'left': '-330px'}
161			var show_other_pos_wrap_show= {'left': '0px'}
162			var show_other_pos_butt= {'right': '-29px'}
163			var show_other_arrow= 'fa fa-angle-right';
164			
165			var left_side_share_top= {'top': '20%'}
166			break
167	}
168	
169	var show_other_block= $('#show_other');
170	var show_other_show= $('.show_other_show');
171	var show_other_close= $('.show_other_close');
172	
173	$(show_other_block).css(show_other_pos_wrap).show();
174	$(show_other_show).css(show_other_pos_butt).show();
175	$(show_other_show).children('i').removeClass().addClass(show_other_arrow);
176	
177	$('.left_side_share').css(left_side_share_top);
178	
179	$(show_other_close).css(show_other_pos_butt);
180	
181	$(show_other_close).click(function(){
182		$(this).hide();
183		$(show_other_show).show();
184		$(show_other_block).css(show_other_pos_wrap);	
185		$.cookie('show_other_hide', 'hide');
186	});
187	
188	$(show_other_show).click(function(){
189		$(this).hide();
190		$(show_other_close).show();
191		$(show_other_block).css(show_other_pos_wrap_show);
192	});
193	
194	$(window).scroll(function(){
195		var aside_height= $('.main_text').outerHeight()- 600;
196
197		if($('#scroll_to_top_button').attr('data-show')){
198			var scroll_to_top_button_show= $('#scroll_to_top_button').attr('data-show');
199		} else {
200			var scroll_to_top_button_show= 500;
201		}
202				
203		if($(this).scrollTop()> scroll_to_top_button_show){
204			$('#scroll_to_top_button').css({'opacity': '1'});
205		} else {
206			$('#scroll_to_top_button').css({'opacity': '0'});
207		}
208
209		if($(this).scrollTop()> aside_height){
210			if($.cookie('show_other_hide')!= 'hide') {
211				$(show_other_block).css(show_other_pos_wrap_show);
212				$(show_other_show).hide();
213				$(show_other_close).show();
214			}
215		} else {		
216			$(show_other_block).css(show_other_pos_wrap);
217			$(show_other_show).show();
218			$(show_other_close).hide();
219		}
220	});
221	
222	$(".wp-caption").removeAttr('style');
223});   
224//ready
225
226function addLink() {
227   var body_element = document.getElementsByTagName('body')[0];   
228   var selection;      selection = window.getSelection();
229   var pagelink = "<br/>Источник: <a href='"+document.location.href+"'>"+document.location.href+"</a>";  
230   var copytext = selection + pagelink;      var newdiv = document.createElement('div');    
231   newdiv.style.position='absolute';      newdiv.style.left='-99999px';      body_element.appendChild(newdiv); 
232   newdiv.innerHTML = copytext;      selection.selectAllChildren(newdiv);      window.setTimeout(function() {   
233   body_element.removeChild(newdiv);      },0);   
234}  
235
236document.oncopy = addLink;
237   
238function left_side_share_pos() {
239	var left_side_share_left = jQuery('div.container').offset().left;
240	jQuery('.left_side_share').css({'left': left_side_share_left - 60 + 'px'});
241}

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.