Browse Source

новые кнопочки и стата

master
gsd 2 years ago
parent
commit
c7fd6f3b17
  1. 58
      index.html
  2. BIN
      site_content/images/preview/_default.jpg
  3. BIN
      site_content/images/preview/alkashplaza.jpg
  4. BIN
      site_content/images/preview/brewery.jpg
  5. BIN
      site_content/images/preview/brewery_ultimate_open.jpg
  6. BIN
      site_content/images/preview/city_faktovsk.jpg
  7. BIN
      site_content/images/preview/city_muhosransk_v6.jpg
  8. BIN
      site_content/images/preview/city_norilsk.jpg
  9. BIN
      site_content/images/preview/city_norilsk_v5.jpg
  10. BIN
      site_content/images/preview/cp_norilsk.jpg
  11. BIN
      site_content/images/preview/dimon_dagger.jpg
  12. BIN
      site_content/images/preview/dm_norilsk_b1_d.jpg
  13. BIN
      site_content/images/preview/donbassborn_open.jpg
  14. BIN
      site_content/images/preview/factovsk13_leto_v1_fix.jpg
  15. BIN
      site_content/images/preview/factovsk13_lobnya.jpg
  16. BIN
      site_content/images/preview/factovsk228.jpg
  17. BIN
      site_content/images/preview/factovsk666.jpg
  18. BIN
      site_content/images/preview/iwantmge.jpg
  19. BIN
      site_content/images/preview/koth_sneed_plaza.jpg
  20. 1
      site_content/images/preview/mge_facti_v1.url
  21. 1
      site_content/images/preview/mvm_ghost_town.url
  22. BIN
      site_content/images/preview/tf_muhosransk.jpg
  23. BIN
      site_content/images/preview/world_of_korbal.jpg
  24. BIN
      site_content/images/preview/zavod_1_pivoupdate.jpg
  25. BIN
      site_content/images/preview/zavod_3_jirikupdate_v4.jpg
  26. 1
      site_content/images/preview/zavod_446241_finalupdate.url
  27. BIN
      site_content/images/preview/zavod_4_obnovaupdate_v2.jpg
  28. BIN
      site_content/images/preview/zavodpipis.jpg
  29. 89
      site_content/js/API.js
  30. 121
      site_content/js/Player_API.js

58
index.html

