PageSourceSearch

https://www.iscreb.org/themes/foundry/js/scripts.js?v=8

js iscreb.org collected 2026-10-02 13:14:25 UTC 29,390 bytes, 895 lines download raw bytes

1(function ($, Drupal) {
2
3  
4  Drupal.behaviors.gazeta = {
5    attach: function (context, settings) {
6		
7		
8var mr_firstSectionHeight,
9    mr_nav,
10    mr_fixedAt,
11    mr_navOuterHeight,
12    mr_navScrolled = false,
13    mr_navFixed = false,
14    mr_outOfSight = false,
15    mr_floatingProjectSections,
16    mr_scrollTop = 0;
17
18    // Update scroll variable for scrolling functions
19
20    addEventListener('scroll', function() {
21        mr_scrollTop = window.pageYOffset;
22    }, false);
23
24    $('.background-image-holder').each(function() {
25        var imgSrc = $(this).find('img').attr('src');
26        $(this).css('background', 'url("' + imgSrc + '")');
27        $(this).children('img').hide();
28        $(this).css('background-position', 'initial');
29    });
30	
31    // Fade in background images
32
33    setTimeout(function() {
34        $('.background-image-holder').each(function() {
35            $(this).addClass('fadeIn');
36        });
37    }, 200)
38
39	// V algin children
40	$('.builder-row.v-align-children .builder-element-children-wrapper').each(function(i) {
41      if ( i === 0 ) {
42        $(this).addClass('v-align-children');
43      }
44    });;
45	
46	// v-align-transform	
47	//$('.v-align-transform').parent().css('height','100vh');
48	
49	/*
50	$('.v-align-transform').each(function() {
51            $(this).parents('.container').addClass('v-align-transform');
52			$(this).removeClass('v-align-transform');
53        });
54	*/
55	
56    // Initialize Tooltips
57
58    $('[data-toggle="tooltip"]').tooltip();
59
60    // Icon bulleted lists
61
62    $('ul[data-bullet]').each(function(){
63        var bullet = $(this).attr('data-bullet');
64        $(this).find('>li').prepend('<i class="'+bullet+'"></i>');
65    });
66
67    // Progress Bars
68
69    $('.progress-bar').each(function() {
70        $(this).css('width', $(this).attr('data-progress') + '%');
71    });
72
73    // Navigation
74    $('[data-toggle="dropdown"]').addClass('dropdown-toggle');
75    $('.mega-menu-link').each(function() {
76        $(this).parents('li').addClass('mega-menu-li');
77    });
78    if (!$('nav').hasClass('fixed') && !$('nav').hasClass('absolute')) {
79
80        // Make nav container height of nav
81
82        $('.nav-container').css('min-height', $('nav').outerHeight(true));
83
84        $(window).resize(function() {
85            $('.nav-container').css('min-height', $('nav').outerHeight(true));
86        });
87
88        // Compensate the height of parallax element for inline nav
89
90        if ($(window).width() > 768) {
91            $('.parallax:nth-of-type(1) .background-image-holder').css('top', -($('nav').outerHeight(true)));
92        }
93
94        // Adjust fullscreen elements
95
96        if ($(window).width() > 768) {
97            $('section.fullscreen:nth-of-type(1)').css('height', ($(window).height() - $('nav').outerHeight(true)));
98        }
99
100    } else {
101        $('body').addClass('nav-is-overlay');
102    }
103
104    if ($('nav').hasClass('bg-dark')) {
105        $('.nav-container').addClass('bg-dark');
106    }
107
108
109    // Fix nav to top while scrolling
110
111    mr_nav = $('body .nav-container nav:first');
112    mr_navOuterHeight = $('body .nav-container nav:first').outerHeight();
113        mr_fixedAt = typeof mr_nav.attr('data-fixed-at') !== typeof undefined ? parseInt(mr_nav.attr('data-fixed-at').replace('px', '')) : parseInt($('section:nth-of-type(1)').outerHeight());
114    window.addEventListener("scroll", updateNav, false);
115
116    // Menu dropdown positioning
117
118    $('.menu > li > ul').each(function() {
119        var menu = $(this).offset();
120        var farRight = menu.left + $(this).outerWidth(true);
121        if (farRight > $(window).width() && !$(this).hasClass('mega-menu')) {
122            $(this).addClass('make-right');
123        } else if (farRight > $(window).width() && $(this).hasClass('mega-menu')) {
124            var isOnScreen = $(window).width() - menu.left;
125            var difference = $(this).outerWidth(true) - isOnScreen;
126            $(this).css('margin-left', -(difference));
127        }
128    });
129
130    // Mobile Menu
131
132    $('.mobile-toggle').click(function() {
133        $('.nav-bar').toggleClass('nav-open');
134        $(this).toggleClass('active');
135    });
136
137    $('.menu li').click(function(e) {
138        if (!e) e = window.event;
139        e.stopPropagation();
140        if ($(this).find('ul').length) {
141            $(this).toggleClass('toggle-sub');
142        } else {
143            $(this).parents('.toggle-sub').removeClass('toggle-sub');
144        }
145    });
146
147    $('.menu li a').click(function() {
148        if ($(this).hasClass('inner-link')){
149            $(this).closest('.nav-bar').removeClass('nav-open');
150        }
151    });
152
153    $('.module.widget-handle').click(function() {
154        $(this).toggleClass('toggle-widget-handle');
155    });
156
157    $('.search-widget-handle .search-form input').click(function(e){
158        if (!e) e = window.event;
159        e.stopPropagation();
160    });
161    
162    // Offscreen Nav
163    
164    if($('.offscreen-toggle').length){
165    	$('body').addClass('has-offscreen-nav');
166    }
167    else{
168        $('body').removeClass('has-offscreen-nav');
169    }
170    
171    $('.offscreen-toggle').click(function(){
172    	$('.main-container').toggleClass('reveal-nav');
173    	$('nav').toggleClass('reveal-nav');
174    	$('.offscreen-container').toggleClass('reveal-nav');
175    });
176    
177    $('.main-container').click(function(){
178    	if($(this).hasClass('reveal-nav')){
179    		$(this).removeClass('reveal-nav');
180    		$('.offscreen-container').removeClass('reveal-nav');
181    		$('nav').removeClass('reveal-nav');
182    	}
183    });
184    
185    $('.offscreen-container a').click(function(){
186    	$('.offscreen-container').removeClass('reveal-nav');
187    	$('.main-container').removeClass('reveal-nav');
188    	$('nav').removeClass('reveal-nav');
189    });
190
191    // Populate filters
192    
193    $('.projects').each(function() {
194        var filters = "";
195        $(this).find('.project').each(function() {
196
197            var filterTags = $(this).attr('data-filter').split(',');
198
199            filterTags.forEach(function(tagName) {
200                if (filters.indexOf(tagName) == -1) {
201                    filters += '<li data-filter="' + tagName + '">' + capitaliseFirstLetter(tagName) + '</li>';
202                }
203            });
204            $(this).closest('.projects')
205                .find('ul.filters').empty().append('<li data-filter="all" class="active">All</li>').append(filters);
206        });
207    });
208
209    $('.filters li').click(function() {
210        var filter = $(this).attr('data-filter');
211        $(this).closest('.filters').find('li').removeClass('active');
212        $(this).addClass('active');
213
214        $(this).closest('.projects').find('.project').each(function() {
215            var filters = $(this).attr('data-filter');
216
217            if (filters.indexOf(filter) == -1) {
218                $(this).addClass('inactive');
219            } else {
220                $(this).removeClass('inactive');
221            }
222        });
223
224        if (filter == 'all') {
225            $(this).closest('.projects').find('.project').removeClass('inactive');
226        }
227    });
228    
229
230    // Twitter Feed
231       $('.tweets-feed').each(function(index) {
232           jQuery(this).attr('id', 'tweets-' + index);
233       }).each(function(index) {
234           var element = $('#tweets-' + index);
235           var TweetConfig = {
236               "domId": '',
237               "maxTweets": element.attr('data-amount'),
238               "enableLinks": true,
239               "showUser": true,
240               "showTime": true,
241               "dateFunction": '',
242               "showRetweet": false,
243               "customCallback": handleTweets
244           };
245
246           if(typeof element.attr('data-widget-id') !== typeof undefined){
247                TweetConfig.id = element.attr('data-widget-id');
248            }else if(typeof element.attr('data-feed-name') !== typeof undefined && element.attr('data-feed-name') !== "" ){
249                TweetConfig.profile = {"screenName": element.attr('data-feed-name').replace('@', '')};
250            }else{
251                TweetConfig.profile = {"screenName": 'twitter'};
252            }
253
254           function handleTweets(tweets) {
255               var x = tweets.length;
256               var n = 0;
257               var element = document.getElementById('tweets-' + index);
258               var html = '<ul class="slides">';
259               while (n < x) {
260                   html += '<li>' + tweets[n] + '</li>';
261                   n++;
262               }
263               html += '</ul>';
264               element.innerHTML = html;
265
266               if ($('.tweets-slider').length) {
267                    $('.tweets-slider').flexslider({
268                        directionNav: false,
269                        controlNav: false
270                    });
271                }       
272               return html;
273           }
274           twitterFetcher.fetch(TweetConfig);
275      });
276
277    // Instagram Feed
278    
279    if($('.instafeed').length){
280    	jQuery.fn.spectragram.accessData = {
281			accessToken: '1406933036.dc95b96.2ed56eddc62f41cbb22c1573d58625a2',
282			clientID: '87e6d2b8a0ef4c7ab8bc45e80ddd0c6a'
283		};	
284
285        $('.instafeed').each(function() {
286            var feedID = $(this).attr('data-user-name');
287            $(this).children('ul').spectragram('getUserFeed', {
288                query: feedID,
289                max: 12
290            });
291        });
292    }   
293
294    // Flickr Feeds
295
296    if($('.flickr-feed').length){
297        $('.flickr-feed').each(function(){
298            var userID = $(this).attr('data-user-id');
299            var albumID = $(this).attr('data-album-id');
300            $(this).flickrPhotoStream({ id: userID, setId: albumID, container: '<li class="masonry-item" />' });   
301            setTimeout(function(){
302                initializeMasonry();
303                window.dispatchEvent(new Event('resize'));
304            }, 1000); 
305        });
306
307    }
308
309    // Image Sliders
310    if($('.slider-all-controls, .slider-paging-controls, .slider-arrow-controls, .slider-thumb-controls, .logo-carousel').length){
311        $('.slider-all-controls').flexslider({
312            start: function(slider){
313                if(slider.find('.slides li:first-child').find('.fs-vid-background video').length){
314                   slider.find('.slides li:first-child').find('.fs-vid-background video').get(0).play(); 
315                }
316            },
317            after: function(slider){
318                if(slider.find('.fs-vid-background video').length){
319                    if(slider.find('li:not(.flex-active-slide)').find('.fs-vid-background video').length){
320                        slider.find('li:not(.flex-active-slide)').find('.fs-vid-background video').get(0).pause();
321                    }
322                    if(slider.find('.flex-active-slide').find('.fs-vid-background video').length){
323                        slider.find('.flex-active-slide').find('.fs-vid-background video').get(0).play();
324                    }
325                }
326            }
327        });
328        $('.slider-paging-controls').flexslider({
329            animation: "slide",
330            directionNav: false
331        });
332        $('.slider-arrow-controls').flexslider({
333            controlNav: false
334        });
335        $('.slider-thumb-controls .slides li').each(function() {
336            var imgSrc = $(this).find('img').attr('src');
337            $(this).attr('data-thumb', imgSrc);
338        });
339        $('.slider-thumb-controls').flexslider({
340            animation: "slide",
341            controlNav: "thumbnails",
342            directionNav: true
343        });
344        $('.logo-carousel').flexslider({
345            minItems: 1,
346            maxItems: 4,
347            move: 1,
348            itemWidth: 200,
349            itemMargin: 0,
350            animation: "slide",
351            slideshow: true,
352            slideshowSpeed: 3000,
353            directionNav: false,
354            controlNav: false
355        });
356    }   
357    
358    // Lightbox gallery titles
359    
360    $('.lightbox-grid li a').each(function(){
361    	var galleryTitle = $(this).closest('.lightbox-grid').attr('data-gallery-title');
362    	$(this).attr('data-lightbox', galleryTitle);
363    });
364
365    // Prepare embedded video modals
366
367    $('iframe[data-provider]').each(function(){
368        var provider = jQuery(this).attr('data-provider');
369        var videoID = jQuery(this).attr('data-video-id');
370        var autoplay = jQuery(this).attr('data-autoplay');
371        var vidURL = '';
372
373        if(provider == 'vimeo'){
374            vidURL = "http://player.vimeo.com/video/"+videoID+"?badge=0&title=0&byline=0&title=0&autoplay="+autoplay;
375            $(this).attr('data-src', vidURL);
376        }else if (provider == 'youtube'){
377            vidURL = "https://www.youtube.com/embed/"+videoID+"?showinfo=0&autoplay="+autoplay;
378            $(this).attr('data-src', vidURL);
379        }else{
380            console.log('Only Vimeo and Youtube videos are supported at this time');
381        }
382    });
383    
384    // Multipurpose Modals
385    
386    jQuery('.foundry_modal[modal-link]').remove();
387
388    if($('.foundry_modal').length && (!jQuery('.modal-screen').length)){
389        // Add a div.modal-screen if there isn't already one there.
390        var modalScreen = jQuery('<div />').addClass('modal-screen').appendTo('body');
391
392    }
393
394    jQuery('.foundry_modal').click(function(){
395        jQuery(this).addClass('modal-acknowledged');
396    });
397
398    jQuery(document).on('wheel mousewheel scroll', '.foundry_modal, .modal-screen', function(evt){
399        $(this).get(0).scrollTop += (evt.originalEvent.deltaY); 
400        return false;
401    });
402    
403    $('.modal-container:not([modal-link])').each(function(index) {
404        if(jQuery(this).find('iframe[src]').length){
405        	jQuery(this).find('.foundry_modal').addClass('iframe-modal');
406        	var iframe = jQuery(this).find('iframe');
407        	iframe.attr('data-src',iframe.attr('src'));
408            iframe.attr('src', '');
409
410        }
411        jQuery(this).find('.btn-modal').attr('modal-link', index);
412
413        // Only clone and append to body if there isn't already one there
414        if(!jQuery('.foundry_modal[modal-link="'+index+'"]').length){
415            jQuery(this).find('.foundry_modal').clone().appendTo('body').attr('modal-link', index).prepend(jQuery('<i class="ti-close close-modal">'));
416        }
417    });
418    
419    $('.btn-modal').unbind('click').click(function(){
420    	var linkedModal = jQuery('.foundry_modal[modal-link="' + jQuery(this).attr('modal-link') + '"]'),
421            autoplayMsg = "";
422        jQuery('.modal-screen').toggleClass('reveal-modal');
423        if(linkedModal.find('iframe').length){
424            if(linkedModal.find('iframe').attr('data-autoplay') === '1'){
425                var autoplayMsg = '&autoplay=1'
426            }
427        	linkedModal.find('iframe').attr('src', (linkedModal.find('iframe').attr('data-src') + autoplayMsg));
428        }
429        if(linkedModal.find('video').length){
430            linkedModal.find('video').get(0).play();
431        }
432        linkedModal.toggleClass('reveal-modal');
433        return false; 
434    });
435    
436    // Autoshow modals
437	
438	$('.foundry_modal[data-time-delay]').each(function(){
439		var modal = $(this);
440		var delay = modal.attr('data-time-delay');
441		modal.prepend($('<i class="ti-close close-modal">'));
442    	if(typeof modal.attr('data-cookie') != "undefined"){
443        	if(!mr_cookies.hasItem(modal.attr('data-cookie'))){
444                setTimeout(function(){
445        			modal.addClass('reveal-modal');
446        			$('.modal-screen').addClass('reveal-modal');
447        		},delay);
448            }
449        }else{
450            setTimeout(function(){
451                modal.addClass('reveal-modal');
452                $('.modal-screen').addClass('reveal-modal');
453            },delay);
454        }
455	});
456
457    // Exit modals
458    $('.foundry_modal[data-show-on-exit]').each(function(){
459        var modal = $(this);
460        var exitSelector = $(modal.attr('data-show-on-exit'));
461        // If a valid selector is found, attach leave event to show modal.
462        if($(exitSelector).length){
463            modal.prepend($('<i class="ti-close close-modal">'));
464            $(document).on('mouseleave', exitSelector, function(){
465                if(!$('body .reveal-modal').length){
466                    if(typeof modal.attr('data-cookie') !== typeof undefined){
467                        if(!mr_cookies.hasItem(modal.attr('data-cookie'))){
468                            modal.addClass('reveal-modal');
469                            $('.modal-screen').addClass('reveal-modal');
470                        }
471                    }else{
472                        modal.addClass('reveal-modal');
473                        $('.modal-screen').addClass('reveal-modal');
474                    }
475                }
476            });
477        }
478    });
479
480    // Autoclose modals
481
482    $('.foundry_modal[data-hide-after]').each(function(){
483        var modal = $(this);
484        var delay = modal.attr('data-hide-after');
485        if(typeof modal.attr('data-cookie') != "undefined"){
486            if(!mr_cookies.hasItem(modal.attr('data-cookie'))){
487                setTimeout(function(){
488                if(!modal.hasClass('modal-acknowledged')){
489                    modal.removeClass('reveal-modal');
490                    $('.modal-screen').removeClass('reveal-modal');
491                }
492                },delay); 
493            }
494        }else{
495            setTimeout(function(){
496                if(!modal.hasClass('modal-acknowledged')){
497                    modal.removeClass('reveal-modal');
498                    $('.modal-screen').removeClass('reveal-modal');
499                }
500            },delay); 
501        }
502    });
503    
504    jQuery('.close-modal:not(.modal-strip .close-modal)').unbind('click').click(function(){
505    	var modal = jQuery(this).closest('.foundry_modal');
506        modal.toggleClass('reveal-modal');
507        if(typeof modal.attr('data-cookie') !== "undefined"){
508            mr_cookies.setItem(modal.attr('data-cookie'), "true", Infinity);
509        }
510    	if(modal.find('iframe').length){
511            modal.find('iframe').attr('src', '');
512        }
513        jQuery('.modal-screen').removeClass('reveal-modal');
514    });
515    
516    jQuery('.modal-screen').unbind('click').click(function(){
517        if(jQuery('.foundry_modal.reveal-modal').find('iframe').length){
518            jQuery('.foundry_modal.reveal-modal').find('iframe').attr('src', '');
519        }
520    	jQuery('.foundry_modal.reveal-modal').toggleClass('reveal-modal');
521    	jQuery(this).toggleClass('reveal-modal');
522    });
523    
524    jQuery(document).keyup(function(e) {
525		 if (e.keyCode == 27) { // escape key maps to keycode `27`
526            if(jQuery('.foundry_modal').find('iframe').length){
527                jQuery('.foundry_modal').find('iframe').attr('src', '');
528            }
529			jQuery('.foundry_modal').removeClass('reveal-modal');
530			jQuery('.modal-screen').removeClass('reveal-modal');
531		}
532	});
533    
534    // Modal Strips
535    
536    jQuery('.modal-strip').each(function(){
537    	if(!jQuery(this).find('.close-modal').length){
538    		jQuery(this).append(jQuery('<i class="ti-close close-modal">'));
539    	}
540    	var modal = jQuery(this);
541
542        if(typeof modal.attr('data-cookie') != "undefined"){
543           
544            if(!mr_cookies.hasItem(modal.attr('data-cookie'))){
545            	setTimeout(function(){
546            		modal.addClass('reveal-modal');
547            	},1000);
548            }
549        }else{
550            setTimeout(function(){
551                    modal.addClass('reveal-modal');
552            },1000);
553        }
554    });
555    
556    jQuery('.modal-strip .close-modal').click(function(){
557        var modal = jQuery(this).closest('.modal-strip');
558        if(typeof modal.attr('data-cookie') != "undefined"){
559            mr_cookies.setItem(modal.attr('data-cookie'), "true", Infinity);
560        }
561    	jQuery(this).closest('.modal-strip').removeClass('reveal-modal');
562    	return false;
563    });
564
565
566    // Video Modals
567
568    jQuery('.close-iframe').click(function() {
569        jQuery(this).closest('.modal-video').removeClass('reveal-modal');
570        jQuery(this).siblings('iframe').attr('src', '');
571        jQuery(this).siblings('video').get(0).pause();
572    });
573
574    // Checkboxes
575
576    $('.checkbox-option').on("click",function() {
577        $(this).toggleClass('checked');
578        var checkbox = $(this).find('input');
579        if (checkbox.prop('checked') === false) {
580            checkbox.prop('checked', true);
581        } else {
582            checkbox.prop('checked', false);
583        }
584    });
585
586    // Radio Buttons
587
588    $('.radio-option').click(function() {
589
590        var checked = $(this).hasClass('checked'); // Get the current status of the radio
591
592        var name = $(this).find('input').attr('name'); // Get the name of the input clicked
593
594        if (!checked) {
595
596            $('input[name="'+name+'"]').parent().removeClass('checked');
597
598            $(this).addClass('checked');
599
600            $(this).find('input').prop('checked', true);
601
602        }
603
604    });
605
606
607    // Accordions
608
609    $('.accordion li').click(function() {
610        if ($(this).closest('.accordion').hasClass('one-open')) {
611            $(this).closest('.accordion').find('li').removeClass('active');
612            $(this).addClass('active');
613        } else {
614            $(this).toggleClass('active');
615        }
616        if(typeof window.mr_parallax !== "undefined"){
617            setTimeout(mr_parallax.windowLoad, 500);
618        }
619    });
620
621    // Tabbed Content
622
623    $('.tabbed-content').each(function() {
624        $(this).append('<ul class="content"></ul>');
625    });
626
627    $('.tabs li').each(function() {
628        var originalTab = $(this),
629            activeClass = "";
630        if (originalTab.is('.tabs>li:first-child')) {
631            activeClass = ' class="active"';
632        }
633        var tabContent = originalTab.find('.tab-content').detach().wrap('<li' + activeClass + '></li>').parent();
634        originalTab.closest('.tabbed-content').find('.content').append(tabContent);
635    });
636
637    $('.tabs li').click(function() {
638        $(this).closest('.tabs').find('li').removeClass('active');
639        $(this).addClass('active');
640        var liIndex = $(this).index() + 1;
641        $(this).closest('.tabbed-content').find('.content>li').removeClass('active');
642        $(this).closest('.tabbed-content').find('.content>li:nth-of-type(' + liIndex + ')').addClass('active');
643    });
644
645    // Local Videos
646
647    $('section').closest('body').find('.local-video-container .play-button').click(function() {
648        $(this).siblings('.background-image-holder').removeClass('fadeIn');
649        $(this).siblings('.background-image-holder').css('z-index', -1);
650        $(this).css('opacity', 0);
651        $(this).siblings('video').get(0).play();
652    });
653
654    // Youtube Videos
655
656    $('section').closest('body').find('.player').each(function() {
657        var section = $(this).closest('section');
658        section.find('.container').addClass('fadeOut');
659        var src = $(this).attr('data-video-id');
660        var startat = $(this).attr('data-start-at');
661        $(this).attr('data-property', "{videoURL:'http://youtu.be/" + src + "',containment:'self',autoPlay:true, mute:true, startAt:" + startat + ", opacity:1, showControls:false}");
662    });
663
664	if($('.player').length){
665        $('.player').each(function(){
666
667            var section = $(this).closest('section');
668            var player = section.find('.player');
669            player.YTPlayer();
670            player.on("YTPStart",function(e){
671                section.find('.container').removeClass('fadeOut');
672                section.find('.masonry-loader').addClass('fadeOut');
673            });
674
675        });
676    }
677    
678    // Countdown Timers
679
680    if ($('.countdown').length) {
681        $('.countdown').each(function() {
682            var date = $(this).attr('data-date');
683            $(this).countdown(date, function(event) {
684                $(this).text(
685                    event.strftime('%D days %H:%M:%S')
686                );
687            });
688        });
689    }
690    
691    
692
693    // Disable parallax on mobile
694
695    if ((/Android|iPhone|iPad|iPod|BlackBerry|Windows Phone/i).test(navigator.userAgent || navigator.vendor || window.opera)) {
696        $('section').removeClass('parallax');
697    }
698   
699    // Load Google MAP API JS with callback to initialise when fully loaded
700    if(document.querySelector('[data-maps-api-key]') && !document.querySelector('.gMapsAPI')){
701        if($('[data-maps-api-key]').length){
702            var script = document.createElement('script');
703            var apiKey = $('[data-maps-api-key]:first').attr('data-maps-api-key');
704            script.type = 'text/javascript';
705            script.src = 'https://maps.googleapis.com/maps/api/js?key='+apiKey+'&callback=initializeMaps';
706            script.className = 'gMapsAPI';
707            document.body.appendChild(script);  
708        } 
709    }
710
711
712
713  
714  
715$(window).load(function() { 
716    "use strict";
717    mr_firstSectionHeight = $('.main-container section:nth-of-type(1)').outerHeight(true);
718
719    // Initialize Masonry
720
721    setTimeout(initializeMasonry, 1000);
722   
723}); 
724
725function updateNav() {
726
727    var scrollY = mr_scrollTop;
728    if (scrollY <= 0) {
729        if (mr_navFixed) {
730            mr_navFixed = false;
731            mr_nav.removeClass('fixed');
732        }
733        if (mr_outOfSight) {
734            mr_outOfSight = false;
735            mr_nav.removeClass('outOfSight');
736        }
737        if (mr_navScrolled) {
738            mr_navScrolled = false;
739            mr_nav.removeClass('scrolled');
740        }
741        return;
742    }
743
744    if (scrollY > mr_navOuterHeight + mr_fixedAt) {
745        if (!mr_navScrolled) {
746            mr_nav.addClass('scrolled');
747            mr_navScrolled = true;
748            return;
749        }
750    } else {
751        if (scrollY > mr_navOuterHeight) {
752           if (!mr_navFixed) {
753                mr_nav.addClass('fixed');
754                mr_navFixed = true;
755            }
756
757            if (scrollY > mr_navOuterHeight +10) {
758                if (!mr_outOfSight) {
759                    mr_nav.addClass('outOfSight');
760                    mr_outOfSight = true;
761                }
762            } else {
763                if (mr_outOfSight) {
764                    mr_outOfSight = false;
765                    mr_nav.removeClass('outOfSight');
766                }
767            }
768        } else {
769            if (mr_navFixed) {
770                mr_navFixed = false;
771                mr_nav.removeClass('fixed');
772            }
773            if (mr_outOfSight) {
774                mr_outOfSight = false;
775                mr_nav.removeClass('outOfSight');
776            }
777        }
778
779        if (mr_navScrolled) {
780            mr_navScrolled = false;
781            mr_nav.removeClass('scrolled');
782        }
783
784    }
785}
786
787
788function capitaliseFirstLetter(string) {
789    return string.charAt(0).toUpperCase() + string.slice(1);
790}
791
792
793function initializeMasonry(){
794    $('.masonry').each(function(){
795        var container = $(this).get(0);
796        var msnry = new Masonry(container, {
797            itemSelector: '.masonry-item'
798        });
799
800        msnry.on('layoutComplete', function() {
801
802            mr_firstSectionHeight = $('.main-container section:nth-of-type(1)').outerHeight(true);
803
804            // Fix floating project filters to bottom of projects container
805            if ($('.filters.floating').length) {
806                setupFloatingProjectFilters();
807                updateFloatingFilters();
808                window.addEventListener("scroll", updateFloatingFilters, false);
809            }
810
811            $('.masonry').addClass('fadeIn');
812            $('.masonry-loader').addClass('fadeOut');
813            if ($('.masonryFlyIn').length) {
814                masonryFlyIn();
815            }
816        });
817
818        msnry.layout();
819    });
820}
821
822function masonryFlyIn() {
823    var $items = $('.masonryFlyIn .masonry-item');
824    var time = 0;
825
826    $items.each(function() {
827        var item = $(this);
828        setTimeout(function() {
829            item.addClass('fadeIn');
830        }, time);
831        time += 170;
832    });
833}
834
835function setupFloatingProjectFilters() {
836    mr_floatingProjectSections = [];
837    $('.filters.floating').closest('section').each(function() {
838        var section = $(this);
839
840        mr_floatingProjectSections.push({
841            section: section.get(0),
842            outerHeight: section.outerHeight(),
843            elemTop: section.offset().top,
844            elemBottom: section.offset().top + section.outerHeight(),
845            filters: section.find('.filters.floating'),
846            filersHeight: section.find('.filters.floating').outerHeight(true)
847        });
848    });
849}
850
851function updateFloatingFilters() {
852    var l = mr_floatingProjectSections.length;
853    while (l--) {
854        var section = mr_floatingProjectSections[l];
855
856        if ((section.elemTop < mr_scrollTop) && typeof window.mr_variant == "undefined" ) {
857            section.filters.css({
858                position: 'fixed',
859                top: '16px',
860                bottom: 'auto'
861            });
862            if (mr_navScrolled) {
863                section.filters.css({
864                    transform: 'translate3d(-50%,48px,0)'
865                });
866            }
867            if (mr_scrollTop > (section.elemBottom - 70)) {
868                section.filters.css({
869                    position: 'absolute',
870                    bottom: '16px',
871                    top: 'auto'
872                });
873                section.filters.css({
874                    transform: 'translate3d(-50%,0,0)'
875                });
876            }
877        } else {
878            section.filters.css({
879                position: 'absolute',
880                transform: 'translate3d(-50%,0,0)'
881            });
882        }
883    }
884}
885
886
887
888
889    }
890  };
891
892})(jQuery, Drupal);
893
894
895

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.