Skip to content

Commit

Permalink
Fixed some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
pgaskin committed Aug 15, 2016
1 parent 926db00 commit 54f1f99
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions reader.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,16 @@ doBook = function(url) {
});

Book.on('renderer:locationChanged', function(locationCfi) {
var toclist = document.getElementById("toc-container").getElementsByClassName("toc-entry");
for (var e = 0; e < toclist.length; e++) {
if (toclist[e].getAttribute("data-cfi") == "epubcfi(" + Book.currentChapter.cfiBase + ")") {
toclist[e].classList.add("active");
} else {
toclist[e].classList.remove("active");
try {
var toclist = document.getElementById("toc-container").getElementsByClassName("toc-entry");
for (var e = 0; e < toclist.length; e++) {
if (toclist[e].getAttribute("data-cfi") == "epubcfi(" + Book.currentChapter.cfiBase + ")") {
toclist[e].classList.add("active");
} else {
toclist[e].classList.remove("active");
}
}
}
} catch (e) {}
});

bookel.innerHTML = "";
Expand Down Expand Up @@ -390,7 +392,9 @@ doUpdateProgressIndicators = function() {
document.getElementById("bookprogresstext").innerText = String(progressint) + "% read";
document.getElementById("bookprogressbar").setAttribute("value", String(progressint));
document.getElementById("bookcurrentcfi").innerText = "Current cfi: " + Book.getCurrentLocationCfi();
document.getElementById("currentchapter").innerText = "Chapter: " + BookToc[Book.currentChapter.spinePos].label;
try {
document.getElementById("currentchapter").innerText = "Chapter: " + BookToc[Book.currentChapter.spinePos].label;
} catch (e) {}
}
document.getElementById("book").innerHTML = "<div class=\"message info\">Please click the middle button on the toolbar below or <a href=\"javascript:void(0);\" onclick=\"document.getElementById('bookChooser').click()\">click here</a> to open a book.</div>";
if (checkCompatibility()) {
Expand Down

0 comments on commit 54f1f99

Please sign in to comment.