add country flag and name to profile

This commit is contained in:
RaidMax 2021-07-01 21:58:09 -05:00
parent c9d7a957dc
commit 33a427bb8a
2 changed files with 22 additions and 6 deletions

View File

@ -23,7 +23,7 @@
</div>
<!-- Name/Level Column -->
<div class="w-50 d-block d-lg-inline-flex flex-column flex-fill text-center text-lg-left pb-3 pb-lg-0 pt-3 pt-lg-0 pl-3 pr-3 ml-auto mr-auto" style="overflow-wrap: anywhere">
<div class="mt-n2 flex-fill d-block d-lg-inline-flex">
<div class="mt-n2 d-block d-lg-inline-flex">
<div id="profile_name" class="client-name h1 mb-0">
<color-code value="@Model.Name" allow="@ViewBag.EnableColorCodes"></color-code>
</div>
@ -35,6 +35,14 @@
@if (ViewBag.Authorized)
{
<div class="d-flex flex-row justify-content-start flex-fill flex-column flex-md-row mr-2 mb-2 mb-md-0">
<div class="ip-lookup-profile align-self-center mr-0 mr-md-2"
data-ip="@Model.IPAddress"
style="background-image: url('http://api.hostip.info/flag.php?ip=@Model.IPAddress'); height: 2.5rem; min-width: 3.0rem; background-size: contain; background-repeat: no-repeat; background-position: center;">
</div>
<div id="ip_lookup_country" class="h4 mb-0 align-self-center text-muted"></div>
</div>
<div id="profile_aliases" class="text-muted pt-0 pt-lg-2 pb-2">
@foreach (var linked in Model.LinkedAccounts)
{

View File

@ -1,7 +1,7 @@
$(document).ready(function () {
/*
Expand alias tab if they have any
*/
/*
Expand alias tab if they have any
*/
$('#profile_aliases_btn').click(function (e) {
const aliases = $('#profile_aliases').text().trim();
if (aliases && aliases.length !== 0) {
@ -10,6 +10,14 @@
}
});
const ipAddresses = $('.ip-lookup-profile');
$.each(ipAddresses, function (index, address) {
$.get('http://ip-api.com/json/' + $(address).data('ip'), function (result) {
const country = result['country'];
$('#ip_lookup_country').text(country)
});
});
/* set the end time for initial event query */
startAt = $('.loader-data-time').last().data('time');
@ -35,7 +43,7 @@
$(this).children().filter('.client-message-prefix').removeClass('oi-chevron-right');
$(this).children().filter('.client-message-prefix').addClass('oi-chevron-bottom');
$.get('/Stats/GetMessageAsync', {
'serverId': $(this).data('serverid'),
'when': $(this).data('when')
@ -102,7 +110,7 @@
$('#mainModal .modal-body').append(response.city);
}
if (response.region.length > 0) {
$('#mainModal .modal-body').append((response.city.length > 0 ? ', ' : '') + response.region);
$('#mainModal .modal-body').append((response.city.length > 0 ? ', ' : '') + response.region);
}
if (response.country.length > 0) {
$('#mainModal .modal-body').append((response.country.length > 0 ? ', ' : '') + response.country);