Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for all function keys, instead of just F11. (#12) #23

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,11 @@ var Typer={
console.html(text.replace(rtn,"<br/>").replace(rtt,"&nbsp;&nbsp;&nbsp;&nbsp;").replace(rts,"&nbsp;"));// replace newline chars with br, tabs with 4 space and blanks with an html blank
window.scrollBy(0,50); // scroll to make sure bottom is always visible
}
if ( key.preventDefault && key.key !== 'F11' ) { // prevent F11(fullscreen) from being blocked
var isNotFnKey = !key.key.match(/^F\d[0-2]?$/m);
if ( key.preventDefault && isNotFnKey ) { // prevent the function keys from being blocked
key.preventDefault()
}
if(key.key !== 'F11'){ // otherwise prevent keys default behavior
if(isNotFnKey){ // otherwise prevent keys default behavior
key.returnValue = false;
}
},
Expand Down