Орла
Области
Компаний
Пользователи
Галерея
Фиксированные новости
Орла
Отзывы о фирмах
Тарифы
Пользователи
Области
Банкоматы
Торговые точки
Доска объявлений
Курсы валют
Скидки
организации Орла
организации области
товары
сайты
сайты Орел
Данные
Разделы
Поиск
Поиск запросы
Статистика
Показы каталога организаций
Статистика клиенты
Пользователи
Сайты
Управление сайтом
Анкета
Аптеки
Афиша
Афиша новая
Баннеры
Бизнес >
Викторина
Голосование
Гость на сайте
Истории
Календарь событий
Каталоги >
Конкурс красоты
Конкурс аудио
Консультации
Меню
Новое на сайте
Новости >
Организации >
Программа ТВ
Публикации
Разделы сайта
Рассылка
Рестораны
Секрет фирмы >
Сервисы >
Ссылки
Тесты
Файловый менеджер
Форум
Фотогалерея
Обратная связь
Недвижимость
Новый год
Тексты
Пользователи
Юридический рейтинг
Отзывы на товары
Бан пользователей
Жалобы
Новые тесты
Коронавирус
Файловый менеджер
Имя файла
RestoranApp.js
Содержимое
/** * Приложение для работы с ресторанами. * @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.restoran-content-tab'); $tabsContentItems.attr('aria-expanded', false); $tabsContentItems.removeClass('uk-active'); $tabsContentItems.eq(tabId).addClass('uk-active'); $('.jq-menu-container').addClass('uk-active'); if (tabId == 1) { // вкладка комментария, в этом случае добавим хеш комментария location.hash = '#reviews'; } }, /** * Функция возвращает промис с комментариями. */ 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] .jq-restoran-karma-btn-group button').on('click', function() { var sign = $(this).data('sign'); $('form[name=add-restoran-comment-form] input[name=karma]').val(sign); }); $('form[name=add-restoran-comment-form]').on('submit', function(e) { e.preventDefault(); e.stopPropagation(); var $scope = $(this); var $button = $scope.find('button[type=submit]'); var oldText = $button.text(); var formData = new FormData(this); $.ajax({ url: '/ajax/restoran/add_comment.php', method: 'POST', data: formData, cache: false, contentType: false, processData: false, dataType: 'json' }).then(function(response) { $button.prop('disabled', false); $button.text(oldText); if (response.success == true) { location.reload(); } else { FormErrors.showErrors($scope, response.data); if (typeof refreshSiteCaptcha === 'function') { refreshSiteCaptcha(); } } }).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.show(response.text); } }).fail(function() { Alert.show('Не удалось отправить запрос. Попробуйте снова.'); }); }); $('.jq-restoran-rating-img').on('click', function() { UIkit.modal('#jq-restoran-rating-modal').show(); console.log('1'); }); /** * Голосование за ресторан */ $('.restoran-vote-handler').on('click', function(e) { e.preventDefault(); var $scope = $(this); $.ajax({ url: '/ajax/restoran/restoran_vote.php', method: 'POST', dataType: 'json', data: { restoran_id: $(this).data('restoran-id'), ball: $(this).data('ball') } }).then(function(response) { if (response.success == false) { Alert.show(response.text); } else { UIkit.modal('#jq-restoran-rating-modal').hide(); // получаем новый рейтинг ресторана $.ajax({ url: '/ajax/restoran/get_rating.php', method: 'GET', dataType: 'json', data: { restoran_id: $scope.data('restoran-id') } }).then(function(response) { if (response.success == true) { $('.jq-restoran-rating-img').attr('src', '/restoran/test.php?lines=ff9800&rating=' + response.data); } }); } }); }); new Swiper('.restoran-photos-swiper', { slidesPerView: 1, pagination: '.swiper-pagination', autoplay: 3000, speed: 800, 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'); }); // Нажатие на пункт меню. $(document).on('click', '.restoran-menu-item-text', function(e) { e.preventDefault(); }); //$('.fancybox-restoran-comments').fancybox(); $('.jq-restoran-comment-body img').on('click', function(e) { e.preventDefault(); console.log(1); $.fancybox([ $(this).attr('src') ],{ // fancybox options 'type': 'image' // etc. }); // fancybox }); $('.jq-show-comment-tab').on('click', function(e) { e.preventDefault(); RestoranApp.showTab(1); if ($(this).data('move-to-form') == 1) { setTimeout(function () { $("html, body").animate({ scrollTop: $(".comment-view-text-restoran").offset().top - 50 }, 600); }, 300); } else { setTimeout(function () { $("html, body").animate({ scrollTop: $("#jq-all-restoran-comments-container").offset().top - 150 }, 600); }, 100); } }); /** * Если пользователь запросил вкладку с отзывами, сразу ее покажем */ if (location.hash === '#reviews') { RestoranApp.showTab(1); } } };
/js/2.0/restoran/
Имя
Дата
Размер
..
2026-05-25
RestoranApp.js
2026-05-25
10 кб.
RestoranApp.js~
2019-01-18
10 кб.
RestoranApp.min.js
2017-06-13
3 кб.
RestoranCommentForm.js
2018-07-10
0 байт
/js/2.0/restoran
Загрузить файлы
Файл 1
Файл 2
Файл 3