Skip to content
This repository was archived by the owner on Mar 5, 2025. 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
13 changes: 13 additions & 0 deletions runestone/activecode/css/activecode.css
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,16 @@
.ac-disabled {
pointer-events: none;
}

.ac_output pre.ac-code-changed {
background: initial;
animation: flash-background 1s;
}
@keyframes flash-background {
0% {
background: rgba(255, 255, 0, 0.3);
}
100% {
background: initial;
}
}
12 changes: 12 additions & 0 deletions runestone/activecode/js/activecode.js
Original file line number Diff line number Diff line change
Expand Up @@ -671,10 +671,22 @@ ActiveCode.prototype.buildProg = function() {
return prog;
};

ActiveCode.prototype.flashBackground = function() {
// Provide a visual cue that the code was re-run, as I was getting feedback
// that, when restructuring code that shouldn't have changed output, they
// were worried about whether the program had actually run again.
this.output.classList.remove('ac-code-changed');
// reflow to ensure that the class removal is synced to DOM
void this.output.offsetWidth;
// add .ac-code-changed to trigger background animation
this.output.classList.add('ac-code-changed');
};

ActiveCode.prototype.runProg = function() {
var prog = this.buildProg();

$(this.output).text('');
this.flashBackground();

$(this.eContainer).remove();
Sk.configure({output : this.outputfun.bind(this),
Expand Down