Skip to content

Commit

Permalink
clean up commit
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffrey-wu committed Oct 21, 2024
1 parent 476805e commit a808498
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
21 changes: 10 additions & 11 deletions client/multiplayer/room.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* globals WebSocket */

import account from '../scripts/accounts.js';
import questionStats from '../scripts/auth/question-stats.js';
import api from '../scripts/api/index.js';
Expand All @@ -26,7 +24,7 @@ let tossup = {};
let USER_ID = window.localStorage.getItem('USER_ID') || 'unknown';
let username = window.localStorage.getItem('multiplayer-username') || api.getRandomName();

const socket = new WebSocket(
const socket = new window.WebSocket(
window.location.href.replace('http', 'ws') +
(window.location.href.endsWith('?private=true') ? '&' : '?') +
new URLSearchParams({
Expand Down Expand Up @@ -831,14 +829,6 @@ document.getElementById('pause').addEventListener('click', function () {
socket.send(JSON.stringify({ type: 'pause', pausedTime }));
});

document.getElementById('strictness').addEventListener('change', function () {
socket.send(JSON.stringify({ type: 'set-strictness', strictness: this.value }));
});

document.getElementById('strictness').addEventListener('input', function () {
document.getElementById('strictness-display').textContent = this.value;
});

document.getElementById('reading-speed').addEventListener('change', function () {
socket.send(JSON.stringify({ type: 'set-reading-speed', readingSpeed: this.value }));
});
Expand Down Expand Up @@ -875,6 +865,15 @@ document.getElementById('set-name').addEventListener('change', async function ()
}));
});

document.getElementById('strictness').addEventListener('change', function () {
this.blur();
socket.send(JSON.stringify({ type: 'set-strictness', strictness: this.value }));
});

document.getElementById('strictness').addEventListener('input', function () {
document.getElementById('strictness-display').textContent = this.value;
});

document.getElementById('toggle-lock').addEventListener('click', function () {
this.blur();
socket.send(JSON.stringify({ type: 'toggle-lock', lock: this.checked }));
Expand Down
Loading

0 comments on commit a808498

Please sign in to comment.