Models
- Albums
') >= 0) {
window.location = url;
return false;
}
}
return true;
},
afterShow: function() {
if (!afterShowCallback) {
this.inner.find('[data-form="ajax"]').each(function () {
utilitiesAjaxForm($(this));
});
this.inner.find('[data-form="ajax-upload"]').each(function () {
initVideoUploadForm($(this));
});
this.inner.find('[data-fancybox="ajax"]').each(function() {
$(this).click(function(e) {
e.preventDefault();
utilitiesAjaxFancyBox($(this), this.href || $(this).attr('data-href'));
});
});
}
utilitiesLoadSmileys(this.inner);
if (afterShowCallback) {
afterShowCallback.call(this);
}
},
beforeClose: function() {
if (this.inner.find('[data-fancybox="refresh"]').exists()) {
if ($sender && $sender.attr('data-fancybox-refresh-id')) {
utilitiesReloadBlock($sender.attr('data-fancybox-refresh-id'), $sender, false, true);
} else {
window.location.reload();
}
} else if ($sender && $sender.attr('data-fancybox-refresh-id')) {
utilitiesReloadBlock($sender.attr('data-fancybox-refresh-id'), $sender, false, true);
}
return true;
},
helpers: {
overlay: {closeClick: false}
},
type: 'ajax',
topRatio: 0.3
});
};
var utilitiesReloadBlock = function(blockId, sender, scroll, animate) {
if (!blockId) {
window.location.reload();
return;
}
var params = null;
if (storage[blockId]) {
params = storage[blockId];
}
var args = {};
args.success = function (sender, html) {
storage[blockId] = params;
var animationOpacity = 0.1;
if (!animate) {
animationOpacity = 1;
}
if (scroll) {
utilitiesScrollTo($('#' + blockId));
}
$('#' + blockId).animate({opacity: animationOpacity}, animationSpeed, function () {
var div = document.createElement('div');
div.innerHTML = html;
var content = $(div).children().first();
$(content).css('opacity', animationOpacity);
$(this).replaceWith(content);
$('#' + blockId).animate({opacity: 1}, animationSpeed);
initAjaxLists($('#' + blockId));
});
};
var errorTries = 0;
args.error = function () {
errorTries++;
var hasFromParameter = false;
for (var paramName in params) {
if (params.hasOwnProperty(paramName)) {
if (paramName.indexOf('from') == 0 && parseInt(params[paramName])>1) {
params[paramName] = parseInt(params[paramName]) - 1;
if (errorTries > 1) {
params[paramName] = 1;
}
hasFromParameter = true;
}
}
}
if (!hasFromParameter) {
params = null;
}
if (errorTries > 1) {
delete args.error;
}
utilitiesGetBlock(blockId, sender, args, params);
};
utilitiesGetBlock(blockId, sender, args, params);
};
var initMenu = function () {
$('.navigation button').click(function() {
$(this).parents('.navigation').toggleClass('open');
});
};
var initTabs = function () {
var $tabLinks = $('.tabs-menu li a');
if ($tabLinks.exists()) {
var tabLinks = {};
var tabQuery = '';
var currentActiveTab = '';
$tabLinks.each(function() {
if ($(this).attr('href').indexOf('#') == 0) {
var tabId = $(this).attr('href');
if (!currentActiveTab || tabId == window.location.hash) {
currentActiveTab = tabId;
}
tabLinks[tabId] = $(this);
tabQuery += ',' + tabId;
}
});
var $tabs = $(tabQuery ? tabQuery.substr(1) : '');
$tabs.hide();
if (currentActiveTab) {
tabLinks[currentActiveTab].addClass('active');
$(currentActiveTab).show();
}
$tabLinks.click(function(e) {
if ($(this).attr('href').indexOf('#') == 0) {
e.preventDefault();
var tabId = $(this).attr('href');
$tabLinks.removeClass('active');
$tabs.hide();
$(tabId).show();
if (tabLinks[tabId]) {
tabLinks[tabId].addClass('active');
}
$(window).trigger('scroll');
}
});
}
};
var initFancyBox = function () {
$('[data-fancybox="ajax"]').each(function() {
$(this).click(function(e) {
e.preventDefault();
utilitiesAjaxFancyBox($(this), this.href || $(this).attr('data-href'));
});
});
$('.block-album .images a.item, .block-screenshots a.item, .list-albums-images a, .list-videos-screenshots a').fancybox({
openEffect: 'none',
closeEffect: 'none',
prevEffect: 'none',
nextEffect: 'none',
helpers: {
title: {
type: 'inside'
},
buttons: {
position: 'bottom'
}
}
});
if (window.location.href.indexOf('?login') > 0) {
$('#login').click();
}
if (window.location.href.indexOf('?signup') > 0) {
$('#signup').click();
}
};
var initRating = function () {
var $ratingContainer = $('.rating-container');
var $links = $ratingContainer.find('.rate-like, .rate-dislike');
$links.click(function(e) {
e.preventDefault();
var $link = $(this);
if ($link.hasClass('disabled') || $link.hasClass('voted')) {
return;
}
var vote = parseInt($link.attr('data-vote')) || 0;
var videoId = $link.attr('data-video-id');
var albumId = $link.attr('data-album-id');
var playlistId = $link.attr('data-playlist-id');
var postId = $link.attr('data-post-id');
var modelId = $link.attr('data-model-id');
var csId = $link.attr('data-cs-id');
var dvdId = $link.attr('data-dvd-id');
var flagId = $link.attr('data-flag-id');
if (videoId || albumId || playlistId || modelId || csId || postId || dvdId) {
utilitiesAjaxRequest($link, {action: 'rate', video_id: videoId, album_id: albumId, playlist_id: playlistId, model_id: modelId, cs_id: csId, post_id: postId, dvd_id: dvdId, vote: vote}, function(json) {
if (json['status']=='success') {
$links.addClass('disabled');
$link.removeClass('disabled').addClass('voted');
$ratingContainer.find('.voters').html($ratingContainer.find('.voters').attr('data-success'));
var $scale = $ratingContainer.find('.scale');
var oldRating = parseFloat($scale.attr('data-rating'));
var oldRatingVotes = parseInt($scale.attr('data-votes'));
if (oldRatingVotes > 0) {
if (oldRating == 0) {
oldRatingVotes = 0;
}
var newRating = (oldRating * oldRatingVotes + vote) / (oldRatingVotes + 1) / 5 * 100;
if (newRating > 100) {
newRating = 100;
}
$ratingContainer.find('.scale').css({width: newRating + '%'});
}
} else {
$links.addClass('disabled');
$ratingContainer.find('.voters').html($ratingContainer.find('.voters').attr('data-error'));
}
});
if (flagId) {
utilitiesAjaxRequest($link, {action: 'flag', video_id: videoId, album_id: albumId, playlist_id: playlistId, postId: postId, dvdId: dvdId, flag_id: flagId}, function() {});
}
}
});
};
var initAddToFavourites = function () {
$('body').on('click', '.btn-favourites li a', function (e) {
var $link = $(this);
var videoId = $link.attr('data-video-id');
var videoUrl = $link.attr('data-video-dir'); // Используем этот URL
var albumId = $link.attr('data-album-id');
var favType = $link.attr('data-fav-type') || 0;
var createPlaylistUrl = $link.attr('data-create-playlist-url');
var playlistId = $link.attr('data-playlist-id') || 0;
if (videoId || albumId) {
e.preventDefault();
if ($link.hasClass('delete')) {
utilitiesAjaxRequest2(videoUrl, $link.parents('li'), {action: 'delete_from_favourites', video_id: videoId, album_id: albumId, fav_type: favType, playlist_id: playlistId}, function(json) {
if (json['status'] == 'success') {
if (playlistId > 0) {
$link.parents('li').addClass('hidden');
$link.parents('ul').find('#add_playlist_' + playlistId).removeClass('hidden');
} else {
$link.parents('li').addClass('hidden');
$link.parents('ul').find('#add_fav_' + favType).removeClass('hidden');
}
}
});
} else {
if (favType == 10 && !playlistId) {
if (createPlaylistUrl) {
utilitiesAjaxFancyBox($link, createPlaylistUrl, function () {
var $form = this.inner.find('form');
utilitiesAjaxForm($form, {
success: function($form, newPlaylistData) {
$.fancybox.close();
newPlaylistData = $(newPlaylistData);
var $playlistDiv = newPlaylistData.find('[data-playlist-id]');
playlistId = $playlistDiv.attr('data-playlist-id');
var playlistTitle = $playlistDiv.attr('data-playlist-title');
if (playlistId) {
utilitiesAjaxRequest2(videoUrl, $link.parents('li'), {action: 'add_to_favourites', video_id: videoId, album_id: albumId, fav_type: favType, playlist_id: playlistId}, function(json) {
if (json['status'] == 'success') {
$('.btn-favourites ul.playlist-sublist').each(function() {
var $ul = $(this);
var $newAddItem = $ul.find('#add_playlist_').clone(true, true);
$newAddItem.find('a').each(function() {
$(this).attr('data-playlist-id', playlistId);
$(this).attr('href', $(this).attr('href').replace('%ID%', playlistId));
$(this).html($(this).html().replace('%1%', playlistTitle));
});
$newAddItem.attr('id', 'add_playlist_' + playlistId);
$ul.prepend($newAddItem);
var $newDeleteItem = $ul.find('#delete_playlist_').clone(true, true);
$newDeleteItem.find('a').each(function() {
$(this).attr('data-playlist-id', playlistId);
$(this).attr('href', $(this).attr('href').replace('%ID%', playlistId));
$(this).html($(this).html().replace('%1%', playlistTitle));
});
$newDeleteItem.attr('id', 'delete_playlist_' + playlistId);
$ul.prepend($newDeleteItem);
if ($ul.is($link.parents('ul.playlist-sublist'))) {
$newDeleteItem.removeClass('hidden');
} else {
$newDeleteItem.addClass('hidden');
$newAddItem.removeClass('hidden');
}
});
}
});
}
}
});
});
}
} else {
utilitiesAjaxRequest2(videoUrl, $link.parents('li'), {action: 'add_to_favourites', video_id: videoId, album_id: albumId, fav_type: favType, playlist_id: playlistId}, function(json) {
if (json['status'] == 'success') {
if (playlistId > 0) {
$link.parents('li').addClass('hidden');
$link.parents('ul').find('#delete_playlist_' + playlistId).removeClass('hidden');
} else {
$link.parents('li').addClass('hidden');
$link.parents('ul').find('#delete_fav_' + favType).removeClass('hidden');
}
}
});
}
}
}
});
};
var initErrorFlaggingForm = function () {
var $blockFlagging = $('.block-flagging');
if ($blockFlagging.exists()) {
var $flaggingForm = $blockFlagging.find('form');
if ($flaggingForm.exists()) {
$flaggingForm.each(function () {
utilitiesAjaxForm($(this), {
success: function($form) {
$form.find('.success').show();
$form.find('.block-radios, .block-textarea').hide();
}
});
});
}
}
};
var initShareForm = function () {
var $blockShare = $('.block-share');
if ($blockShare.exists()) {
if (typeof window['getEmbed'] == 'function') {
$blockShare.find('.embed-code').val(window['getEmbed']());
}
$blockShare.find('.embed-button').click(function (e) {
e.preventDefault();
if (typeof window['getEmbed'] == 'function') {
var embedSize = $(this).attr('data-embed-size');
if (embedSize && embedSize.indexOf('x') > 0) {
var embedWidth = parseInt(embedSize.substr(0, embedSize.indexOf('x')));
var embedHeight = parseInt(embedSize.substr(embedSize.indexOf('x') + 1));
$blockShare.find('.embed-code').val(window['getEmbed'](embedWidth, embedHeight));
}
}
});
$blockShare.find('.embed-code-custom-width, .embed-code-custom-height').on('keyup blur', function () {
var $widthField = $blockShare.find('.embed-code-custom-width');
var $heightField = $blockShare.find('.embed-code-custom-height');
if (parseInt($widthField.val()) && parseInt($heightField.val())) {
$blockShare.find('.embed-code-custom-width-label').html(parseInt($widthField.val()));
$blockShare.find('.embed-code-custom-height-label').html(parseInt($heightField.val()));
$blockShare.find('.embed-button-custom').attr('data-embed-size', parseInt($widthField.val()) + 'x' + parseInt($heightField.val()));
}
});
}
};
var initCommentForm = function () {
var $blockComments = $('.block-comments');
var $blockNewComment = $blockComments.find('.block-new-comment');
if ($blockComments.exists() && $blockNewComment.exists()) {
$blockComments.find('.toggle-button').click(function (e) {
e.preventDefault();
$(this).toggleClass('active');
$blockNewComment.toggle();
$blockComments.find('.success').hide();
if ($blockNewComment.is(':visible')) {
var $captcha = $blockNewComment.find('.captcha-control img');
if ($captcha.exists()) {
if ($captcha.attr('data-src')) {
$captcha.attr('src', $captcha.attr('data-src').replace(new RegExp('rand=\\d+'),'rand=' + new Date().getTime()));
} else {
$captcha.attr('src', $captcha.attr('src').replace(new RegExp('rand=\\d+'),'rand=' + new Date().getTime()));
}
}
}
utilitiesLoadSmileys($blockNewComment);
});
var $commentsForm = $blockComments.find('form');
if ($commentsForm.exists()) {
utilitiesAjaxForm($commentsForm, {
success: function($form, newCommentData) {
var $anonymousUsernameField = $form.find('[name="anonymous_username"]');
var anonymousUsername = $anonymousUsernameField.val();
if (anonymousUsername) {
$.cookie('kt_anonymous_username', anonymousUsername, {expires: 365, path: '/', samesite: 'Lax'});
}
$form.get(0).reset();
$anonymousUsernameField.val(anonymousUsername || '');
var $captcha = $form.find('.captcha-control img');
if ($captcha.exists()) {
$captcha.attr('src', $captcha.attr('src').replace(new RegExp('rand=\\d+'),'rand=' + new Date().getTime()));
}
if (typeof grecaptcha == 'object') {
$form.find('[data-recaptcha-key]').each(function() {
var recaptchaId = $(this).attr('data-recaptcha-id');
if (recaptchaId) {
grecaptcha.reset(recaptchaId);
}
});
}
if ($blockComments.find('.toggle-button').exists())
{
$blockNewComment.hide();
$blockComments.find('.toggle-button').removeClass('active');
}
var commentsBlockId = $blockComments.attr('data-block-id');
var $commentsList = $('.list-comments');
if (newCommentData && newCommentData['approved'] && commentsBlockId && $commentsList.exists()) {
var args = {
success: function(sender, html) {
var resultElement = document.createElement('DIV');
resultElement.innerHTML = html;
var $newItem = $(resultElement).find('.item[data-comment-id="' + (newCommentData['comment_id'] || newCommentData['entry_id']) + '"]').addClass('hidden');
$commentsList.find('#' + commentsBlockId + '_items').prepend($newItem);
setTimeout(function() {
$commentsList.show();
$newItem.fadeIn();
}, 200);
}
};
utilitiesGetBlock(commentsBlockId, null, args);
} else {
$commentsForm.find('.success').show();
}
}
});
}
$commentsForm.find('[name="anonymous_username"]').val($.cookie('kt_anonymous_username') || '');
}
};
var initCommentActions = function () {
$('.list-comments').on('click', '.comment-options a', function(e) {
var $link = $(this);
var $item = $(this).parents('.item');
var $container = $(this).parents('.comment-options');
var $rating = $container.find('.comment-rating');
var $ratingLinks = $container.find('.comment-like, .comment-dislike');
var commentId = $item.attr('data-comment-id');
if (($link.hasClass('comment-like') || $link.hasClass('comment-dislike'))) {
e.preventDefault();
if ($link.hasClass('disabled')) {
return;
}
var increment = ($link.hasClass('comment-dislike') ? -1 : 1);
utilitiesAjaxRequest($link, {action: 'vote_comment', vote: increment, comment_id: commentId}, function(json) {
if (json['status'] == 'success') {
$ratingLinks.fadeOut();
if ($rating.exists()) {
var ratingValue = parseInt($rating.html());
if (!isNaN(ratingValue)) {
ratingValue += increment;
$rating.html(ratingValue);
if (ratingValue > 0) {
$rating.addClass('positive');
} else if (ratingValue < 0) {
$rating.addClass('negative');
$item.addClass('dim-comment');
} else if (ratingValue == 0) {
$rating.removeClass('positive').removeClass('negative');
$item.removeClass('dim-comment');
}
}
}
} else {
$ratingLinks.addClass('disabled');
}
});
} else if ($link.hasClass('comment-edit')) {
e.preventDefault();
$.fancybox($('.popup-edit-comment').clone(true, true), {
afterShow: function () {
var $form = this.inner.find('form');
$form.find('[name="comment_id"], [name="entry_id"]').val(commentId);
var originalText = $item.find('.original-text').html() || '';
originalText = originalText.replace(/
/gi, '\n').replace(/>/gi, '>').replace(/</gi, '<').replace(/"/gi, '"');
originalText = originalText.replace(/
/gi, '\n').replace(/>/gi, '>').replace(/</gi, '<').replace(/"/gi, '"');
originalText = originalText.replace(/', {
src: imageSrc
});
const selection = window.getSelection();
// Проверяем, что выделение находится внутри #send_message_message
if (!selection.rangeCount || !isSelectionInsideCommentMessage(selection)) {
// Если нет выделения или оно вне блока, то ставим курсор в конец блока
const range = document.createRange();
range.selectNodeContents($commentMessage[0]); // Выбираем содержимое блока
range.collapse(false); // Устанавливаем курсор в конец содержимого
selection.removeAllRanges();
selection.addRange(range);
}
const range = selection.getRangeAt(0);
// Удаляем текущий выделенный контент (если есть)
range.deleteContents();
// Вставляем картинку смайлика
range.insertNode(img[0]);
// Устанавливаем курсор после вставленного изображения
range.setStartAfter(img[0]);
selection.removeAllRanges();
selection.addRange(range);
}
// Функция для проверки, находится ли выделение внутри #send_message_message
function isSelectionInsideCommentMessage(selection) {
let node = selection.anchorNode;
while (node) {
if (node === $commentMessage[0]) {
return true;
}
node = node.parentNode;
}
return false;
}
// Обработчик фокуса для поля ввода
$commentMessage.on('focus', function () {
// Если текстовое поле пустое, можно добавить или удалить текст, placeholder и т.д.
initOverlayScroll();
if (!$(this).text().trim()) {
// Пример добавления логики при необходимости
// $(this).text('');
}
});
// Обработчик потери фокуса для поля ввода
$commentMessage.on('blur', function () {
// Если текстовое поле пустое, можно добавить placeholder
if (!$(this).text().trim()) {
// Пример добавления логики при необходимости
// $(this).text('Введите сообщение...');
}
});
var typing_timer;
var typing_timer1;
var isTyping = false;
$commentMessage.on('input', function () {
// if (!isTyping) {
// isTyping = true;
// startSendingAjax();
// }
// clearTimeout(typing_timer1);
// typing_timer1 = setTimeout(stopSendingAjax, 1000);
});
function startSendingAjax() {
typing_timer = setInterval(function () {
var reply_to_user_id = $('[name="reply_to_user_id"]').val();
utilitiesAjaxRequest('', {action: 'input_messages', reply_to_user_id: reply_to_user_id, function: 'get_block', block_id: 'custom_list_messages_my_conversation_messages_new'}, function(json) {
if (json['status']=='success') {
}
});
}, 1000);
}
function stopSendingAjax() {
clearInterval(typing_timer);
var reply_to_user_id = $('[name="reply_to_user_id"]').val();
utilitiesAjaxRequest('', {action: 'stop_messages', reply_to_user_id: reply_to_user_id, function: 'get_block', block_id: 'custom_list_messages_my_conversation_messages_new'}, function(json) {
if (json['status']=='success') {
}
});
isTyping = false;
}
function replaceSmileys(text) {
for (let [imgTag, smiley] of Object.entries($smileys_bar)) {
// Заменяем HTML-тег на текстовый смайл
const regex = new RegExp(imgTag.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g'); // Экранирование спецсимволов
text = text.replace(regex, smiley);
}
return text;
}
let lastContent = '';
if ($commentMessage.length) setInterval(() => {
const currentContent = $commentMessage.html().trim();
if (currentContent !== lastContent) {
let $text = currentContent.replace(/<\/div>
/g, "");
$text = replaceSmileys($text);
$('#send_message_message2').val($text)
lastContent = currentContent;
}
}, 500);
};
function openUserMessages() {
$("body").on("click", ".js-back", function(e) {
e.preventDefault();
var $url = $(this).attr("href");
window.history.pushState("string", null, $url);
$(".dialogues-holder").removeClass("user-mobile");
// $(".js-message").removeClass("active");
});
if ($(".dialogues-list").length>0) {
$dialogues_list = $(".dialogues-list");
// setInterval(function () {
// utilitiesAjaxRequest('', {action: 'check_messages', function: 'get_block', block_id: 'custom_list_messages_my_conversation_messages_new'}, function(json) {
// $dialogues_list.find('.input-text').addClass('hidden');
// $dialogues_list.find('.text').removeClass('hidden');
// $('.ajax-chat').find('[data-text-input-user-id]').addClass('hidden');
// if (json['status']=='success') {
// $.each(json.data, function(index, value) {
// $('.ajax-chat').find('[data-text-input-user-id="' + value + '"]').removeClass('hidden');
// var element = $dialogues_list.find('[data-text-input-user-id="' + value + '"]');
// element.find('.text').addClass('hidden');
// element.find('.input-text').removeClass('hidden');
// });
// }
// });
// }, 1000);
}
$("body").on("click", ".js-ajax-chat", function () {
$('.js-ajax-chat').removeClass('active');
$('.users-items .item').removeClass('active');
var $this = $(this);
var $user_id = $this.attr("data-user_id");
var $url = $this.attr("data-url");
window.history.pushState("string", null, $url);
var url = $url+"?conversation_user_id="+$user_id+"&type=conversation&mode=async&function=get_block&block_id=custom_list_messages_my_conversation_messages_new";
$.ajax({
type: 'GET',
url: url,
success: function(data) {
$('.ajax-chat').html(data);
$('.box').scrollTop($('.box')[0].scrollHeight);
// var widthHeader = $('.header').width();
// if (widthHeader > 767) {
// $(".dialogues-holder .dialogue-holder .nano").nanoScroller({
// // scroll: 'top'
// scroll: 'bottom',
// iOSNativeScrolling: true,
// alwaysVisible: true
// });
// } else {
// window.scrollTo(0,document.body.scrollHeight);
// }
$('.dialogues-holder').addClass('user-mobile');
$('.ajax-chat').removeClass('mobile-hide');
setTimeout(function() {
initMessagesForm();
initMessages();
initAjaxLists($('#custom_list_messages_my_conversation_messages_new'));
initAjaxForms();
initGallerysMessages();
if (typeof(window.initNewChat) !== 'undefined' && $('#js__chat-id').length) {
window.initNewChat($('#js__chat-id').val());
}
initOverlayScroll();
}, 300);
}
});
$('.nano-content .item').removeClass('active');
$this.closest('.item').addClass('active');
$this.addClass('active');
return false;
});
$("body").on("click", ".js-confirm", function () {
var $this = $(this);
var $name = $this.attr('name');
var $form = $this.closest('form');
var $user_id = $form.find('.message_from_user_id').attr('value');
var $block_id = $form.find('.block_id').attr('value');
if ($name=='confirm') {
$action = 'confirm_add_to_friends';
} else {
$action = 'reject_add_to_friends';
}
var data = {};
data['action'] = $action;
data['message_from_user_id'] = $user_id;
data['block_id'] = $block_id;
data['function'] = 'get_block';
$.ajax({
type: 'POST',
url: window.location.href,
data: data,
beforeSend: function () {
},
complete: function () {
},
success: function (json) {
$('.js-ajax-chat.active').click();
}
});
return false;
});
if ($('.js-ajax-chat').hasClass("active")) {
$('.js-ajax-chat.active').click();
}
}
function initOverlayScroll() {
$(".list-messages").each(function () {
var osInstance = OverlayScrollbars(this, {
className: "os-theme-dark",
scrollbars: {
autoHide: "never",
clickScrolling: true,
horizontal: "hidden"
}
});
osInstance.scroll({ y: "100%" }, 0);
});
}
function initGallerysMessages() {
setTimeout(function() {
document.querySelectorAll('.lightgallery').forEach((element) => {
if (element.id && !element.classList.contains('init')) {
lightGallery(document.getElementById(element.id), {
plugins: [lgVideo,lgZoom],
videojsOptions: {
muted: true,
},
download: true,
enableSwipe: true,
autoplayVideoOnSlide: true,
infiniteZoom: true,
speed: 500,
});
element.classList.add('init');
}
});
}, 1000);
}
function searchUserMess() {
$('.js-search-user').on('input', function() {
var value = $(this).val().toLowerCase();
var counter = 0;
$('[data-users] .item').each(function() {
var $this = $(this).find('.name');
console.log($this.text())
if($this.text().toLowerCase().indexOf(value) == -1) {
$this.closest('.item').hide();
}
else {
$this.closest('.item').show();
counter++;
}
if ($('.box.show').hasClass('dialogues-list')) {
var widthHeader = $('.header').width();
if (widthHeader > 767) {
// customScroller();
}
}
});
if (counter == 0) {
// console.log('not found');
$('.not-found').show();
} else {
$('.not-found').hide();
}
});
}
var initMethods = [
initMenu,
initTabs,
initFancyBox,
initRating,
initAddToFavourites,
initErrorFlaggingForm,
initShareForm,
initCommentForm,
initCommentActions,
initAjaxLists,
initAjaxForms,
initSubscriptions,
initSearch,
initVideoUploadForm,
initProfile,
initMessages,
initStats,
initAutoscroll,
initRecaptcha,
openUserMessages,
initMessagesForm,
initGallerysMessages,
searchUserMess
];
for (var i = 0; i < initMethods.length; i++) {
if (typeof initMethods[i] == 'function') {
try {
initMethods[i].call(this);
} catch (e) {
if (console && console.error) {
console.error(e);
}
}
}
}
})();
});