Add an in-place MOTD editor
This commit is contained in:
parent
436df375c7
commit
d09d7ad64e
6 changed files with 48 additions and 2 deletions
|
|
@ -171,7 +171,11 @@ Callbacks = {
|
|||
setMotd: function(data) {
|
||||
CHANNEL.motd = data.html;
|
||||
CHANNEL.motd_text = data.motd;
|
||||
$("#motd").html(data.html);
|
||||
if ($("#motdwrap").find(".motdeditor").length > 0) {
|
||||
$("#motdwrap .motdeditor").val(CHANNEL.motd_text);
|
||||
} else {
|
||||
$("#motd").html(CHANNEL.motd);
|
||||
}
|
||||
$("#motdtext").val(CHANNEL.motd_text);
|
||||
if(data.motd != "") {
|
||||
$("#motdwrap").show();
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ generateToggle("#librarytoggle", "#librarywrap");
|
|||
generateToggle("#userpltoggle", "#userplaylistwrap");
|
||||
generateToggle("#playlisttoggle", "#playlist_controls");
|
||||
|
||||
$("#editmotd").click(showMOTDEditor);
|
||||
|
||||
$("#togglemotd").click(function () {
|
||||
var hidden = $("#motd").css("display") === "none";
|
||||
$("#motd").toggle();
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue