Welcome to our community, Andrew
From what you have described, it would seem that you have
managed to overwrite your project source files with modified
WebHelp output files.
The process of generating WebHelp injects JavaScript into
each topic to support the WebHelp functionality. If you repeatedly
take that output and re-use it as source, you keep getting more and
more instances of JavaScript added and things go downhill in a
hurry.
Step one is to figure out how it's happening and stop it.
Usually the publishing process is a likely candidate. I'd begin
looking there. If you are manually copying the files, you need to
stop and seriously re-think things.
Cheers... Rick