Capture d3, as well.

This allows multiple instances of D3 to be loaded, or the d3 variable to be
renamed without breaking code. Fixes #1058.