mirror of
https://github.com/ankitects/anki.git
synced 2025-11-12 07:37:11 -05:00
Revert "possible workaround for the win32 images issue"
This reverts commit f72a99abf4.
This commit is contained in:
parent
a1b359d4ef
commit
d351d4e9cc
1 changed files with 2 additions and 23 deletions
|
|
@ -6,7 +6,7 @@ import time, os, stat, shutil, difflib, re, cgi
|
|||
import unicodedata as ucd
|
||||
import HTMLParser
|
||||
from aqt.qt import *
|
||||
from anki.utils import fmtTimeSpan, stripHTML, isMac, json, isWin
|
||||
from anki.utils import fmtTimeSpan, stripHTML, isMac, json
|
||||
from anki.hooks import addHook, runHook, runFilter
|
||||
from anki.sound import playFromText, clearAudioQueue, hasSound, play
|
||||
from aqt.utils import mungeQA, getBase, shortcut, openLink, tooltip
|
||||
|
|
@ -110,7 +110,6 @@ class Reviewer(object):
|
|||
<div id=qa></div>
|
||||
<script>
|
||||
var ankiPlatform = "desktop";
|
||||
var isWin = %s;
|
||||
var typeans;
|
||||
function _updateQA (q, answerMode, klass) {
|
||||
$("#qa").html(q);
|
||||
|
|
@ -126,7 +125,6 @@ function _updateQA (q, answerMode, klass) {
|
|||
if (klass) {
|
||||
document.body.className = klass;
|
||||
}
|
||||
if (isWin) { setTimeout(200, function () { _imageLoadHack(0); }); }
|
||||
};
|
||||
|
||||
function _toggleStar (show) {
|
||||
|
|
@ -142,32 +140,13 @@ function _getTypedText () {
|
|||
py.link("typeans:"+typeans.value);
|
||||
}
|
||||
};
|
||||
|
||||
function _typeAnsPress() {
|
||||
if (window.event.keyCode === 13) {
|
||||
py.link("ans");
|
||||
}
|
||||
}
|
||||
|
||||
function _imageLoadHack (tries) {
|
||||
var spacing = [1000, 2000];
|
||||
var checkAgain = false;
|
||||
/* try to work around win32 intermittently failing to load images in qt4.7 */
|
||||
$('img').each(function (idx) {
|
||||
if (!this.complete) {
|
||||
checkAgain = true;
|
||||
this.src += '?'+(new Date().getTime());
|
||||
}
|
||||
});
|
||||
if (checkAgain && tries < spacing.length) {
|
||||
// check again later
|
||||
console.log("resched for " + spacing[tries]);
|
||||
setTimeout(function () { _imageLoadHack(tries+1); },
|
||||
spacing[tries]);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
""" % json.dumps(isWin)
|
||||
"""
|
||||
|
||||
def _initWeb(self):
|
||||
self._reps = 0
|
||||
|
|
|
|||
Loading…
Reference in a new issue