Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions runestone/accessibility/css/accessibility.css
Original file line numberDiff line numberDiff line change
Expand Up@@ -152,4 +152,18 @@ button.btn.btn-link:focus {
button.btn.btn-link {
color:#1a6a83 !important;
background-color:#FFFFFF !important;
}

/*Reset Button*/
button.btn.btn-reset:active {
color:#d78080!important;
background-color:#FFFFFF !important;
}
button.btn.btn-reset:focus {
color:#d78080 !important;
background-color:#FFFFFF !important;
}
button.btn.btn-reset{
color:#FFFFFF !important;
background-color:#d78080 !important;
}
31 changes: 29 additions & 2 deletions runestone/activecode/js/activecode.js
Original file line numberDiff line numberDiff line change
Expand Up@@ -81,6 +81,7 @@ export class ActiveCode extends RunestoneBase {
this.saveButton = null;
this.loadButton = null;
this.outerDiv = null;
this.resetButt = null;
this.partner = "";
this.runCount = 0;
this.logResults = true;
Expand DownExpand Up@@ -308,13 +309,16 @@ export class ActiveCode extends RunestoneBase {
if (eBookConfig.isInstructor) {
this.enableInstructorSharing(ctrlDiv);
}

this.addReset(ctrlDiv);

if (this.enablePartner) {
this.setupPartner(ctrlDiv);
}
if (this.chatcodes && eBookConfig.enable_chatcodes) {
this.enableChatCodes(ctrlDiv);
}

$(this.outerDiv).prepend(ctrlDiv);
if (this.question) {
if ($(this.question).html().match(/^\s+$/)) {
Expand DownExpand Up@@ -467,6 +471,26 @@ export class ActiveCode extends RunestoneBase {
);
}

addReset(ctrlDiv){
let butt = document.createElement("button");
$(butt).text("Reset");
ctrlDiv.appendChild(butt);
$(butt).addClass("btn btn-reset");
$(butt).css("margin-right", "10px");
$(butt).attr("type", "button");
$(butt).attr("target", "_blank");
this.resetButt = butt
$(butt).click(
function(){
this.history = [this.history[0]];
this.editor.setValue(this.history[0]);
$(this.historyScrubber).slider("value", 0)
$(this.timestampP).text(`${this.timestamps[0]} - 1 of 1`);
$(this.historyScrubber).slider("disable");
}.bind(this)
)
}

setupPartner(ctrlDiv) {
var checkPartner = document.createElement("input");
checkPartner.type = "checkbox";
Expand DownExpand Up@@ -639,7 +663,7 @@ export class ActiveCode extends RunestoneBase {
"max-width": "300px",
});
var scrubber = document.createElement("div");
this.timestampP = document.createElement("span");
this.timestampP = document.createElement("span");
this.slideit = function () {
this.editor.setValue(this.history[$(scrubber).slider("value")]);
var curVal = this.timestamps[$(scrubber).slider("value")];
Expand DownExpand Up@@ -1176,6 +1200,9 @@ Yet another is that there is an internal error. The internal error message is:
if (this.historyScrubber === null && !this.autorun) {
await this.addHistoryScrubber();
}
if (this.history.length > 0){
$(this.historyScrubber).slider("enable");
}
if (
this.historyScrubber &&
this.history[$(this.historyScrubber).slider("value")] !=
Expand Down