custom.js

Last source

 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
$(function() {
    // handle "current toctree" for all levels
    var win = $(window);
    win.on('hashchange', reset);
    function reset() {
        setTimeout(function () {
            var anchor = encodeURI(window.location.hash) || '#';
            try {
                var vmenu = $('.wy-menu-vertical');
                var link = vmenu.find('[href="' + anchor + '"]');
                if (link.length === 0) {
                    var id_elt = $('.document [id="' + anchor.substring(1) + '"]');
                    var closest_section = id_elt.closest('div.section');
                    link = vmenu.find('[href="#' + closest_section.attr("id") + '"]');
                    if (link.length === 0) {
                        link = vmenu.find('[href="#"]');
                    }
                }
                if (link.length > 0) {
                    link.parents('li[class*="toctree-l"]').addClass('current');
                    link[0].scrollIntoView();
                }
            } catch (err) {
                console.log("Error expanding nav for anchor", err);
            }
        }, 100);
    }
    // mark current the actual current toctree node if not opened
    setTimeout(function() {
        var link = $('li[class*="toctree-l"]:not(.current) > a.reference.internal.current');
        if (link.length > 0) {
            link.parents('li[class*="toctree-l"]').addClass('current');
        }
    }, 100);
});

Changes

docs(git): Add git commits to documentation

Commit
Hash

0a048252b817f1ddf14dcc2b318fac4335a27b89

Date

2019-06-03 13:54:59 +0200

Type

Added

Stats

+35 -0

@@ -0,0 +1,35 @@
+$(function() {
+    // handle "current toctree" for all levels
+    var win = $(window);
+    win.on('hashchange', reset);
+    function reset() {
+        setTimeout(function () {
+            var anchor = encodeURI(window.location.hash) || '#';
+            try {
+                var vmenu = $('.wy-menu-vertical');
+                var link = vmenu.find('[href="' + anchor + '"]');
+                if (link.length === 0) {
+                    var id_elt = $('.document [id="' + anchor.substring(1) + '"]');
+                    var closest_section = id_elt.closest('div.section');
+                    link = vmenu.find('[href="#' + closest_section.attr("id") + '"]');
+                    if (link.length === 0) {
+                        link = vmenu.find('[href="#"]');
+                    }
+                }
+                if (link.length > 0) {
+                    link.parents('li[class*="toctree-l"]').addClass('current');
+                    link[0].scrollIntoView();
+                }
+            } catch (err) {
+                console.log("Error expanding nav for anchor", err);
+            }
+        }, 100);
+    }
+    // mark current the actual current toctree node if not opened
+    setTimeout(function() {
+        var link = $('li[class*="toctree-l"]:not(.current) > a.reference.internal.current');
+        if (link.length > 0) {
+            link.parents('li[class*="toctree-l"]').addClass('current');
+        }
+    }, 100);
+});