PageSourceSearch

https://dwars.org/wp-content/themes/Dwars/resources/js/navigation.js?ver=6.7.2

js dwars.org collected 2026-10-02 11:08:24 UTC 3,480 bytes, 110 lines download raw bytes

1(function(){
2
3    var menu = document.querySelector('.navblock.navblock-fixed');
4
5    var menuButton = document.querySelector('.navblock-toggle');
6    menuButton.addEventListener('click', toggleMenu, true);
7    menuButton.classList.add('start');
8
9    var subMenu = document.querySelectorAll('.sub-menu');
10    for(var i = 0; i < subMenu.length; i++){
11        insertExpandButton(subMenu[i]);
12    }
13
14    var menuTransition;
15    function toggleMenu(){
16        menuButton.classList.remove('start');
17        clearTimeout(menuTransition);
18        menu.classList.add('transition');
19
20        if(menu.classList.contains('open')){
21            menu.classList.remove('open');
22            document.body.classList.remove('open__menu');
23        } else { 
24            menu.classList.add('open'); 
25            document.body.classList.add('open__menu');
26        }
27
28        menuTransition = setTimeout(function(){
29            menu.classList.remove('transition');
30        }, 200);
31    }
32
33    var subMenuTransition;
34    function toggleSubMenu(){
35        clearTimeout(subMenuTransition);
36        this.parentNode.classList.add('transition');
37
38        if(this.parentNode.classList.contains('open')){
39            this.parentNode.classList.remove('open');
40        } else { 
41            this.parentNode.classList.add('open'); 
42        }
43
44        subMenuTransition = setTimeout(function(){
45            this.parentNode.classList.remove('transition');
46        }, 200);
47    }
48
49    function insertExpandButton(element){
50        var button = document.createElement('button');
51        button.classList.add('expand__sub__menu');
52        button.addEventListener('click', toggleSubMenu, true);
53        element.parentNode.appendChild(button);
54    }
55
56})();
57
58
59
60(function(){
61    /** STICKY MENU **/
62    var nav = document.querySelector('body > nav');
63    var target = document.querySelector('body > nav + *');
64
65    var options = { root: null, rootMargin: '0px', threshold: [0.5, 0.6, 0.7, 0.8, 0.9, 1] };
66    var callback = menuObserver;
67
68    var observerIntersection = new IntersectionObserver(callback, options);
69    observerIntersection.observe(target);
70
71    function menuObserver(entries, observer){
72        if(document.documentElement.scrollTop < 90){ return; }
73        for(var i = 0; i < entries.length; i++){
74            if(entries[i].isIntersecting === false && (entries[i].isVisible === false || entries[i].isVisible === undefined)){
75                if(!nav.classList.contains('sticky')){
76                   transitionMenu();
77                }
78            } else {
79                if(nav.classList.contains('sticky')){
80                    returnMenu(true);
81                    
82                    setTimeout(function(){ returnMenu(); }, 200);
83                    if(entries[i].intersectionRatio == 1){
84                        returnMenu();
85                    }
86                }
87            }
88        }
89    }
90
91    function transitionMenu(){
92        document.body.style.paddingTop = '90px';
93        nav.classList.add('transition');
94        nav.classList.add('sticky');
95        setTimeout(function(){
96            nav.classList.remove('transition');
97        }, 200);
98    }
99
100    function returnMenu(prepare){
101        if(prepare){
102            nav.classList.add('return');
103        } else {
104            document.body.style.transition = 'paddingTop 0.3s ease';
105            document.body.style.paddingTop = '';
106            nav.classList.remove('sticky');
107            nav.classList.remove('return');
108        }
109    }
110})();

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.