1jQuery(function () {
2    /**
3    * Mobile menu open handling
4    */
5    const $tabs = jQuery('nav.notos ul.navtabs');
6    $tabs.on('click', '.primary .opener', function (event) {
7        $tabs.find('li').removeClass('active');
8        jQuery(this).parent().addClass('active').next('.secondary').addClass('active');
9        event.stopPropagation();
10        event.preventDefault();
11    });
12
13    /**
14     * Close other notos toggle menus when opening a new one
15     */
16    jQuery('input.notos-toggle').on('click', function () {
17        jQuery('input.notos-toggle').not(this).prop('checked', false);
18    });
19
20    /**
21     * Close notos toggle menus on clicks elsewhere
22     */
23    jQuery('body').on('click', function(event) {
24        const $target = jQuery(event.target);
25        if ($target.is('.notos-toggle') || $target.parents('.notos-toggle').length) return;
26        const $toggle = jQuery('input.notos-toggle');
27        if ($toggle.prop('checked')) {
28            $toggle.prop('checked', false);
29        }
30    });
31});
32