Ability to unregister channel

This commit is contained in:
calzoneman 2013-06-20 14:54:15 -04:00
parent 57faa03b7c
commit 77800a6587
3 changed files with 28 additions and 14 deletions

View File

@ -54,11 +54,17 @@
externaljs: $("#opt_externaljs").val(), externaljs: $("#opt_externaljs").val(),
chat_antiflood: $("#opt_chat_antiflood").prop("checked"), chat_antiflood: $("#opt_chat_antiflood").prop("checked"),
show_public: $("#opt_show_public").prop("checked"), show_public: $("#opt_show_public").prop("checked"),
/* TODO Deprecate this in favour of per-filter toggle */
enable_link_regex: $("#opt_enable_link_regex").prop("checked") enable_link_regex: $("#opt_enable_link_regex").prop("checked")
}); });
}); });
$("#chanopts_unregister").click(function() {
var res = confirm("You are about to unregister your channel. This will PERMANENTLY delete your channel data, including ranks, bans, and library videos. This cannot be undone. Are you sure you want to continue?");
if(res) {
socket.emit("unregisterChannel");
}
});
$("#save_motd").click(function() { $("#save_motd").click(function() {
socket.emit("setMotd", { socket.emit("setMotd", {
motd: $("#motdtext").val() motd: $("#motdtext").val()

View File

@ -665,6 +665,19 @@ function hasPermission(key) {
return CLIENT.rank >= v; return CLIENT.rank >= v;
} }
function setVisible(selector, bool) {
// I originally added this check because of a race condition
// Now it seems to work without but I don't trust it
if($(selector) && $(selector).attr("id") != selector.substring(1)) {
setTimeout(function() {
setVisible(selector, bool);
}, 100);
return;
}
var disp = bool ? "" : "none";
$(selector).css("display", disp);
}
function handleModPermissions() { function handleModPermissions() {
/* update channel controls */ /* update channel controls */
$("#opt_pagetitle").val(CHANNEL.opts.pagetitle); $("#opt_pagetitle").val(CHANNEL.opts.pagetitle);
@ -689,22 +702,10 @@ function handleModPermissions() {
setVisible("#jsedit_tab", CLIENT.rank >= 3); setVisible("#jsedit_tab", CLIENT.rank >= 3);
setVisible("#filteredit_tab", hasPermission("filteredit")); setVisible("#filteredit_tab", hasPermission("filteredit"));
setVisible("#channelranks_tab", CLIENT.rank >= 3); setVisible("#channelranks_tab", CLIENT.rank >= 3);
setVisible("#chanopts_unregister_wrap", CLIENT.rank >= 10);
} }
function handlePermissionChange() { function handlePermissionChange() {
function setVisible(selector, bool) {
// I originally added this check because of a race condition
// Now it seems to work without but I don't trust it
if($(selector) && $(selector).attr("id") != selector.substring(1)) {
setTimeout(function() {
setVisible(selector, bool);
}, 100);
return;
}
var disp = bool ? "" : "none";
$(selector).css("display", disp);
}
if(CLIENT.rank >= 2) { if(CLIENT.rank >= 2) {
$("#channelsettingswrap3").show(); $("#channelsettingswrap3").show();
if($("#channelsettingswrap").html() == "") { if($("#channelsettingswrap").html() == "") {

View File

@ -79,6 +79,13 @@
<input type="checkbox" id="opt_show_public"> <input type="checkbox" id="opt_show_public">
</div> </div>
</div> </div>
<!-- unregister -->
<div class="control-group" id="chanopts_unregister_wrap">
<label class="control-label" for="chanopts_unregister">Unregister</label>
<div class="controls">
<button class="btn btn-danger" id="chanopts_unregister">Unregister Channel</button>
</div>
</div>
<!-- submit --> <!-- submit -->
<button class="btn btn-primary" id="chanopts_submit">Save</button> <button class="btn btn-primary" id="chanopts_submit">Save</button>
</form> </form>