mirror of
https://github.com/darkwire/darkwire.io.git
synced 2025-07-30 14:25:46 +00:00
Added roomID to top nav, fix tests
This commit is contained in:
parent
77adbce1a1
commit
5d66217e8e
@ -37,7 +37,7 @@ function generateNewRoom(req, res, id) {
|
||||
return res.redirect(`/${id}`);
|
||||
}
|
||||
|
||||
app.get('/', (req, res) => generateNewRoom(req, res, 'lobby') );
|
||||
app.get('/', (req, res) => generateNewRoom(req, res, 'lobby'));
|
||||
|
||||
app.get('/:roomId', (req, res) => {
|
||||
const stripName = (name) => {
|
||||
|
@ -20,12 +20,12 @@ export default class App {
|
||||
const chatName = name.replace('/','').toLowerCase().replace(/[^A-Za-z0-9]/g, '-');
|
||||
if (chatName.length >= 25) {
|
||||
const limitedChatName = chatName.substr(0, 25);
|
||||
window.history.replaceState( {} , limitedChatName, `/${limitedChatName}` );
|
||||
window.history.replaceState({}, limitedChatName, `/${limitedChatName}`);
|
||||
return `/${limitedChatName}`;
|
||||
}
|
||||
|
||||
return '/' + chatName;
|
||||
};
|
||||
}
|
||||
|
||||
init() {
|
||||
this._chat = new Chat(this._darkwire, this._socket);
|
||||
@ -37,7 +37,7 @@ export default class App {
|
||||
$('input.share-text').click(() => {
|
||||
$(this).focus();
|
||||
$(this).select();
|
||||
this.setSelectionRange(0, 9999);
|
||||
$(this).setSelectionRange(0, 9999);
|
||||
});
|
||||
|
||||
const windowHandler = new WindowHandler(this._darkwire, this._socket, this._chat);
|
||||
@ -118,9 +118,9 @@ export default class App {
|
||||
|
||||
this._socket.on('disconnect', (data) => {
|
||||
this._darkwire.connected = false;
|
||||
this._chat.log('Disconnected from server, automatically reloading chatroom in 10 seconds.', {
|
||||
this._chat.log('Disconnected from server, automatically reconnecting in 4 seconds.', {
|
||||
error: true,
|
||||
});
|
||||
});
|
||||
this.retryConnection();
|
||||
});
|
||||
|
||||
@ -259,6 +259,7 @@ export default class App {
|
||||
}
|
||||
|
||||
this._chat.log(moment().format('MMMM Do YYYY, h:mm:ss a'), {info: true});
|
||||
$('#roomName').text(this._roomId);
|
||||
this._darkwire.updateUsername(username).then((socketData) => {
|
||||
this._chat.chatPage.show();
|
||||
this._chat.inputMessage.focus();
|
||||
@ -269,7 +270,7 @@ export default class App {
|
||||
addParticipantsMessage(data) {
|
||||
let message = '';
|
||||
let headerMsg = '';
|
||||
const { numUsers } = data;
|
||||
const {numUsers} = data;
|
||||
|
||||
if (numUsers === 0) {
|
||||
window.location.reload();
|
||||
@ -296,7 +297,7 @@ export default class App {
|
||||
retryConnection() {
|
||||
window.setTimeout(() => {
|
||||
window.location.reload();
|
||||
}, 10000);
|
||||
}, 4000);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -364,3 +364,15 @@ html.no-touchevents .chat #input-icons {
|
||||
color: #FFF;
|
||||
background-color: red;
|
||||
}
|
||||
|
||||
.room-name-top {
|
||||
float: left;
|
||||
text-align: center;
|
||||
padding: 16px;
|
||||
}
|
||||
|
||||
.room-name-top p {
|
||||
margin: 0;
|
||||
color: palegoldenrod;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
@ -28,6 +28,9 @@
|
||||
<a class="navbar-brand" href="javascript:void(0)">
|
||||
<img src="/logo.png">
|
||||
</a>
|
||||
<span class="room-name-top">
|
||||
<p id="roomName" class="room-name"></p>
|
||||
</span>
|
||||
<span class="participants">
|
||||
<span class="glyphicon glyphicon-user"></span> <span id="participants"></span>
|
||||
</span>
|
||||
|
Loading…
x
Reference in New Issue
Block a user