From 0f42cdd63936fcc4c805c55e3b9c666d2bd64439 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Fri, 23 Nov 2018 18:57:17 +1100 Subject: [PATCH] Added functions to Read The Docs sidebar --- docs/_static/js/script.js | 60 +++++++++++++++++++++++++++++++++++++++ docs/conf.py | 3 ++ 2 files changed, 63 insertions(+) create mode 100644 docs/_static/js/script.js diff --git a/docs/_static/js/script.js b/docs/_static/js/script.js new file mode 100644 index 000000000..2cd7335ec --- /dev/null +++ b/docs/_static/js/script.js @@ -0,0 +1,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 = $('