@ -1,34 +1,36 @@
$ ( async function ( ) {
$ ( async function ( ) {
await CheckCurrentUser ( ) ;
} )
async function CheckCurrentUser ( ) {
if ( ! check_cookie_name ( "steam64" ) ) { return ; }
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 {
var current_user = document . getElementById ( "Header_CurrentUser" ) ;
var current_ban = document . getElementById ( "Header_CurrentBan" ) ;
var logout = document . getElementById ( "Header_Logout" ) ;
current_user . href = "#" ;
if ( response . ban ) {
current_user . innerHTML = ` Привет ${ response . steam_data . nickname } ! У меня хорошие новости! `
current_ban . innerHTML = "У тебя БАН! (нажми чтоб посмотреть его)" ;
async function CheckCurrentUser ( ) {
if ( ! check_cookie_name ( "steam64" ) ) { return ; }
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 {
current_user . innerHTML = ` Привет ${ response . steam_data . nickname } ! `
var current_user = document . getElementById ( "Header_CurrentUser" ) ;
var current_ban = document . getElementById ( "Header_CurrentBan" ) ;
var logout = document . getElementById ( "Header_Logout" ) ;
current_user . href = "#" ;
if ( response . ban ) {
current_user . innerHTML = ` Привет ${ response . steam_data . nickname } ! У меня хорошие новости! ` ;
current_ban . innerHTML = "У тебя БАН! (нажми чтоб посмотреть его)" ;
} else {
current_user . innerHTML = ` Привет ${ response . steam_data . nickname } ! ` ;
}
logout . innerHTML = ` (нажми чтоб выйти) ` ;
document . getElementById ( "profile_stats" ) . insertAdjacentHTML ( "beforeend" , FillPlayerInfo ( response ) ) ;
ReconstructVipSection ( response ) ;
}
logout . innerHTML = ` (нажми чтоб выйти) `
}
} )
} )
}
function check_cookie_name ( name ) {
var match = document . cookie . match ( new RegExp ( '(^| )' + name + '=([^;]+)' ) ) ;
if ( match && match [ 2 ] != "None" ) { return true ; }
else { return false ; }
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> `
@ -36,18 +38,18 @@ let ProfileLinkError_div = `<div class="col" id="ProfileLinkIsNotFull"><h6 style
console . log ( "puk" ) ;
//buttonCheckProfile
$ ( '#check_captcha_close_button' ) . click ( async function ( ev ) {
$ ( '#check_captcha_close_button' ) . click ( async function ( ev ) {
ev . preventDefault ( ) ;
$ ( '#CaptchaModalHandler' ) . modal ( 'hide' ) ;
} ) ;
document . getElementById ( "check_profile_submit_button" ) . addEventListener ( "keypress" , async function ( ev ) {
document . getElementById ( "check_profile_submit_button" ) . addEventListener ( "keypress" , async function ( ev ) {
ev . preventDefault ( ) ;
console . log ( ev . key ) ;
return false ;
} ) ;
$ ( '#check_profile_submit_button' ) . click ( async function ( ev ) {
$ ( '#check_profile_submit_button' ) . click ( async function ( ev ) {
//ev.preventDefault();
console . log ( "check profile button presed" ) ;
if ( document . getElementById ( "ProfileLinkIsNotFull" ) ) {
@ -55,7 +57,7 @@ $('#check_profile_submit_button').click(async function(ev) {
}
if ( ! document . forms [ "formProfileSectionInput" ] . steamurl . value . startsWith ( "https://" ) ) {
document . getElementById ( "formProfileSectionInputHelpText" ) . insertAdjacentHTML ( "beforeend" , ProfileLinkError_div ) ;
document . getElementById ( "formProfileSectionInputHelpText" ) . insertAdjacentHTML ( "beforeend" , ProfileLinkError_div ) ;
//document.getElementById("profile").innerHTML = "Долбаеб введи ссылку на профиль!";
} else {
$ ( '#CaptchaModalHandler' ) . modal ( 'show' ) ;
@ -63,34 +65,38 @@ $('#check_profile_submit_button').click(async function(ev) {
return false ;
} ) ;
async function RefreshCaptcha ( ) {
await fetch ( "https://tf2.pblr-nyk.pro/player_api/v1/captcha" , { method : 'POST' } )
. then ( response => response . json ( ) )
. then ( response => {
console . log ( "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;
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 ;
await RefreshCaptcha ( ) ;
async function RefreshCaptcha ( ) {
await fetch ( "https://tf2.pblr-nyk.pro/player_api/v1/captcha" , { method : 'POST' } )
. then ( response => response . json ( ) )
. then ( response => {
console . log ( "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 ;
} ) ;
}
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 ) {
//ev.preventDefault();
if ( $ ( '#ModalCaptchaErrorText' ) ) { $ ( '#ModalCaptchaErrorText' ) . remove ( ) ; }
if ( $ ( '#ModalCaptchaErrorText' ) ) { $ ( '#ModalCaptchaErrorText' ) . remove ( ) ; }
await CheckAndFill ( ev ) ;
return false ;
} ) ;
async function CheckAndFill ( event ) {
if ( form_captcha . captcha . value . length == 0 ) {
if ( ! document . getElementById ( "captcha_error" ) ) {
document . getElementById ( "InvalidCaptchaTextArea" ) . insertAdjacentHTML ( "beforeend" , captcha_error_div ) ;
if ( form_captcha . captcha . value . length == 0 ) {
if ( ! document . getElementById ( "captcha_error" ) ) {
document . getElementById ( "InvalidCaptchaTextArea" ) . insertAdjacentHTML ( "beforeend" , captcha_error_div ) ;
}
document . getElementById ( "captcha_error" ) . innerHTML = "Капчу введи!" ;
return ;
@ -98,7 +104,7 @@ $(document).on("show.bs.modal", "#CaptchaModalHandler", async function () {
$ ( "#check_captcha_close_button" ) . prop ( "disabled" , true ) ;
$ ( "#check_captcha_submit_button" ) . prop ( "disabled" , true ) ;
if ( document . getElementById ( "current_profile" ) ) {
if ( document . getElementById ( "current_profile" ) ) {
document . getElementById ( "current_profile" ) . remove ( ) ;
}
console . log ( new Date ( ) ) ;
@ -110,8 +116,8 @@ $(document).on("show.bs.modal", "#CaptchaModalHandler", async function () {
/////////////////////////////////////////////////////////
if ( "error" in response ) {
console . log ( ` id: ${ captcha_id } error: ${ response } ` ) ;
if ( ! document . getElementById ( "captcha_error" ) ) {
document . getElementById ( "InvalidCaptchaTextArea" ) . insertAdjacentHTML ( "beforeend" , captcha_error_div ) ;
if ( ! document . getElementById ( "captcha_error" ) ) {
document . getElementById ( "InvalidCaptchaTextArea" ) . insertAdjacentHTML ( "beforeend" , captcha_error_div ) ;
}
if ( response . error == "incorrect captcha" ) {
document . getElementById ( "captcha_error" ) . innerHTML = "Капча невалидна, попробуй снова!" ;
@ -120,32 +126,33 @@ $(document).on("show.bs.modal", "#CaptchaModalHandler", async function () {
}
RefreshCaptcha ( ) ;
} else if ( "detail" in response ) {
if ( ! document . getElementById ( "captcha_error" ) ) {
document . getElementById ( "InvalidCaptchaTextArea" ) . insertAdjacentHTML ( "beforeend" , captcha_error_div ) ;
if ( ! document . getElementById ( "captcha_error" ) ) {
document . getElementById ( "InvalidCaptchaTextArea" ) . insertAdjacentHTML ( "beforeend" , captcha_error_div ) ;
}
document . getElementById ( "captcha_error" ) . innerHTML = "Ошибка: " + response . detail [ 0 ] . msg ;
RefreshCaptcha ( ) ;
} else {
console . log ( response ) ;
document . getElementById ( "profile_stats" ) . insertAdjacentHTML ( "beforeend" , FillPlayerInfo ( response ) ) ;
ReconstructVipSection ( response ) ;
document . getElementById ( "profile_stats" ) . insertAdjacentHTML ( "beforeend" , FillPlayerInfo ( response ) ) ;
//ReconstructVipSection(response);
$ ( '#check_captcha_close_button' ) . click ( ) ;
}
form_captcha . captcha . value = '' ;
} ) ;
} } ) ;
} ) ;
}
} ) ;
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 ) ;
}
function FillPlayerInfo ( data ) {
let player_ban_div = "" ;
if ( data . ban ) {
if ( data . ban ) {
let player_ban_length ;
if ( data . ban . ban_length > 0 ) {
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 {
@ -179,23 +186,23 @@ function FillPlayerInfo(data) {
let player_permition_div ;
let player_permition_length = "" ;
let player_permition_continue = ` (купить) ` ;
if ( data . permition ) {
if ( data . permition ) {
let player_permition_status ;
if ( data . permition . status == "VIP" ) {
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 ) {
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 ( ) ;
document . getElementById ( "Modal_SelectPayMethod_CheckVIP_EndDate" ) . innerHTML = ` До: ${ player_permition_end_date } ` ;
if ( date . getTime ( ) - new Date ( ) . getTime ( ) > 604800000 ) {
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 ) {
} 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 ` ;
@ -212,7 +219,7 @@ function FillPlayerInfo(data) {
< p class = "current-profile-text current-profile-bigtext" > Имеется < / p > < a h r e f = " # " o n c l i c k = " d o c u m e n t . g e t E l e m e n t B y I d ( ' T a b _ V I P _ B u t t o n ' ) . c l i c k ( ) ; " c l a s s = " c u r r e n t - p r o f i l e - t e x t c u r r e n t - p r o f i l e - b i g t e x t $ { p l a y e r _ p e r m i t i o n _ e n d _ d a t e _ c o l o r _ s t a t u s } " > $ { p l a y e r _ p e r m i t i o n _ c o n t i n u e } < / a >
`
} else {
player_permition_status = `
< p class = "current-profile-text current-profile-bigtext" > Статус $ { data . permition . status } : < / p >
@ -256,14 +263,14 @@ function FillPlayerInfo(data) {
< p class = "current-profile-text" > zavod_3 - 1 день 2 : 19 : 13 < / p >
< / d i v >
* /
if ( data . gametime ) {
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 ] ) {
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 ] ;
@ -310,9 +317,9 @@ function FillPlayerInfo(data) {
return player_data_div ;
}
function UNIX2FACTI_TIME ( u_time ) {
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 ] ;
@ -321,50 +328,50 @@ function UNIX2FACTI_TIME(u_time){
h = divmod ( h , 24 ) [ 1 ] ;
//бля простите я тупой
if ( ! s & ! m & ! h & ! d ) {
if ( ! s & ! m & ! h & ! d ) {
return "не играл" ;
}
let time = ` ${ h > 9 ? h : '0' + h } : ${ m > 9 ? m : '0' + m } : ${ s > 9 ? s : '0' + s } ` ;
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 ) {
} else if ( d < 2 ) {
return ` ${ d } день ${ time } ` ;
} else {
return ` ${ d } дней ${ time } ` ;
}
}
function ReconstructVipSection ( data ) {
$ ( '#Modal_SelectPayMethod_Close' ) . click ( async function ( ev ) {
function ReconstructVipSection ( data ) {
$ ( '#Modal_SelectPayMethod_Close' ) . click ( async function ( ev ) {
ev . preventDefault ( ) ;
$ ( '#Modal_SelectPayMethod' ) . modal ( 'hide' ) ;
} ) ;
$ ( '#Modal_SelectPayMethod_CheckVIP' ) . click ( async function ( ev ) {
$ ( '#Modal_SelectPayMethod_CheckVIP' ) . click ( async function ( ev ) {
ev . preventDefault ( ) ;
await fetch ( "https://tf2.pblr-nyk.pro/player_api/v1/player/permitions?steam_url=" + document . forms [ "formProfileSectionInput" ] . steamurl . value )
. then ( response => response . json ( ) )
. then ( response => {
if ( response . permition ) {
document . getElementById ( "Modal_SelectPayMethod_CheckVIP_Status" ) . innerHTML = "(имеется)" ;
document . getElementById ( "Modal_SelectPayMethod_CheckVIP_Status" ) . style += "color: green;" ;
if ( response . permition . amount ) {
document . getElementById ( "Modal_SelectPayMethod_CheckVIP_EndDate" ) . innerHTML = ` До: ${ CalculateVipEndDate ( response . permition ) . toLocaleString ( ) } ` ;
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 => {
if ( response . permition ) {
document . getElementById ( "Modal_SelectPayMethod_CheckVIP_Status" ) . innerHTML = "(имеется)" ;
document . getElementById ( "Modal_SelectPayMethod_CheckVIP_Status" ) . style += "color: green;" ;
if ( response . permition . amount ) {
document . getElementById ( "Modal_SelectPayMethod_CheckVIP_EndDate" ) . innerHTML = ` До: ${ CalculateVipEndDate ( response . permition ) . toLocaleString ( ) } ` ;
} else {
document . getElementById ( "Modal_SelectPayMethod_CheckVIP_EndDate" ) . innerHTML = ` бесконечность не предел ` ;
}
} else {
document . getElementById ( "Modal_SelectPayMethod_CheckVIP_EndDate" ) . innerHTML = ` бесконечность не предел ` ;
document . getElementById ( "Modal_SelectPayMethod_CheckVIP_Status" ) . innerHTML = "(отсутствует)" ;
document . getElementById ( "Modal_SelectPayMethod_CheckVIP_Status" ) . style += "color: red;" ;
document . getElementById ( "Modal_SelectPayMethod_CheckVIP_EndDate" ) . innerHTML = ` Время проверки: ${ new Date ( ) . toLocaleString ( ) } ` ;
}
} else {
document . getElementById ( "Modal_SelectPayMethod_CheckVIP_Status" ) . innerHTML = "(отсутствует)" ;
document . getElementById ( "Modal_SelectPayMethod_CheckVIP_Status" ) . style += "color: red;" ;
document . getElementById ( "Modal_SelectPayMethod_CheckVIP_EndDate" ) . innerHTML = ` Время проверки: ${ new Date ( ) . toLocaleString ( ) } ` ;
}
} ) ;
} ) ;
} ) ;
//document.getElementById("Section_VIP_check_profile")?document.getElementById("Section_VIP_check_profile").remove():null;
while ( document . getElementById ( "Section_VIP_buttons" ) . firstChild ) {
while ( document . getElementById ( "Section_VIP_buttons" ) . firstChild ) {
document . getElementById ( "Section_VIP_buttons" ) . lastChild . remove ( ) ;
}
@ -380,10 +387,10 @@ function ReconstructVipSection(data){
[ "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 ) {
for ( const select in price_array ) {
vip_select = `
< div class = "col" >
< div class = "card" >
@ -401,9 +408,9 @@ function ReconstructVipSection(data){
< / d i v >
`
document . getElementById ( "Section_VIP_buttons" ) . insertAdjacentHTML ( "beforeend" , vip_select ) ;
$ ( ` #Section_VIP_buttons_ ${ price_array [ select ] [ 4 ] } ` ) . click ( async function ( ev ) {
$ ( ` #Section_VIP_buttons_ ${ price_array [ select ] [ 4 ] } ` ) . click ( async function ( ev ) {
ev . preventDefault ( ) ;
document . getElementById ( 'Modal_SelectPayMethod_QIWI_Button' ) . href = QIWI_TRADE . replace ( "(AMOUNT)" , price_array [ select ] [ 1 ] ) . replace ( "(COMMENT)" , data . steamids . steam2 . replace ( ":" , "%3A" ) ) ;
document . getElementById ( 'Modal_SelectPayMethod_QIWI_Button' ) . href = QIWI_TRADE . replace ( "(AMOUNT)" , price_array [ select ] [ 1 ] ) . replace ( "(COMMENT)" , data . steamids . steam2 . replace ( ":" , "%3A" ) ) ;
document . getElementById ( 'Modal_SelectPayMethod_QIWI_Value' ) . innerHTML = ` ${ price_array [ select ] [ 1 ] } Рублей ` ;
document . getElementById ( 'Modal_SelectPayMethod_STEAM_Button' ) . href = STEAM_TRADE ;
document . getElementById ( 'Modal_SelectPayMethod_STEAM_Value' ) . innerHTML = price_array [ select ] [ 2 ] ;
@ -449,13 +456,13 @@ $('#Section_VIP_buttons_month').click(async function(ev) {
let konami_code = "" ;
let activated = false ;
document . addEventListener ( 'keypress' , ( event ) => {
if ( activated ) { return ; }
if ( activated ) { return ; }
konami_code += event . key ;
if ( konami_code . length == 6 || event . key == "-" ) {
if ( konami_code == "nigger" ) {
if ( konami_code . length == 6 || event . key == "-" ) {
if ( konami_code == "nigger" ) {
activated = true ;
document . getElementById ( "Tab_About" ) . href = "#SecretEgg" ;
document . getElementById ( "Tab_About" ) . href = "#SecretEgg" ;
$ ( '.nav-pills a[href="#SecretEgg"]' ) . tab ( 'show' ) ;
( new Audio ( "site_content/sounds/sunboy-ledi-night-16.mp3" ) ) . play ( ) ;
document . getElementById ( "Nav_MenuButtons" ) . remove ( )