Further tinkering with the JavaScript

I refined the ability of the script that handles the table of contents to detect whether it should have a "Back to Index" link. The previous logic of checking the file name for whether it was index.html doesn't cover cases where the book is renamed, as Spring Data does with its books. So I added a check for the documet type. A type of "book" indicates a stand-alone document, which shouldn't have hthe link.
This commit is contained in:
Jay Bryant 2018-05-01 15:18:04 -05:00
parent b75df1d0a6
commit bf7031298d
3 changed files with 3 additions and 2 deletions

View File

@ -11,6 +11,7 @@
<version>2.5.3</version>
<configuration>
<descriptor>src/assembly/dep.xml</descriptor>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>

View File

@ -1,7 +1,7 @@
<assembly xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>distribution</id>
<id>resources</id>
<formats>
<format>zip</format>
</formats>

View File

@ -37,7 +37,7 @@
window.addEventListener('tocRefresh', handleTocRefresh);
handleTocOnResize();
if (!window.location.pathname.endsWith("index.html")) {
if (!document.body.classList.contains('book') && !window.location.pathname.endsWith("index.html")) {
var link = document.createElement("a");
link.setAttribute("href", "index.html");
link.innerHTML = "<i class=\"fa fa-chevron-left\"></i>&nbsp;&nbsp;Back to index";