Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[DOC] fix autodoc for spurrious toggles #16452

Merged
merged 1 commit into from
Oct 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 18 additions & 16 deletions docs/python_docs/_static/autodoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,32 @@
/* Customizations to the Sphinx auto module plugin output */
function auto_index() {
var targets = $("dl.class>dt,dl.function>dt");

var li_node = $("li.current>span>a.current.reference.internal").parent().parent();
var html = "<ul id='autodoc'>";
if (li_node.length > 0) {
for (var i = 0; i < targets.length; ++i) {
var id = $(targets[i]).attr('id');
if (id) {
var paths = id.split('.')
if (paths.length >= 2) {
var id_simple = paths.pop();
id_simple = paths.pop() + "." + id_simple;
} else {
var id_simple = id;
if (targets.length > 0) {
for (var i = 0; i < targets.length; ++i) {
var id = $(targets[i]).attr('id');
if (id) {
var paths = id.split('.')
if (paths.length >= 2) {
var id_simple = paths.pop();
id_simple = paths.pop() + "." + id_simple;
} else {
var id_simple = id;
}
html += "<li><span class='link-wrapper'><a class='reference internal' href='#";
html += id;
html += "'>" + id_simple + "</a></span</li>";
}
html += "<li><span class='link-wrapper'><a class='reference internal' href='#";
html += id;
html += "'>" + id_simple + "</a></span</li>";
}
html += "</ul>";
li_node.append(html);
li_node.prepend("<a><span id='autodoc_toggle' onclick='$(\"#autodoc\").toggle()'>[toggle]</span></a>")
}
html += "</ul>";
li_node.append(html);
li_node.prepend("<a><span id='autodoc_toggle' onclick='$(\"#autodoc\").toggle()'>[toggle]</span></a>")
} else {
setTimeout(auto_index, 500);
}

}
$(document).ready(auto_index);