This repository has been archived by the owner on Mar 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
189 lines (169 loc) · 6.34 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?php
require('config.php');
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Logviewer</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
<link href="bootstrap.css" rel="stylesheet" type="text/css" />
<script src="jquery.js"></script>
<script>
//Listeners
$(window).on('resize', function(){
resizeBox();
});
function resizeBox() {
var height = $(window).height();
var controlSize = 150;
//Get Remaining Screen Real Estate
var logViewerSize = height - controlSize - 25;
$("#logView").height(logViewerSize);
}
//Listenrs for checkboxes
$(document).ready(function() {
$('#filterChat').click(function(){
if($(this).is(':checked')){
changeVisibility('chat', 'show')
changeVisibility('adminChat', 'show')
} else {
changeVisibility('chat', 'hide')
changeVisibility('adminChat', 'hide')
}
});
$('#filterCommands').click(function(){
if($(this).is(':checked')){
changeVisibility('commands', 'show')
} else {
changeVisibility('commands', 'hide')
}
});
$('#filterWorldEdit').click(function(){
if($(this).is(':checked')){
changeVisibility('worldEdit', 'show')
} else {
changeVisibility('worldEdit', 'hide')
}
});
$('#filterErrors').click(function(){
if($(this).is(':checked')){
changeVisibility('errors', 'show')
} else {
changeVisibility('errors', 'hide')
}
});
$('#filterKickBans').click(function(){
if($(this).is(':checked')){
changeVisibility('kickBan', 'show')
} else {
changeVisibility('kickBan', 'hide')
}
});
$('#filterLoginLogout').click(function(){
if($(this).is(':checked')){
changeVisibility('loginLogout', 'show')
} else {
changeVisibility('loginLogout', 'hide')
}
});
});
function applyFilters() {
if($('#filterChat').is(':checked')){
changeVisibility('chat', 'show')
} else {
changeVisibility('chat', 'hide')
}
if($('#filterCommands').is(':checked')){
changeVisibility('commands', 'show')
} else {
changeVisibility('commands', 'hide')
}
if($('#filterWorldEdit').is(':checked')){
changeVisibility('worldEdit', 'show')
} else {
changeVisibility('worldEdit', 'hide')
}
if($('#filterErrors').is(':checked')){
changeVisibility('errors', 'show')
} else {
changeVisibility('errors', 'hide')
}
if($('#filterKickBans').is(':checked')){
changeVisibility('kickBan', 'show')
} else {
changeVisibility('kickBan', 'hide')
}
if($('#filterLoginLogout').is(':checked')){
changeVisibility('loginLogout', 'show')
} else {
changeVisibility('loginLogout', 'hide')
}
}
function init() {
resizeBox();
}
function insertIntoLogView(text) {
document.getElementById('logView').innerHTML=text;
}
function getLogs() {
insertIntoLogView('<div class="spinner"><div class="spinner-container container1"><div class="circle1"></div><div class="circle2"></div><div class="circle3"></div><div class="circle4"></div></div><div class="spinner-container container2"><div class="circle1"></div><div class="circle2"></div><div class="circle3"></div><div class="circle4"></div></div><div class="spinner-container container3"><div class="circle1"></div><div class="circle2"></div><div class="circle3"></div><div class="circle4"></div></div></div>');
var kbytes = document.getElementById('kbytes').value;
var filterChat = $("#filterChat").is(":checked");
var filterCommands = $("#filterCommands").is(":checked");
var filterWorldEdit = $("#filterWorldEdit").is(":checked");
var filterErrors = $("#filterErrors").is(":checked");
var filterKickBans = $("#filterKickBans").is(":checked");
var filterLoginLogout = $("#filterLoginLogout").is(":checked");
$.post("<?php echo getLogs_FILENAME; ?>", {kbytes: kbytes, chat: filterChat, commands: filterCommands, worldedit: filterWorldEdit, errors: filterErrors, filterKickBans: filterKickBans, loginlogout: filterLoginLogout}).done(function(data) {
insertIntoLogView(data);
$(function () {
applyFilters();
$('#logView').scrollTop(25000);
});
});
}
function changeVisibility(className, value) {
$('.' + className).each(function(i, obj) {
if (value == 'hide') {
obj.style.display="none";
} else {
obj.style.display="block";
}
});
}
</script>
</head>
<body>
<div id="control">
<form name="control_filters" id="control_filters">
<table class="table table-bordered">
<tr>
<td width="33%"><label for="filterChat"><input type="checkbox" id="filterChat" value="chat" checked> Chat / Admin Chat</label></td>
<td width="33%"><label for="filterCommands"><input type="checkbox" id="filterCommands" value="commands" checked> Commands</label></td>
<td width="33%"><label for="filterWorldEdit"><input type="checkbox" id="filterWorldEdit" value="worldEdit" checked> WorldEdit</label></td>
</tr>
<tr>
<td width="33%"><label for="filterErrors"><input type="checkbox" id="filterErrors" value="error" checked> Errors</label></td>
<td width="33%"><label for="filterKickBans"><input type="checkbox" id="filterKickBans" value="kickBans" checked> Kicks / Bans / Smites</label></td>
<td width="33%"><label for="filterLoginLogout"><input type="checkbox" id="filterLoginLogout" value="loginLogout" checked> Login / Logout</label></td>
</tr>
</table>
<p>
<div class="input-group">
<span class="input-group-addon">KBytes</span>
<input type="text" id="kbytes" value="64" class="form-control ">
<span class="input-group-btn">
<button class="btn btn-primary" onclick="event.preventDefault(); getLogs();">Update Logs</button>
</span>
</div>
</p>
</form>
</div>
<div id="logView">
</div>
</body>
<script>
init();
getLogs();
</script>
</html>