From 8fc85ef4c1c0be31c13dcf3ce2d18b22c5a5fa08 Mon Sep 17 00:00:00 2001 From: RaidMax Date: Sat, 10 Aug 2019 17:35:34 -0500 Subject: [PATCH] have graph color generated by css so that MS Edge doesn't freak out when using rgba don't do simple word check on offensive name --- Plugins/ProfanityDeterment/Plugin.cs | 16 +++++----------- WebfrontCore/wwwroot/css/main.scss | 4 ++++ WebfrontCore/wwwroot/js/server.js | 24 ++++++++++++------------ 3 files changed, 21 insertions(+), 23 deletions(-) diff --git a/Plugins/ProfanityDeterment/Plugin.cs b/Plugins/ProfanityDeterment/Plugin.cs index 66836025b..60ee40613 100644 --- a/Plugins/ProfanityDeterment/Plugin.cs +++ b/Plugins/ProfanityDeterment/Plugin.cs @@ -1,7 +1,5 @@ using System.Collections.Generic; -using System.Linq; using System.Reflection; -using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using SharedLibraryCore; @@ -31,19 +29,15 @@ namespace IW4MAdmin.Plugins.ProfanityDeterment E.Origin.SetAdditionalProperty("_profanityInfringements", 0); var objectionalWords = Settings.Configuration().OffensiveWords; - bool containsObjectionalWord = objectionalWords.FirstOrDefault(w => E.Origin.Name.ToLower().Contains(w)) != null; var matchedFilters = new List(); + bool containsObjectionalWord = false; - // we want to run regex against it just incase - if (!containsObjectionalWord) + foreach (string word in objectionalWords) { - foreach (string word in objectionalWords) + if (Regex.IsMatch(E.Origin.Name.ToLower(), word, RegexOptions.IgnoreCase)) { - if (Regex.IsMatch(E.Origin.Name.ToLower(), word, RegexOptions.IgnoreCase)) - { - containsObjectionalWord |= true; - matchedFilters.Add(word); - } + containsObjectionalWord |= true; + matchedFilters.Add(word); } } diff --git a/WebfrontCore/wwwroot/css/main.scss b/WebfrontCore/wwwroot/css/main.scss index 73e8156e5..d27b8e3c7 100644 --- a/WebfrontCore/wwwroot/css/main.scss +++ b/WebfrontCore/wwwroot/css/main.scss @@ -236,6 +236,10 @@ form *, select { background-color: darken($primary, 10%); } +style { + background-color: darken($primary, 20%); +} + .nav-tabs .nav-item { margin-bottom: 0; } diff --git a/WebfrontCore/wwwroot/js/server.js b/WebfrontCore/wwwroot/js/server.js index 187566edc..86767f3c8 100644 --- a/WebfrontCore/wwwroot/js/server.js +++ b/WebfrontCore/wwwroot/js/server.js @@ -51,18 +51,6 @@ } var charts = {}; -$('.server-history-row').each(function (index, element) { - let clientHistory = $(this).data('clienthistory'); - let serverId = $(this).data('serverid'); - let maxClients = parseInt($('#server_header_' + serverId + ' .server-maxclients').text()); - let primaryColor = window.getComputedStyle(document.body).getPropertyValue('--primary').trim(); - let color = $(this).data('online') === 'True' ? primaryColor.endsWith('80') ? primaryColor : primaryColor + '80' : '#ff6060'; - let width = $('.server-header').first().width(); - let historyChart = getPlayerHistoryChart(clientHistory, serverId, width, color, maxClients); - historyChart.render(); - charts[serverId] = historyChart; -}); - $(window).resize(function () { $('.server-history-row').each(function (index) { let serverId = $(this).data('serverid'); @@ -94,6 +82,18 @@ $(document).ready(function () { $('.server-join-button').click(function (e) { $(this).children('.server-header-ip-address').show(); }); + + $('.server-history-row').each(function (index, element) { + let clientHistory = $(this).data('clienthistory'); + let serverId = $(this).data('serverid'); + let maxClients = parseInt($('#server_header_' + serverId + ' .server-maxclients').text()); + let primaryColor = $('style').css('background-color'); + let color = $(this).data('online') === 'True' ? primaryColor : '#ff6060'; + let width = $('.server-header').first().width(); + let historyChart = getPlayerHistoryChart(clientHistory, serverId, width, color, maxClients); + historyChart.render(); + charts[serverId] = historyChart; + }); }); setInterval(refreshClientActivity, 2000);