commit
b200d6cc2c
|
@ -553,7 +553,9 @@ Callbacks = {
|
|||
return;
|
||||
|
||||
if(data.success) {
|
||||
log.data("log", data.data);
|
||||
log.text(data.data);
|
||||
filterChannelLog();
|
||||
} else {
|
||||
log.text("Error reading channel log");
|
||||
}
|
||||
|
|
|
@ -205,4 +205,24 @@
|
|||
});
|
||||
}
|
||||
});
|
||||
|
||||
var logfilters = [
|
||||
"#filter_chat",
|
||||
"#filter_polls",
|
||||
"#filter_queue",
|
||||
"#filter_bans",
|
||||
"#filter_channelsettings",
|
||||
"#filter_joinquit"
|
||||
];
|
||||
|
||||
logfilters.unshift("#filter_all");
|
||||
logfilters.forEach(function (f) {
|
||||
$(f).change(function () {
|
||||
if (f !== "#filter_all") {
|
||||
$("#filter_all").prop("checked", false);
|
||||
}
|
||||
filterChannelLog();
|
||||
});
|
||||
});
|
||||
logfilters.shift();
|
||||
})();
|
||||
|
|
|
@ -294,7 +294,7 @@ function calcUserBreakdown() {
|
|||
var data = {
|
||||
rank: $(item).data("rank")
|
||||
};
|
||||
|
||||
|
||||
if(data.rank >= 255)
|
||||
breakdown["Site Admins"]++;
|
||||
else if(data.rank >= 3)
|
||||
|
@ -1840,3 +1840,86 @@ function showMOTDEditor() {
|
|||
$("#editmotd").hide();
|
||||
$("#togglemotd").hide();
|
||||
}
|
||||
|
||||
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"));
|
||||
}
|
||||
|
|
|
@ -228,5 +228,31 @@
|
|||
</div>
|
||||
<div id="chanlog" class="span12">
|
||||
<button class="btn" id="chanlog_refresh">Refresh</button>
|
||||
<br>
|
||||
<br>
|
||||
<strong>Filter Log:</strong>
|
||||
<form class="form-inline" action="javascript:void(0)">
|
||||
<label class="checkbox" for="filter_all">Everything
|
||||
<input type="checkbox" id="filter_all" checked="checked">
|
||||
</label>
|
||||
<label class="checkbox" for="filter_chat">Chat
|
||||
<input type="checkbox" id="filter_chat">
|
||||
</label>
|
||||
<label class="checkbox" for="filter_polls">Polls
|
||||
<input type="checkbox" id="filter_polls">
|
||||
</label>
|
||||
<label class="checkbox" for="filter_queue">Playlist actions
|
||||
<input type="checkbox" id="filter_queue">
|
||||
</label>
|
||||
<label class="checkbox" for="filter_bans">Bans
|
||||
<input type="checkbox" id="filter_bans">
|
||||
</label>
|
||||
<label class="checkbox" for="filter_channelsettings">Channel settings
|
||||
<input type="checkbox" id="filter_channelsettings">
|
||||
</label>
|
||||
<label class="checkbox" for="filter_joinquit">Join/Quit Messages
|
||||
<input type="checkbox" id="filter_joinquit">
|
||||
</label>
|
||||
</form>
|
||||
<pre id="chanlog_contents" style="max-height: 400px; overflow-y: scroll"></pre>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue