Refactoring about bob javascript.