Add option for send button in chat

This commit is contained in:
calzoneman 2013-05-17 11:23:11 -04:00
parent 74bdffea58
commit 8671edd106
3 changed files with 25 additions and 2 deletions

View File

@ -193,7 +193,6 @@ Channel.prototype.saveDump = function() {
// Save channel dumps every 5 minutes, in case of crash
function incrementalDump(chan) {
if(chan && chan.users && chan.users.length > 0) {
console.log("dumping " + chan.name);
chan.saveDump();
setTimeout(function() { incrementalDump(chan); }, 300000);
}

View File

@ -68,7 +68,8 @@ var USEROPTS = {
show_timestamps : parseBool(getOrDefault("cytube_show_timestamps", false)),
modhat : parseBool(getOrDefault("cytube_modhat", false)),
blink_title : parseBool(getOrDefault("cytube_blink_title", false)),
sync_accuracy : parseFloat(getOrDefault("cytube_sync_accuracy", 2)) || 2
sync_accuracy : parseFloat(getOrDefault("cytube_sync_accuracy", 2)) || 2,
chatbtn : parseBool(getOrDefault("cytube_chatbtn", false))
};
applyOpts();
$("#optlink").click(showUserOpts);

View File

@ -909,6 +909,12 @@ function showUserOpts() {
blink.prop("checked", USEROPTS.blink_title);
addOption("Chat Notice", blinkcontainer);
var sendbtncontainer = $("<label/>").addClass("checkbox")
.text("Add a send button to the chatbox");
var sendbtn = $("<input/>").attr("type", "checkbox").appendTo(sendbtncontainer);
sendbtn.prop("checked", USEROPTS.chatbtn);
addOption("Send Button", sendbtncontainer);
var profimg = $("<input/>").attr("type", "text")
profimg.val(PROFILE.image);
addOption("Profile Image", profimg);
@ -945,6 +951,7 @@ function showUserOpts() {
USEROPTS.hidevid = hidevid.prop("checked");
USEROPTS.show_timestamps = showts.prop("checked");
USEROPTS.blink_title = blink.prop("checked");
USEROPTS.chatbtn = sendbtn.prop("checked");
if(RANK >= Rank.Moderator) {
USEROPTS.modhat = modhat.prop("checked");
}
@ -1008,6 +1015,22 @@ function applyOpts() {
if(USEROPTS.hidevid) {
$("#videodiv").remove();
}
if(USEROPTS.chatbtn) {
$("#chatline").removeClass("span5").addClass("span4")
.css("float", "left");
var btn = $("<button/>").addClass("btn span1")
.text("Send")
.appendTo($("#chatdiv"));
btn.click(function() {
if($("#chatline").val().trim()) {
socket.emit("chatMsg", {
msg: $("#chatline").val()
});
$("#chatline").val("");
}
});
}
}
function idToURL(data) {