@ -39,9 +39,9 @@
</div>
</div>
<div class="container-fluid" style="background-color: #ff8946; text-align: center;">
<a href="player_api/v1/auth" style="text-decoration: none; color: black; display: inline;" id="Header_CurrentUser">Авторизируйся через стим чтоб получить больше возможностей! (тык)</a>
<a href="api/auth/login" style="text-decoration: none; color: black; display: inline;" id="Header_CurrentUser">Авторизируйся через стим чтоб получить больше возможностей! (тык)</a>
<a href="#" style="text-decoration: none; color: red; display: inline;" id="Header_CurrentBan" onclick="document.getElementById('Tab_Profile_Button').click();"></a>
<a href="player_api/v1/deauth" style="text-decoration: none; color: black; display: inline;" id="Header_Logout"></a>
<a href="api/auth/logout" style="text-decoration: none; color: black; display: inline;" id="Header_Logout"></a>
</div>
<div class="container-fluid" style="
background-color: #E2EFDE;
@ -343,7 +343,34 @@ transition: background-image 1s;" id="main_container">
</div>
</div>
</div>
<div class="row row-cols-1 justify-content-center pt-3 pb-3">
<div class="col-6 text-center rounded border border-dark" style="background-color: #E2EFDE;">
<div class="row">
<div class="col pt-3">
<h4>О нашем сервере...</h4>
<h6 style="font-family: tf2secondary;">Мы используем современные и крутые технологии и любой желающий может принять участие в их совершенствовании!</h6>
</div>
</div>
<div class="row pl-3 pr-3">
<hr>
<div class="col-12">
<p style="font-family: tf2secondary; text-align: center;">Версия сборки жопы: <a href="https://git.pblr-nyk.pro/gsd/Facti13.Web.Backend.Java.V2" target="_blank" id="AboutSection_BuildDate">СЕГОДНЯ БЛЯТЬ</a></p>
</div>
<hr>
<div class="col-12">
<p style="font-family: tf2secondary; text-align: center;">Донаты через QIWI: <a href="https://git.pblr-nyk.pro/gsd/Facti13.QiwiBot.v2" target="_blank" id="AboutSection_BuildDate">исходник</a></p>
</div>
<hr>
<div class="col-12">
<p style="font-family: tf2secondary; text-align: center;">Донаты через Steam: <a href="https://git.pblr-nyk.pro/gsd/Facti13.SteamTradeBot.v2" target="_blank" id="AboutSection_BuildDate">исходник</a></p>
</div>
<hr>
<div class="col-12">
<p style="font-family: tf2secondary; text-align: center;">Наш Discord бот: <a href="https://git.pblr-nyk.pro/gsd/Facti13.Bot.Discord.V2" target="_blank" id="AboutSection_BuildDate">исходник</a></p>
</div>
</div>
</div>
</div>
</div>
</div>
<!--#########################################################################################################################################################-->
@ -494,6 +521,26 @@ transition: background-image 1s;" id="main_container">
<br>
</div>
</div>
<div class="row justify-content-center" id="Modal_SelectPayMethod_DonateStatsText">
<div class="col">
<h6 style="text-align: center;">В этом месяце купили:</h6>
</div>
</div>
<div class="row justify-content-center" id="Modal_SelectPayMethod_DonateStatsText_FREE">
<div class="col" style="text-align: center;">
<h6 style="text-align: center; display: inline;">В этом месяце получили: </h6>
<h6 style="text-align: center; display: inline;", id="Modal_SelectPayMethod_DonateStatsValue_free">count</h6>
<br>
</div>
</div>
<div class="row justify-content-center" id="Modal_SelectPayMethod_DonateStatsValue">
<div class="col-5">
<h6 style="text-align: center;" id="Modal_SelectPayMethod_DonateStatsValue_qiwi">qiwicount</h6>
</div>
<div class="col-5">
<h6 style="text-align: center;" id="Modal_SelectPayMethod_DonateStatsValue_steam">steamcount</h6>
</div>
</div>
<div class="row justify-content-center" id="Modal_SelectPayMethod_PayButtons">
<div class="col-5">
<div class="card">
@ -553,9 +600,8 @@ transition: background-image 1s;" id="main_container">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"
integrity="sha384-VHvPCCyXqtD5DqJeNxl2dtTyhF78xXNXdkwX1CZeRusQfRKp+tA7hAShOK/B/fQ2"
crossorigin="anonymous"></script>
<script type="text/javascript" src="site_content/js/API.js?version=6.66v5" async></script>
<script type="text/javascript" src="site_content/js/Player_API.js?version=1.78" async></script>
<script type="text/javascript" src="site_content/js/VIP_API.js?version=1.3"></script>
<script type="text/javascript" src="site_content/js/API.js?version=6.66v15" async></script>
<script type="text/javascript" src="site_content/js/Player_API.js?version=1.261" async></script>
<script type="text/javascript" src="site_content/js/BackgroundSlides.js?version=9.6"></script>
</body>
</html>

BIN
site_content/images/preview/_default.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 KiB

BIN
site_content/images/preview/alkashplaza.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

BIN
site_content/images/preview/brewery.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

BIN
site_content/images/preview/brewery_ultimate_open.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

BIN
site_content/images/preview/city_faktovsk.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
site_content/images/preview/city_muhosransk_v6.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

BIN
site_content/images/preview/city_norilsk.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

BIN
site_content/images/preview/city_norilsk_v5.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

BIN
site_content/images/preview/cp_norilsk.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

BIN
site_content/images/preview/dimon_dagger.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

BIN
site_content/images/preview/dm_norilsk_b1_d.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

BIN
site_content/images/preview/donbassborn_open.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

BIN
site_content/images/preview/factovsk13_leto_v1_fix.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 128 KiB

BIN
site_content/images/preview/factovsk13_lobnya.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB

BIN
site_content/images/preview/factovsk228.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

BIN
site_content/images/preview/factovsk666.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 KiB

