making code that was in platform-specific custom.js more reusable