PageSourceSearch

https://mrybakov.ru/dev/js/jquery.main.js?15318380868303

js mrybakov.ru collected 2026-10-08 10:23:49 UTC 8,303 bytes, 305 lines download raw bytes

1// page init
2$(function(){
3	initLightbox();
4	initSameHeight();
5	initValidation();
6	$(".video").click(function() {
7		$.fancybox({
8			'padding'		: [0, 0, 0, 0],
9			'margin'		: [100, 20, 100, 20],
10			width: 630,
11            height: 425,
12			'transitionIn'	: 'none',
13			'transitionOut'	: 'none',
14			'title'			: this.title,
15			'href'          : this.href.replace(new RegExp("watch\\?v=([^&]+)&", "i"), 'embed/$1?'),
16			'type'			: 'iframe',
17			'overlayColor': '#000000',
18			'autoPlay': true,
19		});
20
21		return false;
22	});
23
24	$(window).resize( debouncer( checkviewport ) );
25
26	fluidvids.init({
27      selector: ['iframe'],
28      players: ['www.youtube.com', 'player.vimeo.com']
29    });
30});
31
32// Выставляем нужный viewport
33var vp = document.getElementById('viewport');
34var checkviewport = function(){
35	if (window.innerWidth > 736){
36		if( vp.getAttribute('content') != "width=device-width" )
37			vp.setAttribute('content','width=device-width');
38	} else if( vp.getAttribute('content') == "width=device-width" ){
39		vp.setAttribute('content','width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no');
40	}
41}
42window.onload = function () {
43	checkviewport();
44}
45
46
47
48// fancybox modal popup init
49function initLightbox() {
50	$('a.lightbox-open, a[rel*="lightbox"]').each(function(){
51		var link = $(this);
52		link.fancybox({
53			padding: 0,
54			cyclic: false,
55			overlayShow: true,
56			overlayOpacity: 0.6,
57			overlayColor: '#000000',
58			titlePosition: 'inside',
59			onComplete: function(box) {
60				if(link.attr('href').indexOf('#') === 0) {
61					$('#fancybox-content').find('a.close').unbind('click.fb').bind('click.fb', function(e){
62						$.fancybox.close();
63						e.preventDefault();
64					});
65				}
66			}
67		});
68	});
69}
70
71/* Fancybox overlay fix */
72$(function(){
73	// detect device type
74	var isTouchDevice = (function() {
75		try {
76			return ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch;
77		} catch (e) {
78			return false;
79		}
80	}());
81
82	// fix options
83	var supportPositionFixed = !( ($.browser.msie && $.browser.version < 8) || isTouchDevice );
84	var overlaySelector = '#fancybox-overlay';
85	
86	if(supportPositionFixed) {
87		// create <style> rules
88		var head = document.getElementsByTagName('head')[0],
89			style = document.createElement('style'),
90			rules = document.createTextNode(overlaySelector+'{'+
91				'position:fixed;'+
92				'top:0;'+
93				'left:0;'+
94			'}');
95
96		// append style element
97		style.type = 'text/css';
98		if(style.styleSheet) {
99			style.styleSheet.cssText = rules.nodeValue;
100		} else {
101			style.appendChild(rules);
102		}
103		head.appendChild(style);
104	}
105});
106
107// align blocks height
108function initSameHeight() {
109	$('.columns-courses').sameHeight({
110		elements: 'h2',
111		multiLine: true
112	});
113	$('.block-steps').sameHeight({
114		elements: '.inner'
115	});
116}
117
118/*
119 * $ SameHeight plugin
120 */
121;(function($){
122	$.fn.sameHeight = function(opt) {
123		var options = $.extend({
124			skipClass: 'same-height-ignore',
125			leftEdgeClass: 'same-height-left',
126			rightEdgeClass: 'same-height-right',
127			elements: '>*',
128			flexible: false,
129			multiLine: false,
130			useMinHeight: false,
131			biggestHeight: false
132		},opt);
133		return this.each(function(){
134			var holder = $(this), postResizeTimer, ignoreResize;
135			var elements = holder.find(options.elements).not('.' + options.skipClass);
136			if(!elements.length) return;
137
138			// resize handler
139			function doResize() {
140				elements.css(options.useMinHeight && supportMinHeight ? 'minHeight' : 'height', '');
141				if(options.multiLine) {
142					// resize elements row by row
143					resizeElementsByRows(elements, options);
144				} else {
145					// resize elements by holder
146					resizeElements(elements, holder, options);
147				}
148			}
149			doResize();
150
151			// handle flexible layout / font resize
152			var delayedResizeHandler = function() {
153				if(!ignoreResize) {
154					ignoreResize = true;
155					doResize();
156					clearTimeout(postResizeTimer);
157					postResizeTimer = setTimeout(function() {
158						doResize();
159						setTimeout(function(){
160							ignoreResize = false;
161						}, 10);
162					}, 100);
163				}
164			};
165
166			// handle flexible/responsive layout
167			if(options.flexible) {
168				$(window).bind('resize orientationchange fontresize', delayedResizeHandler);
169			}
170
171			// handle complete page load including images and fonts
172			$(window).bind('load', delayedResizeHandler);
173		});
174	};
175
176	// detect css min-height support
177	var supportMinHeight = typeof document.documentElement.style.maxHeight !== 'undefined';
178
179	// get elements by rows
180	function resizeElementsByRows(boxes, options) {
181		var currentRow = $(), maxHeight, maxCalcHeight = 0, firstOffset = boxes.eq(0).offset().top;
182		boxes.each(function(ind){
183			var curItem = $(this);
184			if(curItem.offset().top === firstOffset) {
185				currentRow = currentRow.add(this);
186			} else {
187				maxHeight = getMaxHeight(currentRow);
188				maxCalcHeight = Math.max(maxCalcHeight, resizeElements(currentRow, maxHeight, options));
189				currentRow = curItem;
190				firstOffset = curItem.offset().top;
191			}
192		});
193		if(currentRow.length) {
194			maxHeight = getMaxHeight(currentRow);
195			maxCalcHeight = Math.max(maxCalcHeight, resizeElements(currentRow, maxHeight, options));
196		}
197		if(options.biggestHeight) {
198			boxes.css(options.useMinHeight && supportMinHeight ? 'minHeight' : 'height', maxCalcHeight);
199		}
200	}
201
202	// calculate max element height
203	function getMaxHeight(boxes) {
204		var maxHeight = 0;
205		boxes.each(function(){
206			maxHeight = Math.max(maxHeight, $(this).outerHeight());
207		});
208		return maxHeight;
209	}
210
211	// resize helper function
212	function resizeElements(boxes, parent, options) {
213		var calcHeight;
214		var parentHeight = typeof parent === 'number' ? parent : parent.height();
215		boxes.removeClass(options.leftEdgeClass).removeClass(options.rightEdgeClass).each(function(i){
216			var element = $(this);
217			var depthDiffHeight = 0;
218			var isBorderBox = element.css('boxSizing') === 'border-box';
219
220			if(typeof parent !== 'number') {
221				element.parents().each(function(){
222					var tmpParent = $(this);
223					if(parent.is(this)) {
224						return false;
225					} else {
226						depthDiffHeight += tmpParent.outerHeight() - tmpParent.height();
227					}
228				});
229			}
230			calcHeight = parentHeight - depthDiffHeight;
231			calcHeight -= isBorderBox ? 0 : element.outerHeight() - element.height();
232
233			if(calcHeight > 0) {
234				element.css(options.useMinHeight && supportMinHeight ? 'minHeight' : 'height', calcHeight);
235			}
236		});
237		boxes.filter(':first').addClass(options.leftEdgeClass);
238		boxes.filter(':last').addClass(options.rightEdgeClass);
239		return calcHeight;
240	}
241}($));
242
243/*
244 * $ FontResize Event
245 */
246$.onFontResize = (function($) {
247	$(function() {
248		var randomID = 'font-resize-frame-' + Math.floor(Math.random() * 1000);
249		var resizeFrame = $('<iframe>').attr('id', randomID).addClass('font-resize-helper');
250
251		// required styles
252		resizeFrame.css({
253			width: '100em',
254			height: '10px',
255			position: 'absolute',
256			borderWidth: 0,
257			top: '-9999px',
258			left: '-9999px'
259		}).appendTo('body');
260
261		// use native IE resize event if possible
262		if (window.attachEvent && !window.addEventListener) {
263			resizeFrame.bind('resize', function () {
264				$.onFontResize.trigger(resizeFrame[0].offsetWidth / 100);
265			});
266		}
267		// use script inside the iframe to detect resize for other browsers
268		else {
269			var doc = resizeFrame[0].contentWindow.document;
270			doc.open();
271			doc.write('<scri' + 'pt>window.onload = function(){var em = parent.$("#' + randomID + '")[0];window.onresize = function(){if(parent.$.onFontResize){parent.$.onFontResize.trigger(em.offsetWidth / 100);}}};</scri' + 'pt>');
272			doc.close();
273		}
274		$.onFontResize.initialSize = resizeFrame[0].offsetWidth / 100;
275	});
276	return {
277		// public method, so it can be called from within the iframe
278		trigger: function (em) {
279			$(window).trigger("fontresize", [em]);
280		}
281	};
282}($));
283
284/*
285 * debouncer
286 */
287function debouncer( func , timeout ) {
288   var timeoutID , timeout = timeout || 200;
289   return function () {
290      var scope = this , args = arguments;
291      clearTimeout( timeoutID );
292      timeoutID = setTimeout( function () {
293          func.apply( scope , Array.prototype.slice.call( args ) );
294      } , timeout );
295   }
296}
297
298function slideToHeader()
299{
300	var timeout = 0;
301	setTimeout(function(){
302		$('html, body').stop().animate({scrollLeft: 0, scrollTop:$('#wrapper').offset().top}, 500);
303	}, timeout);
304	
305}

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.