Stats: Clean up sparkline js.

Indent better, add comments and follow `var` declaration conventions. Use jQuery event setters rather than `addEventListener`, since jQuery is available.