Update script.js

added document event listener to call js when ready