1
0
mirror of https://github.com/hack-chat/main.git synced 2024-03-22 13:20:33 +08:00

Update client.js

This commit is contained in:
MinusGix 2020-08-04 19:27:35 -04:00 committed by GitHub
parent c78639f43c
commit 3552b73679
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -316,6 +316,7 @@ function join(channel) {
var wasConnected = false; var wasConnected = false;
ws.onopen = function () { ws.onopen = function () {
var shouldConnect = true;
if (!wasConnected) { if (!wasConnected) {
if (location.hash) { if (location.hash) {
myNick = location.hash.substr(1); myNick = location.hash.substr(1);
@ -323,11 +324,14 @@ function join(channel) {
var newNick = prompt('Nickname:', myNick); var newNick = prompt('Nickname:', myNick);
if (newNick !== null) { if (newNick !== null) {
myNick = newNick; myNick = newNick;
} else {
// The user cancelled the prompt in some manner
shouldConnect = false;
} }
} }
} }
if (myNick) { if (myNick && shouldConnect) {
localStorageSet('my-nick', myNick); localStorageSet('my-nick', myNick);
send({ cmd: 'join', channel: channel, nick: myNick }); send({ cmd: 'join', channel: channel, nick: myNick });
} }