@ -15,12 +15,14 @@ async function CheckCurrentUser(){
var logout = document . getElementById ( "Header_Logout" ) ;
var logout = document . getElementById ( "Header_Logout" ) ;
current_user . href = "#" ;
current_user . href = "#" ;
if ( response . ban ) {
if ( response . ban ) {
current_user . innerHTML = ` Привет ${ response . steam_data . nickname } ! У меня хорошие новости! `
current_user . innerHTML = ` Привет ${ response . steam_data . nickname } ! У меня хорошие новости! ` ;
current_ban . innerHTML = "У тебя БАН! (нажми чтоб посмотреть его)" ;
current_ban . innerHTML = "У тебя БАН! (нажми чтоб посмотреть его)" ;
} else {
} else {
current_user . innerHTML = ` Привет ${ response . steam_data . nickname } ! `
current_user . innerHTML = ` Привет ${ response . steam_data . nickname } ! ` ;
}
}
logout . innerHTML = ` (нажми чтоб выйти) `
logout . innerHTML = ` (нажми чтоб выйти) ` ;
document . getElementById ( "profile_stats" ) . insertAdjacentHTML ( "beforeend" , FillPlayerInfo ( response ) ) ;
ReconstructVipSection ( response ) ;
}
}
} )
} )
}
}
@ -63,23 +65,27 @@ $('#check_profile_submit_button').click(async function(ev) {
return false ;
return false ;
} ) ;
} ) ;
$ ( document ) . on ( "show.bs.modal" , "#CaptchaModalHandler" , async function ( ) {
console . log ( "setup captcha modal" ) ;
let form_url = document . forms [ "formProfileSectionInput" ] ;
let form_captcha = document . forms [ "formCaptchaHandler" ] ;
let captcha_id ;
await RefreshCaptcha ( ) ;
async function RefreshCaptcha ( ) {
async function RefreshCaptcha ( ) {
await fetch ( "https://tf2.pblr-nyk.pro/player_api/v1/captcha" , { method : 'POST' } )
await fetch ( "https://tf2.pblr-nyk.pro/player_api/v1/captcha" , { method : 'POST' } )
. then ( response => response . json ( ) )
. then ( response => response . json ( ) )
. then ( response => {
. then ( response => {
console . log ( "captcha id: " + response . id ) ;
console . log ( "captcha id: " + response . id ) ;
captcha_id = response . id ;
// captcha_id = response.id;
form_captcha . captcha_img . src = "https://tf2.pblr-nyk.pro/player_api/v1/captcha?id=" + response . id ;
// form_captcha.captcha_img.src = "https://tf2.pblr-nyk.pro/player_api/v1/captcha?id=" + response.id;
return response . id ;
} ) ;
} ) ;
}
}
$ ( document ) . on ( "show.bs.modal" , "#CaptchaModalHandler" , async function ( ) {
console . log ( "setup captcha modal" ) ;
let form_url = document . forms [ "formProfileSectionInput" ] ;
let form_captcha = document . forms [ "formCaptchaHandler" ] ;
let captcha_id ;
const captchaId = await RefreshCaptcha ( ) ;
captcha_id = captchaId ;
form_captcha . captcha_img . src = "https://tf2.pblr-nyk.pro/player_api/v1/captcha?id=" + captchaId ;
$ ( '#check_captcha_submit_button' ) . click ( async function ( ev ) {
$ ( '#check_captcha_submit_button' ) . click ( async function ( ev ) {
//ev.preventDefault();
//ev.preventDefault();
if ( $ ( '#ModalCaptchaErrorText' ) ) { $ ( '#ModalCaptchaErrorText' ) . remove ( ) ; }
if ( $ ( '#ModalCaptchaErrorText' ) ) { $ ( '#ModalCaptchaErrorText' ) . remove ( ) ; }
@ -128,12 +134,13 @@ $(document).on("show.bs.modal", "#CaptchaModalHandler", async function () {
} else {
} else {
console . log ( response ) ;
console . log ( response ) ;
document . getElementById ( "profile_stats" ) . insertAdjacentHTML ( "beforeend" , FillPlayerInfo ( response ) ) ;
document . getElementById ( "profile_stats" ) . insertAdjacentHTML ( "beforeend" , FillPlayerInfo ( response ) ) ;
ReconstructVipSection ( response ) ;
//ReconstructVipSection(response);
$ ( '#check_captcha_close_button' ) . click ( ) ;
$ ( '#check_captcha_close_button' ) . click ( ) ;
}
}
form_captcha . captcha . value = '' ;
form_captcha . captcha . value = '' ;
} ) ;
} ) ;
} } ) ;
}
} ) ;
function CalculateVipEndDate ( permition ) {
function CalculateVipEndDate ( permition ) {
return new Date ( ( permition [ "UNIX_TIMESTAMP(`reg_date`)" ] + permition . amount ) * 1000 ) ;
return new Date ( ( permition [ "UNIX_TIMESTAMP(`reg_date`)" ] + permition . amount ) * 1000 ) ;
@ -344,7 +351,7 @@ function ReconstructVipSection(data){
$ ( '#Modal_SelectPayMethod_CheckVIP' ) . click ( async function ( ev ) {
$ ( '#Modal_SelectPayMethod_CheckVIP' ) . click ( async function ( ev ) {
ev . preventDefault ( ) ;
ev . preventDefault ( ) ;
await fetch ( "https://tf2.pblr-nyk.pro/player_api/v1/player/permitions?steam_url=" + document . forms [ "formProfileSectionInput" ] . steamurl . value )
await fetch ( "https://tf2.pblr-nyk.pro/player_api/v1/player/permitions?steam_url=" + document . forms [ "formProfileSectionInput" ] . steamurl . value , { credentials : "same-origin" , headers : { 'Cache-Control' : 'no-cache' } } )
. then ( response => response . json ( ) )
. then ( response => response . json ( ) )
. then ( response => {
. then ( response => {
if ( response . permition ) {
if ( response . permition ) {