Could you explain why you prefer using external files. I’ve made a similar suggestion here, which builds on the way you can already specify a custom CSS file via a URL, so it can be either a local file, or an item link. We just need a second options like that for a JavaScript file, and we should be all set.
I prefer “my” suggestion because it is more general, and potentially extends trivially to DTTG as well.