mirror of
https://github.com/onionshare/onionshare.git
synced 2025-02-03 10:00:10 -05:00
Remove new message and change username buttons (user just presses enter instead) and update a bunch of css
This commit is contained in:
parent
9482461a00
commit
dc15883080
@ -169,6 +169,7 @@ ul.breadcrumbs li a:link, ul.breadcrumbs li a:visited {
|
|||||||
|
|
||||||
.chat-container {
|
.chat-container {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
font-family: monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-users {
|
.chat-users {
|
||||||
@ -177,6 +178,7 @@ ul.breadcrumbs li a:link, ul.breadcrumbs li a:visited {
|
|||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
background: #f2f2f2;
|
background: #f2f2f2;
|
||||||
|
margin: 1rem 0 1rem 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-users .editable-username {
|
.chat-users .editable-username {
|
||||||
@ -185,6 +187,11 @@ ul.breadcrumbs li a:link, ul.breadcrumbs li a:visited {
|
|||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chat-users .editable-username input {
|
||||||
|
font-family: monospace;
|
||||||
|
font-size: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
.chat-users #user-list li {
|
.chat-users #user-list li {
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
@ -193,8 +200,8 @@ ul.breadcrumbs li a:link, ul.breadcrumbs li a:visited {
|
|||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
margin: 0 1rem;
|
margin: 1rem 1rem 0 1rem;
|
||||||
height: calc(100vh - (45px + 2em));
|
height: calc(100vh - (65px + 2em));
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-wrapper #chat {
|
.chat-wrapper #chat {
|
||||||
@ -206,6 +213,12 @@ ul.breadcrumbs li a:link, ul.breadcrumbs li a:visited {
|
|||||||
padding: 0 1rem;
|
padding: 0 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.chat-wrapper .status {
|
||||||
|
font-style: italic;
|
||||||
|
font-size: 0.8em;
|
||||||
|
color: #666666;
|
||||||
|
}
|
||||||
|
|
||||||
.chat-wrapper .username {
|
.chat-wrapper .username {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
display: block;
|
display: block;
|
||||||
@ -217,11 +230,16 @@ ul.breadcrumbs li a:link, ul.breadcrumbs li a:visited {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.chat-wrapper .chat-form {
|
.chat-wrapper .chat-form {
|
||||||
display: flex;
|
display: block;
|
||||||
|
margin: 0.2rem 1rem 1rem 0;
|
||||||
|
padding: -0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-wrapper input#new-message {
|
.chat-wrapper input#new-message {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
width: 100%;
|
||||||
|
font-family: monospace;
|
||||||
|
font-size: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (max-width: 992px) {
|
@media (max-width: 992px) {
|
||||||
|
@ -41,27 +41,16 @@ $(function () {
|
|||||||
emitMessage(socket);
|
emitMessage(socket);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$('#send-button').on('click', function (e) {
|
|
||||||
emitMessage(socket);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Keep buttons disabled unless changed or not empty
|
// Keep buttons disabled unless changed or not empty
|
||||||
$('#username').on('keyup', function (event) {
|
$('#username').on('keyup', function (event) {
|
||||||
if ($('#username').val() !== '' && $('#username').val() !== current_username) {
|
if ($('#username').val() !== '' && $('#username').val() !== current_username) {
|
||||||
$('#update-username').removeAttr('disabled');
|
|
||||||
if (event.keyCode == 13) {
|
if (event.keyCode == 13) {
|
||||||
current_username = updateUsername(socket);
|
current_username = updateUsername(socket);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$('#update-username').attr('disabled', true);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update username
|
|
||||||
$('#update-username').on('click', function () {
|
|
||||||
current_username = updateUsername(socket);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Show warning of losing data
|
// Show warning of losing data
|
||||||
$(window).on('beforeunload', function (e) {
|
$(window).on('beforeunload', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
@ -103,7 +92,6 @@ var updateUsername = function (socket) {
|
|||||||
}).done(function (response) {
|
}).done(function (response) {
|
||||||
console.log(response);
|
console.log(response);
|
||||||
});
|
});
|
||||||
$('#update-username').attr('disabled', true);
|
|
||||||
return username;
|
return username;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +126,7 @@ var scrollBottomMaybe = function (scrollDiff) {
|
|||||||
|
|
||||||
var addStatusMessage = function (message) {
|
var addStatusMessage = function (message) {
|
||||||
$('#chat').append(
|
$('#chat').append(
|
||||||
`<p><small><i>${sanitizeHTML(message)}</i></small></p>`
|
`<p class="status">${sanitizeHTML(message)}</p>`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,19 +24,15 @@
|
|||||||
<div class="chat-users">
|
<div class="chat-users">
|
||||||
<div class="editable-username">
|
<div class="editable-username">
|
||||||
<input id="username" value="{{ username }}" />
|
<input id="username" value="{{ username }}" />
|
||||||
<button id="update-username" disabled>Set Name</button>
|
|
||||||
</div>
|
</div>
|
||||||
<ul id="user-list">
|
<ul id="user-list">
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="chat-wrapper">
|
<div class="chat-wrapper">
|
||||||
<p class="chat-header">Chat Messages</p>
|
|
||||||
|
|
||||||
<div id="chat"></div>
|
<div id="chat"></div>
|
||||||
|
|
||||||
<div class="chat-form">
|
<div class="chat-form">
|
||||||
<p><input type="text" id="new-message" name="new-message" placeholder="Type your message" /></p>
|
<input type="text" id="new-message" name="new-message" placeholder="Type your message" />
|
||||||
<p><button type="button" id="send-button" class="button">Send Message</button></p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user