Add an in-place MOTD editor

This commit is contained in:
calzoneman 2013-11-13 22:36:43 -06:00
parent 436df375c7
commit d09d7ad64e
6 changed files with 48 additions and 2 deletions

View file

@ -1034,6 +1034,7 @@ function handleModPermissions() {
$("#csstext").val(CHANNEL.css);
$("#jstext").val(CHANNEL.js);
$("#motdtext").val(CHANNEL.motd_text);
setVisible("#editmotd", hasPermission("motdedit"));
setVisible("#permedit_tab", CLIENT.rank >= 3);
setVisible("#banlist_tab", hasPermission("ban"));
setVisible("#motdedit_tab", hasPermission("motdedit"));
@ -1812,3 +1813,26 @@ function queueMessage(data, type) {
.addClass("span12 qfalert qf-" + type)
.appendTo($("#queuefail"));
}
function showMOTDEditor() {
var motd = $("#motd");
motd.html("");
var text = $("<textarea/>")
.addClass("motdeditor input-block-level")
.attr("rows", "10")
.val(CHANNEL.motd_text)
.css("width", "100%")
.css("height", "100%")
.appendTo($("#motdwrap"))
.blur(function () {
socket.emit("setMotd", {
motd: text.val()
});
$("#motdwrap .motdeditor").remove();
$("#editmotd").show();
$("#togglemotd").show();
})
.focus();
$("#editmotd").hide();
$("#togglemotd").hide();
}