jquery refactoring