mirror of
https://github.com/darkwire/darkwire.io.git
synced 2025-07-18 18:54:52 +00:00
CMD+K clears chat, or /clear, or CTRL+K
This commit is contained in:
parent
0d9b41bb3a
commit
6b7994442d
@ -17,6 +17,11 @@ export default class Chat {
|
||||
this.bindEvents();
|
||||
}
|
||||
|
||||
clear() {
|
||||
let chatArea = $('.messages');
|
||||
return chatArea.fadeOut(200, () => { chatArea.empty().show(); });
|
||||
}
|
||||
|
||||
// Log a message
|
||||
log(message, options) {
|
||||
let html = options && options.html === true || false;
|
||||
@ -226,6 +231,15 @@ export default class Chat {
|
||||
console.log(err);
|
||||
});
|
||||
}
|
||||
}, {
|
||||
command: 'clear',
|
||||
description: 'Clears the chat screen',
|
||||
paramaters: [],
|
||||
multiple: true,
|
||||
usage: '/clear',
|
||||
action: () => {
|
||||
this.clear();
|
||||
}
|
||||
}];
|
||||
|
||||
const color = () => {
|
||||
|
@ -15,6 +15,7 @@ $(function() {
|
||||
|
||||
let $window = $(window);
|
||||
let $participants = $('#participants');
|
||||
let keyMapping = [];
|
||||
|
||||
let roomId = window.location.pathname.length ? window.location.pathname : null;
|
||||
|
||||
@ -68,16 +69,22 @@ $(function() {
|
||||
}
|
||||
|
||||
// Keyboard events
|
||||
|
||||
$window.keydown(function(event) {
|
||||
$window.keydown((event) => {
|
||||
// When the client hits ENTER on their keyboard and chat message input is focused
|
||||
if (event.which === 13 && !event.shiftKey && $('.inputMessage').is(':focus')) {
|
||||
handleMessageSending();
|
||||
socket.emit('stop typing');
|
||||
chat.typing = false;
|
||||
event.preventDefault();
|
||||
} else {
|
||||
keyMapping[event.keyCode] = event.type === 'keydown';
|
||||
}
|
||||
|
||||
}).keyup((event) => {
|
||||
if ((keyMapping[17] || keyMapping[91] || keyMapping[93]) && keyMapping[75]) {
|
||||
chat.clear();
|
||||
}
|
||||
keyMapping = [];
|
||||
});
|
||||
|
||||
// Select message input when closing modal
|
||||
|
Loading…
x
Reference in New Issue
Block a user