diff --git a/web/client.js b/web/client.js
index 4e3842e..064b9f3 100644
--- a/web/client.js
+++ b/web/client.js
@@ -58,13 +58,13 @@ window.setInterval(function() {
function join(channel) {
- if (document.domain == 'uchats.herokuapp.com') {
+ //if (document.domain == 'uchats.herokuapp.com') {
ws = new WebSocket('wss://uchats.herokuapp.com/uchatsserver')
- }
+ /*}
else {
// for local installs
ws = new WebSocket('ws://' + location.hostname+":"+location.port + '/uchatsserver')
- }
+ }*/
var wasConnected = false
@@ -190,10 +190,10 @@ function pushMessage(args) {
// Text
var textEl = document.createElement('pre')
textEl.classList.add('text')
-
- textEl.textContent = args.text || ''
+
+ textEl.innerHTML = args.text || ''
textEl.innerHTML = textEl.innerHTML.replace(/(\?|https?:\/\/)\S+?(?=[,.!?:)]?\s|$)/g, parseLinks)
-
+
if ($('#parse-latex').checked) {
// Temporary hotfix for \rule spamming, see https://github.com/Khan/KaTeX/issues/109
textEl.innerHTML = textEl.innerHTML.replace(/\\rule|\\\\\s*\[.*?\]/g, '')
@@ -221,7 +221,6 @@ function pushMessage(args) {
updateTitle()
}
-
function insertAtCursor(text) {
var input = $('#chatinput')
var start = input.selectionStart || 0
@@ -297,6 +296,56 @@ $('#footer').onclick = function() {
$('#chatinput').focus()
}
+$('#uploadimage').onchange = function() {
+ file = this.files[0];
+ reader = new FileReader();
+
+ reader.addEventListener("load", function () {
+ args = {};
+ args.cmd = "chat";
+ args.text = '
';
+ send(args);
+ }, 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 = '';
+ send(args);
+ }, false);
+
+ if (file) {
+ reader.readAsDataURL(file);
+ }
+}
+
+$('#uploadfile').onchange = function() {
+ file = this.files[0];
+ reader = new FileReader();
+
+ reader.addEventListener("load", function () {
+ args = {};
+ args.cmd = "chat";
+ args.text = 'File: '+file.name+'';
+ send(args);
+ }, false);
+
+ if (file) {
+ reader.readAsDataURL(file);
+ }
+}
+
$('#chatinput').onkeydown = function(e) {
if (e.keyCode == 13 /* ENTER */ && !e.shiftKey) {
e.preventDefault()
diff --git a/web/images/file.png b/web/images/file.png
new file mode 100644
index 0000000..242e4e5
Binary files /dev/null and b/web/images/file.png differ
diff --git a/web/images/image.png b/web/images/image.png
new file mode 100644
index 0000000..9451791
Binary files /dev/null and b/web/images/image.png differ
diff --git a/web/images/video.png b/web/images/video.png
new file mode 100644
index 0000000..a2e9d37
Binary files /dev/null and b/web/images/video.png differ
diff --git a/web/index.jsp b/web/index.jsp
index cd09586..01d326f 100644
--- a/web/index.jsp
+++ b/web/index.jsp
@@ -15,6 +15,9 @@
diff --git a/web/style.css b/web/style.css
index 18abc33..b707335 100644
--- a/web/style.css
+++ b/web/style.css
@@ -3,19 +3,23 @@ body {
margin: 0;
overflow-y: scroll;
}
+
body,
input,
textarea {
font-family: 'DejaVu Sans Mono', monospace;
font-size: 12px;
}
+
input[type="checkbox"] {
margin: 0;
margin-right: 1em;
}
+
label {
vertical-align: 3px;
}
+
input,
textarea {
background: none;
@@ -23,11 +27,13 @@ textarea {
outline: none;
resize: none;
}
+
h4 {
font-size: 12px;
margin: 1em 0;
font-weight: bold;
}
+
pre {
tab-size: 2;
white-space: pre-wrap;
@@ -35,37 +41,48 @@ pre {
tab-size: 4;
-moz-tab-size: 4;
}
+
a {
color: inherit;
text-decoration: none;
cursor: pointer;
}
+
a:hover {
text-decoration: underline;
}
+
ul {
padding-left: 0;
}
+
ul li {
list-style: inside;
}
+
.hidden {
display: none;
}
+
.container {
max-width: 600px;
margin: 0 auto;
}
+
.messages {
border-left: 1px solid;
}
+
#messages {
padding-top: 2em;
}
+
.message {
padding-bottom: 1em;
}
+
.nick {
+
float: left;
width: 16em;
margin-left: -17em;
@@ -74,29 +91,54 @@ ul li {
white-space: nowrap;
overflow: hidden;
}
+
.trip {
font-size: 10px;
}
+
.text {
margin: 0;
margin-left: 1em;
}
+
.text p {
margin: 0;
}
+
+.select-wrapper {
+ background-repeat: no-repeat;
+ background-size: cover;
+ float:left;
+ display: block;
+ position: relative;
+ width: 20px;
+ height: 20px;
+ margin: 5px;
+}
+.fotterbutton {
+ width: 20px;
+ height: 20px;
+ margin-right: 100px;
+ opacity: 0;
+ filter: alpha(opacity=0); /* IE 5-7 */
+}
+
#footer {
position: fixed;
bottom: 0;
width: 100%;
}
+
#chatform {
border-top: 1px solid;
}
+
#chatinput {
width: 100%;
padding: 1em;
box-sizing: border-box;
}
+
#sidebar {
position: fixed;
top: 0;
@@ -106,9 +148,11 @@ ul li {
border-left: solid 1px;
overflow-y: auto;
}
+
#sidebar-content {
width: 180px;
}
+
@media only screen and (max-width: 600px) {
.messages {
border: none;