Skip to content

Commit 1992d12

Browse files
committed
Remove unused code
1 parent 8a13867 commit 1992d12

2 files changed

Lines changed: 1 addition & 34 deletions

File tree

internal/frontend/index.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ const set_lobbies = (lobbies, visible) => {
184184
const join_button = document.createElement("button");
185185
join_button.className = "join-button";
186186
join_button.innerText = '{{.Translation.Get "join"}}';
187-
join_button.addEventListener("click", (event) => {
187+
join_button.addEventListener("click", () => {
188188
window.location.href = `{{.RootPath}}/lobby/${lobby.lobbyId}`;
189189
});
190190

@@ -231,15 +231,6 @@ document
231231
.getElementById("refresh-lobby-list-button")
232232
.addEventListener("click", refresh_lobby_list);
233233

234-
function getCookie(name) {
235-
let cookie = {};
236-
document.cookie.split(";").forEach(function (el) {
237-
let split = el.split("=");
238-
cookie[split[0].trim()] = split.slice(1).join("=");
239-
});
240-
return cookie[name];
241-
}
242-
243234
// Makes sure, that navigating back after creating a lobby also shows it in the list.
244235
window.addEventListener("pageshow", (event) => {
245236
if (event.persisted) {

internal/frontend/lobby.js

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ window.onbeforeunload = () => {
4242
const messageInput = document.getElementById("message-input");
4343
const playerContainer = document.getElementById("player-container");
4444
const wordContainer = document.getElementById("word-container");
45-
const chat = document.getElementById("chat");
4645
const messageContainer = document.getElementById("message-container");
4746
const roundSpan = document.getElementById("rounds");
4847
const maxRoundSpan = document.getElementById("max-rounds");
@@ -399,8 +398,6 @@ function updateTogglePenIcon() {
399398
//that the actual canvas has to be resized accordingly too. This is needed
400399
//since not every client has the same screensize.
401400
const baseWidth = 1600;
402-
const baseHeight = 900;
403-
const boardRatio = baseWidth / baseHeight;
404401

405402
// Moving this here to extract the context after resizing
406403
const context = drawingBoard.getContext("2d", { alpha: false });
@@ -923,7 +920,6 @@ let round = 0;
923920
let rounds = 0;
924921
let roundEndTime = 0;
925922
let gameState = "unstarted";
926-
let drawingTimeSetting = "∞";
927923

928924
const handleEvent = (parsed) => {
929925
if (parsed.type === "ready") {
@@ -1267,7 +1263,6 @@ const handleReadyEvent = (ready) => {
12671263
round = ready.round;
12681264
rounds = ready.rounds;
12691265
gameState = ready.gameState;
1270-
drawingTimeSetting = ready.drawingTimeSetting;
12711266
updateRoundsDisplay();
12721267
updateButtonVisibilities();
12731268

@@ -1966,16 +1961,6 @@ function onKeyDown(event) {
19661961
//must've clicked it at least once in order for that to work.
19671962
window.addEventListener("keydown", onKeyDown);
19681963

1969-
function debounce(func, timeout) {
1970-
let timer;
1971-
return (...args) => {
1972-
clearTimeout(timer);
1973-
timer = setTimeout(() => {
1974-
func.apply(this, args);
1975-
}, timeout);
1976-
};
1977-
}
1978-
19791964
function clear(context) {
19801965
context.fillStyle = "#FFFFFF";
19811966
context.fillRect(0, 0, drawingBoard.width, drawingBoard.height);
@@ -2058,15 +2043,6 @@ function drawLineAndSendEvent(
20582043
socket.send(JSON.stringify(drawInstruction));
20592044
}
20602045

2061-
function getCookie(name) {
2062-
let cookie = {};
2063-
document.cookie.split(";").forEach(function (el) {
2064-
let split = el.split("=");
2065-
cookie[split[0].trim()] = split.slice(1).join("=");
2066-
});
2067-
return cookie[name];
2068-
}
2069-
20702046
function isString(obj) {
20712047
return typeof obj === "string";
20722048
}

0 commit comments

Comments
 (0)