added requestAnimationFrame detection
added keycode compatibility