refactor widget create js