jQuery javascript app factory