Skip to content

Commit

Permalink
Update better-xcloud.user.js
Browse files Browse the repository at this point in the history
  • Loading branch information
redphx committed Jul 14, 2024
1 parent 29dfdaf commit df71313
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dist/better-xcloud.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -7328,17 +7328,19 @@ class GameTile {
seconds %= 3600;
let m = Math.floor(seconds / 60), s = seconds % 60;
const output = [];
return h > 0 && output.push(`${h}h`), m > 0 && output.push(`${m}m`), output.push(`${s}s`), output.join(" ");
if (h > 0 && output.push(`${h}h`), m > 0 && output.push(`${m}m`), s > 0 || output.length === 0)
output.push(`${s}s`);
return output.join(" ");
}
static async#showWaitTime($elm, productId) {
let totalWaitTime;
const api = XcloudApi.getInstance(), info = await api.getTitleInfo(productId);
if (info) {
const waitTime = await api.getWaitTime(info.titleId);
if (waitTime)
totalWaitTime = waitTime.estimatedTotalWaitTimeInSeconds || 0;
totalWaitTime = (waitTime.estimatedAllocationTimeInSeconds || 0) + Math.floor(Math.random() * 60);
}
if (totalWaitTime && totalWaitTime == 10 && $elm.isConnected) {
if (typeof totalWaitTime === "number" && $elm.isConnected) {
const $div = CE("div", { class: "bx-game-tile-wait-time" }, createSvgIcon(BxIcon.PLAYTIME), CE("span", {}, GameTile.#secondsToHms(totalWaitTime)));
$elm.insertAdjacentElement("afterbegin", $div);
}
Expand Down

0 comments on commit df71313

Please sign in to comment.