diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2018-11-16 11:36:40 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2018-11-24 09:49:57 +0100 |
| commit | e87f8cc49b56ea2b8f01281a0b2baf20e12a319d (patch) | |
| tree | 8f0b44998705c8387f90b0fa11ab9613c962991b /src/librustdoc/html/static/source-script.js | |
| parent | 93520d2ad145b791b1b1a6c71cdea65b1943ffb6 (diff) | |
| download | rust-e87f8cc49b56ea2b8f01281a0b2baf20e12a319d.tar.gz rust-e87f8cc49b56ea2b8f01281a0b2baf20e12a319d.zip | |
Source sidebar improvements
Diffstat (limited to 'src/librustdoc/html/static/source-script.js')
| -rw-r--r-- | src/librustdoc/html/static/source-script.js | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/librustdoc/html/static/source-script.js b/src/librustdoc/html/static/source-script.js index 59b82361c09..f8e0cf196fb 100644 --- a/src/librustdoc/html/static/source-script.js +++ b/src/librustdoc/html/static/source-script.js @@ -72,21 +72,21 @@ function createDirEntry(elem, parent, fullPath, currentFile, hasFoundFile) { children.appendChild(files); parent.appendChild(name); parent.appendChild(children); - return hasFoundFile === true && search.currentFile !== null; + return hasFoundFile === true && currentFile.startsWith(fullPath); } function toggleSidebar() { var sidebar = document.getElementById("source-sidebar"); var child = this.children[0].children[0]; - if (child.innerText === "<") { - sidebar.style.right = ""; - this.style.right = ""; - child.innerText = ">"; + if (child.innerText === ">") { + sidebar.style.left = ""; + this.style.left = ""; + child.innerText = "<"; updateLocalStorage("rustdoc-source-sidebar-hidden", "false"); } else { - sidebar.style.right = "-300px"; - this.style.right = "0"; - child.innerText = "<"; + sidebar.style.left = "-300px"; + this.style.left = "0"; + child.innerText = ">"; updateLocalStorage("rustdoc-source-sidebar-hidden", "true"); } } @@ -102,10 +102,10 @@ function createSidebarToggle() { var inner2 = document.createElement("div"); inner2.style.marginTop = "-2px"; if (getCurrentValue("rustdoc-source-sidebar-hidden") === "true") { - inner2.innerText = "<"; - sidebarToggle.style.right = "0"; - } else { inner2.innerText = ">"; + sidebarToggle.style.left = "0"; + } else { + inner2.innerText = "<"; } inner1.appendChild(inner2); @@ -125,7 +125,7 @@ function createSourceSidebar() { var sidebar = document.createElement("div"); sidebar.id = "source-sidebar"; if (getCurrentValue("rustdoc-source-sidebar-hidden") === "true") { - sidebar.style.right = "-300px"; + sidebar.style.left = "-300px"; } var currentFile = getCurrentFilePath(); |
