mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 22:42:25 -04:00
delay setting q/a if previous operation is still running
fixes incorrect formatting when undoing previous review then immediately hitting enter
This commit is contained in:
parent
944bca0f44
commit
d02901fb7a
1 changed files with 11 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
var ankiPlatform = "desktop";
|
var ankiPlatform = "desktop";
|
||||||
var typeans;
|
var typeans;
|
||||||
|
var _updatingQA = false;
|
||||||
|
|
||||||
var qFade = 100;
|
var qFade = 100;
|
||||||
var aFade = 0;
|
var aFade = 0;
|
||||||
|
@ -14,6 +15,15 @@ function _runHook(arr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _updateQA(html, fadeTime, onupdate, onshown) {
|
function _updateQA(html, fadeTime, onupdate, onshown) {
|
||||||
|
// if a request to update q/a comes in before the previous content
|
||||||
|
// has been loaded, wait a while and try again
|
||||||
|
if (_updatingQA) {
|
||||||
|
setTimeout(function () { _updateQA(html, fadeTime, onupdate, onshown) }, 50);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_updatingQA = true;
|
||||||
|
|
||||||
onUpdateHook = [onupdate];
|
onUpdateHook = [onupdate];
|
||||||
onShownHook = [onshown];
|
onShownHook = [onshown];
|
||||||
|
|
||||||
|
@ -38,6 +48,7 @@ function _updateQA(html, fadeTime, onupdate, onshown) {
|
||||||
MathJax.Hub.Queue(function () {
|
MathJax.Hub.Queue(function () {
|
||||||
qa.fadeTo(fadeTime, 1, function () {
|
qa.fadeTo(fadeTime, 1, function () {
|
||||||
_runHook(onShownHook);
|
_runHook(onShownHook);
|
||||||
|
_updatingQA = false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue