Skip to content

Commit

Permalink
Show days in popup status, if not zero.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sashank999 committed Jun 15, 2024
1 parent ba87b25 commit 8a830a5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 5 additions & 1 deletion extension/changelog.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
"date": false,
"logs": {
"features": [{ "message": "Added bounty filter in Abroad People Filter.", "contributor": "TheFoxMan" }],
"fixes": [{ "message": "Fixed Trade Open Chat.", "contributor": "TheFoxMan" }],
"fixes": [
{ "message": "Fixed Trade Open Chat.", "contributor": "TheFoxMan" },
{ "message": "Fixed no notifications.", "contributor": "TheFoxMan" },
{ "message": "Show days(if present) in popup for Jail and Hospital status.", "contributor": "TheFoxMan" }
],
"changes": [],
"removed": []
}
Expand Down
4 changes: 2 additions & 2 deletions extension/pages/popup/popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,9 +430,9 @@ async function setupDashboard() {
if (!status.dataset.until) return;

if (status.classList.contains("jail")) {
status.textContent = `Jailed for ${formatTime({ milliseconds: status.dataset.until - current }, { type: "timer" })}`;
status.textContent = `Jailed for ${formatTime({ milliseconds: status.dataset.until - current }, { type: "timer", showDays: true, short: true })}`;
} else if (status.classList.contains("hospital")) {
status.textContent = `Hospitalized for ${formatTime({ milliseconds: status.dataset.until - current }, { type: "timer" })}`;
status.textContent = `Hospitalized for ${formatTime({ milliseconds: status.dataset.until - current }, { type: "timer", showDays: true, short: true })}`;
}
}

Expand Down
5 changes: 4 additions & 1 deletion extension/scripts/global/functions/formatting.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,10 @@ function formatTime(time = {}, options = {}) {
parts.push(date.getUTCMinutes());
if (!options.hideSeconds) parts.push(date.getUTCSeconds());

return parts.map((p) => toMultipleDigits(p, 2)).join(":");
let timerText = parts.map((p) => toMultipleDigits(p, 2)).join(":");
if (options.short && options.showDays && timerText.startsWith("00:")) timerText = timerText.slice(3);

return timerText;
case "wordTimer":
date = new Date(millis);

Expand Down

0 comments on commit 8a830a5

Please sign in to comment.