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:
parent
c78639f43c
commit
3552b73679
|
@ -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 });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user