Move client-side JS into embeddable widget