extract the javascript out