[eluser]polyvoid[/eluser]
I couldn't resist fiddling with it a bit more.
As far as I can tell the "javascript" part works.
I've tested it, and it works for me now. I did it with an additional if which checks if it's an url from another domain, or if it's coming from the filesystem, and use the according "get" function then.
I did not change the "styles" part (yet), as usually these are coming from the filesystem.
Perhaps, for the sake of consistency, you could make the changes as well.
The changed file is attached to this post so you can find out if it's alright.
The changes are marked as comments with "start change" and "end change"