class CurrentUser { constructor() { document.getElementById("Header_CurrentUser").innerHTML = `Получение данных профиля с сервера... ПОДОЖДИ`; this.fill_user(); } fill_user() { 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); $("#Header_CurrentUser").html("Ошибка получения данных профиля! "); $("#Header_Logout").html("(Обнови страницу для релога)") return; } document.getElementById("Header_CurrentUser").href = "#"; this.check_ban_in_header(response); document.getElementById("Header_Logout").innerHTML = " (нажми чтоб выйти)"; // document.getElementById("profile_list").remove(); document.getElementById("profile_stats").insertAdjacentHTML("beforeend", FillPlayerInfo(response)); ReconstructVipSection(response); }); } check_ban_in_header(response) { if (response.ban) { document.getElementById("Header_CurrentUser").innerHTML = `Привет ${response.steam_data.nickname}! У меня хорошие новости!`; document.getElementById("Header_CurrentBan").innerHTML = "У тебя БАН! (нажми чтоб посмотреть его)"; } else { document.getElementById("Header_CurrentUser").innerHTML = `Привет ${response.steam_data.nickname}!`; } } } if (check_cookie_name("steam64")) { var current_user = new CurrentUser(); } /* 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 = `
Дата окончания:
${player_ban_end}
` } else { player_ban_length = 'Дата окончания:
Навсегда в бане
' } player_ban_div = `Статус бана:
Забанен
ID бана:
${data.ban.id}
Причина бана:
${data.ban.ban_reason}
Кто выдал бан:
${data.ban.banned_by ? data.ban.banned_by : 'bot'}
Дата окончания ${data.permition.status}:
${player_permition_end_date}
`; player_permition_status = `Статус ${data.permition.status}:
Имеется
${player_permition_continue} ` } else { player_permition_status = `Статус ${data.permition.status}:
Имеется
` } $("#Modal_SelectPayMethod_CheckVIP_Status").html("(имеется)"); $("#Modal_SelectPayMethod_CheckVIP_Status").css("color", "green"); player_permition_div = `Статус VIP:
Отсутствует
${player_permition_continue}Статистика карт
zavod_3_jirikupdate - 1 день 2:19:13
zavod_3_jirik - 1 день 2:19:13
zavod_3 - 1 день 2:19:13
Статистика карт
`; for (const srv in data.gametime) { for (const map_name in data.gametime[srv]) { //${map} - ${UNIX2FACTI_TIME(data.gametime[srv][map_name])}
`; total_gametime += data.gametime[srv][map_name]; } } player_statistic_div += "