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

Commit 0e22894

Browse files
committed
Change deprecated bind to supported on
1 parent 139b570 commit 0e22894

File tree

24 files changed

+292
-228
lines changed

24 files changed

+292
-228
lines changed

runestone/activecode/js/acfactory.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export default class ACFactory {
162162
// Page Initialization
163163
//
164164

165-
$(document).bind("runestone:login-complete", function () {
165+
$(document).on("runestone:login-complete", function () {
166166
ACFactory.createScratchActivecode();
167167
$("[data-component=activecode]").each(function () {
168168
if ($(this).closest("[data-component=timedAssessment]").length == 0) {
@@ -202,10 +202,10 @@ window.ACFactory = ACFactory;
202202
// figure out the login/logout status of the user. Sometimes its immediate, and sometimes its
203203
// long. So to be safe we'll do it both ways..
204204
var loggedout;
205-
$(document).bind("runestone:logout", function () {
205+
$(document).on("runestone:logout", function () {
206206
loggedout = true;
207207
});
208-
$(document).bind("runestone:logout", function () {
208+
$(document).on("runestone:logout", function () {
209209
for (let k in window.edList) {
210210
if (window.edList.hasOwnProperty(k)) {
211211
window.edList[k].disableSaveLoad();

runestone/clickableArea/js/clickable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ export default class ClickableArea extends RunestoneBase {
459459
== Find the custom HTML tags and ==
460460
== execute our code on them ==
461461
=================================*/
462-
$(document).bind("runestone:login-complete", function () {
462+
$(document).on("runestone:login-complete", function () {
463463
$("[data-component=clickablearea]").each(function (index) {
464464
if ($(this).closest("[data-component=timedAssessment]").length == 0) {
465465
// If this element exists within a timed component, don't render it here

runestone/common/js/bookfuncs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ function setupNavbarLoggedIn() {
228228
'<a href="' + eBookConfig.app + '/default/user/logout">Log Out</a>'
229229
);
230230
}
231-
$(document).bind("runestone:login", setupNavbarLoggedIn);
231+
$(document).on("runestone:login", setupNavbarLoggedIn);
232232

233233
function setupNavbarLoggedOut() {
234234
if (eBookConfig.useRunestoneServices) {
@@ -244,7 +244,7 @@ function setupNavbarLoggedOut() {
244244
$(".footer").html("user not logged in");
245245
}
246246
}
247-
$(document).bind("runestone:logout", setupNavbarLoggedOut);
247+
$(document).on("runestone:logout", setupNavbarLoggedOut);
248248

249249
function notifyRunestoneComponents() {
250250
// Runestone components wait until login process is over to load components because of storage issues. This triggers the `dynamic import machinery`, which then sends the login complete signal when this and all dynamic imports are finished.

runestone/common/js/presenter_mode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ function configureCodelens() {
211211
}
212212
}
213213

214-
$(document).bind("runestone:login-complete", function () {
214+
$(document).on("runestone:login-complete", function () {
215215
// if user is instructor, enable presenter mode
216216
if (eBookConfig.isInstructor) {
217217
configure();

runestone/common/js/user-highlights.js

Lines changed: 94 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import "../css/user-highlights.css";
66

7-
87
function getCompletions() {
98
// Get the completion status
109
if (
@@ -43,10 +42,10 @@ function getCompletions() {
4342
}
4443
$("#main-content").append(
4544
'<div style="text-align:center"><button class="btn btn-lg ' +
46-
completionClass +
47-
'" id="completionButton">' +
48-
completionMsg +
49-
"</button></div>"
45+
completionClass +
46+
'" id="completionButton">' +
47+
completionMsg +
48+
"</button></div>"
5049
);
5150
}
5251
});
@@ -57,8 +56,8 @@ function showLastPositionBanner() {
5756
if (typeof lastPositionVal !== "undefined") {
5857
$("body").append(
5958
'<img src="../_static/last-point.png" style="position:absolute; padding-top:55px; left: 10px; top: ' +
60-
parseInt(lastPositionVal) +
61-
'px;"/>'
59+
parseInt(lastPositionVal) +
60+
'px;"/>'
6261
);
6362
$("html, body").animate({ scrollTop: parseInt(lastPositionVal) }, 1000);
6463
}
@@ -168,95 +167,100 @@ function decorateTableOfContents() {
168167
window.location.href.toLowerCase().indexOf("toc.html") != -1 ||
169168
window.location.href.toLowerCase().indexOf("index.html") != -1
170169
) {
171-
jQuery.get(`${eBookConfig.new_server_prefix}/logger/getAllCompletionStatus`, function (
172-
data
173-
) {
174-
var subChapterList;
175-
if (data != "None") {
176-
subChapterList = data.detail;
170+
jQuery.get(
171+
`${eBookConfig.new_server_prefix}/logger/getAllCompletionStatus`,
172+
function (data) {
173+
var subChapterList;
174+
if (data != "None") {
175+
subChapterList = data.detail;
177176

178-
var allSubChapterURLs = $("#main-content div li a");
179-
$.each(subChapterList, function (index, item) {
180-
for (var s = 0; s < allSubChapterURLs.length; s++) {
181-
if (
182-
allSubChapterURLs[s].href.indexOf(
183-
item.chapterName + "/" + item.subChapterName
184-
) != -1
185-
) {
186-
if (item.completionStatus == 1) {
187-
$(allSubChapterURLs[s].parentElement)
188-
.addClass("completed")
189-
.append(
190-
'<span class="infoTextCompleted">- Completed this topic on ' +
191-
item.endDate +
192-
"</span>"
193-
)
194-
.children()
195-
.first()
196-
.hover(
197-
function () {
198-
$(this)
199-
.next(".infoTextCompleted")
200-
.show();
201-
},
202-
function () {
203-
$(this)
204-
.next(".infoTextCompleted")
205-
.hide();
206-
}
207-
);
208-
} else if (item.completionStatus == 0) {
209-
$(allSubChapterURLs[s].parentElement)
210-
.addClass("active")
211-
.append(
212-
'<span class="infoTextActive">Last read this topic on ' +
213-
item.endDate +
214-
"</span>"
215-
)
216-
.children()
217-
.first()
218-
.hover(
219-
function () {
220-
$(this)
221-
.next(".infoTextActive")
222-
.show();
223-
},
224-
function () {
225-
$(this)
226-
.next(".infoTextActive")
227-
.hide();
228-
}
229-
);
177+
var allSubChapterURLs = $("#main-content div li a");
178+
$.each(subChapterList, function (index, item) {
179+
for (var s = 0; s < allSubChapterURLs.length; s++) {
180+
if (
181+
allSubChapterURLs[s].href.indexOf(
182+
item.chapterName + "/" + item.subChapterName
183+
) != -1
184+
) {
185+
if (item.completionStatus == 1) {
186+
$(allSubChapterURLs[s].parentElement)
187+
.addClass("completed")
188+
.append(
189+
'<span class="infoTextCompleted">- Completed this topic on ' +
190+
item.endDate +
191+
"</span>"
192+
)
193+
.children()
194+
.first()
195+
.hover(
196+
function () {
197+
$(this)
198+
.next(".infoTextCompleted")
199+
.show();
200+
},
201+
function () {
202+
$(this)
203+
.next(".infoTextCompleted")
204+
.hide();
205+
}
206+
);
207+
} else if (item.completionStatus == 0) {
208+
$(allSubChapterURLs[s].parentElement)
209+
.addClass("active")
210+
.append(
211+
'<span class="infoTextActive">Last read this topic on ' +
212+
item.endDate +
213+
"</span>"
214+
)
215+
.children()
216+
.first()
217+
.hover(
218+
function () {
219+
$(this)
220+
.next(".infoTextActive")
221+
.show();
222+
},
223+
function () {
224+
$(this)
225+
.next(".infoTextActive")
226+
.hide();
227+
}
228+
);
229+
}
230230
}
231231
}
232-
}
233-
});
232+
});
233+
}
234234
}
235-
});
235+
);
236236
var data = { course: eBookConfig.course };
237-
jQuery.get(`${eBookConfig.new_server_prefix}/logger/getlastpage`, data, function (data) {
238-
var lastPageData;
239-
if (data != "None") {
240-
lastPageData = data.detail;
241-
if (lastPageData.lastPageChapter != null) {
242-
$("#continue-reading")
243-
.show()
244-
.html(
245-
'<div id="jump-to-chapter" class="alert alert-info" ><strong>You were Last Reading:</strong> ' +
246-
lastPageData.lastPageChapter +
247-
(lastPageData.lastPageSubchapter
248-
? " &gt; " +
249-
lastPageData.lastPageSubchapter
250-
: "") +
251-
' <a href="' +
252-
lastPageData.lastPageUrl +
253-
"?lastPosition=" +
254-
lastPageData.lastPageScrollLocation +
255-
'">Continue Reading</a></div>'
256-
);
237+
jQuery.get(
238+
`${eBookConfig.new_server_prefix}/logger/getlastpage`,
239+
data,
240+
function (data) {
241+
var lastPageData;
242+
if (data != "None") {
243+
lastPageData = data.detail;
244+
if (lastPageData.lastPageChapter != null) {
245+
$("#continue-reading")
246+
.show()
247+
.html(
248+
'<div id="jump-to-chapter" class="alert alert-info" ><strong>You were Last Reading:</strong> ' +
249+
lastPageData.lastPageChapter +
250+
(lastPageData.lastPageSubchapter
251+
? " &gt; " +
252+
lastPageData.lastPageSubchapter
253+
: "") +
254+
' <a href="' +
255+
lastPageData.lastPageUrl +
256+
"?lastPosition=" +
257+
lastPageData.lastPageScrollLocation +
258+
'">Continue Reading</a></div>'
259+
);
260+
}
257261
}
258262
}
259-
});
263+
);
260264
}
261265
}
262266

@@ -268,7 +272,7 @@ function enableCompletions() {
268272
}
269273

270274
// call enable user highlights after login
271-
$(document).bind("runestone:login", enableCompletions);
275+
$(document).on("runestone:login", enableCompletions);
272276

273277
// _ processPageState
274278
// -------------------------

runestone/dragndrop/js/dragndrop.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ export default class DragNDrop extends RunestoneBase {
550550
== Find the custom HTML tags and ==
551551
== execute our code on them ==
552552
=================================*/
553-
$(document).bind("runestone:login-complete", function () {
553+
$(document).on("runestone:login-complete", function () {
554554
$("[data-component=dragndrop]").each(function (index) {
555555
var opts = {
556556
orig: this,

runestone/fitb/js/fitb.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ export default class FITB extends RunestoneBase {
407407
== Find the custom HTML tags and ==
408408
== execute our code on them ==
409409
=================================*/
410-
$(document).bind("runestone:login-complete", function () {
410+
$(document).on("runestone:login-complete", function () {
411411
$("[data-component=fillintheblank]").each(function (index) {
412412
var opts = {
413413
orig: this,

0 commit comments

Comments
 (0)