File: script.js

package info (click to toggle)
pillow 8.1.2%2Bdfsg-0.3
  • links: PTS
  • area: main
  • in suites: bookworm, bullseye
  • size: 65,376 kB
  • sloc: python: 35,568; ansic: 31,004; makefile: 388; javascript: 114; sh: 77
file content (60 lines) | stat: -rw-r--r-- 2,709 bytes parent folder | download | duplicates (3)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
jQuery(document).ready(function ($) {
    setTimeout(function () {
        var sectionID = 'base';
        var search = function ($section, $sidebarItem) {
            $section.children('.section, .function, .method').each(function () {
                if ($(this).hasClass('section')) {
                    sectionID = $(this).attr('id');
                    search($(this), $sidebarItem.parent().find('[href=#'+sectionID+']'));
                } else {
                    var $dt = $(this).children('dt');
                    var id = $dt.attr('id');
                    if (id === undefined) {
                        return;
                    }

                    var $functionsUL = $sidebarItem.siblings('[data-sectionID='+sectionID+']');
                    if (!$functionsUL.length) {
                        $functionsUL = $('<ul />').attr('data-sectionID', sectionID);
                        $functionsUL.insertAfter($sidebarItem);
                    }

                    var $li = $('<li />');
                    var $a = $('<a />').css('font-size', '11.5px');
                    var $upperA = $sidebarItem.parent().children('a');
                    var $upperAParent = $upperA.parent();
                    if ($upperAParent.hasClass('toctree-l2')) {
                        $a.css('background-color', '#c9c9c9');
                        $a.css('padding-left', '4em');
                    } else if ($upperAParent.hasClass('toctree-l3')) {
                        if (!$upperA.find('.toctree-expand').length) {
                            $upperA.prepend($('<span />').addClass('toctree-expand'));
                        }
                        $a.css('background-color', '#c9c9c9');
                        $a.css('padding-left', '5em');
                    } else {
                        $a.css('background-color', '#bdbdbd');
                        $a.css('padding-left', '6.25em');
                    }
                    $a.attr('href', '#'+id);
                    $a.text('- '+$dt.find('code').text());
                    $a.click(function () {
                        setTimeout(function () {
                            $a.css('font-weight', 'bold');
                        }, 0);
                    });
                    $li.append($a);
                    $functionsUL.append($li);
                }
            });
        };
        search($('[itemprop=articleBody] > .section'), $('.wy-nav-side a[href=#]'));
    }, 0);
    $(window).on('hashchange', function () {
        $('ul[data-sectionID]').each(function () {
            $(this).find('a').each(function () {
                $(this).css('font-weight', 'normal');
            });
        });
    });
});