Simplify javascript

Since we are not needing the old version simplify the code by just
defining the function we want to overwrite.