$(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 = `
пук
`; let ProfileLinkError_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 = `

Дата окончания:

${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'}


${player_ban_length}
` } 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 = `

Дата окончания ${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 = `

${player_permition_status} ${player_permition_length}
` } else { player_permition_div = `

Статус VIP:

Отсутствует

${player_permition_continue}
`; } let player_statistic_div = ""; let total_gametime = 0; /*

Статистика карт


zavod_3_jirikupdate - 1 день 2:19:13


zavod_3_jirik - 1 день 2:19:13


zavod_3 - 1 день 2:19:13

*/ if (data.gametime) { player_statistic_div = `

Статистика карт

`; for (const srv in data.gametime) { for (const map_name in data.gametime[srv]) { // // let map = map_name.replace("workshop/", "").split(".ugc", 1)[0]; player_statistic_div += `

${map} - ${UNIX2FACTI_TIME(data.gametime[srv][map_name])}

`; total_gametime += data.gametime[srv][map_name]; } } player_statistic_div += "
" } let player_data_div = `

${data.steam_data.nickname}

${player_ban_div} ${player_permition_div} ${player_statistic_div}

Наиграно: ${UNIX2FACTI_TIME(total_gametime)}

` 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 = `
${price_array[select][0]}
${price_array[select][0]}

${price_array[select][1]} Рублей
${price_array[select][2]}
` $(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 = "" } });