rewrite using pure javascript
Merge pull request #1 from hij1nx/master

rewrite using pure javascript