javascript: Add main script for direct source code usage