Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.
Merged
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
7 changes: 7 additions & 0 deletions runestone/activecode/js/timed_activecode.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ TimedActiveCode.prototype.timedInit = function (opts) {
this.init(opts);
this.renderTimedIcon(this.containerDiv);
this.hideButtons();
this.needsReinitialization = true; // the run button click listener needs to be reinitialized
};


Expand Down Expand Up @@ -55,3 +56,9 @@ TimedActiveCode.prototype.processTimedSubmission = function (logFlag) {
this.runButton.disabled = true;
$(this.codeDiv).addClass("ac-disabled");
};

TimedActiveCode.prototype.reinitializeListeners = function () {
// re-attach the run button listener
$(this.runButton).click(this.runProg.bind(this));
$(this.histButton).click(this.addHistoryScrubber.bind(this));
};
5 changes: 5 additions & 0 deletions runestone/assess/js/timed.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,11 @@ Timed.prototype.randomizeRQA = function () {
Timed.prototype.renderTimedQuestion = function () {
$(this.switchDiv).replaceWith(this.renderedQuestionArray[this.currentQuestionIndex].containerDiv);
this.switchDiv = this.renderedQuestionArray[this.currentQuestionIndex].containerDiv;
// If the timed component has listeners, those need to be reinitialized
// This flag will only be set in the elements that need it--it will be undefined in the others and thus evaluate to false
if (this.renderedQuestionArray[this.currentQuestionIndex].needsReinitialization) {
this.renderedQuestionArray[this.currentQuestionIndex].reinitializeListeners();
}
};


Expand Down