mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
* Improve update interval of timer display Timer calculation frequency increased and aligned with new card apparition. * Update CONTRIBUTORS * Update timer interval to 0.333 sec * Restore timer to 1 sec - Restoring timer to 1sec value as it is not necessary to increase the frequency. - Adding a time update directy after new card is displayed so that the timer display immediatly restarts to 0.
This commit is contained in:
parent
111f3bd138
commit
32c129656e
2 changed files with 15 additions and 9 deletions
|
@ -168,6 +168,7 @@ Arbyste <arbyste@outlook.com>
|
|||
Vasll <github.com/vasll>
|
||||
laalsaas <laalsaas@systemli.org>
|
||||
ijqq <ijqq@protonmail.ch>
|
||||
AntoineQ1 <https://github.com/AntoineQ1>
|
||||
********************
|
||||
|
||||
The text of the 3 clause BSD license follows:
|
||||
|
|
|
@ -9,15 +9,6 @@ let time: number; // set in python code
|
|||
let timerStopped = false;
|
||||
|
||||
let maxTime = 0;
|
||||
document.addEventListener("DOMContentLoaded", () => {
|
||||
updateTime();
|
||||
setInterval(function() {
|
||||
if (!timerStopped) {
|
||||
time += 1;
|
||||
updateTime();
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
function updateTime(): void {
|
||||
const timeNode = document.getElementById("time");
|
||||
|
@ -38,10 +29,24 @@ function updateTime(): void {
|
|||
}
|
||||
}
|
||||
|
||||
let intervalId: number | undefined;
|
||||
|
||||
function showQuestion(txt: string, maxTime_: number): void {
|
||||
showAnswer(txt);
|
||||
time = 0;
|
||||
maxTime = maxTime_;
|
||||
updateTime();
|
||||
|
||||
if (intervalId !== undefined) {
|
||||
clearInterval(intervalId);
|
||||
}
|
||||
|
||||
intervalId = setInterval(function() {
|
||||
if (!timerStopped) {
|
||||
time += 1;
|
||||
updateTime();
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function showAnswer(txt: string, stopTimer = false): void {
|
||||
|
|
Loading…
Reference in a new issue