Merge pull request #8 from webxoss/rename

Rename room
This commit is contained in:
webxoss 2017-05-23 00:16:42 +08:00 committed by GitHub
commit 51a710f84c
4 changed files with 27 additions and 5 deletions

View file

@ -608,7 +608,10 @@ function updateRoom (msgObj) {
audio.playSoundEffect('JoinRoom');
}
$('room-name').textContent = msgObj.roomName;
$('room-name').value = msgObj.roomName;
if (!isHost()) {
$('room-name').readOnly = true;
}
$('room-host-nickname').textContent = msgObj.host;
$('room-guest-nickname').textContent = msgObj.guest;
setClass($('room-guest-nickname'),'ready',msgObj.guestReady);
@ -856,6 +859,17 @@ $('link-edit-deck').onclick = function (event) {
return false;
};
$('room-name-form').onsubmit = function (event) {
var roomName = $('room-name').value;
if (roomName) {
socket.emit('renameRoom', {
'roomName': roomName
});
}
event.preventDefault();
return false;
}
/* 直播 */
var stopFetchingLive = 0;
var watchingLive = false;

View file

@ -415,6 +415,10 @@ ol,ul,li {
color: #f2442b;
font-size: 150%;
font-weight: bold;
text-align: center;
background: transparent;
border: none;
widows: 15em;
}
#room-host-nickname {
color: #77d25b;

View file

@ -86,7 +86,11 @@
<table id="table-room">
<tbody>
<tr>
<td colspan="100"><span id="room-name"></span></td>
<td colspan="100">
<form id="room-name-form">
<input id="room-name" type="text" maxlength="15"></input>
</form>
</td>
</tr>
<tr>
<td><span id="room-host-nickname" class="nickname"></span></td>

File diff suppressed because one or more lines are too long