From: CMDR furrycat Date: Wed, 27 Jan 2016 10:58:11 +0000 (-0500) Subject: Strip suffix correctly for stats. X-Git-Url: http://git.furryclan.net/?a=commitdiff_plain;h=00befc85b88dadf797ecbf6e078bd9e72e7c129a;p=furrycat%2Frace-o-matic.git Strip suffix correctly for stats. --- diff --git a/entry.js b/entry.js index 95d642c..ae51f57 100644 --- a/entry.js +++ b/entry.js @@ -220,14 +220,16 @@ function speed(distance, time) { /* Format a distance. */ function format_distance(distance, suffix) { - if (suffix !== false) suffix = 'Ly'; + if (typeof suffix != 'undefined') suffix = ''; + else suffix = 'Ly'; return String(distance.toFixed(2)) + suffix; } /* Format a speed. */ function format_speed(speed, suffix) { - if (suffix !== false) suffix = '/h'; - return format_distance(speed) + suffix; + if (typeof suffix != 'undefined') suffix = ''; + else suffix = '/h'; + return format_distance(speed, suffix); } /* Find the joker checkbox. */