From ca4090c533201731e5741818ec579ede261cbc47 Mon Sep 17 00:00:00 2001 From: Calvin Montgomery Date: Fri, 15 Nov 2013 20:23:57 -0600 Subject: [PATCH 1/7] Start working on filter checkboxes --- www/assets/js/util.js | 4 ++++ www/channeloptions.html | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/www/assets/js/util.js b/www/assets/js/util.js index 78c42bf7..39f0a669 100644 --- a/www/assets/js/util.js +++ b/www/assets/js/util.js @@ -1840,3 +1840,7 @@ function showMOTDEditor() { $("#editmotd").hide(); $("#togglemotd").hide(); } + +function filterChannelLog() { + +} diff --git a/www/channeloptions.html b/www/channeloptions.html index c6fb237b..74724eb7 100644 --- a/www/channeloptions.html +++ b/www/channeloptions.html @@ -228,5 +228,22 @@
+
+ + + + + +

 
From a008c923b765c10e9ea91056ec06d2f21d7d706c Mon Sep 17 00:00:00 2001 From: calzoneman Date: Fri, 15 Nov 2013 23:44:53 -0600 Subject: [PATCH 2/7] Implement log filtering --- www/assets/js/channelsettings.js | 21 ++++++++ www/assets/js/util.js | 83 +++++++++++++++++++++++++++++++- 2 files changed, 102 insertions(+), 2 deletions(-) diff --git a/www/assets/js/channelsettings.js b/www/assets/js/channelsettings.js index ee3263ef..5a179e9a 100644 --- a/www/assets/js/channelsettings.js +++ b/www/assets/js/channelsettings.js @@ -205,4 +205,25 @@ }); } }); + + var logfilters = [ + "#filter_chat", + "#filter_polls", + "#filter_queue", + "#filter_bans", + "#filter_channelsettings", + "#filter_joinquit" + ]; + $("#filter_all").change(function () { + var checked = $("#filter_all").prop("checked"); + logfilters.forEach(function (f) { + $(f).attr("disabled", checked); + }); + }); + + logfilters.unshift("#filter_all"); + logfilters.forEach(function (f) { + $(f).change(filterChannelLog); + }); + logfilters.shift(); })(); diff --git a/www/assets/js/util.js b/www/assets/js/util.js index 39f0a669..c3fa0a21 100644 --- a/www/assets/js/util.js +++ b/www/assets/js/util.js @@ -294,7 +294,7 @@ function calcUserBreakdown() { var data = { rank: $(item).data("rank") }; - + if(data.rank >= 255) breakdown["Site Admins"]++; else if(data.rank >= 3) @@ -1842,5 +1842,84 @@ function showMOTDEditor() { } function filterChannelLog() { - + var cc = $("#chanlog_contents"); + if (!cc.data("log")) { + cc.data("log", cc.text()); + } + var all = $("#filter_all").prop("checked"); + var chat = $("#filter_chat").prop("checked"); + var polls = $("#filter_polls").prop("checked"); + var queue = $("#filter_queue").prop("checked"); + var bans = $("#filter_bans").prop("checked"); + var channelsettings = $("#filter_channelsettings").prop("checked"); + var joinquit = $("#filter_joinquit").prop("checked"); + + var lines = cc.data("log").split("\n"); + var include = []; + lines.forEach(function (line) { + if (line.trim() === "") { + return; + } + if (all) { + include.push(line); + return; + } + + var pre = line.split(" ")[5]; + if (pre === undefined) { + return; + } + + if (chat && pre.match(/<[\w-]+\.>/)) { + include.push(line); + return; + } + + if (polls && pre === "***" && (line.indexOf("Opened Poll") >= 0 || + line.indexOf("closed the active poll") >= 0)) { + include.push(line); + return; + } + + if (queue && pre === "###") { + include.push(line); + return; + } + + if (channelsettings && pre === "%%%") { + include.push(line); + return; + } + + if (joinquit) { + if (pre === "+++" || pre === "---") { + include.push(line); + return; + } + + if (pre.match(/(\d{1,3}\.){3}\d{1,3}/) && + line.indexOf("logged in as") >= 0) { + include.push(line); + return; + } + } + + if (bans && pre === "***" && line.indexOf("banned") >= 0) { + include.push(line); + return; + } + + if (channelsettings && pre === "***") { + if (line.indexOf("Loading") >= 0 || + line.indexOf("Loaded") >= 0 || + line.indexOf("unloading") >= 0 || + line.indexOf("rank") >= 0) { + include.push(line); + return; + } + return; + } + }); + + $("#chanlog_contents").text(include.join("\n")); } From fc41b01209f004bbbd834b893507f9e9bace4202 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Fri, 15 Nov 2013 23:47:32 -0600 Subject: [PATCH 3/7] Fix past commit --- www/channeloptions.html | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/www/channeloptions.html b/www/channeloptions.html index 74724eb7..44aa02f7 100644 --- a/www/channeloptions.html +++ b/www/channeloptions.html @@ -228,21 +228,30 @@
+
+
+ Filter Log:
+ - + +


From ac15c17981d43b7cd596a1c90e4760b195a7dba7 Mon Sep 17 00:00:00 2001
From: calzoneman 
Date: Fri, 15 Nov 2013 23:54:45 -0600
Subject: [PATCH 4/7] Fix log not updating

---
 www/assets/js/callbacks.js | 1 +
 1 file changed, 1 insertion(+)

diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js
index e12cc405..a656ef2e 100644
--- a/www/assets/js/callbacks.js
+++ b/www/assets/js/callbacks.js
@@ -553,6 +553,7 @@ Callbacks = {
             return;
 
         if(data.success) {
+            log.data("log", data);
             log.text(data.data);
         } else {
             log.text("Error reading channel log");

From c14581135e9c564b473566c2c3f83cf5a6b1437f Mon Sep 17 00:00:00 2001
From: calzoneman 
Date: Fri, 15 Nov 2013 23:55:35 -0600
Subject: [PATCH 5/7] Fix the fix

---
 www/assets/js/callbacks.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js
index a656ef2e..0efc117a 100644
--- a/www/assets/js/callbacks.js
+++ b/www/assets/js/callbacks.js
@@ -553,7 +553,7 @@ Callbacks = {
             return;
 
         if(data.success) {
-            log.data("log", data);
+            log.data("log", data.data);
             log.text(data.data);
         } else {
             log.text("Error reading channel log");

From 45ad9e44a3151821403e59a4184ee69f3c5ec94b Mon Sep 17 00:00:00 2001
From: calzoneman 
Date: Fri, 15 Nov 2013 23:56:25 -0600
Subject: [PATCH 6/7] Re-filter on updatE

---
 www/assets/js/callbacks.js | 1 +
 1 file changed, 1 insertion(+)

diff --git a/www/assets/js/callbacks.js b/www/assets/js/callbacks.js
index 0efc117a..c0f61ed0 100644
--- a/www/assets/js/callbacks.js
+++ b/www/assets/js/callbacks.js
@@ -555,6 +555,7 @@ Callbacks = {
         if(data.success) {
             log.data("log", data.data);
             log.text(data.data);
+            filterChannelLog();
         } else {
             log.text("Error reading channel log");
         }

From b077f3f206640859bc26b63abd7a0e6693807ba3 Mon Sep 17 00:00:00 2001
From: calzoneman 
Date: Sat, 16 Nov 2013 00:00:03 -0600
Subject: [PATCH 7/7] Improve behavior

---
 www/assets/js/channelsettings.js | 13 ++++++-------
 www/channeloptions.html          | 12 ++++++------
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/www/assets/js/channelsettings.js b/www/assets/js/channelsettings.js
index 5a179e9a..23a2fcbc 100644
--- a/www/assets/js/channelsettings.js
+++ b/www/assets/js/channelsettings.js
@@ -214,16 +214,15 @@
         "#filter_channelsettings",
         "#filter_joinquit"
     ];
-    $("#filter_all").change(function () {
-        var checked = $("#filter_all").prop("checked");
-        logfilters.forEach(function (f) {
-            $(f).attr("disabled", checked);
-        });
-    });
 
     logfilters.unshift("#filter_all");
     logfilters.forEach(function (f) {
-        $(f).change(filterChannelLog);
+        $(f).change(function () {
+            if (f !== "#filter_all") {
+                $("#filter_all").prop("checked", false);
+            }
+            filterChannelLog();
+        });
     });
     logfilters.shift();
 })();
diff --git a/www/channeloptions.html b/www/channeloptions.html
index 44aa02f7..699dc9fe 100644
--- a/www/channeloptions.html
+++ b/www/channeloptions.html
@@ -236,22 +236,22 @@