7ad6966943
- js code that was previously bundled in .py files is now in the web folder - add helpers to create links to bundled files, and update stdHtml() to accept a list of javascript files to include instead of text - render MathJax in card layout and preview screens - these should be updated in the future to update the document dynamically like the reviewer does - start media server earlier so it can be used to serve content for the toolbar, etc - work around a bug in WebEngine on Windows that could cause the media server to hang
44 lines
881 B
JavaScript
44 lines
881 B
JavaScript
var time; // set in python code
|
|
|
|
var maxTime = 0;
|
|
$(function () {
|
|
$("#ansbut").focus();
|
|
updateTime();
|
|
setInterval(function () {
|
|
time += 1;
|
|
updateTime()
|
|
}, 1000);
|
|
});
|
|
|
|
var updateTime = function () {
|
|
if (!maxTime) {
|
|
$("#time").text("");
|
|
return;
|
|
}
|
|
time = Math.min(maxTime, time);
|
|
var m = Math.floor(time / 60);
|
|
var s = time % 60;
|
|
if (s < 10) {
|
|
s = "0" + s;
|
|
}
|
|
var e = $("#time");
|
|
if (maxTime == time) {
|
|
e.html("<font color=red>" + m + ":" + s + "</font>");
|
|
} else {
|
|
e.text(m + ":" + s);
|
|
}
|
|
}
|
|
|
|
function showQuestion(txt, maxTime_) {
|
|
// much faster than jquery's .html()
|
|
$("#middle")[0].innerHTML = txt;
|
|
$("#ansbut").focus();
|
|
time = 0;
|
|
maxTime = maxTime_;
|
|
}
|
|
|
|
function showAnswer(txt) {
|
|
$("#middle")[0].innerHTML = txt;
|
|
$("#defease").focus();
|
|
}
|