mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
./check
This commit is contained in:
parent
a365369562
commit
6c540c89f1
5 changed files with 18 additions and 12 deletions
|
@ -10,7 +10,7 @@ from collections.abc import Callable, Generator, Sequence
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from enum import Enum, auto
|
from enum import Enum, auto
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from typing import Any, Literal, Match, Union, cast
|
from typing import Any, Literal, Match, cast
|
||||||
|
|
||||||
import aqt
|
import aqt
|
||||||
import aqt.browser
|
import aqt.browser
|
||||||
|
|
|
@ -3,13 +3,15 @@
|
||||||
import { writable } from "svelte/store";
|
import { writable } from "svelte/store";
|
||||||
import { bridgeCommand } from "@tslib/bridgecommand";
|
import { bridgeCommand } from "@tslib/bridgecommand";
|
||||||
import ReviewerBottom from "./ReviewerBottom.svelte";
|
import ReviewerBottom from "./ReviewerBottom.svelte";
|
||||||
|
import type {AnswerButtonInfo} from "./types"
|
||||||
import "./index.scss"
|
import "./index.scss"
|
||||||
|
|
||||||
let answerButtons = writable<AnswerButtonInfo[]>([])
|
const answerButtons = writable<AnswerButtonInfo[]>([])
|
||||||
let remaining = writable<[number, number, number]>([0, 0, 0])
|
const remaining = writable<[number, number, number]>([0, 0, 0])
|
||||||
let remainingIndex = writable<number>(-1)
|
const remainingIndex = writable<number>(-1)
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
/*
|
||||||
let timerStopped = false;
|
let timerStopped = false;
|
||||||
|
|
||||||
let maxTime = 0;
|
let maxTime = 0;
|
||||||
|
@ -31,33 +33,34 @@
|
||||||
} else {
|
} else {
|
||||||
timeNode.textContent = timeString;
|
timeNode.textContent = timeString;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
let intervalId: number | undefined;
|
let intervalId: number | undefined;
|
||||||
|
|
||||||
|
|
||||||
function _showQuestion(txt: string, maxTime_: number): void {
|
function _showQuestion(_txt: string, _maxTime_: number): void {
|
||||||
_showAnswer([]);
|
_showAnswer([]);
|
||||||
globalThis.time = 0;
|
globalThis.time = 0;
|
||||||
maxTime = maxTime_;
|
// maxTime = maxTime_;
|
||||||
// updateTime();
|
// updateTime();
|
||||||
|
|
||||||
if (intervalId !== undefined) {
|
if (intervalId !== undefined) {
|
||||||
clearInterval(intervalId);
|
clearInterval(intervalId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
intervalId = setInterval(function() {
|
intervalId = setInterval(function() {
|
||||||
if (!timerStopped) {
|
if (!timerStopped) {
|
||||||
globalThis.time += 1;
|
globalThis.time += 1;
|
||||||
//updateTime();
|
//updateTime();
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
function _showAnswer(info: AnswerButtonInfo[], stopTimer = false): void {
|
function _showAnswer(info: AnswerButtonInfo[], _stopTimer = false): void {
|
||||||
console.log(info)
|
console.log(info)
|
||||||
answerButtons.set(info);
|
answerButtons.set(info);
|
||||||
timerStopped = stopTimer;
|
// timerStopped = stopTimer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function _updateRemaining(counts: [number, number, number], idx: number) {
|
function _updateRemaining(counts: [number, number, number], idx: number) {
|
||||||
|
@ -69,6 +72,7 @@
|
||||||
globalThis._showAnswer = _showAnswer;
|
globalThis._showAnswer = _showAnswer;
|
||||||
globalThis._updateRemaining = _updateRemaining;
|
globalThis._updateRemaining = _updateRemaining;
|
||||||
|
|
||||||
|
/*
|
||||||
function selectedAnswerButton(): string | undefined {
|
function selectedAnswerButton(): string | undefined {
|
||||||
const node = document.activeElement as HTMLElement;
|
const node = document.activeElement as HTMLElement;
|
||||||
if (!node) {
|
if (!node) {
|
||||||
|
@ -76,7 +80,7 @@
|
||||||
}
|
}
|
||||||
return node.dataset.ease;
|
return node.dataset.ease;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
bridgeCommand("bottomReady");
|
bridgeCommand("bottomReady");
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { bridgeCommand } from "@tslib/bridgecommand";
|
import { bridgeCommand } from "@tslib/bridgecommand";
|
||||||
|
import type { AnswerButtonInfo } from "./types";
|
||||||
|
|
||||||
export let info: AnswerButtonInfo
|
export let info: AnswerButtonInfo
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
import { bridgeCommand } from "@tslib/bridgecommand";
|
import { bridgeCommand } from "@tslib/bridgecommand";
|
||||||
import * as tr from "@generated/ftl";
|
import * as tr from "@generated/ftl";
|
||||||
import RemainingNumber from "./RemainingNumber.svelte";
|
import RemainingNumber from "./RemainingNumber.svelte";
|
||||||
|
import type { AnswerButtonInfo } from "./types";
|
||||||
|
|
||||||
export let answerButtons: Writable<AnswerButtonInfo[]>
|
export let answerButtons: Writable<AnswerButtonInfo[]>
|
||||||
export let remaining: Writable<number[]>
|
export let remaining: Writable<number[]>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
interface AnswerButtonInfo {
|
export interface AnswerButtonInfo {
|
||||||
"extra": string,
|
"extra": string,
|
||||||
"key": string,
|
"key": string,
|
||||||
"i": number,
|
"i": number,
|
||||||
|
|
Loading…
Reference in a new issue