From ef7b821d2a5143db9c0660cffc1189cf6e63dc29 Mon Sep 17 00:00:00 2001 From: Amine El Baghdadi <75886237+NoobJsPerson@users.noreply.github.com> Date: Sat, 15 May 2021 18:12:56 +0000 Subject: update main.js --- main.js | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/main.js b/main.js index 2861b0b..789c316 100644 --- a/main.js +++ b/main.js @@ -1,3 +1,5 @@ +/* Import the interpolate function*/ +import interpolate from "interpolate.js"; /* Compute the total duration of the run. */ function compute() { @@ -51,30 +53,24 @@ function generate_mod_message( const one_prec_millis = milliseconds.toFixed(1).replace("0.", ""); const two_prec_millis = milliseconds.toFixed(2).replace("0.", ""); const three_prec_millis = milliseconds.toFixed(3).replace("0.", ""); - - mod_message = mod_message.replaceAll("${FPS}", fps) - .replaceAll("${H}", hours) - .replaceAll("${M}", minutes) - .replaceAll("${S}", seconds) - .replaceAll("${MS}", milliseconds) - - .replaceAll("${PM}", padded_minutes) - .replaceAll("${PS}", padded_seconds) - - .replaceAll("${1MS}", one_prec_millis) - .replaceAll("${2MS}", two_prec_millis) - .replaceAll("${3MS}", three_prec_millis) - - .replaceAll("${TS}", total_seconds) - - .replaceAll("${ST}", start_time) - .replaceAll("${ET}", end_time) - .replaceAll("${TT}", total_time) - - .replaceAll("${SF}", start_frame) - .replaceAll("${EF}", end_frame) - .replaceAll("${TF}", total_frames) - + const params = { + H: hours, + M: minutes, + S: seconds, + MS: milliseconds, + PM: padded_minutes, + PS: padded_seconds, + "1MS": one_prec_millis, + "2MS": two_prec_millis, + "3MS": three_prec_millis, + ST: start_time, + ET: end_time, + TT: total_time, + SF: start_frame, + EF: end_frame, + TF: total_frames + }; + mod_message = interpolate (mod_message,params); return mod_message; } -- cgit v1.2.3