The main part of the injected code is https://gist.github.com/benfoxall/5647039 - there's a bit of hacking round cors issues there too.