Îðëà
Îáëàñòè
Êîìïàíèé
Ïîëüçîâàòåëè
Ãàëåðåÿ
Ôèêñèðîâàííûå íîâîñòè
Îðëà
Îòçûâû î ôèðìàõ
Òàðèôû
Ïîëüçîâàòåëè
Îáëàñòè
Áàíêîìàòû
Òîðãîâûå òî÷êè
Äîñêà îáúÿâëåíèé
Êóðñû âàëþò
Ñêèäêè
îðãàíèçàöèè Îðëà
îðãàíèçàöèè îáëàñòè
òîâàðû
ñàéòû
ñàéòû Îðåë
Äàííûå
Ðàçäåëû
Ïîèñê
Ïîèñê çàïðîñû
Ñòàòèñòèêà
Ïîêàçû êàòàëîãà îðãàíèçàöèé
Ñòàòèñòèêà êëèåíòû
Ïîëüçîâàòåëè
Ñàéòû
Óïðàâëåíèå ñàéòîì
Àíêåòà
Àïòåêè
Àôèøà
Àôèøà íîâàÿ
Áàííåðû
Áèçíåñ >
Âèêòîðèíà
Ãîëîñîâàíèå
Ãîñòü íà ñàéòå
Èñòîðèè
Êàëåíäàðü ñîáûòèé
Êàòàëîãè >
Êîíêóðñ êðàñîòû
Êîíêóðñ àóäèî
Êîíñóëüòàöèè
Ìåíþ
Íîâîå íà ñàéòå
Íîâîñòè >
Îðãàíèçàöèè >
Ïðîãðàììà ÒÂ
Ïóáëèêàöèè
Ðàçäåëû ñàéòà
Ðàññûëêà
Ðåñòîðàíû
Ñåêðåò ôèðìû >
Ñåðâèñû >
Ññûëêè
Òåñòû
Ôàéëîâûé ìåíåäæåð
Ôîðóì
Ôîòîãàëåðåÿ
Îáðàòíàÿ ñâÿçü
Íåäâèæèìîñòü
Íîâûé ãîä
Òåêñòû
Ïîëüçîâàòåëè
Þðèäè÷åñêèé ðåéòèíã
Îòçûâû íà òîâàðû
Áàí ïîëüçîâàòåëåé
Æàëîáû
Íîâûå òåñòû
Êîðîíàâèðóñ
Ôàéëîâûé ìåíåäæåð
Èìÿ ôàéëà
prod.js
Ñîäåðæèìîå
$(function() { $('.header-navbar .js-menu-a').hover(function() { $('.header-navbar > li').removeClass('active').addClass('nav-hidden'); var $scope = $(this); var $parent = $scope.parent(); $parent.removeClass('nav-hidden').addClass('active'); }); $('.header-navbar .js-menu-a').on('click', function(e) { if (Mobile.isMobile()) { e.preventDefault(); e.stopPropagation(); } }); }); var Mobile = { isMobile: function() { if( navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i) || navigator.userAgent.match(/Mobile/) ){ return true; } else { return false; } } }; var AfishaApp = { initApp: function() { UIkit.datepicker('#afisha-datepicker', {}); $('#afisha-datepicker').on('hide.uk.datepicker', function() { var $scope = $(this); var date = $scope.val(); if (date.length == 0) { return false; } var siteUrl = $('input[name=site-url]').val(); location.href = siteUrl + 'date_ot=' + date; }) } }; var ConsultApp = { initApp: function() { var progressbar = $("#progressbar"), bar = progressbar.find('.uk-progress-bar'), settings = { action: '/ajax/photo_loader.php?route=consult', allow : '*.(jpg|jpeg|png)', loadstart: function() { bar.css("width", "0%").text("0%"); progressbar.removeClass("uk-hidden"); }, progress: function(percent) { percent = Math.ceil(percent); bar.css("width", percent+"%").text(percent+"%"); }, allcomplete: function(response) { bar.css("width", "100%").text("100%"); setTimeout(function(){ progressbar.addClass("uk-hidden"); }, 250); // файл загружен. // показываем этот файл. response = $.parseJSON(response); if (response.success == true) { $('#jq-loaded-photo-preview').html('<img src="/' + response.data + '"><input type="hidden" name="photo_src" value="'+response.data+'">'); } else { Alert.error(response.text); } } }; var select = UIkit.uploadSelect($("#upload-select"), settings), drop = UIkit.uploadDrop($("#upload-drop"), settings); $('form[name=consult_form]').on('submit', function(e) { e.preventDefault(); var $scope = $(this); var $button = $scope.find('button[type=submit]'); var oldText = $button.text(); $button.text('Отправляем...'); $button.attr('disabled', 'disabled'); $.ajax({ url: '/ajax/consult/add.php', method: 'POST', data: $scope.serializeArray(), dataType: 'json' }).then(function(response) { if (response.success == true) { location.reload(); } else { FormErrors.showErrors($scope, response.data); grecaptcha.reset(); $button.prop('disabled', ''); $button.text(oldText); } }).fail(function() { $button.prop('disabled', ''); $button.text(oldText); Alert.error("Не удалось отправить данные. Попробуйте еще раз."); }) }) } }; var Alert = { show: function(message) { alert(message); }, error: function(message) { }, success: function(message, notHide) { alert(message); return false; if (typeof notHide == 'undefined') { notHide = false; } var options = { pos:'top-center', status: 'success' }; if (notHide == true) { options.timeout = 0; } UIkit.notify(message, options); } }; var FormErrors = { removeErrors: function($form) { $form.find('.form-errors').remove(); }, showErrors: function($form, errors) { $form.find('.form-errors').remove(); for (var key in errors) { var $element = $form.find('[name=' + key +']'); if ($element) { var htmlBuffer = '<div class="form-errors"><ul>'; errors[key].forEach(function(error) { htmlBuffer += '<li>' + error + '</li>'; }); htmlBuffer += '</div>'; $element.after(htmlBuffer); } } } }; var MapApp = { $modal: null, initApp: function() { var scope = this; this.$modal = UIkit.modal("#map-modal", { center: true }); $('.modal-map').on('click', function(e) { e.preventDefault(); var $scope = $(this); $('#jq-modal-map-container').html(''); ymaps.ready(function () { var map = new ymaps.Map("jq-modal-map-container", { center: [52.96,36.06], zoom: 14, controls: [] }); scope.$modal.show(); var myGeocoder = ymaps.geocode($scope.data('address')); myGeocoder.then( function (res) { if (res.geoObjects.getLength()) { var geoObject = res.geoObjects.get(0); var coordinates = geoObject.geometry.getCoordinates(); map.setCenter(coordinates, 16); var placemark = new ymaps.Placemark( coordinates, {}, { hideIconOnBallon: false } ); map.geoObjects.add(placemark); } }, function (err) { // обработка ошибки } ); }); }); } }; var Report = { $modal: null, // клик с карты. ymapsClickHandler: function() { Report.reportHandler($('.report-button-hidden')); }, reportHandler: function($scope) { var scope = this; var $modalJQuery = $('#report-modal'); var $container = $modalJQuery.find('.jq-modal-report-form-container'); $container.html(''); var variants = $scope.data('variants'); if (typeof variants == 'undefined' || variants.length == 0) { return false; } variants = variants.split(','); var html = '<form action="#" class="uk-form" name="add-vacancy-message-form">'; variants.forEach(function(value, key) { var id = 'report-form-element-' + key; var checked = ' checked'; if (key > 0) { checked = ''; } html += [ '<div class="uk-form-row">', '<div class="uk-form-controls">', '<input type="radio" class="jq-report-radio" id="'+id+'" name="radio" value="'+value+'" '+checked+'> <label for="'+id+'">'+value+'</label>', '</div>', '</div>' ].join(''); }); html += [ '<div class="uk-form-row">', '<div class="uk-form-controls">', '<input type="radio" id="jq-other-variant-id" name="radio" class="jq-report-other-variant" value="other-value"> <label for="jq-other-variant-id">Другая причина</label>', '</div>', '<div class="uk-form-row uk-hidden jq-report-textarea-container">', '<div class="uk-form-controls">', '<textarea class="uk-form-width-large"></textarea>', '</div>', '</div>', '</div>' ].join(''); html += [ '<div class="uk-modal-footer">', '<button type="submit" class="uk-button uk-button-primary">Отправить</button>', '</div></form>' ].join(''); $container.html(html); $container.find('.jq-report-radio').off('click') .on('click', function() { $container.find('.jq-report-textarea-container').addClass('uk-hidden'); }); $container.find('.jq-report-other-variant').off('click') .on('click', function() { $container.find('.jq-report-textarea-container').removeClass('uk-hidden'); }); scope.$modal.show(); var $form = $container.find('form[name=add-vacancy-message-form]'); $form.off('submit'); $form.on('submit', function(e) { e.preventDefault(); e.stopPropagation(); var url = location.href; var $scope = $(this); var $button = $scope.find('button[type=submit]'); //--- var oldButtonText = $button.text(); $button.text('Отправка...'); $button.attr('disabled', 'disabled'); //--- var radio = $scope.find('input[type=radio]:checked'); var value = radio.val(); if (radio.hasClass('jq-report-other-variant')) { var $textArea = $scope.find('textarea'); if ($textArea.val().length == 0) { Alert.error('Укажите другую причину!'); return false; } value = $textArea.val(); } $.ajax({ url: '/ajax/report/add_message.php', method: 'POST', data: { url: url, value: value }, dataType: 'json' }).then(function(response) { if (response.success == true) { scope.$modal.hide(); Alert.success("Жалоба успешно отправлена"); } else { FormErrors.showErrors($scope, response.data); } $button.prop('disabled', false); $button.text(oldButtonText); }).fail(function() { Alert.error("Во время отправки сообщения произошла ошибка. Попробуйте позже."); $button.prop('disabled', false); $button.text(oldButtonText); }); }); }, initApp: function() { this.$modal = UIkit.modal("#report-modal", { center: true }); $('.report-button').on('click', function() { Report.reportHandler($(this)); }); } }; /** * Класс реализует поддержку окна поделиться. * @type {{}} */ var ShareApp = { initApp: function() { var template = [ '<div class="uk-button-dropdown" data-uk-dropdown="{mode:\'click\'}" aria-haspopup="true" aria-expanded="false">', '<button class="uk-button btn-gray"><i class="fa fa-share-alt gray uk-margin-mini-right" aria-hidden="true"></i> Поделиться</button>', '<div class="uk-dropdown uk-dropdown-bottom" aria-hidden="true" style="top: 30px; left: 0px;" tabindex="">', '<div class="ya-share2" data-services="vkontakte,facebook,odnoklassniki,moimir,gplus,twitter,skype,telegram"></div>', '</div>', '</div>']; template = template.join(''); $('.share-block').html(template); } }; $(function() { $('.jq-toggle').on('click', function(e) { e.preventDefault(); e.stopPropagation(); var $scope = $(this); var selectorDiv = $scope.data('selector'); var toggleShowText = $scope.data('visible-text'); var toggleHideText = $scope.data('hidden-text'); var $div = $(selectorDiv); if ($div.hasClass('uk-hidden')) { $scope.text(toggleHideText); $div.removeClass('uk-hidden'); } else { $scope.text(toggleShowText); $div.addClass('uk-hidden'); } }); }); $(function() { var reportRecaptcha = null; $('form[name=feedback-form]').on('submit', function(e) { e.preventDefault(); e.stopPropagation(); //------- var $form = $(this); var $button = $form.find('button[type=submit]'); var oldButtonText = $button.text(); $button.text('Подождите...'); $button.attr('disabled', 'disabled'); //------- $.ajax({ url: '/ajax/feedback/add_feedback.php', method: 'POST', dataType: 'json', data: $form.serializeArray() }).then(function(response) { if (response.success == true) { alert('Заявка успешно отправлена'); location.reload(); } else { FormErrors.showErrors($form, response.data); $button.prop('disabled', false); $button.text(oldButtonText); grecaptcha.reset(reportRecaptcha); } }).fail(function() { Alert.error('Не удалось отправить сообщение. Попробуйте позже'); $button.prop('disabled', false); $button.text(oldButtonText); grecaptcha.reset(reportRecaptcha); }); }); if ($('div').is('#feedback-recaptcha')) { reportRecaptcha = grecaptcha.render('feedback-recaptcha', { 'sitekey': GOOGLE_CAPTCHA_KEY, 'theme': 'light' }); } }); /** * Приложение для добавления фотографий. */ var AddPhotoModalApp = { $modal: $('#add-photo-modal'), modal: null, sectionItems: [], addPhotoHandler: function($form) { }, showModal: function() { if (this.modal == null) { this.modal = UIkit.modal("#add-photo-modal", { center: true }); } this.modal.show(); }, getAddPhotoOptions: function() { return $.ajax({ url: '/ajax/fotogal/get_add_photo_options.php', method: 'GET', dataType: 'json' }); }, buildNavbar: function() { var $razdelContainer = AddPhotoModalApp.$modal.find('#razdel_id'); var $razdelContainerUl = $('#razdel_id ul'); var $albumContainer = AddPhotoModalApp.$modal.find('#album_id'); var $albumContainerUl = $('#album_id ul'); var scope = this; $razdelContainerUl.html(''); console.log($razdelContainerUl); this.sectionItems.forEach(function(item) { $razdelContainerUl.append('<li data-option-value="'+item.id+'"><a href="#">'+item.name+'</a></li>'); }); $razdelContainerUl.find('li a').on('click', function(e) { e.preventDefault(); $albumContainerUl.html(''); $('input[name=album_id]').val(''); $('.add-photo-album-name').html('<i class="fa fa-angle-down uk-margin-left uk-margin-right-small" aria-hidden="true"></i>'); var $scope = $(this); scope.sectionItems.forEach(function(rootItem) { if (rootItem.id == $scope.parent().data('option-value')) { rootItem.albums.forEach(function(item) { $albumContainerUl.append('<li data-option-value="'+item.id+'"><a href="#">'+item.name+'</a></li>'); }) } }) }) }, initApp: function() { $('#jq-add-photo-handler').on('click', function() { AddPhotoModalApp.showModal(); AddPhotoModalApp .getAddPhotoOptions() .then(function(response) { if (response.success == false) { Alert.error(response.text); return false; } AddPhotoModalApp.sectionItems = response.data; AddPhotoModalApp.buildNavbar(); }) .fail(function() { Alert.error('Не загрузить список альбомов для добавления фотографии. Попробуйте, пожалуйста позже.'); }) }); var progressbar = $("#progressbar"), bar = progressbar.find('.uk-progress-bar'), settings = { action: '/ajax/fotogal/add_only_photo.php', allow : '*.(jpg|jpeg|png)', loadstart: function() { bar.css("width", "0%").text("0%"); progressbar.removeClass("uk-hidden"); }, progress: function(percent) { percent = Math.ceil(percent); bar.css("width", percent+"%").text(percent+"%"); }, allcomplete: function(response) { bar.css("width", "100%").text("100%"); setTimeout(function(){ progressbar.addClass("uk-hidden"); }, 250); // файл загружен. // показываем этот файл. response = $.parseJSON(response); if (response.success == true) { $('#jq-loaded-photo-preview').html('<img src="/' + response.data + '"><input type="hidden" name="photo_src" value="'+response.data+'">'); } else { Alert.error(response.text); } } }; var select = UIkit.uploadSelect($("#upload-select"), settings), drop = UIkit.uploadDrop($("#upload-drop"), settings); // отправка данных на сервер $('form[name=add-photo-form]').on('submit', function(e) { e.preventDefault(); e.stopPropagation(); var $scope = $(this); var $button = $scope.find('button[type=submit]'); var oldButton = $button.text(); $button.text('Сохраняем...'); $button.attr('disabled', 'disabled'); $.ajax({ url: '/ajax/fotogal/add_photo.php', method: 'POST', dataType: 'json', data: $scope.serializeArray() }).then(function(response) { if (response.success == true) { location.reload() } else { FormErrors.showErrors($scope, response.data); } $button.prop('disabled', false); $button.text(oldButton); }) .fail(function() { Alert.error('Во время сохранения фотографии произошла ошибка. Попробуйте позже'); $button.prop('disabled', false); $button.text(oldButton); }) }) } }; /** * Приложение для работы с фотогалереей. */ var PhotoGalleryApp = { activePhotoId: null, photoViewModal: null, $photoViewModal: null, getPhotoData: function(photoId) { return $.ajax({ url: '/ajax/fotogal/photo.php', method: 'GET', dataType: 'json', data: { id: photoId } }); }, /** * Функция получения списка комментариев. * @param photoId */ getComments: function(photoId) { return $.ajax({ url: '/ajax/fotogal/comments.php', method: 'GET', dataType: 'json', data: { id: photoId } }); }, vote: function(photoId, vote) { return $.ajax({ url: '/ajax/fotogal/vote.php', method: 'POST', dataType: 'json', data: { photo_id: photoId, vote: vote } }); }, addComment: function(serializedArrayData) { return $.ajax({ url: '/ajax/fotogal/add_comment.php', method: 'POST', dataType: 'json', data: serializedArrayData }); }, toggleFavorite: function(photoId) { return $.ajax({ url: '/ajax/fotogal/favorite.php', method: 'POST', data: { photo_id: photoId }, dataType: 'json' }); }, /** * Функция задает правильную позицию кнопкам влево и вправо. * @param $container - #jq-photo-gallery-modal-photo-viewer */ buildNavPosition: function($container) { var navLeft = $('.jq-photo-gallery-modal-nav-left'); var navRight = $('.jq-photo-gallery-modal-nav-right'); navLeft.css('top', ($container.height()/2-32) + 'px'); navRight.css('top', ($container.height()/2-32) + 'px'); navRight.css('left', ($container.width() - (32*2)-10) + 'px'); navLeft.fadeIn(300); navRight.fadeIn(300); }, /** * Функция рендерит комментарии * @param comments * @param reInitScrollbar - если true, выполнять инициализацию scrollbar заново, иначе не делать это. */ renderComments: function(comments, reInitScrollbar) { var $commentsContainer = PhotoGalleryApp .$photoViewModal .find('#jq-photo-gallery-comments'); if (reInitScrollbar == true) { $commentsContainer.html(''); } var $template = $('#jq-photo-gallery-modal-comment-item'); // рендерим комментарии var html = ''; for (var key in comments) { var comment = comments[key]; var commentTemplateHtml = $template.html(); commentTemplateHtml = commentTemplateHtml.replace('{avatar}', '<figure class="user-avatar-50" style="background-image:url(' + comment.user.avatar + ')"></figure>') commentTemplateHtml = commentTemplateHtml.replace('{user_login}', comment.user.name); commentTemplateHtml = commentTemplateHtml.replace('{user_name}', (comment.user.name_full == null || comment.user.name_full.length == 0) ? comment.user.name : comment.user.name_full); commentTemplateHtml = commentTemplateHtml.replace('{comment_date}', comment.comment_date_format); commentTemplateHtml = commentTemplateHtml.replace('{comment}', comment.comment); html += commentTemplateHtml; } if (reInitScrollbar == true) { $commentsContainer.html('<div id="photo-comments-block">' + html + '</div>'); } else { $commentsContainer.find('#photo-comments-block').html(html); $commentsContainer.mCustomScrollbar('scrollTo', 'bottom'); } if (reInitScrollbar == true) { $commentsContainer.mCustomScrollbar({ scrollbarPosition: "inside", theme: 'minimal-dark' }); } }, showModal: function($scope) { var photoId = $scope.data('photo-id'); if (typeof photoId == 'undefined') { return false; } PhotoGalleryApp.activePhotoId = photoId; PhotoGalleryApp .getPhotoData(photoId) .then(function(response) { if (response.success == false) { Alert.error(response.text); return false; } // рендерим изображение PhotoGalleryApp .$photoViewModal .find('#jq-photo-gallery-modal-photo-viewer') .html('<img src="' + response.data.foto + '" alt="">'); setTimeout(function() { PhotoGalleryApp.buildNavPosition($('#jq-photo-gallery-modal-photo-viewer')); }, 500); // рендерим описание фотографии if (response.data.user != null) { PhotoGalleryApp .$photoViewModal .find('#jq-photo-gallery-modal-user-avatar') .html('<figure class="user-avatar-50" style="background-image:url(' + response.data.user.avatar + ')"></figure>'); var userName = (response.data.user.name_full == null || response.data.user.name_full.length == 0) ? response.data.user.name : response.data.user.name_full; var userLink = '/user_info.php?login_user=' + response.data.user.name; if (userName == null) { userName = 'Нет пользователя'; userLink = '#'; } PhotoGalleryApp .$photoViewModal .find('#jq-photo-gallery-modal-user-name') .html('<a href="' + userLink + '">' + userName + '</a>'); } PhotoGalleryApp .$photoViewModal .find('#jq-photo-gallery-modal-photo-date') .html('<time class="modal-time">' + response.data.created_at_format + '</time>'); var photoName = (response.data.photo_name.length == 0) ? 'Без названия' : response.data.photo_name; PhotoGalleryApp .$photoViewModal .find('#jq-photo-gallery-modal-photo-name') .text(photoName); var vote = Vote.render({ className: 'jq-photo-gallery-modal-rating', rating: response.data.rating, click: function(rating) { PhotoGalleryApp .vote(PhotoGalleryApp.activePhotoId, rating) .then(function(response) { if (response.success == true) { vote.setRating(response.data); } else { Alert.error(response.text); } }) .fail(function() { Alert.error('Не удалось проголосовать за фотографию.'); }) } }); // рисуем favorite var $favorite = $('#jq-photo-favorite'); if (response.data.favorite == true) { $favorite.html('<i class="fa fa-star" aria-hidden="true"></i>'); } else { $favorite.html('<i class="fa fa-star-o" aria-hidden="true"></i>') } $favorite.find('i').on('click', function() { var $favScope = $(this); PhotoGalleryApp .toggleFavorite(PhotoGalleryApp.activePhotoId) .then(function(response) { if (response.success == true) { if (response.data == 1) { $favScope.removeClass('fa-star-o').addClass('fa-star'); } else { $favScope.removeClass('fa-star').addClass('fa-star-o'); } } }) .fail(function() { Alert.error('Во время запроса произошла ошибка. Попробуйте позже'); }) }); PhotoGalleryApp.$photoViewModal.find('#jq-photo-gallery-comments-parent').html('<div id="jq-photo-gallery-comments" class="uk-flex-middle height-370 overflow-hidden"></div>'); PhotoGalleryApp .getComments($scope.data('photo-id')) .then(function(response) { if (response.success == false) { Alert.error(response.text); return false; } PhotoGalleryApp.renderComments(response.data, true); }) .fail(function() { Alert.error('Не удалось получить список комментариев'); }); PhotoGalleryApp.photoViewModal.show(); }) .fail(function() { Alert.error("Во время запроса произошла ошибка. Попробуйте, пожалуйста позже"); }); } }; PhotoGalleryApp.initApp = function() { PhotoGalleryApp.$photoViewModal = $('#photo-gallery-modal'); PhotoGalleryApp.photoViewModal = UIkit.modal("#photo-gallery-modal", { center: true }); PhotoGalleryApp.$photoViewModal.on({ 'hide.uk.modal': function () { PhotoGalleryApp.activePhotoId = null; } }); $('.jq-gallery-photo-item').on('click', function () { var $scope = $(this); PhotoGalleryApp.showModal($scope); }); $('.jq-a-photo-view').on('click', function(e) { e.preventDefault(); }); // нажатие на фотографию PhotoGalleryApp .$photoViewModal .find('#jq-photo-gallery-modal-photo-viewer') .on('click', function () { if (PhotoGalleryApp.activePhotoId == null) { return false; } //PhotoGalleryApp.photoViewModal.hide(); var $scopeNext = $('.jq-gallery-photo-item[data-photo-id=' + PhotoGalleryApp.activePhotoId + ']').next(); // console.log($scopeNext); PhotoGalleryApp.showModal($scopeNext); }); // предыдущая фотография PhotoGalleryApp .$photoViewModal .find('.jq-photo-gallery-modal-nav-left') .on('click', function () { if (PhotoGalleryApp.activePhotoId == null) { return false; } var $scopePrev = $('.jq-gallery-photo-item[data-photo-id=' + PhotoGalleryApp.activePhotoId + ']').prev(); PhotoGalleryApp.showModal($scopePrev); }); // следующая фотография PhotoGalleryApp .$photoViewModal .find('.jq-photo-gallery-modal-nav-right') .on('click', function () { PhotoGalleryApp .$photoViewModal .find('#jq-photo-gallery-modal-photo-viewer') .trigger('click'); }); // клавиши модификаторы (стрелки) влево и вправо $('body') .on('keyup', function (event) { if (PhotoGalleryApp.activePhotoId == null) { return false; } if (event.keyCode == 37) { PhotoGalleryApp .$photoViewModal .find('.jq-photo-gallery-modal-nav-left') .trigger('click'); } if (event.keyCode == 39) { PhotoGalleryApp .$photoViewModal .find('.jq-photo-gallery-modal-nav-right') .trigger('click'); } // закрытие модального окна if (event.keyCode == 27) { PhotoGalleryApp.photoViewModal.hide(); PhotoGalleryApp.activePhotoId = null; } }); /** * Отправка комментария */ PhotoGalleryApp .$photoViewModal .find('form[name=photo-form-comment-modal]') .on('submit', function (e) { e.preventDefault(); e.stopPropagation(); var $scope = $(this); //----------------- var $button = $scope.find('button'); var oldButtonText = $button.text(); $button.text('Отправка...'); $button.attr('disabled', 'disabled'); PhotoGalleryApp .addComment({ comment: $scope.find('textarea[name=comment]').val(), photo_id: PhotoGalleryApp.activePhotoId }) .then(function (response) { if (response.success == true) { PhotoGalleryApp .getComments(PhotoGalleryApp.activePhotoId) .then(function (response) { if (response.success == false) { Alert.error(response.text); return false; } $scope.find('textarea[name=comment]').val(''); PhotoGalleryApp.renderComments(response.data); }) .fail(function () { Alert.error('Не удалось получить список комментариев'); }); } else { Alert.error(response.text); } $button.prop('disabled', false); $button.text(oldButtonText); }) .fail(function () { $button.prop('disabled', false); $button.text(oldButtonText); }) }); $(window).on('resize', function () { PhotoGalleryApp.buildNavPosition($('#jq-photo-gallery-modal-photo-viewer')); }); }; // код работы с альбомами var PhotoAlbumsApp = { initApp: function() { var $containerNavAlbums = $('.jq-albums'); var $albumsModal = UIkit.modal("#jq-albums-modal", { center: true }); $containerNavAlbums.find('a').on('click', function(e) { e.preventDefault(); e.stopPropagation(); var razdelId = $(this).data('album-id'); $.ajax({ url: '/ajax/fotogal/albums.php', method: 'GET', dataType: 'html', data: { razdel_id: razdelId } }).then(function(response) { $('#jq-albums-modal #jq-album-list').html(response); $albumsModal.show(); }) }); } }; // код просмотра фотографии var PhotoViewApp = { initApp: function() { //jq-photo-view-ratingvar var $ratingContainer = $('#jq-photo-view-rating'); var vote = Vote.render({ className: 'jq-photo-view-rating', rating: $ratingContainer.data('rating'), click: function(rating) { PhotoGalleryApp .vote($ratingContainer.data('photo-id'), rating) .then(function(response) { if (response.success == true) { vote.setRating(response.data); } else { Alert.error(response.text); } }) .fail(function() { Alert.error('Не удалось проголосовать за фотографию.'); }) } }); //jq-photo-view-favorite $('#jq-photo-view-favorite').on('click', function() { var $scope = $(this); PhotoGalleryApp .toggleFavorite($scope.data('photo-id')) .then(function(response) { if (response.success == false) { Alert.show(response.text); return false; } if (response.data == true) { $scope.html($scope.data('favorite-yes')); } else { $scope.html($scope.data('favorite-no')); } }) }); /** * Отправка комментария */ $('form[name=jq-photo-view-form-add-comment]') .on('submit', function (e) { e.preventDefault(); e.stopPropagation(); var $scope = $(this); //----------------- var $button = $scope.find('button'); var oldButtonText = $button.text(); $button.text('Отправка...'); $button.attr('disabled', 'disabled'); PhotoGalleryApp .addComment({ comment: $scope.find('textarea[name=comment]').val(), photo_id: $scope.find('input[name=photo_id]').val() }) .then(function (response) { if (response.success == true) { location.reload(); } else { Alert.error(response.text); } $button.prop('disabled', false); $button.text(oldButtonText); }) .fail(function () { $button.prop('disabled', false); $button.text(oldButtonText); }) }); } }; /** * JavaScript приложение для работы с разделом новости. */ $(function() { var News = { submitCommentHandler: function (e) { var $scope = $(this); e.preventDefault(); $.ajax({ url: '/ajax/add_news_comment.php', method: "POST", data: $(this).serializeArray(), dataType: 'json' }).then(function (response) { if (response.success == true) { // получаем AJAXом комментарии из новостей $.ajax({ url: '/ajax/get_news_comments.php', data: { newsId: $scope.find('input[name=newsId]').val() }, dataType: 'html', method: 'GET' }).then(function(response) { $scope.find('input[type=text]').val(''); $scope.find('textarea').val(''); try { grecaptcha.reset(); } catch (e) { // } $('.comment-items').html(response); $('.news-view-comment-answer').on('click', News.answerCommentHandler); $('.jq-news-comment-vote').on('click', News.voteHandler); }); } else { if (typeof response.text != "undefined") { Alert.show(response.text); } } }).fail(function() { Alert.show("Во время отправки комментария произошла ошибка. Попробуйте, пожалуйста позже"); }); }, answerCommentHandler: function (e) { e.preventDefault(); var $scope = $(this); var commentId = $scope.data('comment-id'); News.showCommentForm(commentId); }, showCommentForm: function (commentId) { // удаляем все старые формы $('.comment-items').find('.news-comments-form-compact').remove(); var form = '<div><div class="jq-form-in-news-comments news-comments-form-compact">' + $('.jq-news-comment-form-container').html() + '</div></div>'; var $form = $(form); try { $form.find('.google-recaptcha-block').attr('id', 'recaptcha-block-' + commentId).html(''); $form.find('input[name=parentId]').val(commentId); $('div[data-comment-id=' + commentId + ']').after($form.html()); grecaptcha.render('recaptcha-block-' + commentId, { 'sitekey': GOOGLE_CAPTCHA_KEY }); } catch (e) { // nothing } $('.comment-items').find('form').off('submit'); $('.comment-items').find('form').on('submit', News.submitCommentHandler); }, voteHandler: function(e) { if (e != null && typeof e.preventDefault != "undefined") { e.preventDefault(); } var $scope = $(this); $.ajax({ url: '/ajax/vote_news_comment.php', method: 'POST', dataType: 'json', data: { commentId: $scope.data('comment-id'), vote: $scope.data('vote') } }).then(function(response) { if (response.success == true) { $scope.parent().find('span').text(response.data); } else { Alert.show(response.data); } }).fail(function() { Alert.show("Во время запроса произошла ошибка. Попробуйте, пожалуйста, позже."); return false; }) } }; $('.news-view-comment-answer').on('click', News.answerCommentHandler); $('.jq-news-comment-form-container').find('form').on('submit', News.submitCommentHandler); $('.jq-news-comment-vote').on('click', News.voteHandler); }); var OrganizationApp = { initApp: function() { var progressbar = $("#progressbar"), bar = progressbar.find('.uk-progress-bar'), settings = { action: '/ajax/photo_loader.php?route=organization_comment', allow : '*.(jpg|jpeg|png)', loadstart: function() { bar.css("width", "0%").text("0%"); progressbar.removeClass("uk-hidden"); }, progress: function(percent) { percent = Math.ceil(percent); bar.css("width", percent+"%").text(percent+"%"); }, allcomplete: function(response) { bar.css("width", "100%").text("100%"); setTimeout(function(){ progressbar.addClass("uk-hidden"); }, 250); // файл загружен. // показываем этот файл. response = $.parseJSON(response); if (response.success == true) { $('#jq-loaded-photo-preview').html('<img src="/' + response.data + '"><input type="hidden" name="photo_src" value="'+response.data+'">'); } else { Alert.error(response.text); } } }; var select = UIkit.uploadSelect($("#upload-select"), settings), drop = UIkit.uploadDrop($("#upload-drop"), settings); } }; $(function() { $('form[name=add-organization-comment-form]').on('submit', function(e) { e.preventDefault(); e.stopPropagation(); var $scope = $(this); var $button = $scope.find('button'); var oldText = $button.text(); $.ajax({ url: '/ajax/organizations/add_organization_comment.php', method: 'POST', data: $scope.serializeArray(), dataType: 'json' }).then(function(response) { $button.prop('disabled', false); $button.text(oldText); if (response.success == true) { location.reload(); } else { console.log(response.data); FormErrors.showErrors($scope, response.data); } }).fail(function() { Alert.show('Не удалось добавить комментарий'); $button.prop('disabled', false); $button.text(oldText); }); }); $('.jq-comment-vote').on('click', function(e) { e.preventDefault(); var sign = $(this).data('sign'); var commentId = $(this).data('comment-id'); $.ajax({ url: '/ajax/organizations/vote.php', method: 'POST', data: { comment_id: commentId, sign: sign }, dataType: 'json' }).then(function(response) { if (response.success == true) { //vote-text-minus-comment-<?=$comment['id'];?> var yes = response.yes; if (yes > 0) { yes = '+' + yes; } var no = response.no; if (no > 0) { no = '-' + no; } $('.vote-text-plus-comment-' + commentId).text(yes); $('.vote-text-minus-comment-' + commentId).text(no); } else { Alert.show(response.text); } }).fail(function() { Alert.show('Произошла ошибка при добавлении вашего голоса. Попробуйте, пожалуйста позже.'); }) }); }); /** * Приложение для работы с организациями */ $(function() { ymaps.ready(function () { var $container = $('#map'); var lat = $container.data('lat'); var lng = $container.data('lng'); var address = $container.data('address'); var organizationName = $container.data('company-name'); //------------------------------- var map = new ymaps.Map("map", { center: [52.96,36.06], zoom: 14, controls: [] }); if (lat > 0 && lng > 0) { var placemark = new ymaps.Placemark( [lng, lat], { hintContent: organizationName, balloonContent: $('#ymaps-placemark-content').html() }, { hideIconOnBallon: false } ); map.geoObjects.add(placemark); placemark.balloon.open(); } else { var myGeocoder = ymaps.geocode(address); myGeocoder.then( function (res) { if (res.geoObjects.getLength()) { var geoObject = res.geoObjects.get(0); var coordinates = geoObject.geometry.getCoordinates(); map.setCenter(coordinates, 16); var placemark = new ymaps.Placemark( coordinates, { hintContent: organizationName, balloonContent: $('#ymaps-placemark-content').html() }, { hideIconOnBallon: false } ); map.geoObjects.add(placemark); placemark.balloon.open(); } }, function (err) { // обработка ошибки } ); } }); }); /** * JS приложение для работы с недвижимостью */ $(function() { var realtyMessageModal = null; $('.jq-show-add-realty-message-modal').on('click', function() { realtyMessageModal = UIkit.modal("#add-realty-message-modal", { center: true }); realtyMessageModal.show(); }); /** * Отправка личного сообщения по недвижимости. */ $('form[name=add-realty-message-form]').on('submit', function(e) { e.preventDefault(); e.stopPropagation(); var $scope = $(this); var $button = $scope.find('button[type=submit]'); //--- var oldButtonText = $button.text(); $button.text('Отправка...'); $button.attr('disabled', 'disabled'); //--- $.ajax({ url: '/ajax/realty/add_message.php', method: 'POST', data: $scope.serializeArray(), dataType: 'json' }).then(function(response) { if (response.success == true) { if (realtyMessageModal != null) { realtyMessageModal.hide(); } Alert.success("Ваше сообщение было успешно отправлено"); } else { FormErrors.showErrors($scope, response.data); } $button.prop('disabled', false); $button.text(oldButtonText); }).fail(function() { Alert.error("Во время отправки сообщения произошла ошибка. Попробуйте позже."); $button.prop('disabled', false); $button.text(oldButtonText); }); }); /** * Событие показа карты, где можно выбрать свой дом. */ var map = null; $('.jq-open-realty-map').on('click', function(e) { var initMap = false; e.preventDefault(); e.stopPropagation(); if (typeof ymaps == 'undefined') { return false; } if (map != null) { $('#add-realty-map').hide().html(''); map = null; return false; } ymaps.ready(function () { $('#add-realty-map').removeClass('uk-hidden').show(); map = new ymaps.Map("add-realty-map", { center: [52.96,36.06], zoom: 14, controls: ['typeSelector', 'searchControl'] }); map.events.add("click", function(e) { var coords = e.get("coords"); $('input[name=lat]').val(coords[1]); $('input[name=lng]').val(coords[0]); geocode(coords); }); var placemark = new ymaps.Placemark( [52.96,36.06], { balloonContent: '' }, { hideIconOnBallon: false, draggable: true } ); map.geoObjects.add(placemark); placemark.events.add("dragend", function(e) { var target = e.get('target'), coordinates = target.geometry.getCoordinates(); geocode(coordinates); }); function geocode( coords ) { var geocoder = ymaps.geocode(coords, {results:1}); geocoder.then( function (res) { if (res.geoObjects.getLength()) { var geoObject = res.geoObjects.get(0); var name = geoObject.properties.get('name'); var name_parts = name.split(','); $('#street').val(''); $('#house').val(''); $('#street').val(name_parts[0]); $('#house').val(name_parts[1]); placemark.properties.set('balloonContentBody', geoObject.properties.get('balloonContentBody')); placemark.geometry.setCoordinates(geoObject.geometry.getCoordinates()); map.panTo(placemark.geometry.getCoordinates()); } }, function (err) {} ); } function direct_geocode(address) { var geocoder = ymaps.geocode(address, {results:1}); geocoder.then( function (res) { if (res.geoObjects.getLength()) { var geoObject = res.geoObjects.get(0); placemark.properties.set('balloonContentBody', geoObject.properties.get('balloonContentBody')); placemark.geometry.setCoordinates(geoObject.geometry.getCoordinates()); map.panTo(geoObject.geometry.getCoordinates()); } }, function (err) {} ); } if ($('#street').val()!='') direct_geocode('город Орел, ' + $('#street').val()+', дом '+$('#house').val()); else geocode(placemark.geometry.getCoordinates()); }); }); $('select[name=object_type_id]').on('change', function() { var $target = $('#jq-com_type_block'); if ($(this).val() == 21) { $target.removeClass('uk-hidden'); } else { $target.addClass('uk-hidden'); } }); $('form[name=add-realty-form]').on('submit', function(e) { e.preventDefault(); var $scope = $(this); var form = document.getElementsByName('add-realty-form')[0]; var formData = new FormData(form); var $button = $scope.find('button[type=submit]'); var oldText = $button.text(); $button.text('Пожалуйста, подождите'); $button.attr('disabled', 'disabled'); var xhr = new XMLHttpRequest(); xhr.open("POST", "/ajax/add_realty.php"); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { if(xhr.status == 200) { try { var response = JSON.parse(xhr.responseText); if (response.success == true) { location.href = '/realty/'; } else { FormErrors.showErrors($scope, response.data) } } catch (e) { Alert.show("Не удалось разобрать ответ от сервера."); } $button.text(oldText); $button.prop('disabled', false); } } }; xhr.send(formData); }) }); /** * Приложение для работы с ресторанами. * @type {{initApp: RestoranApp.initApp}} */ var RestoranApp = { $restoranTabs: null, /** * Функция показывает меню ресторана. * @param $container - JQuery объект, контейнер, куда мы вставляем HTML код. * @param menuId - ID меню, который мы будем вставлять. ID это цифра, * по этому ID мы найдем нужный блок, который выглядит так <div id="restoran-menu-ID">html code..</div> */ showRestoranMenu: function ($container, menuId) { var $menu = $('#restoran-menu-id-' + menuId); if ($menu.length == 0) { alert('false'); return false; } $container.html($menu.html()); return true; }, /** * Функция показывает нужную вкладку, зная номер этой вкладки. * @param tabId */ showTab: function(tabId) { // делаем активной нужную вкладку. var $menuItems = this.$restoranTabs.find('li'); $menuItems.removeClass('uk-active'); $menuItems.attr('aria-expanded', false); var $menuItem = this.$restoranTabs.find('li').eq(tabId); $menuItem.addClass('uk-active'); $menuItem.attr('aria-expanded', true); // показываем контентную область активной var $tabsContentItems = $('#about-restoran-tabs-content li'); $tabsContentItems.attr('aria-expanded', false); $tabsContentItems.removeClass('uk-active'); var $tabsContent = $tabsContentItems.eq(tabId); $tabsContent.attr('aria-expanded', true); $tabsContent.addClass('uk-active'); }, /** * Функция возвращает промис с комментариями. */ getComments: function(restoranId, pageId) { return $.ajax({ url: '/ajax/restoran/get_comments.php', method: 'POST', data: { restoran_id: restoranId, page: pageId }, dataType: 'html' }); }, initApp: function() { var scope = this; scope.$restoranTabs = $('.tabs-about-restoran'); /** * Событие показа меню. */ $('.jq-menu-item').on('click', function(e) { e.preventDefault(); var $scope = $(this); var containerId = $scope.data('container-id'); var menuId = $scope.data('menu-id'); scope.showRestoranMenu($('#' + containerId), menuId); }); $('.show-menu-button').on('click', function(e) { e.preventDefault(); scope.showTab(1); }); $('form[name=add-restoran-comment-form]').on('submit', function(e) { e.preventDefault(); e.stopPropagation(); var $scope = $(this); var $button = $scope.find('button'); var oldText = $button.text(); $.ajax({ url: '/ajax/restoran/add_comment.php', method: 'POST', data: $scope.serializeArray(), dataType: 'json' }).then(function(response) { $button.prop('disabled', false); $button.text(oldText); if (response.success == true) { location.reload(); } else { grecaptcha.reset(); FormErrors.showErrors($scope, response.data); } }).fail(function() { Alert.show('Не удалось добавить комментарий'); $button.prop('disabled', false); $button.text(oldText); }); }); $('.restoran-like').on('click', function(e) { e.preventDefault(); e.stopPropagation(); var $scope = $(this); $.ajax({ url: '/ajax/restoran/vote.php', method: 'POST', data: { comment_id: $scope.data('comment-id'), sign: $scope.data('sign') }, dataType: 'json' }).then(function(response) { if (response.success == true) { var $targetElement = ($scope.data('sign') > 0) ? $('.restoran-like-' + $scope.data('comment-id')) : $('.restoran-unlike-'+$scope.data('comment-id')); $targetElement.text(response.data); } else { Alert.error(response.text); } }).fail(function() { Alert.show('Не удалось отправить запрос. Попробуйте снова.'); }); }); new Swiper('.restoran-photos-swiper', { slidesPerView: 1, pagination: '.swiper-pagination', paginationClickable: true, spaceBetween: 20, // nextButton: '.organization-right', //prevButton: '.organization-left', breakpoints: { 1920: { slidesPerView: 1, spaceBetween: 20 }, 1024: { slidesPerView: 1, spaceBetween: 20 }, 768: { slidesPerView: 1, spaceBetween: 20 }, 640: { slidesPerView: 1, spaceBetween: 20 }, 320: { slidesPerView: 1, spaceBetween: 10 } } }); // просмотр новости $('.jq-view-news-a').on('click', function(e) { e.preventDefault(); var $scope = $(this); var newsId = $scope.data('news-id'); var $newsContent = $('.jq-view-news-' + newsId); var $newsContainer = $('.jq-restoran-views-news-container'); $newsContainer.html($newsContent.html()); $('.jq-restoran-view-news').css('display', 'block'); $('.jq-restoran-news-list').css('display', 'none'); }); // назад к списку новостей $('.jq-restoran-view-news-back').on('click', function(e) { e.preventDefault(); $('.jq-restoran-news-list').css('display', 'block'); $('.jq-restoran-view-news').css('display', 'none'); }); } }; /** * Функция открывает диалоговое окно с личными сообщениями * @type {{open: Messages.open}} */ var Messages = { open: function(userId) { var params = 'scrollbars=0,resizable=1,menubar=0,location=0,width=710,height=469,toolbar=0,status=0'; window.open('http://www.infoorel.ru/private/?contact=' + userId, 'im', params); return false; } }; $(function() { var registrationReCaptchaId = null; var registrationModal = UIkit.modal("#auth-registration", { center: true }); var restorePasswordReCaptchaId = null; var restorePasswordModal = UIkit.modal('#restore-password-modal', { center: true }); /** * Открытие диалогового окна с личными сообщениями */ $('.open-message-dialog').on('click', function(e) { e.preventDefault(); Messages.open($(this).data('user-id')); }) /** * Изменение данных пользователя */ $('#edit-user').on('submit', function(e) { e.preventDefault(); e.stopPropagation(); var $scope = $(this); var $button = $scope.find('button'); var oldButtonText = $button.text(); $button.text('Сохранение данных...'); $button.attr('disabled', 'disabled'); $.ajax({ url: '/ajax/users/edit.php', method: 'POST', data: $scope.serializeArray(), dataType: 'json' }).then(function(response) { $button.prop('disabled', ''); $button.text(oldButtonText); if (response.success == true) { Alert.show("Данные успешно изменены"); } else { if (typeof response.text != "undefined") { Alert.show(response.text); } else { FormErrors.showErrors($scope, response.data); } } }).fail(function() { $button.prop('disabled', ''); $button.text(oldButtonText); Alert.show("Во время запроса произошла ошибка. Попробуйте, пожалуйста, позже."); }); }); $('.change-user-password-form').on('submit', function(e) { e.preventDefault(); e.stopPropagation(); var $scope = $(this); var $button = $scope.find('button'); var oldButtonText = $button.text(); $button.text('Сохранение данных...'); $button.attr('disabled', 'disabled'); $.ajax({ url: '/ajax/users/change_password.php', method: 'POST', data: $scope.serializeArray(), dataType: 'json' }).then(function(response) { $button.prop('disabled', ''); $button.text(oldButtonText); if (response.success == true) { Alert.show("Данные успешно изменены"); } else { if (typeof response.text != "undefined") { Alert.show(response.text); } else { FormErrors.showErrors($scope, response.data); } } }).fail(function() { $button.prop('disabled', ''); $button.text(oldButtonText); Alert.show("Во время запроса произошла ошибка. Попробуйте, пожалуйста, позже."); }); }); /** * Загрузка аватарки пользователя */ $('#edit-user-avatar-form').on('submit', function(e) { e.preventDefault(); var $scope = $(this); var form = document.getElementById('edit-user-avatar-form'); var formData = new FormData(form); var $button = $scope.find('button[type=submit]'); var oldText = $button.text(); $button.text('Пожалуйста, подождите'); $button.attr('disabled', 'disabled'); var xhr = new XMLHttpRequest(); xhr.open("POST", "/ajax/users/avatar.php"); xhr.onreadystatechange = function() { if (xhr.readyState == 4) { if(xhr.status == 200) { try { var response = JSON.parse(xhr.responseText); if (response.success == true) { location.reload(); } else { FormErrors.showErrors($scope, response.data) } } catch (e) { Alert.show("Не удалось разобрать ответ от сервера."); } $button.text(oldText); $button.prop('disabled', false); } } }; xhr.send(formData); }); /** * Авторизация без социальных сетей. */ $('form[name=auth-form]').on('submit', function(e) { e.preventDefault(); e.stopPropagation(); var $scope = $(this); var $button = $scope.find('button[type=submit]'); var oldButtonText = $button.text(); $button.text('Пожалуйста, подождите...'); $button.attr('disabled', 'disabled'); $.ajax({ url: '/ajax/users/auth.php', type: 'POST', dataType: 'json', data: $scope.serializeArray() }).then(function(response) { if (response.success == true) { location.reload(); } else { Alert.show(response.text); } $button.prop('disabled', false); $button.text(oldButtonText); }).fail(function() { Alert.show("Во время авторизации произошла ошибка."); $button.prop('disabled', false); $button.text(oldButtonText); }); }); /** * Регистрация без социальных сетей */ $('.jq-register-button').on('click', function() { registrationModal.show(); try { if (registrationReCaptchaId == null) { registrationReCaptchaId = grecaptcha.render("jq-auth-registration-recaptcha", { 'sitekey': GOOGLE_CAPTCHA_KEY, 'theme': 'light' }); } else { grecaptcha.reset(registrationReCaptchaId); } } catch (e) { //-- } }); /** * Восстановление пароля */ $('.jq-restore-button').on('click', function() { restorePasswordModal.show(); try { if (restorePasswordReCaptchaId == null) { restorePasswordReCaptchaId = grecaptcha.render("jq-restore-password-recaptcha", { 'sitekey': GOOGLE_CAPTCHA_KEY, 'theme': 'light' }); } else { grecaptcha.reset(restorePasswordReCaptchaId); } } catch (e) { //-- } }); /** * Отправка формы для восстановления пароля */ $('#jq-restore-password-form').on('submit', function(e) { e.preventDefault(); e.stopPropagation(); var $scope = $(this); var $button = $scope.find('button'); var oldButtonText = $button.text(); $button.text('Пожалуйста, подождите.'); $button.attr('disabled', 'disabled'); $.ajax({ url: '/ajax/users/restore_password.php', method: 'POST', dataType: 'json', data: $scope.serializeArray() }).then(function(response) { try { if (response.success == true) { restorePasswordModal.hide(); Alert.success("Ваш пароль отправлен на указанный емайл!", true); } else { if (restorePasswordReCaptchaId != null) { grecaptcha.reset(restorePasswordReCaptchaId); } FormErrors.showErrors($scope, response.data); } } catch (e) { // nothing } $button.prop('disabled', false); $button.text(oldButtonText); }).fail(function() { $button.prop('disabled', false); $button.text(oldButtonText); Alert.show("Во время восстановления пароля произошла ошибка. Попробуйте, пожалуйста, позже."); }); }); $('#jq-registration-form').on('submit', function(e) { e.preventDefault(); e.stopPropagation(); var $scope = $(this); var $button = $scope.find('button'); var oldButtonText = $button.text(); $button.text('Пожалуйста, подождите.'); $button.attr('disabled', 'disabled'); $.ajax({ url: '/ajax/users/registration.php', method: 'POST', dataType: 'json', data: $scope.serializeArray() }).then(function(response) { try { if (response.success == true) { registrationModal.hide(); Alert.success("Вы успешно зарегистрировались на сайте. Сейчас на вашу электронную почту было отправлено письмо с кодом активации. Проверьте вашу электронную почту.", true); } else { if (registrationReCaptchaId != null) { grecaptcha.reset(registrationReCaptchaId); } FormErrors.showErrors($scope, response.data); } } catch (e) { // nothing } $button.prop('disabled', false); $button.text(oldButtonText); }).fail(function() { $button.prop('disabled', false); $button.text(oldButtonText); Alert.show("Во время регистрации произошла ошибка. Попробуйте, пожалуйста, позже."); }); }); /** * Подтверждение заявки в друзья. */ $('.jq-accept-friend-action').on('click', function(e) { e.preventDefault(); var $scope = $(this); var friendId = $scope.data('user-id'); $.ajax({ url: '/ajax/users/friends.php?route=accept_friend', data: { friend_id: friendId, }, type: 'POST', dataType: 'json' }).then(function(response) { if (response.success == true) { location.reload(); } else { Alert.error(response.text); } }).fail(function() { Alert.error('При отправке запроса произошла ошибка. Попробуйте, пожалуйста позже'); }) }); /** * Добавление в друзья. */ $('.jq-add-to-friend-action').on('click', function(e) { e.preventDefault(); var $scope = $(this); var friendId = $scope.data('user-id'); $.ajax({ url: '/ajax/users/friends.php?route=add_to_friend', data: { friend_id: friendId, }, type: 'POST', dataType: 'json' }).then(function(response) { if (response.success == true) { location.reload(); } else { Alert.error(response.text); } }).fail(function() { Alert.error('При отправке запроса произошла ошибка. Попробуйте, пожалуйста позже'); }) }); /** * Удалить из друзей. */ $('.jq-delete-friend-action').on('click', function(e) { e.preventDefault(); var $scope = $(this); var friendId = $scope.data('user-id'); $.ajax({ url: '/ajax/users/friends.php?route=delete_friend', data: { friend_id: friendId, }, type: 'POST', dataType: 'json' }).then(function(response) { if (response.success == true) { location.reload(); } else { Alert.error(response.text); } }).fail(function() { Alert.error('При отправке запроса произошла ошибка. Попробуйте, пожалуйста позже'); }) }); }); /** * JavaScript приложения для работы с разделом работа */ var VacancyApp = { $modal: null, initApp: function() { // модальное окно для отправки личного сообщения автору объявления. // add-vacancy-message-modal this.$modal = UIkit.modal("#add-vacancy-message-modal", { center: true }); var progressbar = $("#progressbar"), bar = progressbar.find('.uk-progress-bar'), settings = { action: '/ajax/photo_loader.php?route=vacancy', allow : '*.(jpg|jpeg|png)', loadstart: function() { bar.css("width", "0%").text("0%"); progressbar.removeClass("uk-hidden"); }, progress: function(percent) { percent = Math.ceil(percent); bar.css("width", percent+"%").text(percent+"%"); }, allcomplete: function(response) { bar.css("width", "100%").text("100%"); setTimeout(function(){ progressbar.addClass("uk-hidden"); }, 250); // файл загружен. // показываем этот файл. response = $.parseJSON(response); if (response.success == true) { $('#jq-loaded-photo-preview').html('<img src="/' + response.data + '"><input type="hidden" name="photo_src" value="'+response.data+'">'); } else { Alert.error(response.text); } } }; var select = UIkit.uploadSelect($("#upload-select"), settings), drop = UIkit.uploadDrop($("#upload-drop"), settings); }, showModal: function() { this.$modal.show(); } }; $(function(){ $('form[name=jq-edit-vacancy]').on('submit', function(e) { e.preventDefault(); e.stopPropagation(); var $scope = $(this); var $button = $scope.find('button[type=submit]'); //--- var oldButtonText = $button.text(); $button.text('Отправка...'); $button.attr('disabled', 'disabled'); //--- $.ajax({ url: '/ajax/edit_vacancy.php', method: 'POST', dataType: 'json', data: $scope.serializeArray() }).then(function(response) { if (response.success == false) { FormErrors.showErrors($scope, response.data); grecaptcha.reset(); } else { location.href='/job/'; } $button.prop('disabled', false); $button.text(oldButtonText); }).fail(function() { Alert.error("Во время отправки данных произошла ошибка. Попробуйте позже."); $button.prop('disabled', false); $button.text(oldButtonText); }); }); $('.jq-show-add-vacancy-message-modal').on('click', function() { VacancyApp.showModal(); }); $('form[name=add-vacancy-message-form]').on('submit', function(e) { e.preventDefault(); e.stopPropagation(); var $scope = $(this); var $button = $scope.find('button[type=submit]'); //--- var oldButtonText = $button.text(); $button.text('Отправка...'); $button.attr('disabled', 'disabled'); //--- $.ajax({ url: '/ajax/vacancies/add_message.php', method: 'POST', data: $scope.serializeArray(), dataType: 'json' }).then(function(response) { if (response.success == true) { VacancyApp.$modal.hide(); Alert.success("Ваше сообщение было успешно отправлено"); } else { FormErrors.showErrors($scope, response.data); } $button.prop('disabled', false); $button.text(oldButtonText); }).fail(function() { Alert.error("Во время отправки сообщения произошла ошибка. Попробуйте позже."); $button.prop('disabled', false); $button.text(oldButtonText); }); }) });
/js/prod/
Èìÿ
Äàòà
Ðàçìåð
..
2019-02-14
prod.js
2017-02-14
81 êá.
prod.min.js
2017-02-14
37 êá.
vendor.js
2017-02-14
335 êá.
vendor.min.js
2017-02-14
236 êá.
/js/prod
Çàãðóçèòü ôàéëû
Ôàéë 1
Ôàéë 2
Ôàéë 3