anki/web/webview.js
2017-08-01 17:04:55 +10:00

17 lines
420 B
JavaScript

// prevent backspace key from going back a page
document.addEventListener("keydown", function (evt) {
if (evt.keyCode !== 8) {
return;
}
var isText = 0;
var nn = evt.target.nodeName;
if (nn === "INPUT" || nn === "TEXTAREA") {
isText = 1;
} else if (nn === "DIV" && evt.target.contentEditable) {
isText = 1;
}
if (!isText) {
evt.preventDefault();
}
});