diff options
Diffstat (limited to 'target/doc/main.js')
-rw-r--r-- | target/doc/main.js | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/target/doc/main.js b/target/doc/main.js index 1d1e789..9bb7246 100644 --- a/target/doc/main.js +++ b/target/doc/main.js @@ -34,7 +34,8 @@ "primitive", "associatedtype", "constant", - "associatedconstant"]; + "associatedconstant", + "union"]; // used for special search precedence var TY_PRIMITIVE = itemTypes.indexOf("primitive"); @@ -124,6 +125,11 @@ focusSearchBar(); break; + case "+": + ev.preventDefault(); + toggleAllDocs(); + break; + case "?": if (ev.shiftKey && $("#help").hasClass("hidden")) { ev.preventDefault(); @@ -572,10 +578,6 @@ displayPath = item.path + '::'; href = rootPath + item.path.replace(/::/g, '/') + '/' + name + '/index.html'; - } else if (type === 'static' || type === 'reexport') { - displayPath = item.path + '::'; - href = rootPath + item.path.replace(/::/g, '/') + - '/index.html'; } else if (type === "primitive") { displayPath = ""; href = rootPath + item.path.replace(/::/g, '/') + @@ -586,9 +588,14 @@ } else if (item.parent !== undefined) { var myparent = item.parent; var anchor = '#' + type + '.' + name; - displayPath = item.path + '::' + myparent.name + '::'; + var parentType = itemTypes[myparent.ty]; + if (parentType === "primitive") { + displayPath = myparent.name + '::'; + } else { + displayPath = item.path + '::' + myparent.name + '::'; + } href = rootPath + item.path.replace(/::/g, '/') + - '/' + itemTypes[myparent.ty] + + '/' + parentType + '.' + myparent.name + '.html' + anchor; } else { @@ -879,12 +886,16 @@ sidebar.append(div); } + block("primitive", "Primitive Types"); block("mod", "Modules"); + block("macro", "Macros"); block("struct", "Structs"); block("enum", "Enums"); + block("constant", "Constants"); + block("static", "Statics"); block("trait", "Traits"); block("fn", "Functions"); - block("macro", "Macros"); + block("type", "Type Definitions"); } window.initSidebarItems = initSidebarItems; @@ -931,7 +942,7 @@ return "\u2212"; // "\u2212" is '−' minus sign } - $("#toggle-all-docs").on("click", function() { + function toggleAllDocs() { var toggle = $("#toggle-all-docs"); if (toggle.hasClass("will-expand")) { toggle.removeClass("will-expand"); @@ -950,7 +961,9 @@ $(".toggle-wrapper").addClass("collapsed"); $(".collapse-toggle").children(".inner").text(labelForToggleButton(true)); } - }); + } + + $("#toggle-all-docs").on("click", toggleAllDocs); $(document).on("click", ".collapse-toggle", function() { var toggle = $(this); @@ -981,7 +994,7 @@ $(".method").each(function() { if ($(this).next().is(".docblock") || ($(this).next().is(".stability") && $(this).next().next().is(".docblock"))) { - $(this).children().first().after(toggle.clone()); + $(this).children().last().after(toggle.clone()); } }); |