mirror of
https://github.com/darkwire/darkwire.io.git
synced 2025-07-19 11:02:58 +00:00
Merge branch 'develop' into feature/cmdk
* develop: Version Up Back to jquery Better checking of username colors, throw error on blank slash commands Fix for safari/ios not being able to access filereader
This commit is contained in:
commit
7fa4517e01
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "darkwire",
|
||||
"version": "1.2.3",
|
||||
"version": "1.5.0",
|
||||
"description": "Encrypted web socket chat",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
|
@ -34,7 +34,10 @@ export default class Chat {
|
||||
let usernameContainer = $('<span/>')
|
||||
.text(matchedUsernames[i])
|
||||
.css('color', this.getUsernameColor(matchedUsernames[i]));
|
||||
message = message.replace(matchedUsernames[i], usernameContainer.prop('outerHTML'));
|
||||
|
||||
// Match only the username
|
||||
let matchedUsernameOnly = new RegExp('(' + matchedUsernames[i] + ')(?![^<]*>|[^<>]*<\/)', 'gm');
|
||||
message = message.replace(matchedUsernameOnly, usernameContainer.prop('outerHTML'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -56,7 +59,7 @@ export default class Chat {
|
||||
checkIfUsername(words) {
|
||||
let matchedUsernames = [];
|
||||
this.darkwire.users.forEach((user) => {
|
||||
let usernameMatch = new RegExp('^' + user.username + '$', 'g');
|
||||
let usernameMatch = new RegExp('^' + user.username + '$');
|
||||
for (let i = 0; i < words.length; i++) {
|
||||
let exactMatch = words[i].match(usernameMatch) || false;
|
||||
let usernameInMemory = this.usernamesInMemory.indexOf(words[i]) > -1;
|
||||
@ -255,7 +258,7 @@ export default class Chat {
|
||||
if (commandToTrigger) {
|
||||
expectedParams = commandToTrigger.paramaters.length;
|
||||
if (expectedParams && trigger.params.length > expectedParams || expectedParams && trigger.params.length < expectedParams) {
|
||||
if (!commandToTrigger.multple && trigger.params.length < 1) {
|
||||
if ((!commandToTrigger.multple && trigger.params.length < 1) || (trigger.params.length >= 1 && trigger.params[0] === '')) {
|
||||
return this.log('Missing or too many paramater. Usage: ' + commandToTrigger.usage, {error: true});
|
||||
}
|
||||
}
|
||||
|
@ -128,9 +128,6 @@ export default class FileHandler {
|
||||
listen() {
|
||||
// browser API
|
||||
document.getElementById('fileInput').addEventListener('change', this.confirmTransfer.bind(this), false);
|
||||
|
||||
// darkwire
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ $(function() {
|
||||
|
||||
socket.on('user update', (data) => {
|
||||
darkwire.updateUser(data).then((oldUsername) => {
|
||||
chat.log(oldUsername + ' changed name to ' + data.username);
|
||||
chat.log(oldUsername + ' <span>changed name to</span> ' + data.username);
|
||||
renderParticipantsList();
|
||||
});
|
||||
});
|
||||
|
@ -51,6 +51,7 @@ export default class WindowHandler {
|
||||
window.onblur = () => {
|
||||
this._isActive = false;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -47,6 +47,10 @@ html, body {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: 'SourceCodePro-Regular';
|
||||
src: url('fonts/SourceCodePro-Regular.eot?#iefix') format('embedded-opentype'), url('fonts/SourceCodePro-Regular.woff') format('woff'), url('fonts/SourceCodePro-Regular.ttf') format('truetype'), url('fonts/SourceCodePro-Regular.svg#SourceCodePro-Regular') format('svg');
|
||||
@ -308,7 +312,16 @@ html.no-touchevents .chat #input-icons {
|
||||
}
|
||||
|
||||
#fileInput {
|
||||
display: none;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 45px;
|
||||
margin: 0;
|
||||
opacity: 0;
|
||||
-ms-filter: 'alpha(opacity=0)';
|
||||
font-size: 200px;
|
||||
direction: ltr;
|
||||
cursor: pointer;
|
||||
width: 45px;
|
||||
}
|
||||
|
||||
.file-disclaimer {
|
||||
|
Loading…
x
Reference in New Issue
Block a user