Archived
1
0

various fixes

This commit is contained in:
Jeff Becker 2016-07-05 12:45:28 -04:00
parent 5ec4c823fe
commit a4747b9965
No known key found for this signature in database
GPG Key ID: AB950234D6EA286B
2 changed files with 12 additions and 20 deletions

View File

@ -423,7 +423,7 @@ function buildChat(chat, domElem, channel) {
submit.setAttribute('value', 'send'); submit.setAttribute('value', 'send');
var convobar = new ConvoBar(chat, domElem); var convobar = new ConvoBar(chat, domElem);
input_left.appendChild(name); input_left.appendChild(name);
input_left.appendChild(convobar.elem); input_left.appendChild(convobar.subject);
input_left.appendChild(file); input_left.appendChild(file);
input.appendChild(input_left); input.appendChild(input_left);
messageDiv.appendChild(message); messageDiv.appendChild(message);
@ -438,7 +438,7 @@ function buildChat(chat, domElem, channel) {
navbar: navbar, navbar: navbar,
output: output, output: output,
input: { input: {
convo: convobar.elem, subject: convobar.subject,
form: input, form: input,
message: message, message: message,
name: name, name: name,
@ -632,15 +632,14 @@ function buildConvoBar(domElem) {
var elem = document.createElement("div"); var elem = document.createElement("div");
elem.className = "livechan_convobar_root"; elem.className = "livechan_convobar_root";
var convo = document.createElement('input'); var subject = document.createElement("input");
convo.className = 'livechan_chat_input_convo'; subject.className = "livechan_chat_input_convo";
convo.setAttribute("value", ""); elem.appendChild(subject);
convo.contentEditable = false;
elem.appendChild(convo);
domElem.appendChild(elem); domElem.appendChild(elem);
return { return {
subject: subject,
widget: elem, widget: elem,
input: convo,
} }
} }
@ -652,8 +651,8 @@ function ConvoBar(chat, domElem) {
this.holder = {}; this.holder = {};
this.domElem = domElem; this.domElem = domElem;
var convo = buildConvoBar(domElem); var convo = buildConvoBar(domElem);
this.elem = convo.input;
this.widget = convo.widget; this.widget = convo.widget;
this.subject = convo.subject;
this.active = null; this.active = null;
} }
@ -776,14 +775,12 @@ ConvoBar.prototype.show = function(msgid) {
var itemElem = document.getElementById("livechan_convobar_item_"+convoId); var itemElem = document.getElementById("livechan_convobar_item_"+convoId);
itemElem.style.background = null; itemElem.style.background = null;
self.active = null; self.active = null;
self.elem.value = "";
} else { } else {
// unset active highlight if it's there // unset active highlight if it's there
if (self.active) { if (self.active) {
var convoId = self.holder[self.active].id; var convoId = self.holder[self.active].id;
var itemElem = document.getElementById("livechan_convobar_item_"+convoId); var itemElem = document.getElementById("livechan_convobar_item_"+convoId);
itemElem.style.background = null; itemElem.style.background = null;
self.elem.value = "";
} }
// set active highlight to new element // set active highlight to new element
convoId = self.holder[msgid].id; convoId = self.holder[msgid].id;
@ -800,14 +797,6 @@ ConvoBar.prototype.show = function(msgid) {
// this convo is now active // this convo is now active
self.active = msgid; self.active = msgid;
} }
// set the convobar value
var a = self.holder[self.active];
if(a)
self.elem.value = a.msgid;
else {
self.elem.value = "";
}
// scroll view // scroll view
self.parent.scroll(); self.parent.scroll();
} }
@ -954,16 +943,19 @@ Chat.prototype.sendInput = function(event) {
var message = inputElem.message.value; var message = inputElem.message.value;
var name = inputElem.name.value; var name = inputElem.name.value;
var convo = self.chatElems.convobar.active; var convo = self.chatElems.convobar.active;
var subject = self.chatElems.convobar.subject.value;
self.readImage(inputElem.file, function(fdata, fname, ftype) { self.readImage(inputElem.file, function(fdata, fname, ftype) {
if (fdata) { if (fdata) {
connection.send({Type: "post", Post: { connection.send({Type: "post", Post: {
message: message, message: message,
subject: subject,
name: name, name: name,
reference: convo, reference: convo,
files: [{name: fname, data: fdata, type: ftype}], files: [{name: fname, data: fdata, type: ftype}],
}}); }});
} else { } else {
connection.send({Type: "post", Post: { connection.send({Type: "post", Post: {
subject: subject,
message: message, message: message,
reference: convo, reference: convo,
name: name, name: name,

View File

@ -68,7 +68,7 @@ input, textarea, select {
top: 20px; top: 20px;
left: 0; left: 0;
right: 0; right: 0;
bottom: 60px; bottom: 70px;
overflow: auto; overflow: auto;
width: 90%; width: 90%;
-webkit-overflow-scrolling: touch; -webkit-overflow-scrolling: touch;