mirror of https://github.com/calzoneman/sync.git
Work on channel settings
This commit is contained in:
parent
b1e6f696e8
commit
8aa92f73ec
|
@ -10,26 +10,26 @@ mixin rcheckbox(id, label)
|
||||||
.col-sm-8.col-sm-offset-4
|
.col-sm-8.col-sm-offset-4
|
||||||
.checkbox
|
.checkbox
|
||||||
label.control-label(for=id)= label
|
label.control-label(for=id)= label
|
||||||
input(type="checkbox", id=id)
|
input.cs-checkbox(type="checkbox", id=id)
|
||||||
|
|
||||||
mixin textbox(id, label, placeholder)
|
mixin textbox(id, label, placeholder)
|
||||||
.form-group
|
.form-group
|
||||||
label.control-label.col-sm-4(for=id)= label
|
label.control-label.col-sm-4(for=id)= label
|
||||||
.col-sm-8
|
.col-sm-8
|
||||||
if placeholder
|
if placeholder
|
||||||
input.form-control(id=id, type="text", placeholder=placeholder)
|
input.form-control.cs-textbox(id=id, type="text", placeholder=placeholder)
|
||||||
else
|
else
|
||||||
input.form-control(id=id, type="text")
|
input.form-control.cs-textbox(id=id, type="text")
|
||||||
|
|
||||||
mixin miscoptions
|
mixin miscoptions
|
||||||
#cs-miscoptions.tab-pane
|
#cs-miscoptions.tab-pane
|
||||||
h4 General Settings
|
h4 General Settings
|
||||||
form.form-horizontal(action="javascript:void(0)")
|
form.form-horizontal(action="javascript:void(0)")
|
||||||
mixin rcheckbox("opt_enable_link_regex", "Convert URLs in chat to links")
|
mixin rcheckbox("cs-enable_link_regex", "Convert URLs in chat to links")
|
||||||
mixin rcheckbox("opt_allow_voteskip", "Allow voteskip")
|
mixin rcheckbox("cs-allow_voteskip", "Allow voteskip")
|
||||||
mixin textbox("opt_voteskip_ratio", "Voteskip ratio", "0.5")
|
mixin textbox("cs-voteskip_ratio", "Voteskip ratio", "0.5")
|
||||||
mixin textbox("opt_maxlength", "Max video length", "HH:MM:SS")
|
mixin textbox("cs-maxlength", "Max video length", "HH:MM:SS")
|
||||||
mixin textbox("opt_afktimeout", "Auto-AFK Delay", "0 (disabled)")
|
mixin textbox("cs-afk_timeout", "Auto-AFK Delay", "0 (disabled)")
|
||||||
.form-group
|
.form-group
|
||||||
.col-sm-8.col-sm-offset-4
|
.col-sm-8.col-sm-offset-4
|
||||||
button.btn.btn-default#cs-miscoptionssubmit Save
|
button.btn.btn-default#cs-miscoptionssubmit Save
|
||||||
|
@ -39,11 +39,11 @@ mixin adminoptions
|
||||||
h4 Admin-Only Settings
|
h4 Admin-Only Settings
|
||||||
form.form-horizontal(action="javascript:void(0)")
|
form.form-horizontal(action="javascript:void(0)")
|
||||||
- var defname = "CyTube - /r/" + channelName
|
- var defname = "CyTube - /r/" + channelName
|
||||||
mixin textbox("opt_pagetitle", "Page title", defname)
|
mixin textbox("cs-pagetitle", "Page title", defname)
|
||||||
mixin textbox("opt_password", "Password", "leave blank to disable")
|
mixin textbox("cs-password", "Password", "leave blank to disable")
|
||||||
mixin textbox("opt_externalcss", "External CSS", "Stylesheet URL")
|
mixin textbox("cs-externalcss", "External CSS", "Stylesheet URL")
|
||||||
mixin textbox("opt_externaljs", "External Javascript", "Script URL")
|
mixin textbox("cs-externaljs", "External Javascript", "Script URL")
|
||||||
mixin rcheckbox("opt_show_public", "List channel publicly")
|
mixin rcheckbox("cs-show_public", "List channel publicly")
|
||||||
.form-group
|
.form-group
|
||||||
.col-sm-8.col-sm-offset-4
|
.col-sm-8.col-sm-offset-4
|
||||||
button.btn.btn-default#cs-adminoptionssubmit Save
|
button.btn.btn-default#cs-adminoptionssubmit Save
|
||||||
|
@ -53,21 +53,21 @@ mixin motdeditor
|
||||||
h4 MOTD editor
|
h4 MOTD editor
|
||||||
p The MOTD can be formatted using a subset of HTML. Tags which attempt to execute Javascript will be removed.
|
p The MOTD can be formatted using a subset of HTML. Tags which attempt to execute Javascript will be removed.
|
||||||
textarea.form-control#cs-motdtext(rows="10")
|
textarea.form-control#cs-motdtext(rows="10")
|
||||||
button.btn.btn-default#cs-motdsubmit Save MOTD
|
button.btn.btn-primary.pull-right#cs-motdsubmit Save MOTD
|
||||||
|
|
||||||
mixin csseditor
|
mixin csseditor
|
||||||
#cs-csseditor.tab-pane
|
#cs-csseditor.tab-pane
|
||||||
h4 CSS editor
|
h4 CSS editor
|
||||||
p Maximum size 20KB. If more space is required, use the External CSS option under General Settings to link to an externally hosted stylesheet.
|
p Maximum size 20KB. If more space is required, use the External CSS option under General Settings to link to an externally hosted stylesheet.
|
||||||
textarea.form-control#cs-csstext(rows="10")
|
textarea.form-control#cs-csstext(rows="10")
|
||||||
button.btn.btn-default#cs-csssubmit Save CSS
|
button.btn.btn-primary.pull-right#cs-csssubmit Save CSS
|
||||||
|
|
||||||
mixin jseditor
|
mixin jseditor
|
||||||
#cs-jseditor.tab-pane
|
#cs-jseditor.tab-pane
|
||||||
h4 JS editor
|
h4 JS editor
|
||||||
p Maximum size 20KB. If more space is required, use the External JS option under General Settings to link to an externally hosted stylesheet.
|
p Maximum size 20KB. If more space is required, use the External JS option under General Settings to link to an externally hosted stylesheet.
|
||||||
textarea.form-control#cs-jstext(rows="10")
|
textarea.form-control#cs-jstext(rows="10")
|
||||||
button.btn.btn-default#cs-jssubmit Save JS
|
button.btn.btn-primary.pull-right#cs-jssubmit Save JS
|
||||||
|
|
||||||
mixin banlist
|
mixin banlist
|
||||||
#cs-banlist.tab-pane
|
#cs-banlist.tab-pane
|
||||||
|
|
|
@ -470,3 +470,30 @@ $("#cs-chanranks-owner").click(chanrankSubmit.bind(this, 4));
|
||||||
});
|
});
|
||||||
$(".plcontrol-collapse").collapse();
|
$(".plcontrol-collapse").collapse();
|
||||||
$(".plcontrol-collapse").collapse("hide");
|
$(".plcontrol-collapse").collapse("hide");
|
||||||
|
|
||||||
|
$(".cs-checkbox").change(function () {
|
||||||
|
var box = $(this);
|
||||||
|
var key = box.attr("id").replace("cs-", "");
|
||||||
|
var value = box.prop("checked");
|
||||||
|
var data = {};
|
||||||
|
data[key] = value;
|
||||||
|
socket.emit("setOptions", data);
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".cs-textbox").keyup(function () {
|
||||||
|
var box = $(this);
|
||||||
|
var key = box.attr("id").replace("cs-", "");
|
||||||
|
var value = box.val();
|
||||||
|
var lastkey = Date.now();
|
||||||
|
box.data("lastkey", lastkey);
|
||||||
|
|
||||||
|
setTimeout(function () {
|
||||||
|
if (box.data("lastkey") !== lastkey || box.val() !== value) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var data = {};
|
||||||
|
data[key] = value;
|
||||||
|
socket.emit("setOptions", data);
|
||||||
|
}, 1000);
|
||||||
|
});
|
||||||
|
|
|
@ -724,32 +724,38 @@ function setVisible(selector, bool) {
|
||||||
$(selector).css("display", disp);
|
$(selector).css("display", disp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setParentVisible(selector, bool) {
|
||||||
|
var disp = bool ? "" : "none";
|
||||||
|
$(selector).parent().css("display", disp);
|
||||||
|
}
|
||||||
|
|
||||||
function handleModPermissions() {
|
function handleModPermissions() {
|
||||||
$("#cs-chanranks-adm").attr("disabled", CLIENT.rank < 4);
|
$("#cs-chanranks-adm").attr("disabled", CLIENT.rank < 4);
|
||||||
$("#cs-chanranks-owner").attr("disabled", CLIENT.rank < 4);
|
$("#cs-chanranks-owner").attr("disabled", CLIENT.rank < 4);
|
||||||
/* update channel controls */
|
/* update channel controls */
|
||||||
$("#opt_pagetitle").val(CHANNEL.opts.pagetitle);
|
$("#cs-pagetitle").val(CHANNEL.opts.pagetitle);
|
||||||
$("#opt_pagetitle").attr("disabled", CLIENT.rank < 3);
|
$("#cs-pagetitle").attr("disabled", CLIENT.rank < 3);
|
||||||
$("#opt_externalcss").val(CHANNEL.opts.externalcss);
|
$("#cs-externalcss").val(CHANNEL.opts.externalcss);
|
||||||
$("#opt_externalcss").attr("disabled", CLIENT.rank < 3);
|
$("#cs-externalcss").attr("disabled", CLIENT.rank < 3);
|
||||||
$("#opt_externaljs").val(CHANNEL.opts.externaljs);
|
$("#cs-externaljs").val(CHANNEL.opts.externaljs);
|
||||||
$("#opt_externaljs").attr("disabled", CLIENT.rank < 3);
|
$("#cs-externaljs").attr("disabled", CLIENT.rank < 3);
|
||||||
|
/* TODO FIX */
|
||||||
$("#opt_chat_antiflood").prop("checked", CHANNEL.opts.chat_antiflood);
|
$("#opt_chat_antiflood").prop("checked", CHANNEL.opts.chat_antiflood);
|
||||||
if ("chat_antiflood_params" in CHANNEL.opts) {
|
if ("chat_antiflood_params" in CHANNEL.opts) {
|
||||||
$("#opt_chat_antiflood_burst").val(CHANNEL.opts.chat_antiflood_params.burst);
|
$("#opt_chat_antiflood_burst").val(CHANNEL.opts.chat_antiflood_params.burst);
|
||||||
$("#opt_chat_antiflood_sustained").val(CHANNEL.opts.chat_antiflood_params.sustained);
|
$("#opt_chat_antiflood_sustained").val(CHANNEL.opts.chat_antiflood_params.sustained);
|
||||||
}
|
}
|
||||||
$("#opt_show_public").prop("checked", CHANNEL.opts.show_public);
|
$("#cs-show_public").prop("checked", CHANNEL.opts.show_public);
|
||||||
$("#opt_show_public").attr("disabled", CLIENT.rank < 3);
|
$("#cs-show_public").attr("disabled", CLIENT.rank < 3);
|
||||||
$("#opt_password").val(CHANNEL.opts.password || "");
|
$("#cs-password").val(CHANNEL.opts.password || "");
|
||||||
$("#opt_password").attr("disabled", CLIENT.rank < 3);
|
$("#cs-password").attr("disabled", CLIENT.rank < 3);
|
||||||
$("#opt_enable_link_regex").prop("checked", CHANNEL.opts.enable_link_regex);
|
$("#cs-enable_link_regex").prop("checked", CHANNEL.opts.enable_link_regex);
|
||||||
$("#opt_afktimeout").val(CHANNEL.opts.afk_timeout);
|
$("#cs-afk_timeout").val(CHANNEL.opts.afk_timeout);
|
||||||
$("#opt_allow_voteskip").prop("checked", CHANNEL.opts.allow_voteskip);
|
$("#cs-allow_voteskip").prop("checked", CHANNEL.opts.allow_voteskip);
|
||||||
$("#opt_voteskip_ratio").val(CHANNEL.opts.voteskip_ratio);
|
$("#cs-voteskip_ratio").val(CHANNEL.opts.voteskip_ratio);
|
||||||
(function() {
|
(function() {
|
||||||
if(typeof CHANNEL.opts.maxlength != "number") {
|
if(typeof CHANNEL.opts.maxlength != "number") {
|
||||||
$("#opt_maxlength").val("");
|
$("#cs-maxlength").val("");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var h = parseInt(CHANNEL.opts.maxlength / 3600);
|
var h = parseInt(CHANNEL.opts.maxlength / 3600);
|
||||||
|
@ -761,21 +767,19 @@ function handleModPermissions() {
|
||||||
var s = parseInt(CHANNEL.opts.maxlength % 60);
|
var s = parseInt(CHANNEL.opts.maxlength % 60);
|
||||||
s = ""+s;
|
s = ""+s;
|
||||||
if(s.length < 2) s = "0" + s;
|
if(s.length < 2) s = "0" + s;
|
||||||
$("#opt_maxlength").val(h + ":" + m + ":" + s);
|
$("#cs-maxlength").val(h + ":" + m + ":" + s);
|
||||||
})();
|
})();
|
||||||
$("#csstext").val(CHANNEL.css);
|
$("#cs-csstext").val(CHANNEL.css);
|
||||||
$("#jstext").val(CHANNEL.js);
|
$("#cs-jstext").val(CHANNEL.js);
|
||||||
$("#motdtext").val(CHANNEL.motd_text);
|
$("#cs-motdtext").val(CHANNEL.motd_text);
|
||||||
setVisible("#editmotd", hasPermission("motdedit"));
|
setParentVisible("a[href='#cs-motdeditor']", hasPermission("motdedit"));
|
||||||
setVisible("#permedit_tab", CLIENT.rank >= 3);
|
setParentVisible("a[href='#cs-permissions']", CLIENT.rank >= 3);
|
||||||
setVisible("#banlist_tab", hasPermission("ban"));
|
setParentVisible("a[href='#cs-banlist']", hasPermission("ban"));
|
||||||
setVisible("#motdedit_tab", hasPermission("motdedit"));
|
setParentVisible("a[href='#cs-csseditor']", CLIENT.rank >= 3);
|
||||||
setVisible("#cssedit_tab", CLIENT.rank >= 3);
|
setParentVisible("a[href='#cs-jseditor']", CLIENT.rank >= 3);
|
||||||
setVisible("#jsedit_tab", CLIENT.rank >= 3);
|
setParentVisible("a[href='#cs-filtereditor']", CLIENT.rank >= 3);
|
||||||
setVisible("#filteredit_tab", hasPermission("filteredit"));
|
setParentVisible("a[href='#cs-chanranks']", CLIENT.rank >= 3);
|
||||||
setVisible("#channelranks_tab", CLIENT.rank >= 3);
|
setParentVisible("a[href='#cs-chanlog']", CLIENT.rank >= 3);
|
||||||
setVisible("#chanlog_tab", CLIENT.rank >= 3);
|
|
||||||
setVisible("#chanopts_unregister_wrap", CLIENT.rank >= 10);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handlePermissionChange() {
|
function handlePermissionChange() {
|
||||||
|
|
|
@ -483,3 +483,7 @@
|
||||||
#customembed-content {
|
#customembed-content {
|
||||||
font-family: Monospace;
|
font-family: Monospace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#cs-csssubmit, #cs-motdsubmit, #cs-jssubmit {
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue