if space/ret hit on an ease button, activate that button

This commit is contained in:
Damien Elmes 2011-03-25 09:58:35 +09:00
parent 64d7a3e046
commit 9d060df04c

View file

@ -123,6 +123,11 @@ function showans () {
function proctypeans (res) { function proctypeans (res) {
$("#typeans").replaceWith(res); $("#typeans").replaceWith(res);
} }
function space() {
if (/^ease/.test(document.activeElement.href)) {
py.link(document.activeElement.href);
}
}
$(document).ready(function () { $(document).ready(function () {
$(".ansbut").focus(); $(".ansbut").focus();
}); });
@ -244,8 +249,7 @@ $(".ansbut").focus();
if evt.key() in (Qt.Key_Enter, if evt.key() in (Qt.Key_Enter,
Qt.Key_Return, Qt.Key_Return,
Qt.Key_Space): Qt.Key_Space):
self._answerCard(self._defaultEase()) self.web.eval("space();")
return True
else: else:
key = unicode(evt.text()) key = unicode(evt.text())
if key and key >= "1" and key <= "4": if key and key >= "1" and key <= "4":