PageSourceSearch

https://ascend-rehab.org/application/blocks/autonav/templates/ada-accordion-with-parent/js/accordian.js

js ascend-rehab.org collected 2026-09-29 14:21:14 UTC 2,900 bytes, 77 lines download raw bytes

1
2
3
4
5
6    $(document).ready(function() {
7    function uuid() {
8        return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/x|y/g, function(xy) {
9            var r = Math.floor(Math.random() * 16);
10            return (xy === 'x' ? r : (r & 3 | 8)).toString(16);
11        });
12    }
13
14    $('#accordion li.nav-dropdown > div.acc_center > a').each(function(i, e) {
15        var $e = $(e);
16        var name = $e.text();
17        var id = uuid();
18        $e.after('<button href="#" class="open-menu" aria-expanded="false"></button>');
19        $e.nextAll('button:first').attr('aria-label', 'Open ' + name + ' menu').attr('aria-controls', id);
20        $e.nextAll('ul:first').attr('id', id);
21    });
22
23    $(".open-menu").on('click', function(e) {
24        e.preventDefault();
25        var $target = $(e.target);
26        if ($target.attr('aria-expanded') === 'true') {
27            $target.attr('aria-expanded', 'false');
28            //$target.text('+');
29            return;
30        } else {
31            //$target.text('-');
32        }
33
34        // Close any other open menus, unless they are parents of this one.
35        var parentMenus = $target.parentsUntil('#accordion').filter('ul').prev('button.open-menu');
36        $('#accordion button.open-menu[aria-expanded=true]').not(parentMenus).attr('aria-expanded', 'false');
37        $target.attr('aria-expanded', 'true');
38    });
39});
40
41
42$(document).ready(function() {
43    $('li.nav-path-selected').each(function() {
44        if ($(this).find('ul').length > 0) {
45            $(this).addClass('open_drop');
46        }
47    });
48
49    $("#accordion > .top_level.unselected.nav-dropdown > div").click(function(e) {
50        if ($(this).parent().hasClass('open_drop')) {
51            $(".top_level.unselected.nav-dropdown").removeClass('open_drop');
52            $(".top_level.unselected.nav-dropdown > ul").slideUp();
53        } else {
54            $(".top_level.unselected.nav-dropdown").removeClass('open_drop');
55            $(".top_level.unselected.nav-dropdown > ul").slideUp();
56            $(this).parent().find('ul:first').each(function() {
57                $(this).slideDown('slow');
58            });
59            $(this).parent().addClass('open_drop');
60        }
61    });
62    $(".lower_level > .top_level.unselected.nav-dropdown > div").click(function(e) {
63        if ($(this).parent().hasClass('open_drop')) {
64            $(".lower_level > .top_level.unselected.nav-dropdown").removeClass('open_drop');
65            $(".lower_level > .top_level.unselected.nav-dropdown > ul").slideUp();
66        } else {
67            $(".lower_level > .top_level.unselected.nav-dropdown").removeClass('open_drop');
68            $(".lower_level > .top_level.unselected.nav-dropdown > ul").slideUp();
69            $(this).parent().find('ul:first').each(function() {
70                $(this).slideDown('slow');
71            });
72            $(this).parent().addClass('open_drop');
73        }
74    });
75
76});
77

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.