From 95f19fbfd73923e6a396579904ee529bd2f0df1b Mon Sep 17 00:00:00 2001 From: Daniel van Noord Date: Thu, 3 Dec 2020 15:28:38 +0100 Subject: [PATCH] Fixded CM.Disp.GetTimeColor --- CookieMonster.js | 16 ++++++++++++---- src/Disp.js | 16 ++++++++++++---- 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/CookieMonster.js b/CookieMonster.js index 92dc614..55c23a6 100644 --- a/CookieMonster.js +++ b/CookieMonster.js @@ -1188,10 +1188,18 @@ CM.Disp.FormatTime = function(time, longFormat) { */ CM.Disp.GetTimeColor = function(time) { var color; - var text = CM.Disp.FormatTime(time); - if (time > 300) color = CM.Disp.colorRed; - else if (time > 60) color = CM.Disp.colorOrange; - else color = CM.Disp.colorYellow; + var text; + if (time < 0) { + if (CM.Config.TimeFormat) text = '00:00:00:00:00'; + else text = 'Done!'; + color = CM.Disp.colorGreen; + } + else { + text = CM.Disp.FormatTime(time); + if (time > 300) color = CM.Disp.colorRed; + else if (time > 60) color = CM.Disp.colorOrange; + else color = CM.Disp.colorYellow; + } return {text: text, color: color}; } diff --git a/src/Disp.js b/src/Disp.js index 280417d..67fae59 100644 --- a/src/Disp.js +++ b/src/Disp.js @@ -313,10 +313,18 @@ CM.Disp.FormatTime = function(time, longFormat) { */ CM.Disp.GetTimeColor = function(time) { var color; - var text = CM.Disp.FormatTime(time); - if (time > 300) color = CM.Disp.colorRed; - else if (time > 60) color = CM.Disp.colorOrange; - else color = CM.Disp.colorYellow; + var text; + if (time < 0) { + if (CM.Config.TimeFormat) text = '00:00:00:00:00'; + else text = 'Done!'; + color = CM.Disp.colorGreen; + } + else { + text = CM.Disp.FormatTime(time); + if (time > 300) color = CM.Disp.colorRed; + else if (time > 60) color = CM.Disp.colorOrange; + else color = CM.Disp.colorYellow; + } return {text: text, color: color}; }