PageSourceSearch

https://www.spbstu.ru/local/templates/main/js/main.js

js spbstu.ru collected 2026-09-24 08:49:00 UTC 8,609 bytes, 325 lines download raw bytes

1var Base64 = {
2	// private property
3	_keyStr : "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
4
5	// public method for encoding
6	encode : function (input) {
7		var output = "";
8		var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
9		var i = 0;
10
11		input = Base64._utf8_encode(input);
12
13		while (i < input.length) {
14
15			chr1 = input.charCodeAt(i++);
16			chr2 = input.charCodeAt(i++);
17			chr3 = input.charCodeAt(i++);
18
19			enc1 = chr1 >> 2;
20			enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
21			enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
22			enc4 = chr3 & 63;
23
24			if (isNaN(chr2)) {
25				enc3 = enc4 = 64;
26			} else if (isNaN(chr3)) {
27				enc4 = 64;
28			}
29
30			output = output +
31			this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) +
32			this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
33
34		}
35
36		return output;
37	},
38
39	// public method for decoding
40	decode : function (input) {
41		var output = "";
42		var chr1, chr2, chr3;
43		var enc1, enc2, enc3, enc4;
44		var i = 0;
45
46		input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
47
48		while (i < input.length) {
49
50			enc1 = this._keyStr.indexOf(input.charAt(i++));
51			enc2 = this._keyStr.indexOf(input.charAt(i++));
52			enc3 = this._keyStr.indexOf(input.charAt(i++));
53			enc4 = this._keyStr.indexOf(input.charAt(i++));
54
55			chr1 = (enc1 << 2) | (enc2 >> 4);
56			chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
57			chr3 = ((enc3 & 3) << 6) | enc4;
58
59			output = output + String.fromCharCode(chr1);
60
61			if (enc3 != 64) {
62				output = output + String.fromCharCode(chr2);
63			}
64			if (enc4 != 64) {
65				output = output + String.fromCharCode(chr3);
66			}
67
68		}
69
70		output = Base64._utf8_decode(output);
71
72		return output;
73
74	},
75
76	// private method for UTF-8 encoding
77	_utf8_encode : function (string) {
78		string = string.replace(/\r\n/g,"\n");
79		var utftext = "";
80
81		for (var n = 0; n < string.length; n++) {
82
83			var c = string.charCodeAt(n);
84
85			if (c < 128) {
86				utftext += String.fromCharCode(c);
87			}
88			else if((c > 127) && (c < 2048)) {
89				utftext += String.fromCharCode((c >> 6) | 192);
90				utftext += String.fromCharCode((c & 63) | 128);
91			}
92			else {
93				utftext += String.fromCharCode((c >> 12) | 224);
94				utftext += String.fromCharCode(((c >> 6) & 63) | 128);
95				utftext += String.fromCharCode((c & 63) | 128);
96			}
97
98		}
99
100		return utftext;
101	},
102
103	// private method for UTF-8 decoding
104	_utf8_decode : function (utftext) {
105		var string = "";
106		var i = 0;
107		var c = c1 = c2 = 0;
108
109		while ( i < utftext.length ) {
110
111			c = utftext.charCodeAt(i);
112
113			if (c < 128) {
114				string += String.fromCharCode(c);
115				i++;
116			}
117			else if((c > 191) && (c < 224)) {
118				c2 = utftext.charCodeAt(i+1);
119				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
120				i += 2;
121			}
122			else {
123				c2 = utftext.charCodeAt(i+1);
124				c3 = utftext.charCodeAt(i+2);
125				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
126				i += 3;
127			}
128
129		}
130
131		return string;
132	}
133
134};
135
136var matched, browser;
137
138jQuery.uaMatch = function( ua ) {
139	ua = ua.toLowerCase();
140
141	var match = /(chrome)[ \/]([\w.]+)/.exec( ua ) ||
142		/(webkit)[ \/]([\w.]+)/.exec( ua ) ||
143		/(opera)(?:.*version|)[ \/]([\w.]+)/.exec( ua ) ||
144		/(msie) ([\w.]+)/.exec( ua ) ||
145		ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec( ua ) ||
146		[];
147
148	return {
149		browser: match[ 1 ] || "",
150		version: match[ 2 ] || "0"
151	};
152};
153
154matched = jQuery.uaMatch( navigator.userAgent );
155browser = {};
156
157if ( matched.browser ) {
158	browser[ matched.browser ] = true;
159	browser.version = matched.version;
160}
161
162// Chrome is Webkit, but Webkit is also Safari.
163if ( browser.chrome ) {
164	browser.webkit = true;
165} else if ( browser.webkit ) {
166	browser.safari = true;
167}
168
169jQuery.browser = browser;
170
171$(function(){
172	$('body').find('a.mailcode').each(function(){
173		$(this).attr('href', 'mailto:'+Base64.decode($(this).html())+'')
174		$(this).html(Base64.decode($(this).html()));
175	});
176	$("#faq_form_btn").click(function(){
177		var url = '';
178		var en_url = '/ajax/';
179		var ru_url = '/ajax/';
180		var lang = $(this).data('lang');
181		if(lang=='en'){
182			url = en_url;
183		}
184		if(lang=='ru'){
185			url = ru_url;
186		}
187		$.ajax({
188			url: url+"faq_form.php",
189			cache: false,
190			success: function(html){
191				$("#faq_form_load").html(html);
192			}
193		});
194	});
195	$("#addnews_form_btn").click(function(){
196		$.ajax({
197			url: "/ajax/addnews_form.php",
198			cache: false,
199			success: function(html){
200				$("#addnews_form_load").html(html);
201			}
202		});
203	});
204    $('[data-toggle="popover"]').each(function() {
205        var opts = {trigger: 'manual'};
206        if ($(this).hasClass('person__office-hours')) {
207            opts.template = '<div class="popover popover-office-hours" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>';
208        }
209        $(this).popover(opts);
210    }).on('mouseenter', function() {
211        var $trigger = $(this);
212        $trigger.popover('show');
213        var popoverData = $trigger.data('bs.popover');
214        if (popoverData && popoverData.$tip) {
215            popoverData.$tip.off('mouseleave.sticky').on('mouseleave.sticky', function() {
216                $trigger.popover('hide');
217            });
218        }
219    }).on('mouseleave', function() {
220        var $trigger = $(this);
221        setTimeout(function() {
222            var popoverData = $trigger.data('bs.popover');
223            var $tip = popoverData && popoverData.$tip;
224            if (!$tip || !$tip.is(':hover')) {
225                $trigger.popover('hide');
226            }
227        }, 100);
228    });
229
230
231	if ($('#calendarShort').length){
232		var context = {
233			calendarElem: $('#calendarShort'),
234			language: 'ru'
235		};
236		calendarViewShort (context);
237	}
238});
239
240$(function(){
241	if($(".js-filters-spoiler").length) {
242		var filter_min=$.cookie('filter_min');
243		if(filter_min==1){
244			var button=$(".js-filters-spoiler-click");
245			$(".js-filters-spoiler").hide();
246			$(".clear-button").hide();
247			button.html("Задать фильтры").addClass("js-active blue-button island-020");
248			button.parent("span").parent(".select-boxes").removeClass("border-grey");
249		}
250		$(".js-filters-spoiler-click").click(function() {
251			if($(this).hasClass("js-active")) {
252				$.cookie('filter_min', '1', { path: '/' });
253				$(".clear-button").hide();
254			} else {
255				$.cookie('filter_min', '0', { path: '/' });
256				$(".clear-button").show();
257			}
258		});
259	}
260	$('.autocpl').autocomplete({
261		serviceUrl: '/bitrix/components/ithive/catalog.filter/ajax.php', // Страница для обработки запросов автозаполнения
262		minChars: 3, // Минимальная длина запроса для срабатывания автозаполнения
263		delimiter: /(,|;)\s*/, // Разделитель для нескольких запросов, символ или регулярное выражение
264		maxHeight: 400, // Максимальная высота списка подсказок, в пикселях
265		width: 300, // Ширина списка
266		zIndex: 9999, // z-index списка
267		noCache: false,
268		params: { prop: 1}, // Дополнительные параметры
269		deferRequestBy: 0, // Задержка запроса (мсек), на случай, если мы не хотим слать миллион запросов, пока пользователь печатает. Я обычно ставлю 300.
270		onSearchStart: function(q) {
271
272			q.prop = $(this).attr("data-prop");
273			q.iblock = $(this).attr("data-ibl-id");
274			//console.log(q);
275		}
276	});
277	$(".filter select").chosen();
278});
279
280
281$(function() {
282	if($('#jstree').length){
283		$('#jstree').jstree({
284			'core': {
285				'themes': {
286					'name': 'proton',
287					'responsive': true
288				}
289			}
290		}).bind('select_node.jstree', function(e,data) {
291			window.location.href = data.node.a_attr.href;
292		});
293	}
294
295});
296
297
298document.addEventListener('DOMContentLoaded', function() {
299	var triggers = document.querySelectorAll('.office-hours-trigger');
300
301	function unpin(trigger) {
302		var popup = trigger.querySelector('.office-hours-trigger__popup');
303		if (popup) popup.classList.remove('is-pinned');
304	}
305
306	triggers.forEach(function(trigger) {
307		trigger.addEventListener('click', function() {
308			var popup = trigger.querySelector('.office-hours-trigger__popup');
309			if (!popup) return;
310			var pinned = popup.classList.contains('is-pinned');
311			triggers.forEach(unpin);
312			if (!pinned) popup.classList.add('is-pinned');
313		});
314	});
315
316	document.addEventListener('click', function(e) {
317		if (!e.target.closest('.office-hours-trigger')) {
318			triggers.forEach(unpin);
319		}
320	});
321
322	document.addEventListener('keydown', function(e) {
323		if (e.key === 'Escape') triggers.forEach(unpin);
324	});
325});

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.