make it compatible with firefox 26.0 v1.1.0

- fixed keypress issue under firefox 26.0
- clean code
- try better algorithm to read text from pre but looks it's too slow
- add test.html to test it