fetch_data(
"/api/privatemessage/?other=" + user_id.toString(), add_privatemessages
);
+ document.getElementsByClassName("input")[0].children[0].removeAttribute(
+ "disabled"
+ );
}
function setup_user_callback() {
fetch_data(
"/api/channelmessage/?channel=" + channel_id.toString(), add_channelmessages
);
+ document.getElementsByClassName("input")[0].children[0].removeAttribute(
+ "disabled"
+ );
}
function setup_channel_callback() {
data[name] = current_channel.data[name];
}
}
- post_data(current_channel.url, JSON.stringify(data), null);
- ta.value = "";
+ if (current_channel.url) {
+ post_data(current_channel.url, JSON.stringify(data), null);
+ ta.value = "";
+ }
}
function input_onkeydown(event) {
function (event) {
var ws, schema, input;
event = event || window.event;
+ input = document.getElementsByClassName("input")[0];
+ if (!current_channel.url) {
+ input.children[0].setAttribute("disabled", "");
+ }
if (event.target.readyState !== "complete") {
return;
}
schema = {"http:": "ws:", "https:": "wss:"}[window.location.protocol];
ws = new WebSocket(schema + "//" + window.location.host + "/");
ws.addEventListener("message", ws_receive);
- input = document.getElementsByClassName("input")[0];
input.children[0].addEventListener("keydown", input_onkeydown);
input.children[0].value = "";
input.children[1].addEventListener("click", send);