class BotDetector
{
public function isBot()
{
$userAgent = $_SERVER['HTTP_USER_AGENT'];
$botPatterns = [
'/bot/i',
'/crawler/i',
'/spider/i',
'/curl/i',
'/facebookexternalhit/i',
'/twitterbot/i',
'/pingdom/i',
'/google/i',
'/yahoo/i',
'/bing/i'
// Добавьте другие паттерны для определения ботов по User-Agent
];
foreach ($botPatterns as $pattern) {
if (preg_match($pattern, $userAgent)) {
return true;
}
}
return false;
}
}
$(window).on('scroll', () => {
var windowScrollPosition = $(window).scrollTop();
$( '.comment' ).each( function ( index ) {
var blockPosition = $( this ).offset().top;
if( blockPosition < windowScrollPosition ) {
console.log('ok' + $( this ).attr('uniqid'));
$(this).removeClass('comment');
}
})
});