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

Commit 8436eaf

Browse files
committed
distribute initialization code out of layout.html into the components.
1 parent 0a34f47 commit 8436eaf

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed

runestone/activecode/js/activecode.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,3 +1249,6 @@ function injectCodeCoach(div_id) {
12491249
}
12501250

12511251

1252+
$(document).ready(createEditors);
1253+
$(document).ready(createScratchActivecode);
1254+
$(document).ready(styleUnittestResults);

runestone/codelens/js/codelens.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,11 @@ function redrawAllVisualizerArrows() {
3636
allVisualizers[v].redrawConnectors();
3737
}
3838
}
39+
function styleButtons(divid) {
40+
var myVis = $("#"+divid);
41+
$(myVis).find("#jmpFirstInstr").addClass('btn btn-default');
42+
$(myVis).find("#jmpStepBack").addClass('btn btn-danger');
43+
$(myVis).find("#jmpStepFwd").addClass('btn btn-success');
44+
$(myVis).find("#jmpLastInstr").addClass('btn btn-default');
45+
}
46+

runestone/codelens/visualizer.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def setup(app):
8282
lang : '%(python)s'
8383
});
8484
attachLoggers(%(divid)s_vis,'%(divid)s');
85+
styleButtons('%(divid)s');
8586
allVisualizers.push(%(divid)s_vis);
8687
} catch (e) {
8788
console.log("Failed to Initialize CodeLens component %(divid)s_vis" );

runestone/common/js/bookfuncs.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,3 +247,30 @@ function addDelay(directive, action, delay) {
247247
clearTimeout(timers[directive]);
248248
timers[directive] = setTimeout(action, delay);
249249
}
250+
251+
252+
253+
// initialize stuff
254+
$(document).ready(addUserToFooter);
255+
$(document).ready(addNavbarLoginLink);
256+
$(document).ready(getNumUsers);
257+
$(document).ready(getOnlineUsers);
258+
259+
// misc stuff
260+
// todo: This could be further distributed but making a video.js file just for one function seems dumb.
261+
$(document).ready(function() {
262+
// add the video play button overlay image
263+
$(".video-play-overlay").each(function() {
264+
$(this).css('background-image', "url(\'{{pathto('_static/play_overlay_icon.png', 1)}}\')")
265+
});
266+
267+
// This function is needed to allow the dropdown search bar to work;
268+
// The default behaviour is that the dropdown menu closes when something in
269+
// it (like the search bar) is clicked
270+
$(function() {
271+
// Fix input element click problem
272+
$('.dropdown input, .dropdown label').click(function(e) {
273+
e.stopPropagation();
274+
});
275+
});
276+
});

0 commit comments

Comments
 (0)