Added size limit
This commit is contained in:
parent
5088627dbb
commit
6ba43747d4
|
|
@ -58,13 +58,13 @@ window.setInterval(function() {
|
||||||
|
|
||||||
function join(channel) {
|
function join(channel) {
|
||||||
|
|
||||||
//if (document.domain == 'uchats.herokuapp.com') {
|
if (document.domain == 'uchats.herokuapp.com') {
|
||||||
ws = new WebSocket('wss://uchats.herokuapp.com/uchatsserver')
|
ws = new WebSocket('wss://uchats.herokuapp.com/uchatsserver')
|
||||||
/*}
|
}
|
||||||
else {
|
else {
|
||||||
// for local installs
|
// for local installs
|
||||||
ws = new WebSocket('ws://' + location.hostname+":"+location.port + '/uchatsserver')
|
ws = new WebSocket('ws://' + location.hostname+":"+location.port + '/uchatsserver')
|
||||||
}*/
|
}
|
||||||
|
|
||||||
var wasConnected = false
|
var wasConnected = false
|
||||||
|
|
||||||
|
|
@ -301,27 +301,16 @@ $('#uploadimage').onchange = function() {
|
||||||
reader = new FileReader();
|
reader = new FileReader();
|
||||||
|
|
||||||
reader.addEventListener("load", function () {
|
reader.addEventListener("load", function () {
|
||||||
|
if(file.size > 49000)
|
||||||
|
{
|
||||||
|
pushMessage({nick:'!', text:'Image must be smaller than 49000 bytes'});
|
||||||
|
return ;
|
||||||
|
}
|
||||||
|
|
||||||
args = {};
|
args = {};
|
||||||
args.cmd = "chat";
|
args.cmd = "chat";
|
||||||
args.text = '<img src="'+reader.result+'">';
|
args.text = '<img src="'+reader.result+'">';
|
||||||
send(args);
|
args.nick = "me";
|
||||||
}, false);
|
|
||||||
|
|
||||||
if (file) {
|
|
||||||
reader.readAsDataURL(file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#uploadvideo').onchange = function() {
|
|
||||||
file = this.files[0];
|
|
||||||
reader = new FileReader();
|
|
||||||
|
|
||||||
reader.addEventListener("load", function () {
|
|
||||||
args = {};
|
|
||||||
args.cmd = "chat";
|
|
||||||
args.text = '<video width="320" height="240" controls>'+
|
|
||||||
'<source src="'+reader.result+'">'+
|
|
||||||
'</video>';
|
|
||||||
send(args);
|
send(args);
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
|
|
@ -335,6 +324,12 @@ $('#uploadfile').onchange = function() {
|
||||||
reader = new FileReader();
|
reader = new FileReader();
|
||||||
|
|
||||||
reader.addEventListener("load", function () {
|
reader.addEventListener("load", function () {
|
||||||
|
if(file.size > 49000)
|
||||||
|
{
|
||||||
|
pushMessage({nick:'!', text:'File must be smaller than 49000 bytes'});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
args = {};
|
args = {};
|
||||||
args.cmd = "chat";
|
args.cmd = "chat";
|
||||||
args.text = '<a target="_blank" href="'+reader.result+'">File: '+file.name+'</a>';
|
args.text = '<a target="_blank" href="'+reader.result+'">File: '+file.name+'</a>';
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 297 B |
|
|
@ -16,7 +16,6 @@
|
||||||
<footer id="footer">
|
<footer id="footer">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<span class="select-wrapper" style="background-image: url(images/image.png);"><input class="fotterbutton" type="file" id="uploadimage" value="Upload Image" accept="image/*"></span>
|
<span class="select-wrapper" style="background-image: url(images/image.png);"><input class="fotterbutton" type="file" id="uploadimage" value="Upload Image" accept="image/*"></span>
|
||||||
<span class="select-wrapper" style="background-image: url(images/video.png);"><input class="fotterbutton" type="file" id="uploadvideo" value="Upload Video" accept="video/*"></span>
|
|
||||||
<span class="select-wrapper" style="background-image: url(images/file.png);"><input class="fotterbutton" type="file" id="uploadfile" value="Upload File"></span>
|
<span class="select-wrapper" style="background-image: url(images/file.png);"><input class="fotterbutton" type="file" id="uploadfile" value="Upload File"></span>
|
||||||
<form id="chatform" class="messages"><textarea id="chatinput" type="text" autocomplete="off" autofocus></textarea></form>
|
<form id="chatform" class="messages"><textarea id="chatinput" type="text" autocomplete="off" autofocus></textarea></form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue