mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 12:47:11 -05:00
Merge 44a10811a3 into dac26ce671
This commit is contained in:
commit
d6d3a31d35
4 changed files with 50 additions and 15 deletions
|
|
@ -383,6 +383,10 @@ deck-config-which-deck = Which deck would you like to display options for?
|
||||||
|
|
||||||
deck-config-updating-cards = Updating cards: { $current_cards_count }/{ $total_cards_count }...
|
deck-config-updating-cards = Updating cards: { $current_cards_count }/{ $total_cards_count }...
|
||||||
deck-config-invalid-parameters = The provided FSRS parameters are invalid. Leave them blank to use the default values.
|
deck-config-invalid-parameters = The provided FSRS parameters are invalid. Leave them blank to use the default values.
|
||||||
|
deck-config-placeholder-parameters =
|
||||||
|
Default parameters
|
||||||
|
(Press "{deck-config-optimize-button}" periodically to allow FSRS to better adjust to your memory)
|
||||||
|
deck-config-manual-parameter-edit-warning = The parameters should only be modified using the optimize button. Manually editing them is heavily advised against.
|
||||||
deck-config-not-enough-history = Insufficient review history to perform this operation.
|
deck-config-not-enough-history = Insufficient review history to perform this operation.
|
||||||
deck-config-must-have-400-reviews =
|
deck-config-must-have-400-reviews =
|
||||||
{ $count ->
|
{ $count ->
|
||||||
|
|
|
||||||
|
|
@ -387,11 +387,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<Warning warning={desiredRetentionWarning} className={retentionWarningClass} />
|
<Warning warning={desiredRetentionWarning} className={retentionWarningClass} />
|
||||||
|
|
||||||
<div class="ms-1 me-1">
|
<div class="ms-1 me-1">
|
||||||
<ParamsInputRow
|
<ParamsInputRow bind:value={$config.fsrsParams6} defaultValue={[]}>
|
||||||
bind:value={$config.fsrsParams6}
|
|
||||||
defaultValue={[]}
|
|
||||||
defaults={defaults.fsrsParams6}
|
|
||||||
>
|
|
||||||
<SettingTitle on:click={() => openHelpModal("modelParams")}>
|
<SettingTitle on:click={() => openHelpModal("modelParams")}>
|
||||||
{tr.deckConfigWeights()}
|
{tr.deckConfigWeights()}
|
||||||
</SettingTitle>
|
</SettingTitle>
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { tick } from "svelte";
|
import { tick } from "svelte";
|
||||||
import * as tr from "@generated/ftl";
|
import * as tr from "@generated/ftl";
|
||||||
|
import Warning from "./Warning.svelte";
|
||||||
|
|
||||||
export let value: number[];
|
export let value: number[];
|
||||||
export let defaults: number[];
|
|
||||||
|
|
||||||
let stringValue: string;
|
let stringValue: string;
|
||||||
let taRef: HTMLTextAreaElement;
|
let taRef: HTMLTextAreaElement;
|
||||||
|
|
@ -46,21 +46,57 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
input.value = stringValue;
|
input.value = stringValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const UNLOCK_EDIT_COUNT = 3;
|
||||||
|
const UNLOCK_CLICK_TIMEOUT_MS = 500;
|
||||||
|
let clickCount = 0;
|
||||||
|
|
||||||
|
let clickTimeout: ReturnType<typeof setTimeout>;
|
||||||
|
|
||||||
|
function onClick() {
|
||||||
|
clickCount += 1;
|
||||||
|
clearTimeout(clickTimeout);
|
||||||
|
if (clickCount < UNLOCK_EDIT_COUNT) {
|
||||||
|
clickTimeout = setTimeout(() => {
|
||||||
|
clickCount = 0;
|
||||||
|
}, UNLOCK_CLICK_TIMEOUT_MS);
|
||||||
|
} else {
|
||||||
|
taRef.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$: unlocked = clickCount >= UNLOCK_EDIT_COUNT;
|
||||||
|
$: unlockEditWarning = unlocked ? tr.deckConfigManualParameterEditWarning() : "";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:window onresize={updateHeight} />
|
<svelte:window onresize={updateHeight} />
|
||||||
|
|
||||||
|
<div
|
||||||
|
on:click={onClick}
|
||||||
|
on:keypress={onClick}
|
||||||
|
role="button"
|
||||||
|
aria-label={"FSRS Parameters"}
|
||||||
|
tabindex={unlocked ? -1 : 0}
|
||||||
|
>
|
||||||
<textarea
|
<textarea
|
||||||
bind:this={taRef}
|
bind:this={taRef}
|
||||||
value={stringValue}
|
value={stringValue}
|
||||||
on:blur={update}
|
on:blur={update}
|
||||||
class="w-100"
|
class="w-100"
|
||||||
placeholder={render(defaults)}
|
placeholder={tr.deckConfigPlaceholderParameters()}
|
||||||
|
disabled={!unlocked}
|
||||||
></textarea>
|
></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Warning warning={unlockEditWarning} className="alert-danger"></Warning>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
textarea {
|
textarea {
|
||||||
resize: none;
|
resize: none;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
textarea:disabled {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -10,11 +10,10 @@
|
||||||
|
|
||||||
export let value: number[];
|
export let value: number[];
|
||||||
export let defaultValue: number[];
|
export let defaultValue: number[];
|
||||||
export let defaults: number[];
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<slot />
|
<slot />
|
||||||
<ConfigInput>
|
<ConfigInput>
|
||||||
<ParamsInput bind:value {defaults} />
|
<ParamsInput bind:value />
|
||||||
<RevertButton slot="revert" bind:value {defaultValue} />
|
<RevertButton slot="revert" bind:value {defaultValue} />
|
||||||
</ConfigInput>
|
</ConfigInput>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue