Restructuring drupal_add_js() invocations for testing