BIN
site_content/images/preview/iwantmge.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

BIN
site_content/images/preview/koth_sneed_plaza.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

1
site_content/images/preview/mge_facti_v1.url

@ -0,0 +1 @@
https://steamuserimages-a.akamaihd.net/ugc/1844794463034551146/011D59A5FF30F4721817E6F4A4C61BF1E1AA574D/?imw=512&imh=512

1
site_content/images/preview/mvm_ghost_town.url

@ -0,0 +1 @@
https://media.discordapp.net/attachments/684684947247988748/718119209401450556/FuMPrndsMvc.png

BIN
site_content/images/preview/tf_muhosransk.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

BIN
site_content/images/preview/world_of_korbal.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
site_content/images/preview/zavod_1_pivoupdate.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

BIN
site_content/images/preview/zavod_3_jirikupdate_v4.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 39 KiB

1
site_content/images/preview/zavod_446241_finalupdate.url

@ -0,0 +1 @@
https://steamuserimages-a.akamaihd.net/ugc/1646594327298079340/6B510A6CF3CAF5BFC213A2CBB0F709CEE89EA46A/?imw=512&imh=512

BIN
site_content/images/preview/zavod_4_obnovaupdate_v2.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

BIN
site_content/images/preview/zavodpipis.jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

89
site_content/js/API.js

