Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 3fbc9ee

Browse files
committed
use new endpoint for decorating toc
1 parent 5bc9de5 commit 3fbc9ee

1 file changed

Lines changed: 23 additions & 21 deletions

File tree

runestone/common/js/user-highlights.js

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ function getCompletions() {
4343
}
4444
$("#main-content").append(
4545
'<div style="text-align:center"><button class="btn btn-lg ' +
46-
completionClass +
47-
'" id="completionButton">' +
48-
completionMsg +
49-
"</button></div>"
46+
completionClass +
47+
'" id="completionButton">' +
48+
completionMsg +
49+
"</button></div>"
5050
);
5151
}
5252
});
@@ -57,8 +57,8 @@ function showLastPositionBanner() {
5757
if (typeof lastPositionVal !== "undefined") {
5858
$("body").append(
5959
'<img src="../_static/last-point.png" style="position:absolute; padding-top:55px; left: 10px; top: ' +
60-
parseInt(lastPositionVal) +
61-
'px;"/>'
60+
parseInt(lastPositionVal) +
61+
'px;"/>'
6262
);
6363
$("html, body").animate({ scrollTop: parseInt(lastPositionVal) }, 1000);
6464
}
@@ -158,6 +158,8 @@ function addNavigationAndCompletionButtons() {
158158
});
159159
}
160160

161+
// _ decorateTableOfContents
162+
// -------------------------
161163
function decorateTableOfContents() {
162164
if (
163165
window.location.href.toLowerCase().indexOf("toc.html") != -1 ||
@@ -183,8 +185,8 @@ function decorateTableOfContents() {
183185
.addClass("completed")
184186
.append(
185187
'<span class="infoTextCompleted">- Completed this topic on ' +
186-
item.endDate +
187-
"</span>"
188+
item.endDate +
189+
"</span>"
188190
)
189191
.children()
190192
.first()
@@ -205,8 +207,8 @@ function decorateTableOfContents() {
205207
.addClass("active")
206208
.append(
207209
'<span class="infoTextActive">Last read this topic on ' +
208-
item.endDate +
209-
"</span>"
210+
item.endDate +
211+
"</span>"
210212
)
211213
.children()
212214
.first()
@@ -229,7 +231,7 @@ function decorateTableOfContents() {
229231
}
230232
});
231233
var data = { course: eBookConfig.course };
232-
jQuery.get(eBookConfig.ajaxURL + "getlastpage", data, function (data) {
234+
jQuery.get("/logger/getlastpage", data, function (data) {
233235
var lastPageData;
234236
if (data != "None") {
235237
lastPageData = $.parseJSON(data);
@@ -238,16 +240,16 @@ function decorateTableOfContents() {
238240
.show()
239241
.html(
240242
'<div id="jump-to-chapter" class="alert alert-info" ><strong>You were Last Reading:</strong> ' +
241-
lastPageData[0].lastPageChapter +
242-
(lastPageData[0].lastPageSubchapter
243-
? " &gt; " +
244-
lastPageData[0].lastPageSubchapter
245-
: "") +
246-
' <a href="' +
247-
lastPageData[0].lastPageUrl +
248-
"?lastPosition=" +
249-
lastPageData[0].lastPageScrollLocation +
250-
'">Continue Reading</a></div>'
243+
lastPageData[0].lastPageChapter +
244+
(lastPageData[0].lastPageSubchapter
245+
? " &gt; " +
246+
lastPageData[0].lastPageSubchapter
247+
: "") +
248+
' <a href="' +
249+
lastPageData[0].lastPageUrl +
250+
"?lastPosition=" +
251+
lastPageData[0].lastPageScrollLocation +
252+
'">Continue Reading</a></div>'
251253
);
252254
}
253255
}

0 commit comments

Comments
 (0)