PageSourceSearch

https://nbu.bg/js/main.js?v=4

js nbu.bg collected 2026-10-01 10:32:24 UTC 16,129 bytes, 565 lines download raw bytes

1(function($) {
2	$(document).ready(function() {
3
4		$('.tab_wrap h2').click(function(){
5			var tab_ix= $(this).index(),
6				tables=$(this).parent().next().find('.table_slide');
7
8			$(this).addClass('active').siblings().removeClass('active');
9			tables.eq(tab_ix).show().siblings().hide();
10		});
11
12		//window resize
13		var wwidth = $(window).width(),
14			w_timeout;
15
16		function wresize() {
17			clearTimeout(w_timeout);
18			w_timeout = setTimeout(function() {
19				if($(window).width() != wwidth) {
20					header();
21				}
22				wwidth = $(window).width();
23
24				if(wwidth >= 1024) {
25					$('.upcoming_events.box').show();
26					$('.leading-news.box, .filtered_news').show();
27				}
28
29			}, 300);
30		}
31		$(window).on('resize', wresize);
32
33		//open mobile menu
34		var clicked,
35			vr,
36			parentNav;
37
38		if($('header#main').hasClass('departments') || wwidth < 1024) {
39			$('.mobile_navigation .main li:not(".back")').each(function() {
40				var $this = $(this);
41
42				if($this.children('ul').length == 0) {
43					return;
44				}
45
46				$("<span class='sub_m'></span>").appendTo($this);
47			});
48		}
49
50		function header() {
51			clicked = null;
52			vr = null;
53			parentNav = null;
54
55			$('header#main .hide').removeClass('hide');
56			$('header#main .clicked').removeClass('clicked');
57			$('header#main .move_up').removeClass('move_up');
58			$('header#main .move_back').removeClass('move_back');
59			$('header#main .opened').removeClass('opened');
60			$('header#main .show').removeClass('show');
61
62			if(wwidth < 1024 || $('header#main').hasClass('departments')) {
63				$('header#main .menu_trigger').off('click').on('click', function() {
64					var $this = $(this);
65					$('header#main').toggleClass('mobile_open');
66					$this.toggleClass('opened');
67					$this.next('nav').toggleClass('show');
68				});
69
70				//sub_m
71				$('nav.main a, nav.main .sub_m').off().on('click', function(e) {
72					var $this = $(this);
73					clicked = $this.parent();
74
75					parentNav = $this.parents('nav.main');
76					if(clicked.hasClass('back')) {
77						e.preventDefault();
78						vr = $('<div class="vr_out"/>').appendTo(parentNav);
79						clicked.parent('ul').clone().appendTo(vr);
80
81						clicked.parents('.hide').eq(0).removeClass('hide');
82						parentNav.find('.navigation_wrap').addClass('move_up');
83						return;
84					}
85
86					if($this.hasClass('sub_m')) {
87						clicked.removeClass('clicked').children('ul.hide').removeClass('hide');
88
89						if($this.prev('ul').length > 0) {
90							vr = $('<div class="vr"/>').appendTo(parentNav);
91							$this.prev('ul').clone().appendTo(vr);
92
93							parentNav.find('.navigation_wrap').addClass('move_back');
94						}
95					}
96				});
97
98				/*$('nav.main a').off().on('click', function(e) {
99					var $this = $(this);
100					clicked = $this.parent();
101
102					if($this.next('ul').length > 0) {
103						e.preventDefault();
104					}
105
106					parentNav = $this.parents('nav.main');
107
108					if(clicked.hasClass('back')) {
109						e.preventDefault();
110						vr = $('<div class="vr_out"/>').appendTo(parentNav);
111						clicked.parent('ul').clone().appendTo(vr);
112
113						clicked.parents('.hide').eq(0).removeClass('hide');
114						parentNav.find('.navigation_wrap').addClass('move_up');
115						return;
116					}
117
118					clicked.removeClass('clicked').children('ul.hide').removeClass('hide');
119
120					if($this.next('ul').length > 0) {
121						vr = $('<div class="vr"/>').appendTo(parentNav);
122						$this.next('ul').clone().appendTo(vr);
123
124						parentNav.find('.navigation_wrap').addClass('move_back');
125					}
126				});*/
127			} else {
128				$('header#main').removeClass('mobile_open');
129
130				$('.desktop_navigation ul ul a').off().on('click', function(e) {
131					var $this = $(this);
132					clicked = $this.parent();
133
134					if($this.next('ul').length > 0) {
135						e.preventDefault();
136					}
137
138					parentNav = $this.parents('li').last();
139
140					if(clicked.hasClass('back')) {
141						e.preventDefault();
142						vr = $('<div class="vr_out"/>').appendTo(parentNav);
143						clicked.parent('ul').clone().appendTo(vr);
144
145						clicked.parents('.hide').eq(0).removeClass('hide');
146						parentNav.find(' > ul').addClass('move_up');
147						return;
148					}
149
150					clicked.removeClass('clicked').children('ul.hide').removeClass('hide');
151
152					if($this.next('ul').length > 0) {
153						vr = $('<div class="vr"/>').appendTo(parentNav);
154						$this.next('ul').clone().appendTo(vr);
155
156						parentNav.find(' > ul').addClass('move_back');
157					}
158
159				});
160			}
161		}
162
163		header();
164
165		//footer
166		function footer() {
167			/*$('footer#main_footer nav li').on('click', function() {
168				$('footer#main_footer .categories').stop().slideToggle();
169			});*/
170
171			//mobile
172			var current = 0;
173
174			$('footer#main_footer .right, footer#main_footer .left').on('click', function() {
175				var $this = $(this),
176					categories = $('footer#main_footer nav li'),
177					categories_container = $('footer#main_footer nav ul');
178
179				if(parseInt(categories_container.css('left'), 10) === 0) {
180					current = 0;
181				}
182
183				if($this.hasClass('right')) {
184					if(current >= categories.length -1) {
185						return;
186					}
187					current++;
188				} else {
189					if(current <= 0) {
190						return;
191					}
192					current--;
193				}
194
195				categories_container.css('left', -(100* current) + '%');
196				$('footer#main_footer .categories_wrap').css('left', -(100* current) + '%');
197
198			});
199		}
200
201		footer();
202
203		$('.mobile_navigation nav.main').off().on('animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd', function(e){
204			e = e.originalEvent;
205			if (e.animationName == 'vr_move' || e.animationName == 'vr_move_out') {
206				vr.remove();
207				$('.mobile_navigation nav.main').find('.navigation_wrap').removeClass('move_back move_up');
208				clicked.addClass('clicked').parent().addClass('hide');
209			}
210		});
211
212		$('.desktop_navigation .main_buttons > ul > li > ul').off().on('animationend webkitAnimationEnd MSAnimationEnd oAnimationEnd', function(e){
213			e = e.originalEvent;
214			if (e.animationName == 'moveback' || e.animationName == 'moveup') {
215				vr.remove();
216
217				parentNav.find(' > ul').removeClass('move_back move_up');
218				clicked.addClass('clicked').parent().addClass('hide');
219			}
220		});
221
222		//rich text tabs
223		if($('.rich_text .tabs').length > 0) {
224			$('.rich_text .tabs').on('click', '.title', function() {
225				//$('.rich_text .tabs .title').removeClass('active');
226				$(this).toggleClass('active').next('.content').stop().slideToggle();
227			});
228		}
229
230		//table
231		if($('table').length > 0) {
232			$('table').each(function() {
233
234				var t_warpper = $(this).wrap($('<div class="table_slide"/>'));
235
236				t_warpper.wrap($('<div class="table_wrapper"/>'));
237			});
238		}
239
240		//browser detection
241		navigator.browser = (function(){
242			var ua= navigator.userAgent, tem,
243				cantouch = ("ontouchstart" in document.documentElement) || ("ontouchstart" in window),
244				device = cantouch ? "mobile" : "desktop",
245				M= ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
246			if(/trident/i.test(M[1])){
247				tem=  /\brv[ :]+(\d+)/g.exec(ua) || [];
248				return Array('ie', tem[1], device);
249			}
250
251			if(M[1]=== 'Chrome'){
252				tem= ua.match(/\bOPR\/(\d+)/)
253				if(tem!= null) return Array('Opera', tem[1], device);
254			}
255
256			M= M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?'];
257			if((tem= ua.match(/version\/(\d+)/i))!= null) M.splice(1, 1, tem[1]);
258			M.push(device);
259
260			return M;
261		})();
262		$('body').addClass(navigator.browser[0].toLowerCase()).attr('data-version', navigator.browser[1]).attr('data-device', navigator.browser[2]);
263
264		if($('.accordion').length > 0) {
265			$('.accordion').accordion();
266		}
267
268
269		if ((navigator.browser[0].toLowerCase() != 'msie') && (navigator.browser[1] != 9) && $('.page').hasClass('inner') && $(window).width() > 1024) {
270			var isTop = $(window).scrollTop(),
271				w_height = $(window).outerHeight();
272
273				//$('#main_wrapper').addClass('load');
274
275			if ((isTop) != 0) {
276				$('body').addClass('loaded');
277			} else {
278				setTimeout(function(){
279					$('body').addClass('loaded');
280					$('.page.max_1440').css({
281						top: 0
282					})
283				}, 1);
284			}
285		}
286
287		//alumni ajax info
288		if ($('.alumni_success').length > 0) {
289			$('.alumni_success .view_more, .alumni_success h3 a').click(function(){
290				var $this = $(this),
291					content = $(this).closest('figure').clone();
292
293				if (!$('.content_popup').length > 0) {
294					var	popup_container = $('<div class="content_popup"/>').appendTo($(this).closest('.alumni_success'));
295					$(this).closest('.alumni_success').addClass('overlay');
296				} else {
297					$('.content_popup').remove();
298					var	popup_container = $('<div class="content_popup"/>').appendTo($(this).closest('.alumni_success'));
299					$(this).closest('.alumni_success').addClass('overlay');
300				}
301
302				$.ajax({
303					method: 'get',
304					url: $(this).data('content'),
305					data: {page_id: $(this).data('id')},
306					dataType: 'json',
307					success: function(json) {
308						if (json.success) {
309							popup_container.html(content).prepend('<a class="close_btn" href="javascript:;" title="close">×</a>').append('<p>'+json.info+'</p>');
310						}
311					}
312				});
313
314				var current = $(this).closest('figure').offset().top;
315				popup_container.css({
316					top: $(this).closest('figure').offset().top - $('.inner2_slider').height() + (($(window).height() - ($(window).height() * 0.65)) / 2) - 30,
317					height: $(window).height() * 0.65
318				});
319
320				$('html, body').animate({
321					scrollTop: current
322				}, 1000);
323
324
325			});
326
327			$('body').on('click', '.close_btn', function() {
328				$(this).parent().remove();
329				$('.alumni_success').removeClass('overlay');
330			});
331		}
332
333		$("iframe[src*='youtube']").wrap('<div class="videoWrapper"></div>');
334
335		$('.rich_text table').wrap('<div style="overflow-x: auto;"></div>');
336
337		$('.upcoming-events-btn').click(function () {
338			if(wwidth < 1024) {
339				$('.leading-news.box, .filtered_news').hide();
340				$('.upcoming_events.box').show();
341				$('.leading-news-btn').removeClass('active');
342				$(this).addClass('active');
343			}
344		});
345
346		$('.leading-news-btn').click(function () {
347			if(wwidth < 1024) {
348				$('.upcoming_events.box').hide();
349				$('.leading-news.box, .filtered_news').show();
350				$('.upcoming-events-btn').removeClass('active');
351				$(this).addClass('active');
352			}
353		});
354
355		$('.accents-2 figure h2').click(function () {
356			$('.accents-2 img').hide();
357			$('.accents-2 figure div').slideUp();
358			$('.accents-2 figure').removeClass('active');
359			$(this).next('div').slideDown();
360			$(this).parent().addClass('active');
361			if(wwidth >= 1024) {
362				setTimeout(function () {
363					$('.accents-2 figure.active img').fadeIn();
364				}, 400);
365			}
366		});
367	});
368
369	$.fn.accordion  = function() {
370		$(this).each(function() {
371			var $this = $(this);
372
373			$this.find('dd').each(function() {
374				var $self = $(this);
375
376				if($self.is(':empty')) {
377					$self.prev('dt').find('.trigger').remove();
378				}
379			});
380
381			$this.on('click', 'dt .trigger', function(e) {
382				e.preventDefault();
383				var $this = $(this).parent('dt');
384
385				if ($this.parent().hasClass('open')) {
386					return;
387				}
388
389				$this.toggleClass('opened').siblings().removeClass('opened').removeClass('active');
390				$this.next('dd').stop().slideToggle().siblings('dd').slideUp();;
391			});
392
393			$this.on('click', 'dd .trigger', function(e) {
394				e.preventDefault();
395				var trigger = $(this);
396				trigger.next('ul').find('.trigger'); //.removeClass('opened')
397				trigger.stop().toggleClass('opened');
398				trigger.parent('li').siblings('li').find('ul').slideUp();
399				trigger.parent('li').siblings('li').find('.trigger').removeClass('opened');
400				trigger.next('ul').stop().slideToggle();
401			});
402		});
403	}
404
405	//accents
406	if($('.accents').length > 0) {
407		$('.accents .icon-details').on('click', function(e) {
408			var $this = $(this);
409			e.preventDefault();
410			$this.toggleClass('hide');
411			$this.siblings('.info').children('ul').slideToggle();
412		});
413	}
414
415
416
417var delay = function() {
418	var time = 0;
419	return function(t, i) {
420		clearTimeout(time), time = setTimeout(t, i)
421	}
422}();
423
424	var time = 100;
425	$(window).resize(function() {
426		delay(function() {
427			var time = $(window).width(),
428				exclude_h = $('#main_footer').outerHeight() + $('.m_header_wrap').outerHeight() + $('.breadcrumbs').outerHeight() + $('.page_title').outerHeight() + 40;
429			time > 767 && ($(".page_content").css('min-height', ($(window).height() - exclude_h) + 'px'), $(window).resize(function() {
430				$(".page_content").css('min-height', ($(window).height() - exclude_h) + 'px')
431			}));
432		}, time)
433	}), $(window).resize();
434
435
436})(jQuery);
437
438$(document).ready(function() {
439	$('.left_side_content dd').each(function () {
440		var $this = $(this);
441
442		//check for active
443		var activ_element = $this.find('li.active');
444
445		if ($this.parents('.accordion').length > 0 && activ_element.length > 0) {
446			$this.closest('dd').addClass('active-dd').show().prev('dt').addClass('opened');
447			activ_element.closest('ul').show().prev('.trigger').addClass('opened');
448			var parent = activ_element.closest('ul').parent('li').parent('ul');
449
450			for(i=1; i<=10; i++) {
451				parent.show().prev('.trigger').addClass('opened');
452				parent = parent.parent('li').parent('ul');
453
454				if(parent.length == 0) {
455					break;
456				}
457			}
458		}
459
460		var has_sub = $this.find('.level_one ul').prev('a').wrap('<div class="has_submenu" />');
461		has_sub.parent('.has_submenu').append('<span class="submenu_trigger" />');
462
463		if ($this.parents('.accordion').length > 0 && activ_element.length > 0) {
464			setTimeout(function () {
465				$this.closest('dd').show().prev('dt').addClass('opened');
466			}, 0);
467		}
468	});
469});
470
471/**
472 *
473 * Define constants for the app and much much more...
474 *
475 */
476var NBU = {};
477
478
479NBU.gallery = (function() {
480	'use strict'; // Just to annoy...
481
482	/**
483     * Initialize the global features.
484     *
485     * @public
486     * @function
487     *
488     * Example:
489     * NBU.init()
490	     */
491	function init() {
492		// Allways initialize the global functions, unless they're not necessary
493
494		// init Isotope
495		var $grid = $('.nbu-grid-images').isotope({
496			itemSelector: '.nbu-grid-images-item',
497			percentPosition: true,
498			masonry: {
499				columnWidth: '.nbu-grid-images-sizer'
500			}
501		});
502		// layout Isotope after each image loads
503		$grid.imagesLoaded().progress(function() {
504			$grid.isotope('layout');
505		});
506
507		$('.nbu-grid-images').each(function() {
508			$(this).magnificPopup({
509				delegate: 'a',
510				type: 'image',
511				gallery: {
512					enabled:true
513				},
514				removalDelay: 300
515			});
516		});
517	}
518
519	/**
520     * Aux functions
521     */
522
523	return {
524		init: init,
525	};
526})();
527
528// HTML  CSS  JS  Result
529// EDIT ON
530 // Select all links with hashes
531$('a[href*="#"]')
532  // Remove links that don't actually link to anything
533  .not('[href="#"]')
534  .not('[href="#0"]')
535  .click(function(event) {
536    // On-page links
537    if (
538      location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '')
539      &&
540      location.hostname == this.hostname
541    ) {
542      // Figure out element to scroll to
543      var target = $(this.hash);
544      target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
545      // Does a scroll target exist?
546      if (target.length) {
547        // Only prevent default if animation is actually gonna happen
548        event.preventDefault();
549        $('html, body').animate({
550          scrollTop: target.offset().top
551        }, 1000, function() {
552          // Callback after animation
553          // Must change focus!
554          var $target = $(target);
555          $target.focus();
556          if ($target.is(":focus")) { // Checking if the target was focused
557            return false;
558          } else {
559            $target.attr('tabindex','-1'); // Adding tabindex for elements not focusable
560            $target.focus(); // Set focus again
561          };
562        });
563      }
564    }
565  });

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.