PageSourceSearch

https://kommunion.no/_t/13892/files/js/main.js?z=20260813

js kommunion.no collected 2026-09-24 13:14:15 UTC 16,187 bytes, 408 lines download raw bytes

1(function ($) {
2    "use strict";
3    /*===============================
4    =         Wow Active            =
5    ================================*/
6    new WOW().init();
7    
8    /*=============================================
9    =       Menu sticky & Scroll to top          =
10    =============================================*/
11	var windows = $(window);
12	var screenSize = windows.width();
13	var sticky = $('.header-sticky');
14	var $html = $('html');
15	var $body = $('body');
16	windows.on('scroll', function () {
17		var scroll = windows.scrollTop();
18		var headerHeight = sticky.height();
19		if (screenSize >= 320) {
20			if (scroll < headerHeight) {
21				sticky.removeClass('is-sticky');
22			} else {
23				sticky.addClass('is-sticky');
24            }
25		}
26    });
27    /*----------  Scroll to top  ----------*/
28    function scrollToTop() {
29        var $scrollUp = $('#scroll-top'),
30            $lastScrollTop = 0,
31            $window = $(window);
32        $window.on('scroll', function () {
33            var st = $(this).scrollTop();
34            if (st > $lastScrollTop) {
35                $scrollUp.removeClass('show');
36            } else {
37                if ($window.scrollTop() > 200) {
38                    $scrollUp.addClass('show');
39                } else {
40                    $scrollUp.removeClass('show');
41                }
42            }
43            $lastScrollTop = st;
44        });
45        $scrollUp.on('click', function (evt) {
46            $('html, body').animate({scrollTop: 0}, 600);
47            evt.preventDefault();
48        });
49    }
50    scrollToTop();
51    
52    /*=========================================
53    =            Preloader active            =
54    ===========================================*/
55    windows.on('load', function(){
56        $(".preloader-activate").removeClass('preloader-active');
57    });
58    
59    
60    jQuery(window).on('load', function(){
61		setTimeout(function(){
62        jQuery('.open_tm_preloader').addClass('loaded');
63        }, 200);
64	});
65    
66    /*===========================================
67    =            Submenu viewport position      =
68    =============================================*/
69    if ($(".has-children--multilevel-submenu").find('.submenu').length) {
70        var elm = $(".has-children--multilevel-submenu").find('.submenu');
71        
72        elm.each(function(){
73            var off = $(this).offset();
74            var l = off.left;
75            var w = $(this).width();
76            var docH = windows.height();
77            var docW = windows.width() - 10;
78            var isEntirelyVisible = (l + w <= docW);
79            if (!isEntirelyVisible) {
80                $(this).addClass('left');
81            }
82        });
83    }
84  
85    /*==========================================
86    =            mobile menu active            =
87    ============================================*/
88    
89    /* WCAG 2.1.1 / 4.1.2: триггер и кнопка закрытия — <button> с aria-expanded.
90       Фокус переводится внутрь панели при открытии и возвращается на кнопку при
91       закрытии; Esc закрывает панель; Tab не уходит на фон (см. фокус-ловушку ниже). */
92    var $menuTrigger = $("#mobile-menu-trigger"),
93        $menuOverlay = $("#mobile-menu-overlay"),
94        $menuClose   = $("#mobile-menu-close-trigger");
95
96    function openMobileMenu(){
97        $menuOverlay.addClass("active").attr('aria-hidden', 'false');
98        $body.addClass('no-overflow');
99        $menuTrigger.attr('aria-expanded', 'true');
100        /* Панель раскрывается с CSS-переходом visibility/opacity: пока он не завершился,
101           элементы внутри ещё не фокусируемы. Поэтому фокус переводим после перехода,
102           иначе он остался бы на бургере и пользователь клавиатуры не попал бы в меню. */
103        setTimeout(function(){
104            if ($menuOverlay.hasClass('active')) { $menuClose.trigger('focus'); }
105        }, 400);
106    }
107
108    function closeMobileMenu(returnFocus){
109        if (!$menuOverlay.hasClass("active")) { return; }
110        $menuOverlay.removeClass("active").attr('aria-hidden', 'true');
111        $body.removeClass('no-overflow');
112        $menuTrigger.attr('aria-expanded', 'false');
113        if (returnFocus !== false) { $menuTrigger.trigger('focus'); }
114    }
115
116    $menuTrigger.on('click', function(){
117        if ($menuOverlay.hasClass("active")) { closeMobileMenu(); } else { openMobileMenu(); }
118    });
119
120    $menuClose.on('click', function(){
121        closeMobileMenu();
122    });
123
124    $(".offcanvas-navigation--onepage ul li a").on('click', function(){
125        closeMobileMenu(false);
126    });
127
128    /* Esc закрывает мобильное меню */
129    $(document).on('keydown', function(e){
130        if (e.key === 'Escape' || e.keyCode === 27) { closeMobileMenu(); }
131    });
132
133    /* Фокус-ловушка внутри открытой панели (2.4.3 Focus Order) */
134    $menuOverlay.on('keydown', function(e){
135        if ((e.key !== 'Tab' && e.keyCode !== 9) || !$menuOverlay.hasClass('active')) { return; }
136        var $focusable = $menuOverlay
137            .find('a[href], button, input:not([type=hidden]), select, textarea, [tabindex]:not([tabindex="-1"])')
138            .filter(':visible');
139        if (!$focusable.length) { return; }
140        var first = $focusable.get(0), last = $focusable.get($focusable.length - 1);
141        if (e.shiftKey && document.activeElement === first) {
142            e.preventDefault(); last.focus();
143        } else if (!e.shiftKey && document.activeElement === last) {
144            e.preventDefault(); first.focus();
145        }
146    });
147
148    /* WCAG 2.1.1 / 1.4.13: пункты десктопного меню, раскрывающие подменю.
149       В варианте «nohref» это <a class="submenu-toggle" role="button" tabindex="0">
150       без href — активируется Enter и Space, состояние в aria-expanded.
151       Esc закрывает подменю и возвращает фокус на пункт. */
152    function closeAllSubmenus(){
153        $('.navigation-menu li.is-open').removeClass('is-open')
154            .children('[aria-expanded]').attr('aria-expanded', 'false');
155    }
156
157    $('.navigation-menu').on('click keydown', 'a.submenu-toggle', function(e){
158        if (e.type === 'keydown') {
159            var k = e.key || e.keyCode;
160            if (k !== 'Enter' && k !== ' ' && k !== 'Spacebar' && k !== 13 && k !== 32) { return; }
161        }
162        e.preventDefault();
163        var $toggle = $(this), $li = $toggle.closest('li'), wasOpen = $li.hasClass('is-open');
164        closeAllSubmenus();
165        if (!wasOpen) {
166            $li.addClass('is-open');
167            $toggle.attr('aria-expanded', 'true');
168        }
169    });
170
171    $('.navigation-menu').on('keydown', function(e){
172        if (e.key !== 'Escape' && e.keyCode !== 27) { return; }
173        var $openLi = $('.navigation-menu li.is-open');
174        if (!$openLi.length) { return; }
175        $openLi.removeClass('is-open').children('[aria-expanded]')
176            .attr('aria-expanded', 'false').first().trigger('focus');
177    });
178
179    /* Синхронизация aria-expanded при раскрытии мышью */
180    $('.navigation-menu li.has-children')
181        .on('mouseenter', function(){ $(this).children('[aria-expanded]').attr('aria-expanded', 'true'); })
182        .on('mouseleave', function(){
183            if (!$(this).hasClass('is-open')) {
184                $(this).children('[aria-expanded]').attr('aria-expanded', 'false');
185            }
186        });
187
188    /* Синхронизация aria-expanded при раскрытии фокусом.
189       В варианте меню со ссылками (не submenu-toggle) подменю раскрывается
190       правилом :focus-within, поэтому состояние надо проставлять здесь —
191       иначе aria-expanded="false" противоречит видимому подменю (4.1.2). */
192    $('.navigation-menu li.has-children')
193        .on('focusin', function(){ $(this).children('[aria-expanded]').attr('aria-expanded', 'true'); })
194        .on('focusout', function(e){
195            var li = this;
196            setTimeout(function(){
197                if (!li.contains(document.activeElement) && !$(li).hasClass('is-open')) {
198                    $(li).children('[aria-expanded]').attr('aria-expanded', 'false');
199                }
200            }, 0);
201        });
202    
203    /*Close When Click Outside*/
204    $body.on('click', function(e){
205        var $target = e.target;
206        if (!$($target).is('.mobile-menu-overlay__inner') && !$($target).parents().is('.mobile-menu-overlay__inner') && !$($target).is('#mobile-menu-trigger') && !$($target).is('#mobile-menu-trigger i')){
207            /* через closeMobileMenu(), чтобы aria-expanded не рассинхронизировался;
208               фокус не возвращаем — закрытие инициировано мышью */
209            closeMobileMenu(false);
210        }
211        
212        if (!$($target).is('.page-oppen-off-sidebar__inner') && !$($target).parents().is('.page-oppen-off-sidebar__inner') && !$($target).is('#open-off-sidebar-tr
212igger') && !$($target).is('#mobile-menu-trigger i')){
213            $("#page-oppen-off-sidebar-overlay").removeClass("active");
214            $body.removeClass('no-overflow');
215        }
216        
217        if (!$($target).is('.search-overlay__inner') && !$($target).parents().is('.search-overlay__inner') && !$($target).is('#search-overlay-trigger') && !$($target).is('#search-overlay-trigger i')){
218            $("#search-overlay").removeClass("active");
219            $body.removeClass('no-overflow');
220        }
221        if (!$($target).is('.newsletter-popup__inner') && !$($target).parents().is('.newsletter-popup__inner') ){
222            $("#newsletter-popup").removeClass("active");
223        }
224    });
225    
226    
227    
228    /*=========================================
229    =             open menu Active            =
230    ===========================================*/
231     $('.openmenu-trigger').on('click', function (e) {
232        e.preventDefault();
233        $('.open-menuberger-wrapper').addClass('is-visiable');
234    });
235    $('.page-close').on('click', function (e) {
236        e.preventDefault();
237        $('.open-menuberger-wrapper').removeClass('is-visiable');
238    });
239    
240      
241    /*=========================================
242    =             open menu Active            =
243    ===========================================*/
244    $("#open-off-sidebar-trigger").on('click', function(){
245        $("#page-oppen-off-sidebar-overlay").addClass("active");
246        $body.addClass('no-overflow');
247    });
248    
249    $("#menu-close-trigger").on('click', function(){
250        $("#page-oppen-off-sidebar-overlay").removeClass("active");
251        $body.removeClass('no-overflow');
252    });
253    /*=============================================
254    =            search overlay active            =
255    =============================================*/
256    
257    $("#search-overlay-trigger").on('click', function(){
258        $("#search-overlay").addClass("active");
259        $body.addClass('no-overflow');
260    });
261    
262    $("#search-close-trigger").on('click', function(){
263        $("#search-overlay").removeClass("active");
264        $body.removeClass('no-overflow');
265    });
266    
267    /*=============================================
268    =            hidden icon active            =
269    =============================================*/
270    
271    $("#hidden-icon-trigger").on('click', function(){
272        $("#hidden-icon-wrapper").toggleClass("active");
273    });
274    
275    
276    
277    /*=========================================
278    =             open menu Active            =
279    ===========================================*/
280     $('.share-icon').on('click', function (e) {
281        e.preventDefault();
282        $('.entry-post-share').addClass('opened');
283    });
284    $body.on("click", function () {
285        $(".entry-post-share").removeClass('opened');
286    });
287    // Prevent closing dropdown upon clicking inside the dropdown
288    $(".entry-post-share").on("click", function(e) {
289        e.stopPropagation();
290    });
291    
292    
293    /*=============================================
294    =            minicart active            =
295    =============================================*/
296    
297    $('.minicart-icon').on('click', function(event){
298        event.stopPropagation();
299        $('.minicart-box').toggleClass('active');
300      
301    });
302    $body.on("click", function () {
303        $(".minicart-box").removeClass('active');
304	});
305    // Prevent closing dropdown upon clicking inside the dropdown
306    $(".minicart-box").on("click", function(e) {
307        e.stopPropagation();
308    });
309    
310 
311    
312    
313    
314    /*=============================================
315    =            background image            =
316    =============================================*/
317    var bgSelector = $(".bg-img");
318    bgSelector.each(function (index, elem) {
319        var element = $(elem),
320            bgSource = element.data('bg');
321        element.css('background-image', 'url(' + bgSource + ')');
322    });
323    /*=====  End of background image  ======*/
324   
325    
326    /* =====================================
327        Fullpage Scroll Animation   
328    ======================================*/
329    if ($('#fullpage').length) {
330        $('#fullpage').fullpage({
331            scrollBar: false,
332            navigation: true,
333            loopBottom: false,
334            sectionSelector: 'section',
335            scrollingSpeed: 1000,
336            autoScrolling: true,
337            fitToSection: true,
338            fitToSectionDelay: 1000,
339            afterLoad: function () {
340                var activeSetion = $('.fp-viewing-' + 3);
341                activeSetion.addClass('tm-one-page-footer-expanded');
342            },
343        });
344    }
345   
346        /*=============================================
347    =            newsletter popup active            =
348    =============================================*/
349    
350    $("#newsletter-popup-close-trigger").on('click', function(){
351        $("#newsletter-popup").removeClass("active");
352    });
353    
354    /*=============================================
355    =            reveal footer active            =
356    =============================================*/
357    
358    var revealId = $(".reveal-footer"),
359        heightFooter = revealId.outerHeight(),
360        windowWidth = $(window).width()
361    if (windowWidth > 991) {
362        $(".site-wrapper-reveal").css({
363            'margin-bottom': heightFooter + 'px'
364        });
365    }
366    $(".loading-item").slice(0, 9).show();
367    $(".loadMore").on("click", function(e){
368        e.preventDefault();
369        $(".loading-item:hidden").slice(0, 3).slideDown();
370        if($(".loading-item:hidden").length == 0) {
371          $(".loadMore").text("All items displayed").addClass("noContent");
372        }
373    });
374    
375    $(".loading-item-4").slice(0, 8).show();
376    $(".loadMoreBtn").on("click", function(e){
377        e.preventDefault();
378        $(".loading-item-4:hidden").slice(0, 4).slideDown();
379        if($(".loading-item-4:hidden").length == 0) {
380          $(".loadMoreBtn").text("All items displayed").addClass("noContent");
381        }
382    });
383  
384    /* ===================================
385    	All Animation For Fade Up 
386    =======================================*/
387    $(window).on('load', function () {
388        function allAnimation() {
389            $('.move-up').css('opacity', 0);
390            $('.move-up').waypoint(function () {
391                $('.move-up').addClass('animate');
392            }, {
393                offset: '90%'
394            });
395        }
396        allAnimation();
397        function allAnimationx() {
398            $('.move-up-x').css('opacity', 0);
399            $('.move-up-x').waypoint(function () {
400                $('.move-up-x').addClass('animate');
401            }, {
402                offset: '90%'
403            });
404        }
405        allAnimationx();
406    })
407    
408})(jQuery);

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.