aboutsummaryrefslogtreecommitdiffstats
path: root/doc/phpdoc/js/sidebar.js
blob: e9096fff5b067a4e33a40523e4a9309567379f5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
jQuery.expr[':'].Contains = function(a, i, m) {
    return jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase()) >= 0;
};

$(function() {
    $("#sidebar-nav").accordion({
        autoHeight: false,
        navigation: true,
        collapsible: true
    }).accordion("activate", false)
            .find('a.link').unbind('click').click(
            function(ev) {
                ev.cancelBubble = true; // IE
                if (ev.stopPropagation) {
                    ev.stopPropagation(); // the rest
                }

                return true;
            }).prev().prev().remove();

    $("#sidebar-nav>h3").click(function() {
        if ($(this).attr('initialized') == 'true') return;

        $(this).next().find(".sidebar-nav-tree").treeview({
            collapsed: true,
            persist: "cookie"
        });
        $(this).attr('initialized', true);
    });
});

function tree_search(input) {
    treeview = $(input).parent().parent().next();

    // Expand all items
    treeview.find('.expandable-hitarea').click();

    // make all items visible again
    treeview.find('li:hidden').show();

    // hide all items that do not match the given search criteria
    if ($(input).val()) {
        treeview.find('li').not(':has(a:Contains(' + $(input).val() + '))').hide();
    }
}