mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 07:52:24 -04:00
prevent backspace key from going back a page
This commit is contained in:
parent
ca9a6fb86c
commit
a44dc7f174
1 changed files with 17 additions and 0 deletions
|
@ -169,6 +169,23 @@ body { zoom: %f; %s }
|
|||
%s</style>
|
||||
<script>
|
||||
%s
|
||||
|
||||
// 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();
|
||||
}
|
||||
});
|
||||
</script>
|
||||
%s
|
||||
|
||||
|
|
Loading…
Reference in a new issue