@ -22,6 +22,7 @@
//https://icon-icons.com
const Keys = { Enter: 13 };
var api_response;
var api_prices;
function Steam3to64(steam3) {
var SID64_1 = "7656"
@ -50,7 +51,6 @@ $(async function() {
FillCharacters();
FillRules();
await CheckApi();
await RequestAPI();
if(window.location.href.endsWith("#RulesSection")){
@ -104,13 +104,22 @@ function generate_server_card_div(data){
<a href="#" class="stretched-link" ${data.status ? "" : "disabled"} id="ChoiceServerButton_${data.selfname.replaceAll(".","_")}" data-id="${data.selfname.replaceAll(".","_")}"></a>
<h4 class="card-title" style="color: whitesmoke;">${data.name}</h4>
<p class="card-text" style="color: whitesmoke; font-family: tf2build; font-size: 3rem; text-align: center;">${data.player_count}/${data.max_players}</p>
<h4 class="card-title" style="color: whitesmoke; text-align: right;">${data.human_name}</h4>
<h4 class="card-title" style="color: whitesmoke; text-align: right;">${human_name_impl(data)}</h4>
</div>
</div>
</div>
`
}
function human_name_impl(data){
let number = Math.abs(data.player_count) % 100;
let number_post = number % 10;
if (number > 10 && number < 20) { return data.naming[2]; }
if (number_post > 1 && number_post < 5) { return data.naming[1]; }
if (number_post == 1) { return data.naming[0] }
return data.naming[2];
}
function bind_ServerAboutClose(){
$('#Modal_ServerAbout_Close').click(async function (ev) {
ev.preventDefault();
@ -131,22 +140,12 @@ function bind_ServerAboutReportPlayer_Close(){
if($('#Modal_ServerAboutReportPlayer_reason').val().length < 32){
$("#Modal_ServerAboutReportPlayer_error").html("У тебя причина говно, сделай ее более красочной. Опиши подробнее где тебя трогали.");
} else {
fetch("https://tf2.pblr-nyk.pro/player_api/v1/report", {headers: {'Cache-Control':'no-cache'}, method:"GET"})
.then(res => res.json())
.then(res => {
if ("error" in res && "allow" in res) {
$("#Modal_ServerAboutReportPlayer_error").html(`Следующий репорт доступен через ${res.kd} секунд!`);
} else if ("error" in res) {
$("#Modal_ServerAboutReportPlayer_error").html(res.error);
return;
} else if ("allow" in res && res.allow == true) {
fetch(`https://tf2.pblr-nyk.pro/player_api/v1/report?server=${$('#Modal_ServerAboutReportPlayer_srv').text()}&id=${$('#Modal_ServerAboutReportPlayer_id').text()}&text=${$('#Modal_ServerAboutReportPlayer_reason').val()}`, {headers: {'Cache-Control':'no-cache'}, method:"POST"})
fetch(`https://tf2.pblr-nyk.pro/api/profile/current/report?steam64=${$('#Modal_ServerAboutReportPlayer_id').text()}&text=${$('#Modal_ServerAboutReportPlayer_reason').val()}`, {headers: {'Cache-Control':'no-cache'}, method:"POST"})
.then(res => res.json())
.then(res => {
$("#Modal_ServerAboutReportPlayer_error").html("Донос отправлен!");
});
}
})
if (res > 0) $("#Modal_ServerAboutReportPlayer_error").html("Донос отправлен!");
else $("#Modal_ServerAboutReportPlayer_error").html(`Подожди еще ${res*-1} секунд!`);
})
.catch(err => {$("#Modal_ServerAboutReportPlayer_error").html("Ошибка получения");});
}
//$("#Modal_ServerAboutReportPlayer_error").html("ЛОХ");
@ -157,16 +156,17 @@ function bind_ServerAboutReportPlayerButton(id){
$(id).click(async function (ev) {
ev.preventDefault();
$('#Modal_ServerAbout').modal('hide');
let data = ev.currentTarget.dataset.id.replaceAll("_",".").split("|", 2);
Modal_Fill_Report(data[0], data[1]);
let data = ev.currentTarget.dataset.id//.replaceAll("_",".").split("|", 2);
Modal_Fill_Report(data);
$('#Modal_ServerAboutReportPlayer').modal('show');
});
}
function Modal_Fill_Report(srv, player_id){
$(`#Modal_ServerAboutReportPlayer_name`).html(api_response.servers[srv].players[player_id].name);
$(`#Modal_ServerAboutReportPlayer_srv`).html(srv);
$(`#Modal_ServerAboutReportPlayer_id`).html(api_response.servers[srv].players[player_id].id);
function Modal_Fill_Report(player_id){
//$(`#Modal_ServerAboutReportPlayer_name`).html(api_response.servers[srv].players[player_id].name);
//$(`#Modal_ServerAboutReportPlayer_srv`).html(srv);
//$(`#Modal_ServerAboutReportPlayer_id`).html(api_response.servers[srv].players[player_id].id);
$(`#Modal_ServerAboutReportPlayer_id`).html(player_id);
}
function bind_ServerAboutButton(srv_name){
@ -258,13 +258,14 @@ function Modal_Fill_Choiced(srv){
return api_response.servers[srv].players[b].score - api_response.servers[srv].players[a].score;
});
for (const player_id in sorted_players) {
if (api_response.servers[srv].players[sorted_players[player_id]].id == 0) continue;
let player = api_response.servers[srv].players[sorted_players[player_id]];
modal_body += `
<tr>
<th scope="row"><a href="https://steamcommunity.com/profiles/${Steam3to64(player.steam2)}" target="_blank" class="player-in-list">${player.name}</a></th>
<th scope="row"><a href="${player.steam.community_url}" target="_blank" class="player-in-list">${player.name}</a></th>
<td>${player.score ? player.score : 0}</td>
<td>${player.duration}</td>
${allow_report?`<td><a href="#" id="Modal_ReportButton_${srv.replaceAll(".","_")}_${player.id}" data-id="${srv.replaceAll(".","_")}|${sorted_players[player_id]}"><img style="height:1rem" src="site_content/images/logo/report.svg" alt="report"></td>`:''}
${allow_report?`<td><a href="#" id="Modal_ReportButton_${player.steam.steam64}" data-id="${player.steam.steam64}"><img style="height:1rem" src="site_content/images/logo/report.svg" alt="report"></td>`:''}
</tr>
`;
}
@ -288,45 +289,33 @@ function Modal_Fill_Choiced(srv){
if(allow_report && api_response.servers[srv].status && api_response.servers[srv].player_count > 0) {
for (const player_id in api_response.servers[srv].players) {
player = api_response.servers[srv].players[player_id];
bind_ServerAboutReportPlayerButton(`#Modal_ReportButton_${srv.replaceAll(".","_")}_${player.id}`);
bind_ServerAboutReportPlayerButton(`#Modal_ReportButton_${player.steam.steam64}`);
}
}
}
async function CheckApi() {
let api_request_time = (new Date).getTime();
await fetch("https://tf2.pblr-nyk.pro/api", {headers: {'Cache-Control':'no-cache'}})
.then(res => res.text())
.then(res => {api_request_time = (new Date).getTime() - api_request_time})
.catch(err => {api_request_time = 0});
////////////////////////////////////////////
let player_api_request_time = (new Date).getTime();
await fetch("https://tf2.pblr-nyk.pro/player_api/v1/ping", {headers: {'Cache-Control':'no-cache'}})
.then(res => res.text())
.then(res => {player_api_request_time = (new Date).getTime() - player_api_request_time})
.catch(err => {player_api_request_time = 0});
////////////////////////////////////////////
FillFooter("", api_request_time, player_api_request_time);
}
async function RequestAPI() {
//let api_request_time = (new Date).getTime();
//, {headers: {'Cache-Control':'no-cache'}}
let api_request_time = (new Date).getTime();
await fetch("https://tf2.pblr-nyk.pro/api/stats", {headers: {'Cache-Control':'no-cache'}})
.then(res => res.json())
.then(res => {
api_request_time = (new Date).getTime() - api_request_time
FillFooter("", api_request_time, "disabled");
api_response = res;
FillServices(res);
// $('#current_players').text(res.servers.statistic.player_now)
$("#current_players").html(res.servers.statistic.player_now);
$("#max_per_day").html(res.servers.statistic.player_max);
$("#servers_works").html(`${res.servers.statistic.working_servers}/${res.servers.statistic.total_servers}`);
// $('#current_players').text(res.statistic.player_now)
$("#current_players").html(res.statistic.player_now);
$("#max_per_day").html(res.statistic.player_max);
$("#servers_works").html(`${res.statistic.working_servers}/${res.statistic.total_servers}`);
$("#uniq_day_players").html(res.uniq.day);
$("#uniq_month_players").html(res.uniq.month);
$("#uniq_year_players").html(res.uniq.year);
$("#ServersSectionLastUpdate").html(`Информация обновлена: ${UNIX2TIMESTAMP(res.updates.servers)}`);
$("#AboutSection_discord").html(`${res.discord_users} ГЕЙмеров `);
$("#AboutSection_vk").html(`${res.vk_users} Участников `);
$("#AboutSection_BuildDate").html(`${UNIX2TIMESTAMP(parseInt(res.builddate))}`);
$("#Section_VIP_users").html(`${res.vip_players} карликов уже имеют випку!`);
let active = false;
@ -377,6 +366,12 @@ async function RequestAPI() {
//FillFooter("", 0, 0);
});
await fetch("https://tf2.pblr-nyk.pro/api/external/vip", {headers: {'Cache-Control':'no-cache'}})
.then(res => res.json())
.then(res => {
api_prices = res;
})
//FillFooter("", api_request_time, "");
}
@ -395,13 +390,13 @@ function FillFooter(data, api_time, player_api_time){
} else {
document.getElementById("Footer_Text").insertAdjacentHTML("beforeend", text_good.replace("{text}", `${api_time} ms`));
}
/*
document.getElementById("Footer_Text").insertAdjacentHTML("beforeend", text.replace("{text}", ` | Player API: `));
if(player_api_time == 0) {
document.getElementById("Footer_Text").insertAdjacentHTML("beforeend", text_bad.replace("{text}", `not work`));
} else {
document.getElementById("Footer_Text").insertAdjacentHTML("beforeend", text_good.replace("{text}", `${player_api_time} ms`));
}
}*/
}
function FillServices(data) {

121
site_content/js/Player_API.js

@ -5,11 +5,21 @@ class CurrentUser {
}
fill_user() {
fetch("https://tf2.pblr-nyk.pro/player_api/v1/current_user", { credentials: "same-origin", headers: { 'Cache-Control': 'no-cache' } })
fetch("https://tf2.pblr-nyk.pro/api/profile/current", { credentials: "same-origin", headers: { 'Cache-Control': 'no-cache' } })
.then(response => response.json())
.catch(err => {
if (err.code == 429) {
$("#Header_CurrentUser").html("Слишком частые запросы с беку, обнови позднее позже!!");
$("#Header_Logout").html("");
return;
}
$("#Header_CurrentUser").html("Ошибка получения данных профиля! ");
$("#Header_Logout").html("(Обнови страницу для релога)");
return;
})
.then(response => {
if ("error" in response) {
console.log(response.error);
if (response == null || "error" in response) {
//console.log(response.error);
$("#Header_CurrentUser").html("Ошибка получения данных профиля! ");
$("#Header_Logout").html("(Обнови страницу для релога)")
return;
@ -37,30 +47,6 @@ class CurrentUser {
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 + '=([^;]+)'));
@ -72,7 +58,7 @@ let captcha_error_div = `<div class="col" id="ModalCaptchaErrorText"><h6 style="
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);
return new Date((permition.u_timestamp + permition.amount) * 1000);
}
function FillPlayerInfo(data) {
@ -272,6 +258,15 @@ function UNIX2FACTI_TIME(u_time) {
}
}
function human_name_impl_2(count, naming){
let number = Math.abs(count) % 100;
let number_post = number % 10;
if (number > 10 && number < 20) { return naming[2]; }
if (number_post > 1 && number_post < 5) { return naming[1]; }
if (number_post == 1) { return naming[0] }
return naming[2];
}
function ReconstructVipSection(data) {
$('#Modal_SelectPayMethod_Close').click(async function (ev) {
ev.preventDefault();
@ -280,7 +275,7 @@ function ReconstructVipSection(data) {
$('#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' } })
await fetch("https://tf2.pblr-nyk.pro/api/profile/current?requests=permition", { credentials: "same-origin", headers: { 'Cache-Control': 'no-cache' } })
.then(response => response.json())
.then(response => {
if (response.permition) {
@ -307,43 +302,66 @@ function ReconstructVipSection(data) {
$("#Modal_SelectPayMethod_ProfileLink").attr("href", data.steamids.community_url);
$("#Modal_SelectPayMethod_ProfileName").html(`Вип будет выдан: ${data.steam_data.nickname}`);
let price_array = new Array(
/*let price_array = new Array(
["1 месяц", 150, "1 ключ", "site_content/images/vip/VIP_1_MOUNTH.jpg", "month"],
["1 неделя", 75, "20 рефов", "site_content/images/vip/VIP_7_DAYS.jpg", "seven_day"],
["1 неделя", 75, "20 рефов", "site_content/images/vip/VIP_7_DAYS.jpg", "week"],
["1 день", 20, "5 рефов", "site_content/images/vip/VIP_1_DAY.jpg", "day"],
["1 день", 0, "бесплатно", "site_content/images/vip/freevip.jpg", "free"]
);
);*/
let vip_select;
for (const select in price_array) {
for (let price in api_prices) {
price = api_prices[price];
vip_select = `
<div class="col">
<div class="card">
<img class="card-img" src="${price_array[select][3]}" alt="${price_array[select][0]}">
<img class="card-img" src="${price.img_url}" alt="${price.human_duration}">
<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>
<a href="#" class="stretched-link" id="Section_VIP_buttons_${price.period}"></a>
<div class="mt-auto">
<h5 class="vip-card-text">${price_array[select][0]}</h5>
<h6 class="vip-card-text">${price_array[select][1]} Рублей</h6>
<h6 class="vip-card-text">${price_array[select][2]}</h6>
<h5 class="vip-card-text">${price.human_duration}</h5>
<h6 class="vip-card-text">${price.money_price} Рублей</h6>
<h6 class="vip-card-text">${price.item_price}</h6>
</div>
</div>
</div>
</div>
`
$(vip_select).appendTo("#Section_VIP_buttons");
$(`#Section_VIP_buttons_${price_array[select][4]}`).click(async function (ev) {
$(`#Section_VIP_buttons_${price.period}`).click(async function (ev) {
ev.preventDefault();
if(price_array[select][4] != "free"){
if(price.period != "free"){
$("#Modal_SelectPayMethod_PayButtons").show(0);
$("#Modal_SelectPayMethod_GetFreeButtons").hide(0);
$("#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_QIWI_Button").attr("href", QIWI_TRADE.replace("(AMOUNT)", price.money_price).replace("(COMMENT)", data.steamids.steam2.replace(":", "%3A")));
$("#Modal_SelectPayMethod_QIWI_Value").html(`${price.money_price} Рублей`);
$("#Modal_SelectPayMethod_STEAM_Button").attr("href", STEAM_TRADE);
$("#Modal_SelectPayMethod_STEAM_Value").html(price_array[select][2]);
$("#Modal_SelectPayMethod_STEAM_Value").html(price.item_price);
try {
let value_qiwi = price.period in api_response.donate.month.statistic.qiwi? api_response.donate.month.statistic.qiwi[price.period] : 0;
let value_name_1 = human_name_impl_2(value_qiwi, ["раз", "раза", "раз"])
$("#Modal_SelectPayMethod_DonateStatsValue_qiwi").html(`${value_qiwi} ${value_name_1}`);
let value_steam = price.period in api_response.donate.month.statistic.steam? api_response.donate.month.statistic.steam[price.period] : 0;
let value_name_2 = human_name_impl_2(value_steam, ["раз", "раза", "раз"])
$("#Modal_SelectPayMethod_DonateStatsValue_steam").html(`${value_steam} ${value_name_2}`);
$("#Modal_SelectPayMethod_DonateStatsText_FREE").hide(0);
$("#Modal_SelectPayMethod_DonateStatsValue").show(0);
$("#Modal_SelectPayMethod_DonateStatsText").show(0);
} catch {
$("#Modal_SelectPayMethod_DonateStatsValue").hide(0);
$("#Modal_SelectPayMethod_DonateStatsText").hide(0);
}
} else {
$("#Modal_SelectPayMethod_DonateStatsValue").hide(0);
$("#Modal_SelectPayMethod_DonateStatsText").hide(0);
$("#Modal_SelectPayMethod_PayButtons").hide(0);
$("#Modal_SelectPayMethod_GetFreeButtons").show(0);
let value_free = "day" in api_response.donate.month.statistic.free? api_response.donate.month.statistic.free.day : 0;
let value_free_naming = human_name_impl_2(value_free, ["раз", "раза", "раз"])
$("#Modal_SelectPayMethod_DonateStatsValue_free").html(`${value_free} ${value_free_naming}`);
$("#Modal_SelectPayMethod_DonateStatsText_FREE").show(0);
}
$('#Modal_SelectPayMethod').modal('show');
return false;
@ -353,7 +371,22 @@ function ReconstructVipSection(data) {
$("#Modal_SelectPayMethod_GetFreeButton_Check").click(async function (ev) {
ev.preventDefault();
alert("пошел нахуй");
await fetch("https://tf2.pblr-nyk.pro/api/profile/current/freevip", { credentials: "same-origin", headers: { 'Cache-Control': 'no-cache' }, method:"POST"})
.then(response => response.json())
.then(response => {
if (response == 0) $("#Modal_SelectPayMethod_GetFreeButton_Text").html("У тебя уже есть права!");
else if (response == 1) $("#Modal_SelectPayMethod_GetFreeButton_Text").html("Права выданы! Балдей!");
else if (response > 1) $("#Modal_SelectPayMethod_GetFreeButton_Text").html(`Ты не можешь получить вип бесплатно, вернись через ${UNIX2FACTI_TIME(response)}`);
else if (response < 0) $("#Modal_SelectPayMethod_GetFreeButton_Text").html(`Наиграй на сервере еще ${UNIX2FACTI_TIME(response * -1)}`);
else $("#Modal_SelectPayMethod_GetFreeButton_Text").html("Сегодня не твой день");
})
.catch(err => {
if (err.code == 429) {
$("#Modal_SelectPayMethod_GetFreeButton_Text").html("Помедленее друг, не так сильно");
} else {
$("#Modal_SelectPayMethod_GetFreeButton_Text").html("Сегодня не твой день, друг...");
}
});
});
//secret egg

Loading…
Cancel
Save