Modularize party status javascript