Re-factor admin.js