[BUGFIX] Only hide loading animation when the document is ready