mirror of
https://github.com/ankitects/anki.git
synced 2025-11-14 00:27:13 -05:00
Merge pull request #1123 from hgiesel/reviewerbottomdropjquery
Remove jQuery reviewer-bottom.ts and overview.ts
This commit is contained in:
commit
ca6edc1470
3 changed files with 19 additions and 28 deletions
|
|
@ -1,6 +0,0 @@
|
||||||
/* Copyright: Ankitects Pty Ltd and contributors
|
|
||||||
* License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */
|
|
||||||
|
|
||||||
$(function () {
|
|
||||||
$("#study").focus();
|
|
||||||
});
|
|
||||||
|
|
@ -4,8 +4,7 @@
|
||||||
var time: number; // set in python code
|
var time: number; // set in python code
|
||||||
|
|
||||||
let maxTime = 0;
|
let maxTime = 0;
|
||||||
$(function () {
|
document.addEventListener("DOMContentLoaded", () => {
|
||||||
$("#ansbut").focus();
|
|
||||||
updateTime();
|
updateTime();
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
time += 1;
|
time += 1;
|
||||||
|
|
@ -13,35 +12,33 @@ $(function () {
|
||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
|
|
||||||
let updateTime = function () {
|
function updateTime(): void {
|
||||||
let timeNode = $("#time");
|
const timeNode = document.getElementById("time");
|
||||||
if (!maxTime) {
|
if (maxTime === 0) {
|
||||||
timeNode.text("");
|
timeNode.textContent = "";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
time = Math.min(maxTime, time);
|
time = Math.min(maxTime, time);
|
||||||
const m = Math.floor(time / 60);
|
const m = Math.floor(time / 60);
|
||||||
const s = time % 60;
|
const s = time % 60;
|
||||||
let sStr = s.toString();
|
const sStr = String(s).padStart(2, "0");
|
||||||
if (s < 10) {
|
const timeString = `${m}:${sStr}`;
|
||||||
sStr = "0" + s;
|
|
||||||
}
|
|
||||||
if (maxTime === time) {
|
|
||||||
timeNode.html("<font color=red>" + m + ":" + sStr + "</font>");
|
|
||||||
} else {
|
|
||||||
timeNode.text(m + ":" + sStr);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function showQuestion(txt, maxTime_) {
|
if (maxTime === time) {
|
||||||
// much faster than jquery's .html()
|
timeNode.innerHTML = `<font color=red>${timeString}</font>`;
|
||||||
$("#middle")[0].innerHTML = txt;
|
} else {
|
||||||
|
timeNode.textContent = timeString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showQuestion(txt: string, maxTime_: number): void {
|
||||||
|
showAnswer(txt);
|
||||||
time = 0;
|
time = 0;
|
||||||
maxTime = maxTime_;
|
maxTime = maxTime_;
|
||||||
}
|
}
|
||||||
|
|
||||||
function showAnswer(txt) {
|
function showAnswer(txt: string): void {
|
||||||
$("#middle")[0].innerHTML = txt;
|
document.getElementById("middle").innerHTML = txt;
|
||||||
}
|
}
|
||||||
|
|
||||||
function selectedAnswerButton() {
|
function selectedAnswerButton() {
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ class Overview:
|
||||||
self.web.stdHtml(
|
self.web.stdHtml(
|
||||||
self._body % content.__dict__,
|
self._body % content.__dict__,
|
||||||
css=["css/overview.css"],
|
css=["css/overview.css"],
|
||||||
js=["js/vendor/jquery.min.js", "js/overview.js"],
|
js=["js/vendor/jquery.min.js"],
|
||||||
context=self,
|
context=self,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue