Skip to content

Commit

Permalink
Reduce indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Quitch committed May 13, 2024
1 parent 816f8a0 commit 418ce4f
Showing 1 changed file with 30 additions and 28 deletions.
58 changes: 30 additions & 28 deletions ui/mods/com.pa.quitch.copy-replay-id/replay_browser/lobby_id.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
var copyReplayIDButtonLoaded;

if (!copyReplayIDButtonLoaded) {
function copyReplayIDButton() {
if (copyReplayIDButtonLoaded) {
return;
}

copyReplayIDButtonLoaded = true;

function copyReplayIDButton() {
try {
model.gameId = ko.observable("");
try {
model.gameId = ko.observable("");

$(".section_controls").append(
loadHtml(
"coui://ui/mods/com.pa.quitch.copy-replay-id/replay_browser/lobby_id.html"
)
);
$(".section_controls").append(
loadHtml(
"coui://ui/mods/com.pa.quitch.copy-replay-id/replay_browser/lobby_id.html"
)
);

var formattedId = function () {
var selectedGame = model.currentSelectedGame();
var replayId = selectedGame.host_id;
var requiredContent = selectedGame.required_content
? selectedGame.required_content + ":"
: "";
return requiredContent + replayId;
};
var formattedId = function () {
var selectedGame = model.currentSelectedGame();
var replayId = selectedGame.host_id;
var requiredContent = selectedGame.required_content
? selectedGame.required_content + ":"
: "";
return requiredContent + replayId;
};

model.currentSelectedGame.subscribe(function () {
if (!model.canViewReplay() || !model.currentSelectedGame()) {
return;
}
model.currentSelectedGame.subscribe(function () {
if (!model.canViewReplay() || !model.currentSelectedGame()) {
return;
}

model.gameId(formattedId());
});
} catch (e) {
console.error(e);
console.error(JSON.stringify(e));
}
model.gameId(formattedId());
});
} catch (e) {
console.error(e);
console.error(JSON.stringify(e));
}
copyReplayIDButton();
}
copyReplayIDButton();

0 comments on commit 418ce4f

Please sign in to comment.