From 77800a6587ec4812d5e4f876f5a5107bd7904b32 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Thu, 20 Jun 2013 14:54:15 -0400 Subject: [PATCH] Ability to unregister channel --- www/assets/js/channelsettings.js | 8 +++++++- www/assets/js/util.js | 27 ++++++++++++++------------- www/channeloptions.html | 7 +++++++ 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/www/assets/js/channelsettings.js b/www/assets/js/channelsettings.js index ae2bdb82..b8b2b682 100644 --- a/www/assets/js/channelsettings.js +++ b/www/assets/js/channelsettings.js @@ -54,11 +54,17 @@ externaljs: $("#opt_externaljs").val(), chat_antiflood: $("#opt_chat_antiflood").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") }); }); + $("#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() { socket.emit("setMotd", { motd: $("#motdtext").val() diff --git a/www/assets/js/util.js b/www/assets/js/util.js index b3a2544f..939c826b 100644 --- a/www/assets/js/util.js +++ b/www/assets/js/util.js @@ -665,6 +665,19 @@ function hasPermission(key) { 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() { /* update channel controls */ $("#opt_pagetitle").val(CHANNEL.opts.pagetitle); @@ -689,22 +702,10 @@ function handleModPermissions() { setVisible("#jsedit_tab", CLIENT.rank >= 3); setVisible("#filteredit_tab", hasPermission("filteredit")); setVisible("#channelranks_tab", CLIENT.rank >= 3); + setVisible("#chanopts_unregister_wrap", CLIENT.rank >= 10); } 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) { $("#channelsettingswrap3").show(); if($("#channelsettingswrap").html() == "") { diff --git a/www/channeloptions.html b/www/channeloptions.html index 172cd41d..6b37ce50 100644 --- a/www/channeloptions.html +++ b/www/channeloptions.html @@ -79,6 +79,13 @@ + +
+ +
+ +
+