You would need to modify the javascript. The existing code does not capture distance between waypoints on your route.
You can do something similar using the Navigate component
HOW TO: Use the Navigate control
where you can calculate total route distance by adapting the code. You could alternatively use the Google Distance Matrix api .