Preload image before using it in the spinner; use external js file instead of inline script
GCP-9481
Reviewer: Jaira