PageSourceSearch

https://udprf.ru/sites/all/themes/udprf/js/greedyNav.js?swcj8p

js udprf.ru collected 2026-10-02 03:42:35 UTC 8,369 bytes, 191 lines download raw bytes

1(function ($) {
2    Drupal.behaviors.greedyNav = {
3        attach: function (context, settings) {
4
5            if ($(window).width() > 768) {
6                $('nav .menu li>a').addClass('hoverLine');
7                $('.top-fix-menu .region-header .menu > li.dropdown, .top-fix-menu .region-header .block-menu, .manager-menu').append('<ul class="hidden-links hidden"></ul>');
8                $('.top-fix-menu .region-header .menu > li.dropdown ul.dropdown-menu, .top-fix-menu .region-header .menu, .manager-menu  .menu').prepend('<button><div class="hamburger"></div>');
9            }
10
11            if (navigator.platform == 'iPad' || navigator.platform == 'iPhone' || navigator.platform == 'iPod' || window.navigator.platform == 'Android' || window.navigator.platform == 'Linux armv7l' || window.navigator.platform == 'Linux i686' || navigator.platform == 'null' || navigator.platform == 'BlackBerry' || navigator.platform == 'Symbian') {
12                $('nav .menu li>a').removeClass('hoverLine');
13            }
14
15            $(function() {
16                if ($(window).width() > 768) {
17                    var $nav = $('.top-fix-menu .region-header .menu > li.dropdown');
18                    var $btn = $('.top-fix-menu .region-header .menu > li.dropdown > ul.dropdown-menu > button');
19                    var $vlinks = $('.top-fix-menu .region-header .menu > li.dropdown > ul.dropdown-menu');
20                    var $hlinks = $('.top-fix-menu .region-header .menu > li.dropdown >.hidden-links');
21
22                    var numOfItems = 0;
23                    var totalSpace = 0;
24                    var breakWidths = [];
25
26                    // Get initial state
27                    $vlinks.children().outerWidth(function (i, w) {
28                        totalSpace += w;
29                        numOfItems += 1;
30                        breakWidths.push(totalSpace);
31                    });
32
33                    var availableSpace, numOfVisibleItems, requiredSpace;
34
35                    function check() {
36
37                        // Get instant state
38                        availableSpace = $vlinks.width() - 10;
39                        numOfVisibleItems = $vlinks.children().length;
40                        requiredSpace = breakWidths[numOfVisibleItems - 1];
41
42                        // There is not enought space
43                        if (requiredSpace > availableSpace) {
44                            $vlinks.children().last().prependTo($hlinks);
45                            numOfVisibleItems -= 1;
46                            check();
47                            // There is more than enough space
48                        } else if (availableSpace > breakWidths[numOfVisibleItems]) {
49                            $hlinks.children().first().appendTo($vlinks);
50                            numOfVisibleItems += 1;
51                        }
52                        // Update the button accordingly
53                        $btn.attr("count", numOfItems - numOfVisibleItems);
54                        if (numOfVisibleItems === numOfItems) {
55                            $btn.addClass('hidden');
56                        } else $btn.removeClass('hidden');
57                    }
58
59                    // Window listeners
60                    $(window).resize(function () {
61                        check();
62                    });
63
64                    $btn.on('click', function () {
65                        $hlinks.toggleClass('hidden');
66                    });
67
68                    check();
69                } else {
70
71                }
72            });
73            $(function() {
74                if ($(window).width() > 768) {
75                    var $nav = $('.manager-menu');
76                    var $btn = $('.manager-menu .menu button');
77                    var $vlinks = $('.manager-menu ul.menu');
78                    var $hlinks = $('.manager-menu >.hidden-links');
79
80                    var numOfItems = 0;
81                    var totalSpace = 0;
82                    var breakWidths = [];
83
84                    // Get initial state
85                    $vlinks.children().outerWidth(function (i, w) {
86                        totalSpace += w;
87                        numOfItems += 1;
88                        breakWidths.push(totalSpace);
89                    });
90
91                    var availableSpace, numOfVisibleItems, requiredSpace;
92
93                    function check() {
94
95                        // Get instant state
96                        availableSpace = $vlinks.width() - 10;
97                        numOfVisibleItems = $vlinks.children().length;
98                        requiredSpace = breakWidths[numOfVisibleItems - 1];
99
100                        // There is not enought space
101                        if (requiredSpace > availableSpace) {
102                            $vlinks.children().last().prependTo($hlinks);
103                            numOfVisibleItems -= 1;
104                            check();
105                            // There is more than enough space
106                        } else if (availableSpace > breakWidths[numOfVisibleItems]) {
107                            $hlinks.children().first().appendTo($vlinks);
108                            numOfVisibleItems += 1;
109                        }
110                        // Update the button accordingly
111                        $btn.attr("count", numOfItems - numOfVisibleItems);
112                        if (numOfVisibleItems === numOfItems) {
113                            $btn.addClass('hidden');
114                        } else $btn.removeClass('hidden');
115                    }
116
117                    // Window listeners
118                    $(window).resize(function () {
119                        check();
120                    });
121
122                    $btn.on('click', function () {
123                        $hlinks.toggleClass('hidden');
124                    });
125
126                    check();
127                } else {
128
129                }
130            });
131            $(function() {
132                if ($(window).width() > 768) {
133                    var $nav = $('.region-header .block-menu');
134                    var $btn = $('.region-header .block-menu > ul.menu > button');
135                    var $vlinks = $('.region-header .block-menu > ul.menu');
136                    var $hlinks = $('.region-header .block-menu >.hidden-links');
137
138                    var numOfItems = 0;
139                    var totalSpace = 0;
140                    var breakWidths = [];
141
142                    // Get initial state
143                    $vlinks.children().outerWidth(function (i, w) {
144                        totalSpace += w;
145                        numOfItems += 1;
146                        breakWidths.push(totalSpace);
147                    });
148
149                    var availableSpace, numOfVisibleItems, requiredSpace;
150
151                    function check() {
152
153                        // Get instant state
154                        availableSpace = $vlinks.width() - 10;
155                        numOfVisibleItems = $vlinks.children().length;
156                        requiredSpace = breakWidths[numOfVisibleItems - 1];
157
158                        // There is not enought space
159                        if (requiredSpace > availableSpace) {
160                            $vlinks.children().last().prependTo($hlinks);
161                            numOfVisibleItems -= 1;
162                            check();
163                            // There is more than enough space
164                        } else if (availableSpace > breakWidths[numOfVisibleItems]) {
165                            $hlinks.children().first().appendTo($vlinks);
166                            numOfVisibleItems += 1;
167                        }
168                        // Update the button accordingly
169                        $btn.attr("count", numOfItems - numOfVisibleItems);
170                        if (numOfVisibleItems === numOfItems) {
171                            $btn.addClass('hidden');
172                        } else $btn.removeClass('hidden');
173                    }
174
175                    // Window listeners
176                    $(window).resize(function () {
177                        check();
178                    });
179
180                    $btn.on('click', function () {
181                        $hlinks.toggleClass('hidden');
182                    });
183
184                    check();
185                } else {
186
187                }
188            });
189        }
190    };
191}(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.