1
0
mirror of https://github.com/RaidMax/IW4M-Admin.git synced 2025-06-11 15:52:25 -05:00

Chat history stuff

fixed kills not saving
This commit is contained in:
RaidMax
2017-11-04 18:42:31 -05:00
parent 308427e662
commit 07e3c61e98
13 changed files with 2648 additions and 143 deletions

View File

@ -165,6 +165,9 @@
<Content Include="webfront\images\minimap_mp_terminal.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="webfront\scripts\wordcloud2.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="webfront\stats.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
@ -363,7 +366,6 @@ copy /Y "$(ProjectDir)lib\Kayak.dll" "$(SolutionDir)BUILD\lib"
xcopy /Y /I /E "$(ProjectDir)webfront\*" "$(SolutionDir)BUILD\Webfront"
if $(ConfigurationName) == Release-Nightly powershell.exe -file "$(SolutionDir)DEPLOY\publish_nightly.ps1" 1.4
if $(ConfigurationName) == Release-Stable powershell.exe -file "$(SolutionDir)DEPLOY\publish_stable.ps1" 1.4</PostBuildEvent>
</PropertyGroup>

View File

@ -362,7 +362,7 @@ namespace IW4MAdmin
if ((lastCount - playerCountStart).TotalMinutes >= SharedLibrary.Helpers.PlayerHistory.UpdateInterval)
{
while (PlayerHistory.Count > ((60 / SharedLibrary.Helpers.PlayerHistory.UpdateInterval) * 12 )) // 12 times a hour for 12 hours
while (PlayerHistory.Count > ((60 / SharedLibrary.Helpers.PlayerHistory.UpdateInterval) * 12)) // 12 times a hour for 12 hours
PlayerHistory.Dequeue();
PlayerHistory.Enqueue(new SharedLibrary.Helpers.PlayerHistory(ClientNum));
playerCountStart = DateTime.Now;
@ -593,8 +593,9 @@ namespace IW4MAdmin
else // Not a command
{
E.Data = E.Data.StripColors().CleanChars();
if (E.Data.Length > 50)
E.Data = E.Data.Substring(0, 50) + "...";
// this should not be done for all messages.
//if (E.Data.Length > 50)
// E.Data = E.Data.Substring(0, 50) + "...";
ChatHistory.Add(new Chat(E.Origin.Name, E.Data, DateTime.Now));
}

Binary file not shown.

View File

@ -1 +1,31 @@

<script src="/webfront/scripts/wordcloud2.js"></script>
<div class="chat-history"></div>
<canvas id="chat-word-cloud" width="625" height="625"></canvas>
<script>
if (parseGet("clientid") == "undefined") {
$.getJSON("/_words", function (result) {
var wordList = [];
$.each(result, function (i, word) {
wordList.push([word.Word, word.Count]);
});
WordCloud(document.getElementById('chat-word-cloud'), { list: wordList, backgroundColor: "rgb(34,34,34)", minSize: "14pt", color: "rgb(0, 122, 204)", wait: 20, weightFactor: 2 });
});
}
else {
$.getJSON("/_clientchat?clientid=" + parseGet("clientid"), function (result) {
result = result.sort(function (a, b) {
// Turn your strings into dates, and then subtract them
// to get a value that is either negative, positive, or zero.
return new Date(b.TimeSent) - new Date(a.TimeSent);
});
$.each(result, function (i, chat) {
var date = new Date(chat.TimeSent);
$('.chat-history').append("<div><span>" + date.toLocaleString() + " &mdash; </span><span><b>" + chat.Client.Name + "</b></span>: <span>" + chat.Message + "</span></div>");
});
});
}
</script>

View File

@ -1,134 +1,113 @@
<script>
var curFrom = 0;
var curFrom = 0;
function getNextPage()
{
curFrom += 15;
return curFrom;
}
function getPrevPage()
{
if ((curFrom - 15) >= 0)
{
curFrom -= 15;
return (curFrom - 15);
}
else
return 0;
}
function formatHidden(data, authed)
{
var p = "<div class=\"hiddenWrapper\"><span>Expand</span><div class=\"hiddenElements\">";
if (authed) {
$.each(data, function (i, dat) {
p += "<span>" + dat + "</span><br/>"
})
function getNextPage() {
curFrom += 15;
return curFrom;
}
else
p += "Hidden";
function getPrevPage() {
if ((curFrom - 15) >= 0) {
curFrom -= 15;
return (curFrom - 15);
}
else
return 0;
}
p += "</div></div>"
function formatHidden(data, authed) {
var p = "<div class=\"hiddenWrapper\"><span>Expand</span><div class=\"hiddenElements\">";
return p;
}
if (authed) {
$.each(data, function (i, dat) {
p += "<span>" + dat + "</span><br/>"
})
}
function printPlayer(player, i)
{
var p = "";
p +=
"<div class=\"playerInfo table alternate_" + i % 2 + "\"> \
else
p += "Hidden";
p += "</div></div>"
return p;
}
function printPlayer(player, i) {
var p = "";
p +=
"<div class=\"playerInfo table alternate_" + i % 2 + "\"> \
<div class=\"tableCell\"><a href=\"/players?id=" + player['playerID'] + "\">" + player['playerName'] + "</a></div> \
<div class=\"tableCell\">" + formatHidden(player['playerAliases'], player.authed) + "</div> \
<div class=\"tableCell\">" + formatHidden(player['playerIPs'], player.authed) + "</div> \
<div class=\"tableCell\">" + getColorForLevel(player['playerLevel'], player['playerLevel']) + "</div> \
<div class=\"tableCell\">" + player['playerConnections'] + "</div>";
if (player.showV2Features)
{
p +=
"<div class=\"tableCell actionButton\" style='width: 2em;'> \
<a target=\"_blank\" href='http://server.nbsclan.org/screen.php?id=" + player.forumID + "&name=" + player.playerName + "'> \
<i class=\"fa fa-camera\" aria-hidden=\"true\"></i> \
</a> \
<a target=\"_blank\" href='https://v2.mcsebi.ru/memberlist.php?mode=viewprofile&u=" + player.forumID + "'> \
<i class=\"fa fa-user tableCell\" aria-hidden=\"true\"></i> \
</a> \
</div> ";
}
"<div class=\"tableCell\" style='width: 2em;'><a href=\"/chat?clientid=" + player.playerID + "\"><i class=\"fa fa-comments\" aria-hidden=\"true\"></i></a></div>"
else
{
p+=
"<div class=\"tableCell\" style='width: 2em;'><i class=\"fa fa-ban\" aria-hidden=\"true\"></i></div>"
}
p +=
"<div class=\"tableCell alignRight\">" + checkJustNow(player['lastSeen']) + "</div> \
p +=
"<div class=\"tableCell alignRight\">" + checkJustNow(player['lastSeen']) + "</div> \
</div>";
$("#playersTable").append(p);
$("#playersTable").append(p);
}
function getPlayer(ident, identValue)
{
$("#playersTable").html("");
$(".loader").fadeIn();
$.getJSON("/getplayer?" + ident + "=" + identValue, function(result) {
$.each(result, function(i, player) {
printPlayer(player, i);
});
}).done(function (data) { $(".loader").fadeOut(); });
}
$( document ).ready(function() {
if (parseGet('id') != "undefined")
getPlayer('id', parseGet('id'));
else if (parseGet('name') != "undefined")
getPlayer('name', parseGet('name'));
else {
getPlayer('recent', '1');
}
});
$('#content').on('click', 'div.hiddenWrapper span', function(){
$(this).parent().find('.hiddenElements').toggle()
});
function getPlayer(ident, identValue) {
$("#playersTable").html("");
$(".loader").fadeIn();
$.getJSON("/getplayer?" + ident + "=" + identValue, function (result) {
$.each(result, function (i, player) {
printPlayer(player, i);
});
}).done(function (data) { $(".loader").fadeOut(); });
}
$(document).ready(function () {
if (parseGet('id') != "undefined")
getPlayer('id', parseGet('id'));
else if (parseGet('name') != "undefined")
getPlayer('name', parseGet('name'));
else {
getPlayer('recent', '1');
}
});
$('#content').on('click', 'div.hiddenWrapper span', function () {
$(this).parent().find('.hiddenElements').toggle()
});
</script>
<div class="playerSearchWrap">
<input type="button" class="searchButton" name="Search" value="Search"/>
<input type="text" class="search" placeholder="Player Name..."/>
<input type="button" class="searchButton" name="Search" value="Search" />
<input type="text" class="search" placeholder="Player Name..." />
</div>
<div class="contentHeader table">
<div class="contentColumn tableCell">Name</div>
<div class="contentColumn tableCell">Aliases</div>
<div class="contentColumn tableCell">IP</div>
<div class="contentColumn tableCell">Level</div>
<div class="contentColumn tableCell">Connections</div>
<div class="contentColumn tableCell" style="width: 1em;">V2</div>
<div class="contentColumn tableCell alignRight">Last Seen</div>
<div class="contentColumn tableCell">Name</div>
<div class="contentColumn tableCell">Aliases</div>
<div class="contentColumn tableCell">IP</div>
<div class="contentColumn tableCell">Level</div>
<div class="contentColumn tableCell">Connections</div>
<div class="contentColumn tableCell" style="width: 1em;">Chat</div>
<div class="contentColumn tableCell alignRight">Last Seen</div>
</div>
<div id="playersTable">
</div>
<hr/>
<hr />
<script>
$('.searchButton').click(function() {
if ($('.search').val().length > 0)
getPlayer('name', $('.search').val());
});
$('.searchButton').click(function () {
if ($('.search').val().length > 0)
getPlayer('name', $('.search').val());
});
$(document).keypress(function(e) {
if(e.which == 13) {
$('.searchButton').click();
}
});
$(document).keypress(function (e) {
if (e.which == 13) {
$('.searchButton').click();
}
});
</script>

File diff suppressed because it is too large Load Diff