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

Commit a503723

Browse files
committed
Add autorun
1 parent 30e8e91 commit a503723

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

runestone/activecode/activecode.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,7 @@ def setup(app):
6565
<p class="ac_caption"><span class="ac_caption_text">%(caption)s (%(divid)s)</span> </p>
6666
'''
6767

68-
AUTO = '''
69-
<script type="text/javascript">
70-
$(document).ready(function() {
71-
$(window).load(function() {
72-
var runb = document.getElementById("%(divid)s_runb");
73-
runit('%(divid)s',runb, %(include)s);
74-
});
75-
});
76-
</script>
77-
'''
68+
7869

7970

8071
class ActivcodeNode(nodes.General, nodes.Element):

runestone/activecode/js/activecode.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,10 @@ ActiveCode.prototype.init = function(opts) {
6161
this.createOutput();
6262
this.createControls();
6363

64-
}
64+
if ($(orig).data('autorun')) {
65+
$(document).ready(this.runProg.bind(this));
66+
}
67+
};
6568

6669
ActiveCode.prototype.createEditor = function (index) {
6770
var newdiv = document.createElement('div');

0 commit comments

Comments
 (0)