TNEW javascript loader, anyone?

Hi folks! I'm cross-posting this between the TNEW and Web forums because I think it's heavy on the custom programming side of things.

I am curious to know if anyone out there using TNEW in a highly customized manner has built any tools to enable themselves to more easily inject JavaScript snippets onto specified TNEW pages. My goal is to get this code out of system tables and content types, and into source control.

What I envision is a script file included in the TNEW template that contains blocks of code to be run on certain TNEW pages, as well as some kind of "loader" tool that identifies the TNEW page we are on and then runs the appropriate blocks on it. Part of the strucure of each block would be some kind of TNEW page selector that tells the loader which single or multiple pages it should be run on.

It occurs to me that this kind of tool might be very broadly useful to lots of different organizations, so I wanted to see if anyone has something they'd be willing to share (or would want to collaborate!) before starting on my own.