You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
333 lines
16 KiB
333 lines
16 KiB
$(async function () {
|
|
await CheckCurrentUser();
|
|
})
|
|
|
|
async function CheckCurrentUser() {
|
|
if (!check_cookie_name("steam64")) { return; }
|
|
$("#Header_CurrentUser").html(`Получение данных профиля с сервера... ПОДОЖДИ`);
|
|
await fetch("https://tf2.pblr-nyk.pro/player_api/v1/current_user", { credentials: "same-origin", headers: { 'Cache-Control': 'no-cache' } })
|
|
.then(response => response.json())
|
|
.then(response => {
|
|
if ("error" in response) {
|
|
console.log(response.error);
|
|
} else {
|
|
$("#Header_CurrentUser").attr("href", "#");
|
|
if (response.ban) {
|
|
$("#Header_CurrentUser").html(`Привет ${response.steam_data.nickname}! У меня хорошие новости!`);
|
|
$("#Header_CurrentBan").html("У тебя БАН! (нажми чтоб посмотреть его)");
|
|
} else {
|
|
$("#Header_CurrentUser").html(`Привет ${response.steam_data.nickname}!`);
|
|
}
|
|
$("#Header_Logout").html(` (нажми чтоб выйти)`);
|
|
$("#profile_list").remove();
|
|
$(FillPlayerInfo(response)).appendTo("#profile_stats");
|
|
ReconstructVipSection(response);
|
|
}
|
|
})
|
|
}
|
|
|
|
function check_cookie_name(name) {
|
|
var match = document.cookie.match(new RegExp('(^| )' + name + '=([^;]+)'));
|
|
if (match && match[2] != "None") { return true; }
|
|
else { return false; }
|
|
}
|
|
|
|
let captcha_error_div = `<div class="col" id="ModalCaptchaErrorText"><h6 style="color: red;" id="captcha_error">пук</h6></div>`;
|
|
let ProfileLinkError_div = `<div class="col" id="ProfileLinkIsNotFull"><h6 style="color: red;" id="profile_error">Долбаеб введи ссылку на профиль!</h6></div>`;
|
|
|
|
function CalculateVipEndDate(permition) {
|
|
return new Date((permition["UNIX_TIMESTAMP(`reg_date`)"] + permition.amount) * 1000);
|
|
}
|
|
|
|
function FillPlayerInfo(data) {
|
|
|
|
let player_ban_div = "";
|
|
|
|
if (data.ban) {
|
|
let player_ban_length;
|
|
if (data.ban.ban_length > 0) {
|
|
let player_ban_end = new Date((new Date(data.ban.timestamp)).getTime() + (data.ban.ban_length * 60 * 1000)).toLocaleString();
|
|
player_ban_length = `<p class="current-profile-text">Дата окончания: </p><p class="current-profile-text">${player_ban_end}</p>`
|
|
} else {
|
|
player_ban_length = '<p class="current-profile-text">Дата окончания: </p><p class="current-profile-text current-profile-text-color-alarm">Навсегда в бане</p>'
|
|
}
|
|
|
|
player_ban_div = `
|
|
<div id="ban_section">
|
|
<hr>
|
|
<p class="current-profile-text current-profile-bigtext">Статус бана: </p>
|
|
<p class="current-profile-text current-profile-bigtext current-profile-text-color-alarm">Забанен</p>
|
|
<br>
|
|
<p class="current-profile-text">ID бана: </p>
|
|
<p class="current-profile-text">${data.ban.id}</p>
|
|
<br>
|
|
<p class="current-profile-text">Причина бана: </p>
|
|
<p class="current-profile-text">${data.ban.ban_reason}</p>
|
|
<br>
|
|
<p class="current-profile-text">Кто выдал бан: </p>
|
|
<p class="current-profile-text">${data.ban.banned_by ? data.ban.banned_by : 'bot'}</p>
|
|
<!---->
|
|
<a href="${data.ban.admin_info.steam_url}" target="_blank" class="current-profile-text"><img style="height: 1.0rem;" class="rounded-1" src="site_content/images/logo/steam.png"></a>
|
|
<a href="https://vk.me/id${data.ban.admin_info.vk_id}" target="_blank" class="current-profile-text"><img style="height: 1.0rem;" class="rounded-1" src="site_content/images/logo/vk.png"></a>
|
|
<a href="#" class="current-profile-text" onclick="alert('Пиши в дискорд сюда: ${data.ban.admin_info.discord_name}');"><img style="height: 1.0rem;" class="rounded-1" src="site_content/images/logo/discord.png?version=2"></a>
|
|
<!---->
|
|
<br>
|
|
${player_ban_length}
|
|
</div>
|
|
`
|
|
}
|
|
|
|
let player_permition_div;
|
|
let player_permition_length = "";
|
|
|
|
let player_permition_continue = `(купить)`;
|
|
|
|
if (data.permition) {
|
|
let player_permition_status;
|
|
if (data.permition.status == "VIP") {
|
|
let player_permition_end_date = `бесконечны`;
|
|
let player_permition_end_date_color_status = `current-profile-text-color-normal`;
|
|
|
|
if (data.permition.amount) {
|
|
player_permition_continue = `(продлить)`;
|
|
let date = CalculateVipEndDate(data.permition);// new Date((data.permition["UNIX_TIMESTAMP(`reg_date`)"] + data.permition.amount) * 1000);
|
|
player_permition_end_date = date.toLocaleString();
|
|
$("#Modal_SelectPayMethod_CheckVIP_EndDate").html(`До: ${player_permition_end_date}`);
|
|
if (date.getTime() - new Date().getTime() > 604800000) {
|
|
player_permition_end_date_color_status = `current-profile-text-color-normal`;
|
|
} else if (date.getTime() - new Date().getTime() > 259200000) {
|
|
player_permition_end_date_color_status = `current-profile-text-color-maybe`;
|
|
} else {
|
|
player_permition_end_date_color_status = `current-profile-text-color-alarm`;
|
|
}
|
|
}
|
|
|
|
player_permition_length = `
|
|
<br>
|
|
<p class="current-profile-text">Дата окончания ${data.permition.status}: </p><p class="current-profile-text">${player_permition_end_date}</p>
|
|
`;
|
|
|
|
player_permition_status = `
|
|
<p class="current-profile-text current-profile-bigtext">Статус ${data.permition.status}: </p>
|
|
<p class="current-profile-text current-profile-bigtext">Имеется </p><a href="#" onclick="document.getElementById('Tab_VIP_Button').click();" class="current-profile-text current-profile-bigtext ${player_permition_end_date_color_status}">${player_permition_continue}</a>
|
|
`
|
|
|
|
|
|
} else {
|
|
player_permition_status = `
|
|
<p class="current-profile-text current-profile-bigtext">Статус ${data.permition.status}: </p>
|
|
<p class="current-profile-text current-profile-bigtext">Имеется</p>
|
|
`
|
|
}
|
|
|
|
$("#Modal_SelectPayMethod_CheckVIP_Status").html("(имеется)");
|
|
$("#Modal_SelectPayMethod_CheckVIP_Status").css("color", "green");
|
|
|
|
player_permition_div = `
|
|
<div id="vip_section">
|
|
<hr>
|
|
${player_permition_status}
|
|
${player_permition_length}
|
|
<br>
|
|
</div>
|
|
`
|
|
} else {
|
|
player_permition_div = `
|
|
<div id="vip_section">
|
|
<hr>
|
|
<p class="current-profile-text current-profile-bigtext">Статус VIP: </p>
|
|
<p class="current-profile-text current-profile-bigtext">Отсутствует </p><a href="#" onclick="document.getElementById('Tab_VIP_Button').click();" class="current-profile-text current-profile-bigtext current-profile-text-color-alarm">${player_permition_continue}</a>
|
|
<br>
|
|
<div>
|
|
`;
|
|
}
|
|
|
|
let player_statistic_div = "";
|
|
let total_gametime = 0;
|
|
/*
|
|
<div id="statistic_section">
|
|
<hr>
|
|
<p class="current-profile-text current-profile-bigtext">Статистика карт</p>
|
|
<br>
|
|
<p class="current-profile-text">zavod_3_jirikupdate - 1 день 2:19:13</p>
|
|
<br>
|
|
<p class="current-profile-text">zavod_3_jirik - 1 день 2:19:13</p>
|
|
<br>
|
|
<p class="current-profile-text">zavod_3 - 1 день 2:19:13</p>
|
|
</div>
|
|
*/
|
|
if (data.gametime) {
|
|
player_statistic_div = `<div id="statistic_section">
|
|
<hr>
|
|
<p class="current-profile-text current-profile-bigtext">Статистика карт</p>
|
|
`;
|
|
|
|
for (const srv in data.gametime) {
|
|
for (const map_name in data.gametime[srv]) {
|
|
//<a href="${data.ban.admin_info.steam_url}" target="_blank" class="current-profile-text"><img style="height: 1.0rem;" class="rounded-1" src="site_content/images/logo/steam.png"></a>
|
|
//<img style="height: 1.0rem;" class="rounded-1" src="${return_last_api_response().servers[srv].preview}">
|
|
let map = map_name.replace("workshop/", "").split(".ugc", 1)[0];
|
|
player_statistic_div += `<br><p class="current-profile-text">${map} - ${UNIX2FACTI_TIME(data.gametime[srv][map_name])}</p>`;
|
|
total_gametime += data.gametime[srv][map_name];
|
|
}
|
|
}
|
|
player_statistic_div += "</div>"
|
|
}
|
|
|
|
let player_data_div = `
|
|
<div class="col-md-8 col-sm-6 col-lg-6 col-xl-5 rounded border border-dark gy-3 p-4" style="background-color: #E2EFDE;" id="current_profile">
|
|
<div class="row">
|
|
<div class="col-6 offset-3">
|
|
<hr>
|
|
</div>
|
|
</div>
|
|
<div class="row" id="player_data">
|
|
<div class="col" id="player_data_window">
|
|
<div class="row">
|
|
<div class="col" style="text-align: left;">
|
|
<h2>${data.steam_data.nickname}</h2>
|
|
${player_ban_div}
|
|
${player_permition_div}
|
|
${player_statistic_div}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-4">
|
|
<img class="img-fluid w-100 rounded-5" src="${data.steam_data.avatar}">
|
|
<p></p>
|
|
<!--<p>Убийств: 20</p>
|
|
<p>Смертей: 582</p>-->
|
|
<p>Наиграно: ${UNIX2FACTI_TIME(total_gametime)}</p>
|
|
<div class="row">
|
|
<div class="col justify-content-end">
|
|
<a href="${data.steamids.community_url}" target="_blank"><img class="img-fluid w-25" src="site_content/images/logo/steam.png" id="CurrentPlayerURL"></a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`
|
|
return player_data_div;
|
|
}
|
|
|
|
function UNIX2FACTI_TIME(u_time) {
|
|
const divmod = (x, y) => [Math.floor(x / y), x % y];
|
|
|
|
let s = divmod(u_time, 60)[1];
|
|
let m = divmod(u_time, 60)[0];
|
|
let h = divmod(m, 60)[0];
|
|
m = divmod(m, 60)[1];
|
|
let d = divmod(h, 24)[0];
|
|
h = divmod(h, 24)[1];
|
|
//бля простите я тупой
|
|
|
|
if (!s & !m & !h & !d) {
|
|
return "не играл";
|
|
}
|
|
|
|
let time = `${h > 9 ? h : '0' + h}:${m > 9 ? m : '0' + m}:${s > 9 ? s : '0' + s}`;
|
|
|
|
if (!d) {
|
|
return time;
|
|
} else if (d < 2) {
|
|
return `${d} день ${time}`;
|
|
} else {
|
|
return `${d} дней ${time}`;
|
|
}
|
|
}
|
|
|
|
function ReconstructVipSection(data) {
|
|
$('#Modal_SelectPayMethod_Close').click(async function (ev) {
|
|
ev.preventDefault();
|
|
$('#Modal_SelectPayMethod').modal('hide');
|
|
});
|
|
|
|
$('#Modal_SelectPayMethod_CheckVIP').click(async function (ev) {
|
|
ev.preventDefault();
|
|
await fetch("https://tf2.pblr-nyk.pro/player_api/v1/player/permitions", { credentials: "same-origin", headers: { 'Cache-Control': 'no-cache' } })
|
|
.then(response => response.json())
|
|
.then(response => {
|
|
if (response.permition) {
|
|
$("#Modal_SelectPayMethod_CheckVIP_Status").html("(имеется)");
|
|
$("#Modal_SelectPayMethod_CheckVIP_Status").css("color", "green");
|
|
if (response.permition.amount) {
|
|
$("#Modal_SelectPayMethod_CheckVIP_EndDate").html(`До: ${CalculateVipEndDate(response.permition).toLocaleString()}`);
|
|
} else {
|
|
$("#Modal_SelectPayMethod_CheckVIP_EndDate").html(`бесконечность не предел`);
|
|
}
|
|
} else {
|
|
$("#Modal_SelectPayMethod_CheckVIP_Status").html("(отсутствует)");
|
|
$("#Modal_SelectPayMethod_CheckVIP_Status").css("color", "red");
|
|
$("#Modal_SelectPayMethod_CheckVIP_EndDate").html(`Время проверки: ${new Date().toLocaleString()}`);
|
|
}
|
|
});
|
|
});
|
|
|
|
$("#Section_VIP_buttons").empty();
|
|
|
|
const STEAM_TRADE = "https://steamcommunity.com/tradeoffer/new/?partner=47239992&token=8gNFVl7h";
|
|
const QIWI_TRADE = "https://qiwi.com/payment/form/99?currency=643&amount=(AMOUNT)&extra%5B%27comment%27%5D=(COMMENT)&extra%5B%27account%27%5D=79207516287&blocked%5B0%5D=sum&blocked%5B1%5D=account&blocked%5B2%5D=comment";
|
|
|
|
$("#Modal_SelectPayMethod_ProfileLink").attr("href", data.steamids.community_url);
|
|
$("#Modal_SelectPayMethod_ProfileName").html(`Вип будет выдан: ${data.steam_data.nickname}`);
|
|
|
|
let price_array = new Array(
|
|
["VIP (1 месяц)", 150, "1 ключ", "site_content/images/vip/VIP_1_MOUNTH.jpg", "month"],
|
|
["VIP (1 неделя)", 75, "20 рефов", "site_content/images/vip/VIP_7_DAYS.jpg", "seven_day"],
|
|
["VIP (1 день)", 20, "5 рефов", "site_content/images/vip/VIP_1_DAY.jpg", "day"]
|
|
);
|
|
|
|
let vip_select;
|
|
for (const select in price_array) {
|
|
vip_select = `
|
|
<div class="col">
|
|
<div class="card">
|
|
<img class="card-img" src="${price_array[select][3]}" alt="${price_array[select][0]}">
|
|
<div class="card-img-overlay d-flex flex-column" style="background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.7))">
|
|
<a href="#" class="stretched-link" id="Section_VIP_buttons_${price_array[select][4]}"></a>
|
|
<div class="mt-auto">
|
|
<h5 class="vip-card-text">${price_array[select][0]}</h5>
|
|
<hr class="vip-card-text">
|
|
<h6 class="vip-card-text">${price_array[select][1]} Рублей</h6>
|
|
<h6 class="vip-card-text">${price_array[select][2]}</h6>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
`
|
|
$(vip_select).appendTo("#Section_VIP_buttons");
|
|
$(`#Section_VIP_buttons_${price_array[select][4]}`).click(async function (ev) {
|
|
ev.preventDefault();
|
|
$("#Modal_SelectPayMethod_QIWI_Button").attr("href", QIWI_TRADE.replace("(AMOUNT)", price_array[select][1]).replace("(COMMENT)", data.steamids.steam2.replace(":", "%3A")));
|
|
$("#Modal_SelectPayMethod_QIWI_Value").html(`${price_array[select][1]} Рублей`);
|
|
$("#Modal_SelectPayMethod_STEAM_Button").attr("href", STEAM_TRADE);
|
|
$("#Modal_SelectPayMethod_STEAM_Value").html(price_array[select][2]);
|
|
$('#Modal_SelectPayMethod').modal('show');
|
|
return false;
|
|
});
|
|
}
|
|
}
|
|
|
|
//secret egg
|
|
let konami_code = "";
|
|
let activated = false;
|
|
//$().keypress(function (event) {
|
|
|
|
//document.addEventListener('keypress', (event) => {
|
|
$(":root").keypress(function (event) {
|
|
if (activated) { return; }
|
|
|
|
konami_code += event.key;
|
|
if (konami_code.length == 6 || event.key == "-") {
|
|
if (konami_code == "nigger") {
|
|
activated = true;
|
|
$("#Tab_About").attr("href", "#SecretEgg");
|
|
$('.nav-pills a[href="#SecretEgg"]').tab('show');
|
|
(new Audio("site_content/sounds/sunboy-ledi-night-16.mp3")).play();
|
|
$("#Nav_MenuButtons").remove();
|
|
ChangeBackgoundImage("site_content/images/background/hasbik_dance.jpg");
|
|
//$('Tab_Secret_Egg').click();
|
|
}
|
|
konami_code = ""
|
|
}
|
|
});
|