JavaScript funciona apenas em Codepen

if(document.readyState == "complete" || document.addEventListener){

 //Place all of your code here

}
Blyxyas