PageSourceSearch

https://home.arrl.org/Action/Portals/_default/Skins/PersonifySkin/js/responsivemobilemenu.js

js arrl.org collected 2026-10-01 09:24:44 UTC 7,707 bytes, 197 lines download raw bytes

1// Make the sub-menu sidebar (where left side links normally reside)
2if ($('.navCol').length !== 0 && $('.store-nav').length === 0) {
3    $(function () {
4
5        // Create the dropdown base
6        $("<ul />", {
7            "class": "sub-menu-sidebar"
8        }).appendTo(".sub-menu-container");
9
10        // Create "Head of sub-menu..."
11        $(".navCol > h2").each(function () {
12            var el = $(this).clone();
13            $(el).appendTo(".sub-menu-sidebar").wrap('<li />');
14        });
15
16        var moduleTitles = $('.navCol .moduleTitle span');
17        var titleTexts = [];
18        $(moduleTitles).each(function () {
19            titleTexts.push($(this).html());
20        });
21        // Populate dropdown with menu items
22        var i = 0;
23        $(".navCol a").each(function () {
24            var el = $(this).clone();
25
26            if (el[0].id == '') { // Look for an empty link that signifies a new section on My Account
27                var title = titleTexts[i];
28                if (title) {
29                    title = title.replace(/&amp;/g, "&");
30                    $('<h2 />', { text: title }).appendTo(".sub-menu-sidebar").wrap('<li />');
31                }
32                i++;
33                return true;
34            }
35            if ($(this).parents('.rpGroup').length !== 0) {
36                $(el).appendTo(".sub-menu-sidebar").wrap('<li class="child-link"></li>');
37            } else if (el[0].innerHTML != '') {
38                $(el).appendTo(".sub-menu-sidebar").wrap('<li />');
39            }
40        });
41    });
42} else if ($('.store-nav').length !== 0) {
43    $('#content').addClass('store-nav-exists');
44    $('#sub-menu-navbar-header').addClass('mobile-hide');
45    $('.dnnMenu').addClass('no-bg');
46} else if ($('.navCol').length === 0) {
47    $('#content').addClass('no-nav-col');
48    $('#sub-menu-navbar-header').addClass('mobile-hide');
49    $('.dnnMenu').addClass('no-bg');
50} else {
51    console.log('No boostrap navbar.');
52}
53
54if ($('.navCol').length !== 0 && $('.store-nav').length === 0) {
55    $('button#sub-menu-toggle').click(function (e) {
56        e.stopPropagation();
57        if (!$("#wrapper").hasClass("toggled")) {
58            $("#wrapper").toggleClass("toggled");
59            $("#sidebar-wrapper").toggleClass("toggled");
60            $('html, #Body').toggleClass('hide-side-scrolling');
61        } else if ($(".sub-menu-container").hasClass("toggled")) {
62            $(".sub-menu-container").toggleClass("toggled");
63        } else {
64            $("#wrapper").toggleClass("toggled");
65            $("#sidebar-wrapper").toggleClass("toggled");
66            $('html, #Body').toggleClass('hide-side-scrolling');
67        }
68    });
69
70    // MIH:   Set click listener for toggling side-menu
71    $("button.navbar-toggle").click(function (e) {
72        e.stopPropagation();
73        if (!$("#wrapper").hasClass("toggled")) {
74            if (!$(".sub-menu-container").hasClass("toggled")) {
75                $(".sub-menu-container").toggleClass("toggled");
76            }
77            $("#wrapper").toggleClass("toggled");
78            $("#sidebar-wrapper").toggleClass("toggled");
79            $('html, #Body').toggleClass('hide-side-scrolling');
80        } else if (!$(".sub-menu-container").hasClass("toggled")) {
81            $(".sub-menu-container").toggleClass("toggled");
82        } else {
83            $("#wrapper").toggleClass("toggled");
84            $(".sub-menu-container").toggleClass("toggled");
85            $("#sidebar-wrapper").toggleClass("toggled");
86            $('html, #Body').toggleClass('hide-side-scrolling');
87        }
88    });
89} else {
90    $("button.navbar-toggle").click(function (e) {
91        e.stopPropagation();
92        $("#wrapper").toggleClass("toggled");
93        $("#sidebar-wrapper").toggleClass("toggled");
94        $('html, #Body').toggleClass('hide-side-scrolling');
95    });
96}
97
98$('#wrapper').click(function () {
99    if ($(this).hasClass('toggled')) {
100        $(this).removeClass('toggled');
101        $('#sidebar-wrapper').removeClass('toggled');
102        $('.sub-menu-container').removeClass('toggled');
103    }
104});
105
106$('.logout-sidebar-link').attr('href', $('.logInOut').attr('href'));
107$('.login-sidebar-button').attr('href', $('.logInOut').attr('href'));
108$('.register-sidebar-button').attr('href', $('.user').attr('href'));
109
110/*  MIH:  Detect DNNMenu and add bootstrap classes
111 *  The code below will be adjusted if the client decides
112 *  not to use DNNMenu as their default navigation menu 
113 *  provider. Adjust component detection as necessary.
114 */
115$('#nav-jQuery-hook > div > ul').addClass("navbar-nav nav"); // Use our jQuery hook div to the find the ul for the nav, add BS classes
116
117var menuContents = $('#nav-jQuery-hook .navbar-nav').clone();
118$('#sidebar-wrapper .navbar-mobile').append(menuContents); // Append nav contents to mobile menu container
119
120$('.navbar-nav > li').each(function () { // Add dropdown menu functionality
121    if ($(this).has('ul').length > 0) {
122        $(this).addClass('dropdown');
123        var dropdownMenu = $(this).children('ul');
124        dropdownMenu.addClass('dropdown-menu').attr('role', 'menu');
125        dropdownMenu.find('ul').addClass('side-dropdown-menu'); // Dropdowns confirmed to work up to 2 levels deep
126
127        //check for tablets 
128        if ((navigator.userAgent.match(/Android|iPad/i)) && (window.matchMedia('(min-width: 766px)').matches)
129        ) {
130            var aTag = $(this).find('>a').clone();
131            $(this).find('>a').attr("href", "javascript:void(0)")
132            dropdownMenu.prepend("<li>" + $(aTag)[0].outerHTML + "</li>");
133        }
134
135    }
136});
137
138$('.dnnMenu .navbar-nav > li').each(function () { // Open first level dropdowns on item hover
139    $(this).hover(function () {
140        $(this).addClass('open');
141    }, function () {
142        $(this).removeClass('open');
143    });
144});
145
146$('#sidebar-wrapper .navbar-nav > li').each(function () { // Add button to open dropdowns on mobile menu
147    var dropdownMenu = $(this).children('ul');
148    dropdownMenu.before('<button type="button" class="toggle-open btn"><span class="caret"></span></button>');
149    var li = $(this);
150    $(this).children('.toggle-open').click(function (e) {
151        $(li).toggleClass('open');
152        return false;
153    });
154});
155
156/*  If menu item has side dropdown menus, open them to the left
157 *  if they are positioned more than .65 of the width of the nav menu
158 *  to the right.
159 */
160var navbarWidth = $('.dnnMenu .navbar-nav').width();
161$('.dnnMenu .navbar-nav > li').each(function () {
162    var el = $(this);
163    var position = el.position();
164    if (position.left > (navbarWidth * .65)) {
165        el.addClass('dropdown-left');
166    }
167});
168
169/* If the default DNN menu is not displayed,
170*  this piece of JS will create a dummy
171*  object for dnn.controls and a dummy
172*  function called initMenu. This is to
173*  prevent a JS error that may cause an
174*  error window to pop up in IE.
175*/
176if (!dnn.controls) {
177    console.log("dnn.controls is undefined");
178    dnn.controls = new Object();
179    dnn.controls.initMenu = function (randomVar) {
180
181    };
182} else if (!dnn.controls.initMenu) {
183    console.log("dnn.controls.initMenu is undefined");
184    dnn.controls.initMenu = function (randomVar) {
185
186    };
187}
188
189/* 
190* Changing viewport meta tab for tablet devices
191*/
192if (window.matchMedia('(min-width: 768px)').matches && window.matchMedia('(max-width: 1024px)').matches) {
193    $("meta[name='viewport']").attr("content", "width=device-width, initial-scale=0.78");
194}
195else{
196    $("meta[name='viewport']").attr("content", "width=device-width, initial-scale=1");
197}

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.