diff --git a/apps/conference/models.py b/apps/conference/models.py index 65088d3a..f0a8e806 100644 --- a/apps/conference/models.py +++ b/apps/conference/models.py @@ -146,30 +146,6 @@ class Conference(TranslatableModel, EventMixin, ExpoMixin): def __unicode__(self): return self.lazy_translation_getter('name', unicode(self.pk)) - def get_services(self): - return self.get_services_detail() - # country_ids = [item for item, bool in self.country.services if bool==True] - # ids = [item for item, bool in self.services if bool==True] - - # qs = Service.objects.filter(Q(Q(url__in=country_ids) & Q(type=Service.type.conference)) | Q(url__in=ids)) - - # return list(qs) - #return list(Service.objects.language().filter(url__in=ids, type=Service.type.conference).order_by('sort')) - - def get_services_detail(self): - # excluded = ['tickets'] - return super(Conference, self).get_services_detail(None, Service.type.conference) - - # def get_nearest_events(self): - # if self.theme.all(): - # theme = self.theme.all()[0] - # now = datetime.datetime.now() - # now = now - datetime.timedelta(days=1) - # conferences = Conference.objects.filter(theme__in=[theme], data_begin__gt=now).exclude(id=self.id).order_by('data_begin') - # return conferences[:3] - # else: - # return [] - def get_audience(self): return self.audience.all() diff --git a/apps/conference/tests/test_models.py b/apps/conference/tests/test_models.py index b1cd5448..680afc5a 100644 --- a/apps/conference/tests/test_models.py +++ b/apps/conference/tests/test_models.py @@ -1,11 +1,8 @@ import datetime -from accounts.models import User -from django.contrib.contenttypes.models import ContentType from django.core.urlresolvers import reverse, NoReverseMatch from django.test import TestCase from expobanner.models import Paid, Banner -from service.models import Service from stats_collector.models import ObjectStats from theme.models import Tag, Theme @@ -71,16 +68,6 @@ class ConferenceTest(TestCase): 'name', unicode(self.conference.pk)) ) - def test_method_get_services(self): - services = [item for item, bool in self.conference.services if bool] - qs = Service.objects.language() - qs = qs.filter(url__in=services) - - self.assertEqual( - sorted(self.conference.get_services(), key=lambda x: x.pk), - sorted(list(qs), key=lambda x: x.pk) - ) - def test_method_get_news_url(self): self.assertEqual( self.conference.get_news_url(), diff --git a/apps/country/admin.py b/apps/country/admin.py index df71991a..877fa7b1 100644 --- a/apps/country/admin.py +++ b/apps/country/admin.py @@ -81,7 +81,7 @@ def country_change(request, url): 'logo': c.logo} if c.capital: - data['capital'] = c.capital.id + data['capital'] = c.capital_id #data from translated fields for code, name in settings.LANGUAGES: diff --git a/apps/emencia/django/newsletter/forms.py b/apps/emencia/django/newsletter/forms.py index ca385020..a9cd3c6b 100644 --- a/apps/emencia/django/newsletter/forms.py +++ b/apps/emencia/django/newsletter/forms.py @@ -107,15 +107,12 @@ class MailingSettingsForm(forms.ModelForm): model = Contact fields = [ 'email', 'first_name', 'moscow', 'russia', 'r_cities', 'foreign', - 'periodic', 'periodic_day', 'content_news', 'content_overview', - 'content_articles', + 'content_news', 'content_overview', 'content_articles', ] widgets = { 'first_name': forms.TextInput(attrs={'placeholder': _(u'Ваше имя')}), 'moscow': forms.CheckboxInput(), 'foreign': forms.CheckboxInput(), - 'periodic': forms.RadioSelect(), - 'periodic_day': forms.RadioSelect(), 'content_news': forms.CheckboxInput(), 'content_overview': forms.CheckboxInput(), 'content_articles': forms.CheckboxInput(), @@ -437,27 +434,6 @@ class AbstractSubscribeForm(forms.ModelForm): return Theme.objects.filter(id__in=themes) -class SubscribeAssideForm(AbstractSubscribeForm): - city = forms.CharField( - widget=forms.HiddenInput(attrs={'id': 'id_subscription_city', 'placeholder': _(u'Город')}), - required=False) - - periodic = forms.ChoiceField( - choices=ContactSettings.PERIODIC_CHOICES, required=False, - widget=forms.Select(attrs={'placeholder': _(u'Периодичность'), 'id': 'id_subscription_periodic'})) - - def __init__(self, *args, **kwargs): - super(SubscribeAssideForm, self).__init__(*args, **kwargs) - lang = translation.get_language() - self.fields['theme'] = forms.MultipleChoiceField( - choices=[(item.pk, get_by_lang(item, 'name', lang)) for item in SearchQuerySet().models(Theme).all()], - widget=forms.SelectMultiple(attrs={'placeholder': _(u'Тематики'), 'id': 'id_subscription_theme'})) - self.fields['country'] = forms.MultipleChoiceField( - choices=[(item.pk, get_by_lang(item, 'name', lang)) for item in SearchQuerySet().models(Country).all()], - required=False, - widget=forms.SelectMultiple(attrs={'placeholder': _(u'Страны'), 'id': 'id_subscription_country'})) - - class SubscribeSettingsForm(AbstractSubscribeForm): NA_ID = 12 ASIA_ID = 9 diff --git a/apps/emencia/django/newsletter/mailer.py b/apps/emencia/django/newsletter/mailer.py index d0a1b2eb..39f2081c 100644 --- a/apps/emencia/django/newsletter/mailer.py +++ b/apps/emencia/django/newsletter/mailer.py @@ -412,7 +412,6 @@ class NewsLetterSender(object): }) if self.announce: # render template by default announce template - # template = get_template('newsletter/announce_template.html') template = get_template('newsletter/AutomaticEmail_v2.html') context.update(announce_context) content = template.render(context) diff --git a/apps/emencia/django/newsletter/urls/__init__.py b/apps/emencia/django/newsletter/urls/__init__.py index 14c82185..7e6ed352 100644 --- a/apps/emencia/django/newsletter/urls/__init__.py +++ b/apps/emencia/django/newsletter/urls/__init__.py @@ -12,7 +12,6 @@ urlpatterns = patterns('', url(r'^statistics/', include('emencia.django.newsletter.urls.statistics')), url(r'^', include('emencia.django.newsletter.urls.newsletter')), - url(r'^test-letter/', TemplateView.as_view(template_name='client/newsletters/announce_template.html'), name='newsletter_test_letter'), url(r'^activation/send/', TemplateView.as_view(template_name='client/newsletters/activation_send.html'), name='subscription_activation_send'), url(r'^activation/complete/', TemplateView.as_view(template_name='client/newsletters/activation_complete.html'), @@ -22,7 +21,5 @@ urlpatterns = patterns('', name='newsletter_subscription_popup_validate'), url(r'^partisipation/validate/$', 'emencia.django.newsletter.views.expo_views.landing_partisipation_validate', name='landing_partisipation_validate'), - url(r'^subsribe/aside/$', 'emencia.django.newsletter.views.expo_views.subscribe_aside', - name='newsletter_subscription_aside'), url(r'^$', SubscribeView.as_view(), name='newsletter_subscription'), ) diff --git a/apps/emencia/django/newsletter/views/expo_views.py b/apps/emencia/django/newsletter/views/expo_views.py index 45d16142..3125207f 100644 --- a/apps/emencia/django/newsletter/views/expo_views.py +++ b/apps/emencia/django/newsletter/views/expo_views.py @@ -2,19 +2,18 @@ import json from django.core.urlresolvers import reverse_lazy +from django.db.models import Count from django.views.generic import TemplateView, FormView from django.http import HttpResponse from django.shortcuts import redirect from emencia.django.newsletter.forms import ContactForm from emencia.django.newsletter.models import Contact, MailingList -from emencia.django.newsletter.forms import ( - SubscribeAssideForm, MailingSettingsForm -) -from accounts.models import User +from emencia.django.newsletter.forms import MailingSettingsForm from accounts.views import GetUserMixin from functions.http import JsonResponse from city.models import City +from theme.models import Theme class SubscribeView(GetUserMixin, FormView): @@ -81,6 +80,7 @@ class SubscribeView(GetUserMixin, FormView): ctx['object'] = self.object ctx['r_cities'] = self.get_russian_cities() ctx['checked_th'] = self.get_checked_th() + ctx['popular_themes'] = self.get_popular_themes() if self.object is not None: if self.request.GET.get('unsibscribe') and self.object.subscriber: @@ -105,6 +105,17 @@ class SubscribeView(GetUserMixin, FormView): return self.object.themes.values_list('pk', flat=True) return [] + def get_popular_themes(self): + """ + :return: 7 популярных тем (где больше всего подписчиков) + """ + qs = Theme.objects.annotate(c=Count('contact'))\ + .values('pk', 'c')\ + .order_by('-c')[:7] + return Theme.objects.language()\ + .filter(pk__in=[x['pk'] for x in qs])\ + .order_by('name') + class ActivationView(TemplateView): http_method_names = ['get'] @@ -137,34 +148,6 @@ class ActivationView(TemplateView): return ('subscription_activation_complete', (), {}) -def subscribe_aside(request): - if request.POST: - response = {'success': False} - form = SubscribeAssideForm(request.POST) - if form.is_valid(): - email = form.cleaned_data['email'] - try: - user = User.objects.get(username=email) - except User.DoesNotExist: - user = None - contact = Contact.objects.create_contact(email, user) - contact_setting = form.save(commit=False) - contact_setting.contact = contact - contact_setting.exponent_practicum = True - contact_setting.organiser_practicum = True - contact_setting.save() - form.save_m2m() - response['success'] = True - else: - errors = form.errors - if 'theme' in errors: - errors['id_subscription_theme'] = errors['theme'] - response['errors'] = errors - return HttpResponse(json.dumps(response, indent=2), content_type='application/json') - else: - return HttpResponse('not form request') - - def popup_validate(request): response = {'success': False} if request.GET: diff --git a/apps/expobanner/views.py b/apps/expobanner/views.py index 6ec37c7b..624e9a74 100644 --- a/apps/expobanner/views.py +++ b/apps/expobanner/views.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- import json import re + from django.http import HttpResponse -from django.shortcuts import redirect, get_object_or_404 -from django.shortcuts import render_to_response -from django.template import RequestContext +from django.shortcuts import redirect, get_object_or_404, render + from .models import Banner, BannerGroup, URL, Top from expobanner.utils import get_banner_by_params, get_client_ip, get_top_events, get_referer_view, set_cookie @@ -102,7 +102,13 @@ def get_top(request): tops = Top.cached.all() events = get_top_events(tops, params, request) - context = {'objects': events} + ctx = {'objects': events} + + if not events: + return HttpResponse('') + if catalog == 'places': - return render_to_response('client/includes/exposition/expo_top_place.html', context, context_instance=RequestContext(request)) - return render_to_response('client/includes/exposition/expo_top.html', context, context_instance=RequestContext(request)) + return render( + request, 'client/includes/exposition/expo_top_place.html', ctx + ) + return render(request, 'client/includes/exposition/expo_top.html', ctx) diff --git a/apps/exposition/models.py b/apps/exposition/models.py index 69b776d3..9b29049b 100644 --- a/apps/exposition/models.py +++ b/apps/exposition/models.py @@ -5,7 +5,6 @@ from django.contrib.contenttypes import generic from django.core.urlresolvers import reverse_lazy from django.db import models from django.db.models.signals import post_save, pre_save -from django.dispatch import receiver from django.utils import translation from django.utils.translation import ugettext as _ from events.models import TargetAudience @@ -174,19 +173,6 @@ class Exposition(TranslatableModel, EventMixin, ExpoMixin): def get_price(self): return self.price_day or self.price_all - def get_services(self): - return self.get_services_detail() - # country_ids = [item for item, bool in self.country.services if bool==True] - # ids = [item for item, bool in self.services if bool==True] - - # qs = Service.objects.language().filter(Q(Q(url__in=country_ids) & Q(type=Service.type.expo)) | Q(url__in=ids)) - - # return list(qs) - - def get_services_detail(self): - excluded = ['visit'] - return super(Exposition, self).get_services_detail(excluded, Service.type.expo) - def get_parent(self): return {} diff --git a/apps/functions/model_mixin.py b/apps/functions/model_mixin.py index 680a4d4b..9610dd78 100644 --- a/apps/functions/model_mixin.py +++ b/apps/functions/model_mixin.py @@ -245,38 +245,6 @@ class EventMixin(object): def cancel(self): self.canceled_by_administrator = True - def get_services(self): - - country_ids = [item for item, bool in self.country.services if bool==True] - ids = [item for item, bool in self.services if bool==True and item in country_ids] - - return list(Service.objects.language().filter(url__in=ids).order_by('sort')) - - def get_services_detail(self, excluded, _type): - if not isinstance(getattr(self, '_get_services_detail', None), list): - # excluded = ['visit', 'tickets'] - # country_ids = [item for item, bool in self.country.services if bool==True] - services = [item for item, bool in self.services if bool] - qs = Service.objects.language() - if excluded is not None: - qs = qs.exclude(url__in=excluded) - # qs = qs.filter(Q(Q(url__in=country_ids) & Q(type=_type)) | Q(url__in=ids)) - qs = qs.filter(url__in=services) - self._get_services_detail = list(qs) - # import pdb; pdb.set_trace() - #двигаем билеты сразу за переводом - if excluded is None or 'tickets' not in excluded: - translator_idx = tickets = None - for idx, service in enumerate(self._get_services_detail): - if service.url == 'translator': - translator_idx = idx + 1 - elif service.url == 'tickets': - tickets = service - if tickets and translator_idx: - self._get_services_detail.remove(tickets) - self._get_services_detail.insert(translator_idx, tickets) - return self._get_services_detail - def duration_days(self, month=None): if not month: d = self.data_end - self.data_begin diff --git a/apps/place_exposition/views.py b/apps/place_exposition/views.py index d438c3c3..0b6073fa 100644 --- a/apps/place_exposition/views.py +++ b/apps/place_exposition/views.py @@ -237,7 +237,6 @@ class PlaceExpositionListView(MetadataMixin, ListView): места, по ссылке "Все события" """ template_name = 'client/place/place_exposition_list.html' - # cache_range = settings.CACHE_RANGE def get_object(self): slug = self.kwargs.get('slug') diff --git a/apps/service/models.py b/apps/service/models.py index b2dbed81..43df840f 100644 --- a/apps/service/models.py +++ b/apps/service/models.py @@ -6,7 +6,7 @@ from django.db.models.signals import post_save from django.utils.translation import ugettext as _ from functions.custom_fields import EnumField from functions.signal_handlers import post_save_handler -from hvad.models import TranslatableModel, TranslatedFields, TranslationManager +from hvad.models import TranslatableModel, TranslatedFields CURENCIES = ('', 'USD', 'RUB', 'EUR') diff --git a/apps/service/urls.py b/apps/service/urls.py index 9eee7cc6..59786a70 100644 --- a/apps/service/urls.py +++ b/apps/service/urls.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -from django.conf.urls import patterns, include, url +from django.conf.urls import patterns, url from views import ServiceView, CallBackListView, VisitListView, TranslationListView, AdvertisingListView, \ ParticipationListView, RemoteListView,TicketsListView, Thanks diff --git a/apps/service/views.py b/apps/service/views.py index 979245e1..26fce496 100644 --- a/apps/service/views.py +++ b/apps/service/views.py @@ -2,23 +2,17 @@ import json from itertools import chain -from django.http import HttpResponse from django.views.generic import ListView, FormView, TemplateView from django.shortcuts import get_object_or_404 -from django.http import Http404 from django.http import HttpResponseRedirect, HttpResponse -from haystack.query import EmptySearchQuerySet - from meta.views import MetadataMixin -from accounts.models import UserLog from exposition.models import Exposition from conference.models import Conference -from functions.custom_views import ExpoListView from models import Service from order_forms import TranslationForm, CatalogForm, VisitForm, RemoteForm, ParticipationForm, TicketsForm,\ AdvertiseForm, BuildStandForm -#from functions.search_forms import CompanySearchForm +from service.models import CallBack, Visit, Translation, Advertising, Participation, Remote, Tickets order_forms = {'translator': TranslationForm, 'catalog': CatalogForm, 'participation': ParticipationForm, @@ -121,12 +115,12 @@ def advertise(request, catalog=None, event_url=None): raise HttpResponse('not ajax') -from service.models import CallBack, Visit, Translation, Advertising, Participation, Remote, Tickets class AbstractOrderListView(ListView): template_name = 'c_admin/service/order_list.html' paginate_by = 20 + class CallBackListView(AbstractOrderListView): model = CallBack @@ -138,15 +132,19 @@ class VisitListView(AbstractOrderListView): class TranslationListView(AbstractOrderListView): model = Translation + class AdvertisingListView(AbstractOrderListView): model = Advertising + class ParticipationListView(AbstractOrderListView): model = Participation + class RemoteListView(AbstractOrderListView): model = Remote + class TicketsListView(AbstractOrderListView): model = Tickets diff --git a/proj/views.py b/proj/views.py index 709cad65..7d14090a 100644 --- a/proj/views.py +++ b/proj/views.py @@ -16,8 +16,6 @@ from theme.models import Theme from article.models import Article from exposition.models import Exposition from conference.models import Conference -from emencia.django.newsletter.forms import SubscribeAssideForm - from django.db.models.loading import get_model @@ -40,7 +38,7 @@ def expo_context(request): 'main_page_blogs': Article.objects.main_page_blogs(), 'blogs': Article.objects.every_page_blogs(), 'news_list': Article.objects.main_page_news(), 'sng_countries': settings.SNG_COUNTRIES, - 'seo_text': add_seo(request), 'announce_subscribe': SubscribeAssideForm(), + 'seo_text': add_seo(request), 'NO_EXTERNAL_JS': getattr(settings, 'NO_EXTERNAL_JS', False), 'NO_BANNERS': getattr(settings, 'NO_BANNERS', False), 'SUBSCRIBERS_COUNT': get_subscribers_count(), diff --git a/static/client.old/js/main.js b/static/client.old/js/main.js index 013a924f..9a6825bf 100644 --- a/static/client.old/js/main.js +++ b/static/client.old/js/main.js @@ -1020,23 +1020,6 @@ function placeInput(width){ $scrollContainer.mCustomScrollbar(customScrollOptions); }); - /* Открыть диалог подписки на нужной вкладке */ - $('#subscribe-sm').each(function () { - var $container = $(this); - var $links = $container.find('a'); - - $links.on('click', function () { - var $link = $(this); - var index = $links.index(this); - var popupSubscribe = $('#pw-subscribe'); - - $.fancybox(popupSubscribe, fbPopupOptions); - var $tabs = popupSubscribe.find('ul.tabs > li'); - $tabs.eq(index).trigger('click'); - return false; - }); - }); - /* Обработка поведения вкладок */ $("ul.tabs > li").on('click', function () { var $curTab = $(this); diff --git a/static/client/js/_modules/block.exposition.list.js b/static/client/js/_modules/block.exposition.list.js index b659578a..27b14172 100644 --- a/static/client/js/_modules/block.exposition.list.js +++ b/static/client/js/_modules/block.exposition.list.js @@ -1,78 +1,27 @@ var EXPO = EXPO || {}; //isolated namespace EXPO.exposition = EXPO.exposition || {}; if (EXPO.exposition.list){ - console.warn('WARNING: EXPO.place.object is already defined!'); + console.warn('WARNING: EXPO.place.object is already defined!'); }else { - EXPO.exposition.list = (function () { + EXPO.exposition.list = (function () { // dependencies - var com = EXPO.common; + var com = EXPO.common; // variables - var that = {}, - Note = function (it, opt) { - this.opt = opt; - this.DOMthis = it; - this.DOMbutton = it.querySelector('.'+opt.buttonClass); - this.DOMinput = it.querySelector('.'+opt.inputClass); - this.inputName = this.DOMinput.getAttribute('name'); - this.url = this.DOMbutton.getAttribute('href'); - this._controller(); - }; - Note.prototype = { - _init: function () { - - }, - _controller: function () { - var self = this; - $(this.DOMinput).on('blur', function () { - self.send(); - }); - $(this.DOMbutton).on('click', function () { - return false; - }); - }, - send: function () { - var data = {}, - response, - self = this, - handler = function (data) { - if (data.success) { - console.log('ok'); - $(self.DOMbutton).addClass('active'); - } else { - console.log('data not send'); - } - - }; - data[this.inputName] = this.DOMinput.value; - response = com.getRequest(data,this.url,handler); - } - }; - - that.opt = {}; //свойства по умолчанию + var that = {}; + that.opt = {}; //свойства по умолчанию //private - $(function () { - }); + $(function () { + }); // methods - //инициализация общих свойств - that.init = function (options) { - $.extend(this.opt, options); - this.notes = []; - var self = this; - - $('.'+this.opt.note.wrapClass).each(function () { - var note = new Note(this,self.opt.note); - self.notes.push(note); - }); - $('.'+this.opt.note.wrapDisabledClass).on('click', function () { - $.fancybox.open('#pw-login'); - return false; - }); - com.opt.addCalendarText = this.opt.addCalendarText; - com.opt.removeCalendarText = this.opt.removeCalendarText; - }; - return that; - }()); + //инициализация общих свойств + that.init = function (options) { + $.extend(this.opt, options); + com.opt.addCalendarText = this.opt.addCalendarText; + com.opt.removeCalendarText = this.opt.removeCalendarText; + }; + return that; + }()); } diff --git a/static/client/js/_modules/page.events.feed.js b/static/client/js/_modules/page.events.feed.js index 241a7dfc..5555a552 100644 --- a/static/client/js/_modules/page.events.feed.js +++ b/static/client/js/_modules/page.events.feed.js @@ -1,1859 +1,1859 @@ var EXPO = EXPO || {}; //isolated namespace EXPO.events = EXPO.events || {}; if (EXPO.events.feed) { - console.warn('WARNING: EXPO.eventsFeed is already defined!'); + console.warn('WARNING: EXPO.eventsFeed is already defined!'); } else { - EXPO.events.feed = (function () { - // variables - var that = {}; - - //default module setting - that.opt = {}; - //dependence's - var com = EXPO.common; - //private - var Filter = function (opt) { - this.opt = opt; - this.DOMbody = document.getElementById(opt.bodyId); - - }, - /** - * make ajax GET request and launch handler if exist or return data - * @param {Object|string} dataToSend - * @param {string} url - * @param {function} handler - function to execute when task is ready - */ - getRequest = function (dataToSend,url,handler) { - if(!dataToSend){ - dataToSend = ''; - } - $.ajax({ - type: 'GET', - url: url, - data:dataToSend, - success: function(data) { - if(typeof handler == 'function'){ - handler(data); - } else{ - return data; - } - } - }); - }, - /** - * rename name of property of an object/ Check for the old property name to avoid a ReferenceError in strict mode. - * @param {Object} obj object to rename its properties - * @param {string} oldName - * @param {string} newName - * @returns {renameProperty} - */ - renameProperty = function (obj,oldName, newName) { - if (obj.hasOwnProperty(oldName)) { - obj[newName] = obj[oldName]; - - } - return this; - }, - /** - * analogue of Array.length but for object instance - * @param {Object} obj - Object to count its method - * @returns {number} - */ - getObjectLength = function (obj) { - var size = 0, key; - for (key in obj) { - if (obj.hasOwnProperty(key)) size++; - } - return size; - }, - $waiter = $('.wait-ajax.absolute'), - Json2URI = function (jsonObj) { - var str = Object.keys(jsonObj).map(function(key){ - return encodeURIComponent(key) + '=' + encodeURIComponent(jsonObj[key]); - }).join('&'); - return ('?'+str); - }; - - // methods - Filter.prototype = { - show: function () { - //$(this.DOMbody).show(); - $(this.DOMbody).slideDown(); - }, - hide: function () { - $(this.DOMbody).hide(); - //$(this.DOMbody).slideUp(); - - } - }; - - // places and subject modals - /** - * Constructor for modal window 'select subject' - * @param {Object} options - * @constructor - */ - var SubjectModal = function (options) { - /** - * options init - * @type {Object} - */ - this.opt = options; - var self = this, index = 0, - $subjWrap = $('#' + self.opt.subjectTriggerWrapId), - $topicBox, - modalId = self.opt.id, - $modal = $('#' + modalId), - $checkBox = $('.csb-menu-input', $modal), - $selectedItemsWrap = $('#'+this.opt.selectedItemsContainer, $modal), - setDefault = self.opt.defaultOn, - applyBtnClass = self.opt.applyBtnClass, - $modalTrigger = $('#' + self.opt.modalTrigger), - DOMfilterBox = document.getElementById(self.opt.bodyId), - /** - * executed after render of modal Window - * @function - */ - afterRenderHandler = function () { - $waiter.hide(); - - }, - $waiter = $('.wait-ajax.absolute'); - - /** - * this modal window DOM Instance - * @type {*|jQuery|HTMLElement} - */ - this.$modalInst = $('#' + modalId); - - /** - * clones of tags for selected(checked) subject (powered by dna.js objects: see http://dnajs.org/) - * in modal window - * @type {Object} - */ - this.itemsSelected = {}; - /** - * clones of tags for selected(checked) subject (powered by dna.js objects: see http://dnajs.org/) - * on the page itself - * @type {Object} - */ - this.tagsBoxItems = {}; - /** - * clones of sublist of selected(checked) subject (powered by dna.js objects: see http://dnajs.org/) - * @type {Object} - */ - this.sublist = {}; - /** - * Jquery object of filtering input (autocomplete input) - * @type {*|jQuery|HTMLElement} - */ - this.$inputFilter = $('#' + self.opt.filterInputId); - /** - * label span element that contain short description for active filter - * @type {*|jQuery|HTMLElement} - */ - this.$label = $(document.getElementById(this.opt.labelId)); - - this.$selectedItemsWrap = $selectedItemsWrap; - /** - * flag for management of turn of asynchronous requests - * @type {boolean} - */ - this.isReceived = true; - - $(function () { - // topic checkbox selected event - $('.topicChecks', $subjWrap).on('change', function () { - - if ($(this).prop('checked')) { - self._setVisible($(this).val()); - - } else { - self._setUnvisible($(this).val()); - } - }); - // selected topic by default self.opt.defaultOn[] - for (index = 0; index < setDefault.length; index++) { - $topicBox = $('#' + setDefault[index]) - $topicBox.prop('checked', true); - $topicBox.trigger('change'); - - - } - //modal list and sublist behavior - $modal.on('click', 'a.trigger', function () { - var name = $(this).attr('data-name'), - id = $(this).attr('data-id'), - tmplId = $(this).attr('data-template-id'), - $sublist = $(this).siblings('.dna-container'); - // no more than once execution - if ($(this).attr('data-sub') == 'true') { - if ($(this).parent().hasClass('level1')) { - - if (!$sublist.children().length) { - $waiter.show(); - self._renderSublist({name: name, id: id}, tmplId, afterRenderHandler); - $(this).parent().addClass('active'); - } else { - //slideUp & Down stuff - self._slideToggle($sublist, $(this).parent()); - } - } - } - return false; - }); - // modal theme checkbox change behavior - $checkBox.on('change', function (event, param) { - var checkboxId = $(this).attr('id'), - $label = $(this).closest('.custom-radio-check'), - $parent = $(this).closest('.level'), - $parentCheckBox = $parent.parent().closest('.level').children('.custom-radio-check').find('.csb-menu-input'), - $sublist = $parent.children('.sublist'); - if (!param) { - - if ($label.hasClass('active')) { - $label.removeClass('active'); - } else { - $label.addClass('active'); - } - if (this.checked) { - var text = $(this).closest('.level').find('.trigger').first().text(), - tplObj = {'text': text, 'id': checkboxId}; - - //tags field logic - if (!$selectedItemsWrap.hasClass('visible')) { - $selectedItemsWrap.addClass('visible'); - } - self._addTag(checkboxId, tplObj); - - // proper selection and selection group logic - if ($sublist.length) { - $('.csb-menu-input', $sublist).each(function () { - var thisId = this.getAttribute('id'), - tagText = $(this).closest('.level').find('.trigger').first().text(), - DOMlabel = com.closest(this, 'custom-radio-check'); - - this.checked = true; - self._destroyTag(thisId); - com.addClass(DOMlabel, 'active'); - }); - - } else { - $parent = $parent.parent().closest('.level') - // if checked items count equals all items count then parent item is checked and tags for children - deleted - if ($('.csb-menu-input', $parent.find('.sublist')).length == $('.csb-menu-input:checked', $parent.find('.sublist')).length) { - var parentId = $parentCheckBox[0].getAttribute('id'), - parentText = $parentCheckBox.closest('.level').find('.trigger').first().text(), - DOMlabel = com.closest(this, 'custom-radio-check'), - DOMParentLabel = com.closest(DOMlabel.parentNode.parentNode, 'level'), - parentObj = {'text': parentText, 'id': parentId}; - $('.csb-menu-input:checked', $parent.find('.sublist')).each(function () { - - self._destroyTag(this.getAttribute('id')); - }); - $parentCheckBox.prop('checked', true); - com.addClass($(DOMParentLabel).find('.custom-radio-check')[0], 'active'); - - //$parentCheckBox.trigger('change',['true']); - self._addTag(parentId, parentObj); - } - } - - //!uncheck event - } else { - self._destroyTag(checkboxId); - if (!$selectedItemsWrap.children('.dna-clone').length) { - $selectedItemsWrap.removeClass('visible'); - - } - //uncheck all sublist items while parent item is unchecked - if ($sublist.length) { - //destroy all tags for sublist items - $('.csb-menu-input', $sublist).each(function () { - var thisId = $(this).attr('id'), - DOMlabel = com.closest(this, 'custom-radio-check'); - this.checked = false; - - com.removeClass(DOMlabel, 'active'); - self._destroyTag(thisId); - }); - $sublist.addClass('hidden'); - $parent.removeClass('active'); - } else { - // parent item is unchecked and tags for every children item are made - if ($parentCheckBox.length && $parentCheckBox[0].checked) { - var DOMlabel = com.closest($parentCheckBox[0], 'custom-radio-check'), - DOMParentItem = com.closest(DOMlabel, 'level'), - DOMSublist = DOMParentItem.querySelector('.sublist'); - $parentCheckBox.prop('checked', false); - com.removeClass(DOMlabel, 'active'); - self._destroyTag($parentCheckBox.attr('id')); - // checks children items - - $('.csb-menu-input:checked', DOMSublist).each(function () { - var id = this.getAttribute('id'), - tagText = com.closest(this, 'level').querySelector('.trigger').textContent, - tagObj = {'text': tagText, 'id': id}; - self._addTag(id, tagObj); - }); - } - } - - } - } - }); - //delete tag behavior - $('.' + self.opt.deleteTagClass, $modal).on('click', function (e) { - e.stopPropagation(); - var checkboxId = $(this).attr('data-checkbox-id'), - $uncheckBoxes = $('#' + checkboxId); - $uncheckBoxes.prop('checked', false); - $uncheckBoxes.trigger('change'); - self._refreshLabel(); - if (!$selectedItemsWrap.children('.dna-clone').length) { - $selectedItemsWrap.removeClass('visible'); - } - return false; - }); - $('.del-on-page').on('click',function () { - var dataCheckboxId = $(this).attr('data-checkbox-id'); - $('.' + self.opt.deleteTagClass+'[data-checkbox-id="'+dataCheckboxId+'"]', $modal).trigger('click'); - }); - self._autocompleteInit(); - $('.' + applyBtnClass, $modal).on('click', function () { - self.applyHandler(this); - return false; - }); - // кнопка "очистить параметры" - - $('.'+self.opt.clearAllButtonClass,$modal).on('click', function (e) { - e.preventDefault(); - self.resetList(); - return false; - }); - }); - }; - /** - * methods - * @type {{_getAjax: Function, _setVisible: Function, _setUnvisible: Function, _checkCheckBox: Function, check: Function, _autocompleteInit: Function, _renderSublist: Function, _loadParentTree: Function, _destroyTag: Function, _addTag: Function, _slideToggle: Function, resetList: Function, applyHandler: Function}} - */ - SubjectModal.prototype = { - /** - * get ajax response when want sublists - * @param {Object|sting} dataToSend - * @param {function} handler - fires after request is complete - * @private - */ - _getAjax: function (dataToSend, handler) { - var self = this; - if (!dataToSend) { - dataToSend = ''; - } - $waiter.css({display: 'block'}); - $.ajax({ - type: 'GET', - url: self.opt.ajaxUrl, - data: dataToSend, - success: function (data) { - if (typeof handler == 'function') { - $waiter.hide(); - handler(data); - } else { - return data; - - } - } - }); - }, - /** - * filter list accordingly to checked checkbox in 'select type' part of modal - * @param {string} type - * @private - */ - _setVisible: function (type) { - var self = this; - $('.' + type, self.$modalInst).addClass('visible'); - }, - /** - * filter list accordingly to checked checkbox in 'select type' part of modal - * @param {string} type - * @private - */ - _setUnvisible: function (type) { - var self = this, - $li = $('.' + type, self.$modalInst); - $li.find('input[type="checkbox"]').each(function () { - var $this = $(this); - if ($this.prop('checked')) { - $this.prop('checked', false); - $this.trigger('change'); - } - }); - $li.find('.dna-container').each(function () { - if ($(this).children().length) { - $(this).addClass('hidden'); - } - }); - $li.removeClass('visible'); - - }, - /** - * check particular checkbox input - * @param {string} id - * @param {string} name - * @private - */ - _checkCheckBox: function (id, name) { - var self = this, - $chckBox; - if (name == 'th') { - $chckBox = $('#tid_' + self.opt.prefix + id, self.$modalInst); - } else if (name == 'tg') { - $chckBox = $('#tgid_' + self.opt.prefix + id, self.$modalInst); - } - if ($chckBox.length && !$chckBox.prop('checked')) { - $chckBox.prop('checked', true); - $chckBox.trigger('change'); - } - - }, - /** - * check particular checkbox input - * @param {string} id - * @param {string} name - * @public - */ - check: function (id, name) { - var self = this, - $chckBox; - if (name == 'th') { - - $chckBox = $('#tid_' + self.opt.prefix + id, self.$modalInst); - } else if (name == 'tg') { - $chckBox = $('#tgid_' + self.opt.prefix + id, self.$modalInst); - } - if ($chckBox.length) { - $chckBox.prop('checked', true); - $chckBox.trigger('change'); - $chckBox.parent().addClass('active'); - } - - }, - /** - * initiliazing and setup autocomplete field for subject list - * @private - */ - _autocompleteInit: function () { - var self = this, dataObj, text, form = self.$inputFilter.attr('data-form'), index, - $completeWrap = $('#' + self.opt.autoCompleteId), - firstComplete = true, - selectTag = function (event, ui) { - //check of repeating execution - $waiter.show(); - var firstTime = true; - for (var prop in self.sublist) { - for (var prop2 in self.sublist[prop]) { - if (prop2 == ui.item.value) { - firstTime = false; - } - - - } - } - if ($('#tid_' + self.opt.prefix + ui.item.value + '[name="' + ui.item.name + '"]:checked').length) { - firstTime = false; - } - // ban of repeating execution - if (firstTime) { // konec - var $checkbox = $('#tid_' + self.opt.prefix + ui.item.value + '[name="' + ui.item.name + '"]'), - requestObj, requestName, - treeLoadHandler = function (data) { - // make checkboxes selected after loading - if (getObjectLength(data)) { - self._loadParentTree(data, function () { - self._checkCheckBox(ui.item.value, 'tg'); - $waiter.hide(); - }); - } else { - $waiter.hide(); - console.warn() - } - - }; - // load tree related to selected item - if (!$checkbox.length) { - - requestObj = { - id: ui.item.value, - name: ui.item.name - }; - getRequest(requestObj, self.opt.getParentUrl, treeLoadHandler); - } else { - $waiter.hide(); - $checkbox.prop('checked', true); - $checkbox.trigger('change'); - } - - } - }, - requestHandler = function (data) { - dataObj = data; - for (index = 0; index < dataObj.length; ++index) { - renameProperty(dataObj[index], 'text', 'label'); - } - for (index = 0; index < dataObj.length; ++index) { - renameProperty(dataObj[index], 'id', 'value'); - } - if (!self.$inputFilter.hasClass('ui-autocomplete-input')) { - - self.$inputFilter.placeComplete({ - source: dataObj, - minLength: 0, - appendTo: $completeWrap, - select: function (event, ui) { - self.$inputFilter.val(''); - self.$inputFilter.trigger('keyup'); - selectTag(event, ui); - event.preventDefault(); - // return ui.label; - } - }); - self.$inputFilter.placeComplete('search', ""); - firstComplete = false; - } else { - - self.$inputFilter.placeComplete('search', ""); - } - - }; - // var newData = ['banan','banan2','banan3','banan4','banan5']; - self.$inputFilter.attr('autocomplete', 'on'); - - self.$inputFilter.on('keyup', function (event) { - text = $(this).val(); - event.stopImmediatePropagation(); - - - if (text.length > 2 && firstComplete) { - getRequest({'term': text, 'form': form}, self.opt.autoCompleteUrl, requestHandler); - firstComplete = false; - } else if (text.length == 0 && !firstComplete) { - if (self.$inputFilter.hasClass('ui-autocomplete-input')) { - - self.$inputFilter.placeComplete("destroy"); - firstComplete = true; - } - } - return false; - }).click(function () { - return false; - }); - - }, - /** - * render first level sublist - * @param {Object} dataObj - * @param {number|string} tmplId - * @param {function} handler - * @private - */ - _renderSublist: function (dataObj, tmplId, handler) { - var self = this, - index = 0, - template = tmplId + '-sub', - ajaxHandler = function (data) { - if (data.length) { - - self.sublist[template] = {}; - - // for dna.clone definition see dnajs.org - for (index; index < data.length; index++) { - self.sublist[template][data[index].id] = dna.clone(tmplId, data[index]); - - } - handler(data.length); - } else { - $waiter.hide(); - } - }; - self._getAjax(dataObj, ajaxHandler); - }, - /** - * if there is no children element in list, loads list that is parent to children element - * @param {Object} data - * @param {number|string} handler - * @param {function} counter - * @private - */ - _loadParentTree: function (data, handler, counter) { - var self = this, - dataObj = data, - optObj, sublistTemplateId, nestedObj, nestedSublistTemplateId, - /** - * makes request in order to recieve children list information fires after request for parent list - * @param {number} length - * @function - */ - handlerParent = function () { - $waiter.hide(); - counter || counter === 0 ? handler(counter) : handler(); - }; - $waiter.show(); - - - optObj = { - name: dataObj.name, - id: dataObj.id - }; - sublistTemplateId = $('#tid_' + self.opt.prefix + dataObj.id).closest('.level').children('.trigger').attr('data-template-id'); - self._renderSublist(optObj, sublistTemplateId, handlerParent); - - - }, - /** - * destroy tag and clear tags block.for dna.clone definition see dnajs.org - * @param {string} checkboxId - * @private - */ - _destroyTag: function (checkboxId, outer) { - var self = this; - if (self.itemsSelected[checkboxId]) { - dna.destroy(self.itemsSelected[checkboxId]); - - } - if (self.tagsBoxItems[checkboxId]) { - dna.destroy(self.tagsBoxItems[checkboxId]); - - } - }, - /** - * for dna.clone definition see dnajs.org - * @param {number} checkboxId - * @param {Object} tplObj - * @private - */ - _addTag: function (checkboxId, tplObj) { - var self = this; - self.itemsSelected[checkboxId] = dna.clone(self.opt.selectedItemTemplate, tplObj); - self.tagsBoxItems[checkboxId] = dna.clone(self.opt.tagsBoxId, tplObj); - self._refreshLabel(); - if(getObjectLength(self.itemsSelected)){ - $(EXPO.events.feed.DOMapplyButton).show(); - $(EXPO.events.feed.DOMhint).hide(); - } - }, - /** - * hide or show sublists according active selected link - * @param {*|jQuery|HTMLElement} $sublist - * @param {*|jQuery|HTMLElement} $this - * @private - */ - _slideToggle: function ($sublist, $this) { - if ($sublist.hasClass('hidden')) { - $sublist.removeClass('hidden'); - $this.addClass('active'); - } else { - $sublist.addClass('hidden').find('ul').addClass('hidden'); - $this.removeClass('active'); - } - - }, - /** - * reset all selected items, uncheck all selected checkboxes - * @public - */ - resetList: function () { - var self = this; - for (var key in self.itemsSelected) { - if (self.itemsSelected.hasOwnProperty(key)) { - $('#'+key, self.$selfContainer).prop('checked', false).closest('.custom-radio-check').removeClass('active'); - - dna.destroy(self.itemsSelected[key]); - dna.destroy(self.tagsBoxItems[key]); - - } - } - $('.level.active',this.$modal).removeClass('active'); - this._refreshLabel(); - - this.$selectedItemsWrap.removeClass('visible'); - }, - /** - * render label text, if there is no selected element then text will be default - * @private - */ - _refreshLabel: function () { - var oLength = this.$selectedItemsWrap.children().length; - if (oLength){ - this.$label.text(this.$label.attr('data-selected')); - }else{ - this.$label.text(this.$label.attr('data-default')); - - } - }, - // кнопка применить - applyHandler: function (it) { - EXPO.events.feed.modalWindow.close(); - - }, - /** - * select particular item and render its tag and check checkbox - * @param {Object} item - * @public - */ - selectTag:function (item) { - //check of repeating execution - var firstTime = true, - self = this, - waitHandler = function () { - self.isReceived = false; - if(!item.children){ - - for (var prop in self.itemsSelected) { - if (prop == 'tid_'+ self.opt.prefix+item.id){ - firstTime = false; - } - - } - if($('#tid_'+ self.opt.prefix+item.id+':checked').length){ - firstTime = false; - } - if(firstTime){ - self.check(item.id, item.name); - self.isReceived = true; - }else{ - $('#tid_'+ self.opt.prefix + item.id).prop('checked', true); - $('#tid_'+ self.opt.prefix + item.id).trigger('change'); - self.isReceived = true; - - } - }else{ - if($('#tgid_'+ self.opt.prefix+item.children.id).length){ - firstTime = false; - } - //Если выбран родитель - if($('#tid_'+ self.opt.prefix+item.id+':checked').length){ - firstTime = false; - } - if(firstTime) { - - self._loadParentTree({name: item.name, id: item.id}, function () { - self.check(item.children.id, item.children.name); - self.isReceived = true; - - }); - }else if(!$('#tgid_'+ self.opt.prefix+item.id+':checked').length){ - - $('#tgid_'+ self.opt.prefix + item.children.id).prop('checked', true); - $('#tgid_'+ self.opt.prefix + item.children.id).trigger('change'); - self.isReceived = true; - - } - } - - }; - this.wait(waitHandler); - }, - /** - * waits so far the previous request will be executed and execute a method - * @param {function} method - * @param {Object|Array} args - * @public - */ - wait:function(method, args) { - var self = this, - waitImages, - waitHandler = function(self, method, args) { - if (self.isReceived) { - if (args) { - method(args); - } - else{ - method(); - } - clearInterval(waitImages); - } - }; - waitImages = setInterval(function() {waitHandler(self, method, args)}, 100); - } - - - }; - - /** - * Constructor for modal window 'select place' - * @param {Object} options - * @constructor - */ - var PlacesModal = function (options) { - /** - * object properties - * @type {Object} - */ - this.opt = options; - var self = this, - $modal = $('#' + self.opt.id), - $checkBox = $('input[type="checkbox"]', $modal), - $selectedItemsWrap = $('#'+this.opt.selectedItemsContainer, $modal), - DOMTagsWrapper = $('#'+this.opt.selectedItemsContainer, $modal)[0], - $modalTrigger = $('#' + self.opt.modalTrigger), - applyBtnClass = self.opt.applyBtnClass, - idPrefix = 'id_', - DOMfilterBox = document.getElementById(self.opt.bodyId), - - /** - * set trigger link text under the search field - * @function - */ - triggerSetText = function () { - var selectedString, - cutLength = 16; - }; - /** - * current template instances - * @type {Object} - */ - this.curDNA = {}; - /** - * place modal list items that had selected - * in modal window - * @type {Object} - */ - this.itemsSelected = {}; - /** - * place modal list items that had selected - * on page itself - * @type {Object} - */ - this.tagsBoxItems = {}; - this.selectedWrap = $selectedItemsWrap; - this.$selfContainer = $modal; - this.$modal = $modal; - this.idPrefix = idPrefix; - /** - * flag for management of turn of asynchronous requests - * @type {boolean} - */ - this.isReceived = true; - /** - * label span element that contain short description for active filter - * @type {*|jQuery|HTMLElement} - */ - this.$label = $(document.getElementById(this.opt.labelId)); - - /** - * Jquery object of filtering input (autocomplete input) - * @type {*|jQuery|HTMLElement} - */ - this.$inputFilter = $('#' + self.opt.filterInputId); - $(function () { - self._autocompleteInit(); - $modal.on('click', 'a.trigger', function () { - var name = $(this).attr('data-name'), - id = $(this).attr('data-id'), - that = this, - tmplId = $(this).attr('data-template-id'), - $sublist = $(this).siblings('.dna-container'), - afterRenderHandler = function (elem, data) { - var DOMParent = com.closest(that, 'level'), - DOMParentCheckbox = DOMParent.querySelector('.csb-menu-input'); - $('.csb-menu-input', $sublist).each(function () { - var DOMCheckboxWrap = com.closest(this, 'custom-radio-check'); - if (!this.selected) { - - if (DOMParentCheckbox.checked) { - this.checked = true; - com.addClass(DOMCheckboxWrap, 'active'); - } - } - }); - $waiter.hide(); - - }; - // no more than once execution - if ($(this).attr('data-sub') == 'true') { - if ($(this).parent().hasClass('level1')) { - - if (!$sublist.children().length) { - $waiter.show(); - self._renderSublist({name: name, id: id}, tmplId, afterRenderHandler); - } else { - //slideUp & Down stuff - self._slideToggle($sublist, $(this).parent()); - } - } else if ($(this).parent().hasClass('level2')) { - if (!$sublist.children().length) { - self._renderNested({name: name, id: id}, afterRenderHandler, tmplId, id); - $(this).parent().addClass('active'); - } - else { - //slideUp & Down stuff - self._slideToggle($sublist, $(this).parent()); - } - } - } - return false; - }); - - $checkBox.on('change', function (event, param) { - - var id = this.getAttribute('id'), - fakeCheckboxClass = 'custom-radio-check', - fakeCheckbox = com.closest(this, fakeCheckboxClass), - itemClass = 'level', - activeClass = 'active', - sublistClass = 'sublist', - checkboxClass = 'csb-menu-input', - highestItemClass = 'level1', - tagClass = 'csb-selected', - tagButtonClass = 'csbs-del', - triggerClass = 'trigger', - tagIdAttribute = 'data-checkbox-id', - - DOMParentRow = com.closest(this, itemClass), - - DOMParentItem = com.hasClass(DOMParentRow, highestItemClass) == false?com.closest(DOMParentRow.parentNode, itemClass):DOMParentRow, - DOMParentCheckbox = DOMParentItem.querySelector('.'+checkboxClass), - DOMSublist = DOMParentItem.querySelector('.'+sublistClass), - DOMSublistInner = DOMParentRow.querySelector('.'+sublistClass), - DOMHighestItem = com.closest(this, highestItemClass), - DOMHighestCheckbox = DOMHighestItem.querySelector('.'+checkboxClass), - DOMHighestSublist = DOMHighestItem.querySelector('.'+sublistClass), - - selectSublist = function (it) { - var DOMParentItem = com.closest(it, itemClass) || this, - DOMSublist = DOMParentItem.querySelector('.'+sublistClass); - $('.'+checkboxClass, DOMSublist).each(function () { - selectItem(this); - }); - - }, - unSelectSublist = function (it) { - var DOMParentItem = com.closest(it, itemClass) || this, - DOMSublist = DOMParentItem.querySelector('.'+sublistClass); - $('.'+checkboxClass, DOMSublist).each(function () { - unSelectItem(this); - - }); - - }, - selectParent = function (it) { - var DOMParentRow = com.closest(it, itemClass), - DOMParentItem; - if(com.hasClass(DOMParentRow,'level1')){ - DOMParentItem = DOMParentRow; - }else{ - DOMParentItem = com.closest(DOMParentRow.parentNode, itemClass); - } - - com.addClass(DOMParentItem.querySelector('.'+fakeCheckboxClass), activeClass); - DOMParentItem.querySelector('.'+checkboxClass).checked = true; - - //it.selected = true; - - }, - unSelectParent = function (it) { - var DOMParentRow = com.closest(it, itemClass), - DOMParentItem = com.closest(DOMParentRow.parentNode, itemClass) || DOMParentRow; - - com.removeClass(DOMParentItem.querySelector('.'+fakeCheckboxClass), activeClass); - DOMParentItem.querySelector('.'+checkboxClass).checked = false; - //it.checked = false; - - }, - selectItem = function (it) { - var itFakeCheckbox = com.closest(it, fakeCheckboxClass); - com.addClass(itFakeCheckbox, activeClass); - it.checked = true; - com.addClass(DOMParentItem,activeClass); - com.removeClass(DOMSublist,'hidden'); - - }, - unSelectItem = function (it) { - var itFakeCheckbox = com.closest(it, fakeCheckboxClass), - DOMitem = com.closest(it, itemClass); - com.removeClass(itFakeCheckbox, activeClass); - it.checked = false; - // if there is children items - if(DOMitem.querySelector('.'+sublistClass) && !com.hasClass(DOMitem,highestItemClass)){ - unSelectSublist(it); - } - }, - allChildrenSelected = function () { - //var DOMselected = DOMSublist.querySelectorAll('.'+checkboxClass+':checked'), - var DOMSublistParent = com.closest(DOMSublist,sublistClass), - $selected = $(DOMSublist).children('li').children('.'+fakeCheckboxClass).find('.'+checkboxClass+':checked'), - selectedCount = $selected.length, - //allCount = DOMSublist.querySelectorAll('.'+checkboxClass).length; - allCount = $(DOMSublist).children('li').children('.'+fakeCheckboxClass).find('.'+checkboxClass).length; - - if(allCount == selectedCount && selectedCount != 0){ - return true; - } else{ - return false; - } - }, - allHighestSelected = function () { - //var DOMselected = DOMSublist.querySelectorAll('.'+checkboxClass+':checked'), - var $selected = $(DOMHighestSublist).children('li').children('.'+fakeCheckboxClass).find('.'+checkboxClass+':checked'), - selectedCount = $selected.length, - allCount = $(DOMHighestSublist).children('li').children('.'+fakeCheckboxClass).find('.'+checkboxClass).length; - - if(allCount == selectedCount && selectedCount != 0){ - return true; - } else{ - return false; - } - }, - parentSelected = function () { - var parentCheckbox = DOMParentItem.querySelector('.'+checkboxClass); - if(parentCheckbox.checked){ - return true; - }else{ - return false; - } - - }, - // Функционал добавления тегов: если есть в панели выбранный элемент либо его дочерние то удалить эти эдементы; - refreshTags = function (it) { - var DOMSublist = com.closest(it,sublistClass); - var DOMItem = com.closest(it,itemClass); - var DOMSublistInner = DOMItem.querySelector('.'+sublistClass); - var DOMAllTags = DOMTagsWrapper.querySelectorAll('.'+tagClass); - var ARRsublist; - var ARRsublistChildren = DOMSublist.querySelector('.'+sublistClass)?$('.'+checkboxClass+':checked',DOMSublist.querySelector('.'+sublistClass)):null; - var ARRsublistChildrenLength = ARRsublistChildren?ARRsublistChildren.length:null; - var ARRSublistIds = []; - var ARRAllTagsIds = []; - var allTagsLength = 0; - var sublistIdsLength = 0; - var itId = it.getAttribute('id'); - var i = 0, j= 0, t= 0, tmp, k = 0; - var tagId; - var tagText = DOMParentRow.querySelector('.'+triggerClass).innerHTML; - - // если есть дочерние элементы - if(DOMSublistInner){ - ARRsublist = $(DOMSublistInner).children('li').children('.'+fakeCheckboxClass).find('.'+checkboxClass+':checked') - //получаем массив id жлементовЮ для которых есть тег - for(k; k < ARRsublist.length; k++){ - tmp = ARRsublist[k].getAttribute('id'); - ARRSublistIds.push(tmp); - } - //очистк - for(t; t 2 && firstComplete) { - $waiter.show(); - getRequest({'term': text, 'form': form}, self.opt.autoCompleteUrl, requestHandler); - firstComplete = false; - } else if (text.length == 0 && !firstComplete) { - if (self.$inputFilter.hasClass('ui-autocomplete-input')) { - - self.$inputFilter.autocomplete("destroy"); - firstComplete = true; - } - } - return false; - }).click(function () { - return false; - }); - - }, - /** - * loads and shows list tree related to selected id - * @param {Object} data - is JSON object with information about parent elements. - * @param {function} handler - callback function - * @param {number} counter - * @private - */ - _loadParentTree: function (data, handler, counter) { - var self = this, - dataObj = data, - optObj, sublistTemplateId, nestedObj, nestedSublistTemplateId, - $midleLevelCheckbox = $('#id_' + self.opt.prefix + dataObj.id), - /** - * makes request in order to recieve children list information fires after request for parent list - * @param {number} length - * @function - */ - handlerNested = function (length) { - var $checkbox = $('#id_' + self.opt.prefix + dataObj.id), - index = 0, - afterAll = function (number) { - $waiter.hide(); - index++ - if(index == number){ - - counter||counter===0?handler(counter):handler(); - } - }; - $waiter.hide(); - if ($checkbox.length && getObjectLength(self.curDNA[sublistTemplateId + '-sub']) == length) { - - nestedObj = { - name: dataObj.name, - id: dataObj.id - }; - $waiter.show(); - nestedSublistTemplateId = $('#id_' + self.opt.prefix + dataObj.id).closest('.level').children('.trigger').attr('data-template-id'); - self._renderNested(nestedObj, afterAll, nestedSublistTemplateId, dataObj.id); - } - - }, - /** - * @function - */ - handlerParent = function () { - $waiter.hide(); - counter || counter === 0 ? handler(counter) : handler(); - }; - $waiter.show(); - //if element has parent element - if (dataObj.hasOwnProperty('parent')) { - //if checbox is existed - if ($midleLevelCheckbox.length) { - nestedObj = { - name: dataObj.name, - id: dataObj.id - }; - nestedSublistTemplateId = $midleLevelCheckbox.closest('.level').children('.trigger').attr('data-template-id'); - self._renderNested(nestedObj, function () { - $waiter.hide(); - handler(); - }, nestedSublistTemplateId, dataObj.id); - } else { - - optObj = { - name: dataObj.parent.name, - id: dataObj.parent.id - }; - sublistTemplateId = $('#id_' + self.opt.prefix + dataObj.parent.id).closest('.level').children('.trigger').attr('data-template-id'); - self._renderSublist(optObj, sublistTemplateId, handlerNested); - } - - - } else { - optObj = { - name: dataObj.name, - id: dataObj.id - }; - sublistTemplateId = $('#id_' + self.opt.prefix + dataObj.id).closest('.level').children('.trigger').attr('data-template-id'); - self._renderSublist(optObj, sublistTemplateId, handlerParent); - } - - }, - applyHandler: function (it) { - EXPO.events.feed.modalWindow.close(); - }, - /** - * render label text, if there is no selected element then text will be default - * @private - */ - _refreshLabel: function () { - var oLength = this.selectedWrap.children().length; - - if (oLength){ - this.$label.text(this.$label.attr('data-selected')); - }else{ - this.$label.text(this.$label.attr('data-default')); - - } - } - }; - - /////////////////////////// - //инициализация общих свойств - that.init = function (options) { - // settings extending - $.extend(this.opt, options); - // begin of initialization - var self = this, - submitHandler = function () { - $(self.DOMform).find('input[name="~~name~~"]').remove(); - }; - if(this.opt.searchData != 'None' && this.opt.searchData){ - this.previousSearch = JSON.parse(this.opt.searchData) - - } - this.DOMform = document.getElementById(this.opt.formId); - this.DOMhint = document.getElementById(this.opt.filter.hintId); - $(this.DOMform).on('submit', function () { - submitHandler(); - }); - $.widget( "custom.placeComplete", $.ui.autocomplete,{ - _renderItem: function( ul, item ) { - return $( "
  • " ) - .append( $( "" ).text( item.label) ) - .append(' ('+item.cat+')') - .appendTo( ul ); - } - }); - this.DOMapplyButton = document.getElementById(this.opt.applyButtonId); - this.filterPane = new Filter(this.opt.filter); - $('#' + this.opt.filter.buttonId).on('click', function () { - if (com.hasClass(this, self.opt.activeClass)) { - com.removeClass(this, self.opt.activeClass); - self.filterPane.hide(); - } else { - com.addClass(this, self.opt.activeClass); - self.filterPane.show(); - } - return false; - }); - $('#'+self.opt.bodyId+' .' + self.opt.modalTriggerClass).on('click', function (event) { - event.preventDefault(); - self.modalWindow.pullData(this.getAttribute('href')); - self.modalWindow.open(); - return false; - }); - //кнопка применить - $('#'+self.opt.applyButtonId).on('click', function () { - $(self.DOMform).submit(); - return false; - }); - //modal - //модальное окно - this.modalWindow = new com.Modal(self.opt.modal); - //modal windows - this.placesModal = new PlacesModal(self.opt.place); - this.subjModal = new SubjectModal(self.opt.subject); - - // заполнение полей предыдущими значениями - $(function () { - if(self.previousSearch.inputs.length){ - $(self.DOMhint).hide(); - for (var i = 0; i < self.previousSearch.inputs.length; i++) { - // окно выбора тематики - if (self.previousSearch.inputs[i].name == 'th'){ - self.subjModal.selectTag(self.previousSearch.inputs[i]); - - // окно выбора мест - } else if (self.previousSearch.inputs[i].name == 'area'){ - - if(self.previousSearch.inputs[i].children && self.previousSearch.inputs[i].children.children){ - self.placesModal.selectTag(self.previousSearch.inputs[i].children.children); - - }else if (self.previousSearch.inputs[i].children){ - self.placesModal.selectTag(self.previousSearch.inputs[i].children); - - } else if(self.previousSearch.inputs[i]){ - self.placesModal.selectTag(self.previousSearch.inputs[i]); - - - } - } - } - - }else{ - $(self.DOMhint).fadeIn(); - } - //Если выбраны фильтры то появляется кнопка "применить" - if(getObjectLength(self.placesModal.itemsSelected) || getObjectLength(self.subjModal.itemsSelected) ){ - $(self.DOMapplyButton).show(); - - } - }); - - }; - return that; - }()); + EXPO.events.feed = (function () { + // variables + var that = {}; + + //default module setting + that.opt = {}; + //dependence's + var com = EXPO.common; + //private + var Filter = function (opt) { + this.opt = opt; + this.DOMbody = document.getElementById(opt.bodyId); + + }, + /** + * make ajax GET request and launch handler if exist or return data + * @param {Object|string} dataToSend + * @param {string} url + * @param {function} handler - function to execute when task is ready + */ + getRequest = function (dataToSend,url,handler) { + if(!dataToSend){ + dataToSend = ''; + } + $.ajax({ + type: 'GET', + url: url, + data:dataToSend, + success: function(data) { + if(typeof handler == 'function'){ + handler(data); + } else{ + return data; + } + } + }); + }, + /** + * rename name of property of an object/ Check for the old property name to avoid a ReferenceError in strict mode. + * @param {Object} obj object to rename its properties + * @param {string} oldName + * @param {string} newName + * @returns {renameProperty} + */ + renameProperty = function (obj,oldName, newName) { + if (obj.hasOwnProperty(oldName)) { + obj[newName] = obj[oldName]; + + } + return this; + }, + /** + * analogue of Array.length but for object instance + * @param {Object} obj - Object to count its method + * @returns {number} + */ + getObjectLength = function (obj) { + var size = 0, key; + for (key in obj) { + if (obj.hasOwnProperty(key)) size++; + } + return size; + }, + $waiter = $('.wait-ajax.absolute'), + Json2URI = function (jsonObj) { + var str = Object.keys(jsonObj).map(function(key){ + return encodeURIComponent(key) + '=' + encodeURIComponent(jsonObj[key]); + }).join('&'); + return ('?'+str); + }; + + // methods + Filter.prototype = { + show: function () { + //$(this.DOMbody).show(); + $(this.DOMbody).slideDown(); + }, + hide: function () { + $(this.DOMbody).hide(); + //$(this.DOMbody).slideUp(); + + } + }; + + // places and subject modals + /** + * Constructor for modal window 'select subject' + * @param {Object} options + * @constructor + */ + var SubjectModal = function (options) { + /** + * options init + * @type {Object} + */ + this.opt = options; + var self = this, index = 0, + $subjWrap = $('#' + self.opt.subjectTriggerWrapId), + $topicBox, + modalId = self.opt.id, + $modal = $('#' + modalId), + $checkBox = $('.csb-menu-input', $modal), + $selectedItemsWrap = $('#'+this.opt.selectedItemsContainer, $modal), + setDefault = self.opt.defaultOn, + applyBtnClass = self.opt.applyBtnClass, + $modalTrigger = $('#' + self.opt.modalTrigger), + DOMfilterBox = document.getElementById(self.opt.bodyId), + /** + * executed after render of modal Window + * @function + */ + afterRenderHandler = function () { + $waiter.hide(); + + }, + $waiter = $('.wait-ajax.absolute'); + + /** + * this modal window DOM Instance + * @type {*|jQuery|HTMLElement} + */ + this.$modalInst = $('#' + modalId); + + /** + * clones of tags for selected(checked) subject (powered by dna.js objects: see http://dnajs.org/) + * in modal window + * @type {Object} + */ + this.itemsSelected = {}; + /** + * clones of tags for selected(checked) subject (powered by dna.js objects: see http://dnajs.org/) + * on the page itself + * @type {Object} + */ + this.tagsBoxItems = {}; + /** + * clones of sublist of selected(checked) subject (powered by dna.js objects: see http://dnajs.org/) + * @type {Object} + */ + this.sublist = {}; + /** + * Jquery object of filtering input (autocomplete input) + * @type {*|jQuery|HTMLElement} + */ + this.$inputFilter = $('#' + self.opt.filterInputId); + /** + * label span element that contain short description for active filter + * @type {*|jQuery|HTMLElement} + */ + this.$label = $(document.getElementById(this.opt.labelId)); + + this.$selectedItemsWrap = $selectedItemsWrap; + /** + * flag for management of turn of asynchronous requests + * @type {boolean} + */ + this.isReceived = true; + + $(function () { + // topic checkbox selected event + $('.topicChecks', $subjWrap).on('change', function () { + + if ($(this).prop('checked')) { + self._setVisible($(this).val()); + + } else { + self._setUnvisible($(this).val()); + } + }); + // selected topic by default self.opt.defaultOn[] + for (index = 0; index < setDefault.length; index++) { + $topicBox = $('#' + setDefault[index]) + $topicBox.prop('checked', true); + $topicBox.trigger('change'); + + + } + //modal list and sublist behavior + $modal.on('click', 'a.trigger', function () { + var name = $(this).attr('data-name'), + id = $(this).attr('data-id'), + tmplId = $(this).attr('data-template-id'), + $sublist = $(this).siblings('.dna-container'); + // no more than once execution + if ($(this).attr('data-sub') == 'true') { + if ($(this).parent().hasClass('level1')) { + + if (!$sublist.children().length) { + $waiter.show(); + self._renderSublist({name: name, id: id}, tmplId, afterRenderHandler); + $(this).parent().addClass('active'); + } else { + //slideUp & Down stuff + self._slideToggle($sublist, $(this).parent()); + } + } + } + return false; + }); + // modal theme checkbox change behavior + $checkBox.on('change', function (event, param) { + var checkboxId = $(this).attr('id'), + $label = $(this).closest('.custom-radio-check'), + $parent = $(this).closest('.level'), + $parentCheckBox = $parent.parent().closest('.level').children('.custom-radio-check').find('.csb-menu-input'), + $sublist = $parent.children('.sublist'); + if (!param) { + + if ($label.hasClass('active')) { + $label.removeClass('active'); + } else { + $label.addClass('active'); + } + if (this.checked) { + var text = $(this).closest('.level').find('.trigger').first().text(), + tplObj = {'text': text, 'id': checkboxId}; + + //tags field logic + if (!$selectedItemsWrap.hasClass('visible')) { + $selectedItemsWrap.addClass('visible'); + } + self._addTag(checkboxId, tplObj); + + // proper selection and selection group logic + if ($sublist.length) { + $('.csb-menu-input', $sublist).each(function () { + var thisId = this.getAttribute('id'), + tagText = $(this).closest('.level').find('.trigger').first().text(), + DOMlabel = com.closest(this, 'custom-radio-check'); + + this.checked = true; + self._destroyTag(thisId); + com.addClass(DOMlabel, 'active'); + }); + + } else { + $parent = $parent.parent().closest('.level') + // if checked items count equals all items count then parent item is checked and tags for children - deleted + if ($('.csb-menu-input', $parent.find('.sublist')).length == $('.csb-menu-input:checked', $parent.find('.sublist')).length) { + var parentId = $parentCheckBox[0].getAttribute('id'), + parentText = $parentCheckBox.closest('.level').find('.trigger').first().text(), + DOMlabel = com.closest(this, 'custom-radio-check'), + DOMParentLabel = com.closest(DOMlabel.parentNode.parentNode, 'level'), + parentObj = {'text': parentText, 'id': parentId}; + $('.csb-menu-input:checked', $parent.find('.sublist')).each(function () { + + self._destroyTag(this.getAttribute('id')); + }); + $parentCheckBox.prop('checked', true); + com.addClass($(DOMParentLabel).find('.custom-radio-check')[0], 'active'); + + //$parentCheckBox.trigger('change',['true']); + self._addTag(parentId, parentObj); + } + } + + //!uncheck event + } else { + self._destroyTag(checkboxId); + if (!$selectedItemsWrap.children('.dna-clone').length) { + $selectedItemsWrap.removeClass('visible'); + + } + //uncheck all sublist items while parent item is unchecked + if ($sublist.length) { + //destroy all tags for sublist items + $('.csb-menu-input', $sublist).each(function () { + var thisId = $(this).attr('id'), + DOMlabel = com.closest(this, 'custom-radio-check'); + this.checked = false; + + com.removeClass(DOMlabel, 'active'); + self._destroyTag(thisId); + }); + $sublist.addClass('hidden'); + $parent.removeClass('active'); + } else { + // parent item is unchecked and tags for every children item are made + if ($parentCheckBox.length && $parentCheckBox[0].checked) { + var DOMlabel = com.closest($parentCheckBox[0], 'custom-radio-check'), + DOMParentItem = com.closest(DOMlabel, 'level'), + DOMSublist = DOMParentItem.querySelector('.sublist'); + $parentCheckBox.prop('checked', false); + com.removeClass(DOMlabel, 'active'); + self._destroyTag($parentCheckBox.attr('id')); + // checks children items + + $('.csb-menu-input:checked', DOMSublist).each(function () { + var id = this.getAttribute('id'), + tagText = com.closest(this, 'level').querySelector('.trigger').textContent, + tagObj = {'text': tagText, 'id': id}; + self._addTag(id, tagObj); + }); + } + } + + } + } + }); + //delete tag behavior + $('.' + self.opt.deleteTagClass, $modal).on('click', function (e) { + e.stopPropagation(); + var checkboxId = $(this).attr('data-checkbox-id'), + $uncheckBoxes = $('#' + checkboxId); + $uncheckBoxes.prop('checked', false); + $uncheckBoxes.trigger('change'); + self._refreshLabel(); + if (!$selectedItemsWrap.children('.dna-clone').length) { + $selectedItemsWrap.removeClass('visible'); + } + return false; + }); + $('.del-on-page').on('click',function () { + var dataCheckboxId = $(this).attr('data-checkbox-id'); + $('.' + self.opt.deleteTagClass+'[data-checkbox-id="'+dataCheckboxId+'"]', $modal).trigger('click'); + }); + self._autocompleteInit(); + $('.' + applyBtnClass, $modal).on('click', function () { + self.applyHandler(this); + return false; + }); + // кнопка "очистить параметры" + + $('.'+self.opt.clearAllButtonClass,$modal).on('click', function (e) { + e.preventDefault(); + self.resetList(); + return false; + }); + }); + }; + /** + * methods + * @type {{_getAjax: Function, _setVisible: Function, _setUnvisible: Function, _checkCheckBox: Function, check: Function, _autocompleteInit: Function, _renderSublist: Function, _loadParentTree: Function, _destroyTag: Function, _addTag: Function, _slideToggle: Function, resetList: Function, applyHandler: Function}} + */ + SubjectModal.prototype = { + /** + * get ajax response when want sublists + * @param {Object|sting} dataToSend + * @param {function} handler - fires after request is complete + * @private + */ + _getAjax: function (dataToSend, handler) { + var self = this; + if (!dataToSend) { + dataToSend = ''; + } + $waiter.css({display: 'block'}); + $.ajax({ + type: 'GET', + url: self.opt.ajaxUrl, + data: dataToSend, + success: function (data) { + if (typeof handler == 'function') { + $waiter.hide(); + handler(data); + } else { + return data; + + } + } + }); + }, + /** + * filter list accordingly to checked checkbox in 'select type' part of modal + * @param {string} type + * @private + */ + _setVisible: function (type) { + var self = this; + $('.' + type, self.$modalInst).addClass('visible'); + }, + /** + * filter list accordingly to checked checkbox in 'select type' part of modal + * @param {string} type + * @private + */ + _setUnvisible: function (type) { + var self = this, + $li = $('.' + type, self.$modalInst); + $li.find('input[type="checkbox"]').each(function () { + var $this = $(this); + if ($this.prop('checked')) { + $this.prop('checked', false); + $this.trigger('change'); + } + }); + $li.find('.dna-container').each(function () { + if ($(this).children().length) { + $(this).addClass('hidden'); + } + }); + $li.removeClass('visible'); + + }, + /** + * check particular checkbox input + * @param {string} id + * @param {string} name + * @private + */ + _checkCheckBox: function (id, name) { + var self = this, + $chckBox; + if (name == 'th') { + $chckBox = $('#tid_' + self.opt.prefix + id, self.$modalInst); + } else if (name == 'tg') { + $chckBox = $('#tgid_' + self.opt.prefix + id, self.$modalInst); + } + if ($chckBox.length && !$chckBox.prop('checked')) { + $chckBox.prop('checked', true); + $chckBox.trigger('change'); + } + + }, + /** + * check particular checkbox input + * @param {string} id + * @param {string} name + * @public + */ + check: function (id, name) { + var self = this, + $chckBox; + if (name == 'th') { + + $chckBox = $('#tid_' + self.opt.prefix + id, self.$modalInst); + } else if (name == 'tg') { + $chckBox = $('#tgid_' + self.opt.prefix + id, self.$modalInst); + } + if ($chckBox.length) { + $chckBox.prop('checked', true); + $chckBox.trigger('change'); + $chckBox.parent().addClass('active'); + } + + }, + /** + * initiliazing and setup autocomplete field for subject list + * @private + */ + _autocompleteInit: function () { + var self = this, dataObj, text, form = self.$inputFilter.attr('data-form'), index, + $completeWrap = $('#' + self.opt.autoCompleteId), + firstComplete = true, + selectTag = function (event, ui) { + //check of repeating execution + $waiter.show(); + var firstTime = true; + for (var prop in self.sublist) { + for (var prop2 in self.sublist[prop]) { + if (prop2 == ui.item.value) { + firstTime = false; + } + + + } + } + if ($('#tid_' + self.opt.prefix + ui.item.value + '[name="' + ui.item.name + '"]:checked').length) { + firstTime = false; + } + // ban of repeating execution + if (firstTime) { // konec + var $checkbox = $('#tid_' + self.opt.prefix + ui.item.value + '[name="' + ui.item.name + '"]'), + requestObj, requestName, + treeLoadHandler = function (data) { + // make checkboxes selected after loading + if (getObjectLength(data)) { + self._loadParentTree(data, function () { + self._checkCheckBox(ui.item.value, 'tg'); + $waiter.hide(); + }); + } else { + $waiter.hide(); + console.warn() + } + + }; + // load tree related to selected item + if (!$checkbox.length) { + + requestObj = { + id: ui.item.value, + name: ui.item.name + }; + getRequest(requestObj, self.opt.getParentUrl, treeLoadHandler); + } else { + $waiter.hide(); + $checkbox.prop('checked', true); + $checkbox.trigger('change'); + } + + } + }, + requestHandler = function (data) { + dataObj = data; + for (index = 0; index < dataObj.length; ++index) { + renameProperty(dataObj[index], 'text', 'label'); + } + for (index = 0; index < dataObj.length; ++index) { + renameProperty(dataObj[index], 'id', 'value'); + } + if (!self.$inputFilter.hasClass('ui-autocomplete-input')) { + + self.$inputFilter.placeComplete({ + source: dataObj, + minLength: 0, + appendTo: $completeWrap, + select: function (event, ui) { + self.$inputFilter.val(''); + self.$inputFilter.trigger('keyup'); + selectTag(event, ui); + event.preventDefault(); + // return ui.label; + } + }); + self.$inputFilter.placeComplete('search', ""); + firstComplete = false; + } else { + + self.$inputFilter.placeComplete('search', ""); + } + + }; + // var newData = ['banan','banan2','banan3','banan4','banan5']; + self.$inputFilter.attr('autocomplete', 'on'); + + self.$inputFilter.on('keyup', function (event) { + text = $(this).val(); + event.stopImmediatePropagation(); + + + if (text.length > 2 && firstComplete) { + getRequest({'term': text, 'form': form}, self.opt.autoCompleteUrl, requestHandler); + firstComplete = false; + } else if (text.length == 0 && !firstComplete) { + if (self.$inputFilter.hasClass('ui-autocomplete-input')) { + + self.$inputFilter.placeComplete("destroy"); + firstComplete = true; + } + } + return false; + }).click(function () { + return false; + }); + + }, + /** + * render first level sublist + * @param {Object} dataObj + * @param {number|string} tmplId + * @param {function} handler + * @private + */ + _renderSublist: function (dataObj, tmplId, handler) { + var self = this, + index = 0, + template = tmplId + '-sub', + ajaxHandler = function (data) { + if (data.length) { + + self.sublist[template] = {}; + + // for dna.clone definition see dnajs.org + for (index; index < data.length; index++) { + self.sublist[template][data[index].id] = dna.clone(tmplId, data[index]); + + } + handler(data.length); + } else { + $waiter.hide(); + } + }; + self._getAjax(dataObj, ajaxHandler); + }, + /** + * if there is no children element in list, loads list that is parent to children element + * @param {Object} data + * @param {number|string} handler + * @param {function} counter + * @private + */ + _loadParentTree: function (data, handler, counter) { + var self = this, + dataObj = data, + optObj, sublistTemplateId, nestedObj, nestedSublistTemplateId, + /** + * makes request in order to recieve children list information fires after request for parent list + * @param {number} length + * @function + */ + handlerParent = function () { + $waiter.hide(); + counter || counter === 0 ? handler(counter) : handler(); + }; + $waiter.show(); + + + optObj = { + name: dataObj.name, + id: dataObj.id + }; + sublistTemplateId = $('#tid_' + self.opt.prefix + dataObj.id).closest('.level').children('.trigger').attr('data-template-id'); + self._renderSublist(optObj, sublistTemplateId, handlerParent); + + + }, + /** + * destroy tag and clear tags block.for dna.clone definition see dnajs.org + * @param {string} checkboxId + * @private + */ + _destroyTag: function (checkboxId, outer) { + var self = this; + if (self.itemsSelected[checkboxId]) { + dna.destroy(self.itemsSelected[checkboxId]); + + } + if (self.tagsBoxItems[checkboxId]) { + dna.destroy(self.tagsBoxItems[checkboxId]); + + } + }, + /** + * for dna.clone definition see dnajs.org + * @param {number} checkboxId + * @param {Object} tplObj + * @private + */ + _addTag: function (checkboxId, tplObj) { + var self = this; + self.itemsSelected[checkboxId] = dna.clone(self.opt.selectedItemTemplate, tplObj); + self.tagsBoxItems[checkboxId] = dna.clone(self.opt.tagsBoxId, tplObj); + self._refreshLabel(); + if(getObjectLength(self.itemsSelected)){ + $(EXPO.events.feed.DOMapplyButton).show(); + $(EXPO.events.feed.DOMhint).hide(); + } + }, + /** + * hide or show sublists according active selected link + * @param {*|jQuery|HTMLElement} $sublist + * @param {*|jQuery|HTMLElement} $this + * @private + */ + _slideToggle: function ($sublist, $this) { + if ($sublist.hasClass('hidden')) { + $sublist.removeClass('hidden'); + $this.addClass('active'); + } else { + $sublist.addClass('hidden').find('ul').addClass('hidden'); + $this.removeClass('active'); + } + + }, + /** + * reset all selected items, uncheck all selected checkboxes + * @public + */ + resetList: function () { + var self = this; + for (var key in self.itemsSelected) { + if (self.itemsSelected.hasOwnProperty(key)) { + $('#'+key, self.$selfContainer).prop('checked', false).closest('.custom-radio-check').removeClass('active'); + + dna.destroy(self.itemsSelected[key]); + dna.destroy(self.tagsBoxItems[key]); + + } + } + $('.level.active',this.$modal).removeClass('active'); + this._refreshLabel(); + + this.$selectedItemsWrap.removeClass('visible'); + }, + /** + * render label text, if there is no selected element then text will be default + * @private + */ + _refreshLabel: function () { + var oLength = this.$selectedItemsWrap.children().length; + if (oLength){ + this.$label.text(this.$label.attr('data-selected')); + }else{ + this.$label.text(this.$label.attr('data-default')); + + } + }, + // кнопка применить + applyHandler: function (it) { + EXPO.events.feed.modalWindow.close(); + + }, + /** + * select particular item and render its tag and check checkbox + * @param {Object} item + * @public + */ + selectTag:function (item) { + //check of repeating execution + var firstTime = true, + self = this, + waitHandler = function () { + self.isReceived = false; + if(!item.children){ + + for (var prop in self.itemsSelected) { + if (prop == 'tid_'+ self.opt.prefix+item.id){ + firstTime = false; + } + + } + if($('#tid_'+ self.opt.prefix+item.id+':checked').length){ + firstTime = false; + } + if(firstTime){ + self.check(item.id, item.name); + self.isReceived = true; + }else{ + $('#tid_'+ self.opt.prefix + item.id).prop('checked', true); + $('#tid_'+ self.opt.prefix + item.id).trigger('change'); + self.isReceived = true; + + } + }else{ + if($('#tgid_'+ self.opt.prefix+item.children.id).length){ + firstTime = false; + } + //Если выбран родитель + if($('#tid_'+ self.opt.prefix+item.id+':checked').length){ + firstTime = false; + } + if(firstTime) { + + self._loadParentTree({name: item.name, id: item.id}, function () { + self.check(item.children.id, item.children.name); + self.isReceived = true; + + }); + }else if(!$('#tgid_'+ self.opt.prefix+item.id+':checked').length){ + + $('#tgid_'+ self.opt.prefix + item.children.id).prop('checked', true); + $('#tgid_'+ self.opt.prefix + item.children.id).trigger('change'); + self.isReceived = true; + + } + } + + }; + this.wait(waitHandler); + }, + /** + * waits so far the previous request will be executed and execute a method + * @param {function} method + * @param {Object|Array} args + * @public + */ + wait:function(method, args) { + var self = this, + waitImages, + waitHandler = function(self, method, args) { + if (self.isReceived) { + if (args) { + method(args); + } + else{ + method(); + } + clearInterval(waitImages); + } + }; + waitImages = setInterval(function() {waitHandler(self, method, args)}, 100); + } + + + }; + + /** + * Constructor for modal window 'select place' + * @param {Object} options + * @constructor + */ + var PlacesModal = function (options) { + /** + * object properties + * @type {Object} + */ + this.opt = options; + var self = this, + $modal = $('#' + self.opt.id), + $checkBox = $('input[type="checkbox"]', $modal), + $selectedItemsWrap = $('#'+this.opt.selectedItemsContainer, $modal), + DOMTagsWrapper = $('#'+this.opt.selectedItemsContainer, $modal)[0], + $modalTrigger = $('#' + self.opt.modalTrigger), + applyBtnClass = self.opt.applyBtnClass, + idPrefix = 'id_', + DOMfilterBox = document.getElementById(self.opt.bodyId), + + /** + * set trigger link text under the search field + * @function + */ + triggerSetText = function () { + var selectedString, + cutLength = 16; + }; + /** + * current template instances + * @type {Object} + */ + this.curDNA = {}; + /** + * place modal list items that had selected + * in modal window + * @type {Object} + */ + this.itemsSelected = {}; + /** + * place modal list items that had selected + * on page itself + * @type {Object} + */ + this.tagsBoxItems = {}; + this.selectedWrap = $selectedItemsWrap; + this.$selfContainer = $modal; + this.$modal = $modal; + this.idPrefix = idPrefix; + /** + * flag for management of turn of asynchronous requests + * @type {boolean} + */ + this.isReceived = true; + /** + * label span element that contain short description for active filter + * @type {*|jQuery|HTMLElement} + */ + this.$label = $(document.getElementById(this.opt.labelId)); + + /** + * Jquery object of filtering input (autocomplete input) + * @type {*|jQuery|HTMLElement} + */ + this.$inputFilter = $('#' + self.opt.filterInputId); + $(function () { + self._autocompleteInit(); + $modal.on('click', 'a.trigger', function () { + var name = $(this).attr('data-name'), + id = $(this).attr('data-id'), + that = this, + tmplId = $(this).attr('data-template-id'), + $sublist = $(this).siblings('.dna-container'), + afterRenderHandler = function (elem, data) { + var DOMParent = com.closest(that, 'level'), + DOMParentCheckbox = DOMParent.querySelector('.csb-menu-input'); + $('.csb-menu-input', $sublist).each(function () { + var DOMCheckboxWrap = com.closest(this, 'custom-radio-check'); + if (!this.selected) { + + if (DOMParentCheckbox.checked) { + this.checked = true; + com.addClass(DOMCheckboxWrap, 'active'); + } + } + }); + $waiter.hide(); + + }; + // no more than once execution + if ($(this).attr('data-sub') == 'true') { + if ($(this).parent().hasClass('level1')) { + + if (!$sublist.children().length) { + $waiter.show(); + self._renderSublist({name: name, id: id}, tmplId, afterRenderHandler); + } else { + //slideUp & Down stuff + self._slideToggle($sublist, $(this).parent()); + } + } else if ($(this).parent().hasClass('level2')) { + if (!$sublist.children().length) { + self._renderNested({name: name, id: id}, afterRenderHandler, tmplId, id); + $(this).parent().addClass('active'); + } + else { + //slideUp & Down stuff + self._slideToggle($sublist, $(this).parent()); + } + } + } + return false; + }); + + $checkBox.on('change', function (event, param) { + + var id = this.getAttribute('id'), + fakeCheckboxClass = 'custom-radio-check', + fakeCheckbox = com.closest(this, fakeCheckboxClass), + itemClass = 'level', + activeClass = 'active', + sublistClass = 'sublist', + checkboxClass = 'csb-menu-input', + highestItemClass = 'level1', + tagClass = 'csb-selected', + tagButtonClass = 'csbs-del', + triggerClass = 'trigger', + tagIdAttribute = 'data-checkbox-id', + + DOMParentRow = com.closest(this, itemClass), + + DOMParentItem = com.hasClass(DOMParentRow, highestItemClass) == false?com.closest(DOMParentRow.parentNode, itemClass):DOMParentRow, + DOMParentCheckbox = DOMParentItem.querySelector('.'+checkboxClass), + DOMSublist = DOMParentItem.querySelector('.'+sublistClass), + DOMSublistInner = DOMParentRow.querySelector('.'+sublistClass), + DOMHighestItem = com.closest(this, highestItemClass), + DOMHighestCheckbox = DOMHighestItem.querySelector('.'+checkboxClass), + DOMHighestSublist = DOMHighestItem.querySelector('.'+sublistClass), + + selectSublist = function (it) { + var DOMParentItem = com.closest(it, itemClass) || this, + DOMSublist = DOMParentItem.querySelector('.'+sublistClass); + $('.'+checkboxClass, DOMSublist).each(function () { + selectItem(this); + }); + + }, + unSelectSublist = function (it) { + var DOMParentItem = com.closest(it, itemClass) || this, + DOMSublist = DOMParentItem.querySelector('.'+sublistClass); + $('.'+checkboxClass, DOMSublist).each(function () { + unSelectItem(this); + + }); + + }, + selectParent = function (it) { + var DOMParentRow = com.closest(it, itemClass), + DOMParentItem; + if(com.hasClass(DOMParentRow,'level1')){ + DOMParentItem = DOMParentRow; + }else{ + DOMParentItem = com.closest(DOMParentRow.parentNode, itemClass); + } + + com.addClass(DOMParentItem.querySelector('.'+fakeCheckboxClass), activeClass); + DOMParentItem.querySelector('.'+checkboxClass).checked = true; + + //it.selected = true; + + }, + unSelectParent = function (it) { + var DOMParentRow = com.closest(it, itemClass), + DOMParentItem = com.closest(DOMParentRow.parentNode, itemClass) || DOMParentRow; + + com.removeClass(DOMParentItem.querySelector('.'+fakeCheckboxClass), activeClass); + DOMParentItem.querySelector('.'+checkboxClass).checked = false; + //it.checked = false; + + }, + selectItem = function (it) { + var itFakeCheckbox = com.closest(it, fakeCheckboxClass); + com.addClass(itFakeCheckbox, activeClass); + it.checked = true; + com.addClass(DOMParentItem,activeClass); + com.removeClass(DOMSublist,'hidden'); + + }, + unSelectItem = function (it) { + var itFakeCheckbox = com.closest(it, fakeCheckboxClass), + DOMitem = com.closest(it, itemClass); + com.removeClass(itFakeCheckbox, activeClass); + it.checked = false; + // if there is children items + if(DOMitem.querySelector('.'+sublistClass) && !com.hasClass(DOMitem,highestItemClass)){ + unSelectSublist(it); + } + }, + allChildrenSelected = function () { + //var DOMselected = DOMSublist.querySelectorAll('.'+checkboxClass+':checked'), + var DOMSublistParent = com.closest(DOMSublist,sublistClass), + $selected = $(DOMSublist).children('li').children('.'+fakeCheckboxClass).find('.'+checkboxClass+':checked'), + selectedCount = $selected.length, + //allCount = DOMSublist.querySelectorAll('.'+checkboxClass).length; + allCount = $(DOMSublist).children('li').children('.'+fakeCheckboxClass).find('.'+checkboxClass).length; + + if(allCount == selectedCount && selectedCount != 0){ + return true; + } else{ + return false; + } + }, + allHighestSelected = function () { + //var DOMselected = DOMSublist.querySelectorAll('.'+checkboxClass+':checked'), + var $selected = $(DOMHighestSublist).children('li').children('.'+fakeCheckboxClass).find('.'+checkboxClass+':checked'), + selectedCount = $selected.length, + allCount = $(DOMHighestSublist).children('li').children('.'+fakeCheckboxClass).find('.'+checkboxClass).length; + + if(allCount == selectedCount && selectedCount != 0){ + return true; + } else{ + return false; + } + }, + parentSelected = function () { + var parentCheckbox = DOMParentItem.querySelector('.'+checkboxClass); + if(parentCheckbox.checked){ + return true; + }else{ + return false; + } + + }, + // Функционал добавления тегов: если есть в панели выбранный элемент либо его дочерние то удалить эти эдементы; + refreshTags = function (it) { + var DOMSublist = com.closest(it,sublistClass); + var DOMItem = com.closest(it,itemClass); + var DOMSublistInner = DOMItem.querySelector('.'+sublistClass); + var DOMAllTags = DOMTagsWrapper.querySelectorAll('.'+tagClass); + var ARRsublist; + var ARRsublistChildren = DOMSublist.querySelector('.'+sublistClass)?$('.'+checkboxClass+':checked',DOMSublist.querySelector('.'+sublistClass)):null; + var ARRsublistChildrenLength = ARRsublistChildren?ARRsublistChildren.length:null; + var ARRSublistIds = []; + var ARRAllTagsIds = []; + var allTagsLength = 0; + var sublistIdsLength = 0; + var itId = it.getAttribute('id'); + var i = 0, j= 0, t= 0, tmp, k = 0; + var tagId; + var tagText = DOMParentRow.querySelector('.'+triggerClass).innerHTML; + + // если есть дочерние элементы + if(DOMSublistInner){ + ARRsublist = $(DOMSublistInner).children('li').children('.'+fakeCheckboxClass).find('.'+checkboxClass+':checked') + //получаем массив id жлементовЮ для которых есть тег + for(k; k < ARRsublist.length; k++){ + tmp = ARRsublist[k].getAttribute('id'); + ARRSublistIds.push(tmp); + } + //очистк + for(t; t 2 && firstComplete) { + $waiter.show(); + getRequest({'term': text, 'form': form}, self.opt.autoCompleteUrl, requestHandler); + firstComplete = false; + } else if (text.length == 0 && !firstComplete) { + if (self.$inputFilter.hasClass('ui-autocomplete-input')) { + + self.$inputFilter.autocomplete("destroy"); + firstComplete = true; + } + } + return false; + }).click(function () { + return false; + }); + + }, + /** + * loads and shows list tree related to selected id + * @param {Object} data - is JSON object with information about parent elements. + * @param {function} handler - callback function + * @param {number} counter + * @private + */ + _loadParentTree: function (data, handler, counter) { + var self = this, + dataObj = data, + optObj, sublistTemplateId, nestedObj, nestedSublistTemplateId, + $midleLevelCheckbox = $('#id_' + self.opt.prefix + dataObj.id), + /** + * makes request in order to recieve children list information fires after request for parent list + * @param {number} length + * @function + */ + handlerNested = function (length) { + var $checkbox = $('#id_' + self.opt.prefix + dataObj.id), + index = 0, + afterAll = function (number) { + $waiter.hide(); + index++ + if(index == number){ + + counter||counter===0?handler(counter):handler(); + } + }; + $waiter.hide(); + if ($checkbox.length && getObjectLength(self.curDNA[sublistTemplateId + '-sub']) == length) { + + nestedObj = { + name: dataObj.name, + id: dataObj.id + }; + $waiter.show(); + nestedSublistTemplateId = $('#id_' + self.opt.prefix + dataObj.id).closest('.level').children('.trigger').attr('data-template-id'); + self._renderNested(nestedObj, afterAll, nestedSublistTemplateId, dataObj.id); + } + + }, + /** + * @function + */ + handlerParent = function () { + $waiter.hide(); + counter || counter === 0 ? handler(counter) : handler(); + }; + $waiter.show(); + //if element has parent element + if (dataObj.hasOwnProperty('parent')) { + //if checbox is existed + if ($midleLevelCheckbox.length) { + nestedObj = { + name: dataObj.name, + id: dataObj.id + }; + nestedSublistTemplateId = $midleLevelCheckbox.closest('.level').children('.trigger').attr('data-template-id'); + self._renderNested(nestedObj, function () { + $waiter.hide(); + handler(); + }, nestedSublistTemplateId, dataObj.id); + } else { + + optObj = { + name: dataObj.parent.name, + id: dataObj.parent.id + }; + sublistTemplateId = $('#id_' + self.opt.prefix + dataObj.parent.id).closest('.level').children('.trigger').attr('data-template-id'); + self._renderSublist(optObj, sublistTemplateId, handlerNested); + } + + + } else { + optObj = { + name: dataObj.name, + id: dataObj.id + }; + sublistTemplateId = $('#id_' + self.opt.prefix + dataObj.id).closest('.level').children('.trigger').attr('data-template-id'); + self._renderSublist(optObj, sublistTemplateId, handlerParent); + } + + }, + applyHandler: function (it) { + EXPO.events.feed.modalWindow.close(); + }, + /** + * render label text, if there is no selected element then text will be default + * @private + */ + _refreshLabel: function () { + var oLength = this.selectedWrap.children().length; + + if (oLength){ + this.$label.text(this.$label.attr('data-selected')); + }else{ + this.$label.text(this.$label.attr('data-default')); + + } + } + }; + + /////////////////////////// + //инициализация общих свойств + that.init = function (options) { + // settings extending + $.extend(this.opt, options); + // begin of initialization + var self = this, + submitHandler = function () { + $(self.DOMform).find('input[name="~~name~~"]').remove(); + }; + if(this.opt.searchData != 'None' && this.opt.searchData){ + this.previousSearch = JSON.parse(this.opt.searchData) + + } + this.DOMform = document.getElementById(this.opt.formId); + this.DOMhint = document.getElementById(this.opt.filter.hintId); + $(this.DOMform).on('submit', function () { + submitHandler(); + }); + $.widget( "custom.placeComplete", $.ui.autocomplete,{ + _renderItem: function( ul, item ) { + return $( "
  • " ) + .append( $( "" ).text( item.label) ) + .append(' ('+item.cat+')') + .appendTo( ul ); + } + }); + this.DOMapplyButton = document.getElementById(this.opt.applyButtonId); + this.filterPane = new Filter(this.opt.filter); + $('#' + this.opt.filter.buttonId).on('click', function () { + if (com.hasClass(this, self.opt.activeClass)) { + com.removeClass(this, self.opt.activeClass); + self.filterPane.hide(); + } else { + com.addClass(this, self.opt.activeClass); + self.filterPane.show(); + } + return false; + }); + $('#'+self.opt.bodyId+' .' + self.opt.modalTriggerClass).on('click', function (event) { + event.preventDefault(); + self.modalWindow.pullData(this.getAttribute('href')); + self.modalWindow.open(); + return false; + }); + //кнопка применить + $('#'+self.opt.applyButtonId).on('click', function () { + $(self.DOMform).submit(); + return false; + }); + //modal + //модальное окно + this.modalWindow = new com.Modal(self.opt.modal); + //modal windows + this.placesModal = new PlacesModal(self.opt.place); + this.subjModal = new SubjectModal(self.opt.subject); + + // заполнение полей предыдущими значениями + $(function () { + if(self.previousSearch.inputs.length){ + $(self.DOMhint).hide(); + for (var i = 0; i < self.previousSearch.inputs.length; i++) { + // окно выбора тематики + if (self.previousSearch.inputs[i].name == 'th'){ + self.subjModal.selectTag(self.previousSearch.inputs[i]); + + // окно выбора мест + } else if (self.previousSearch.inputs[i].name == 'area'){ + + if(self.previousSearch.inputs[i].children && self.previousSearch.inputs[i].children.children){ + self.placesModal.selectTag(self.previousSearch.inputs[i].children.children); + + }else if (self.previousSearch.inputs[i].children){ + self.placesModal.selectTag(self.previousSearch.inputs[i].children); + + } else if(self.previousSearch.inputs[i]){ + self.placesModal.selectTag(self.previousSearch.inputs[i]); + + + } + } + } + + }else{ + $(self.DOMhint).fadeIn(); + } + //Если выбраны фильтры то появляется кнопка "применить" + if(getObjectLength(self.placesModal.itemsSelected) || getObjectLength(self.subjModal.itemsSelected) ){ + $(self.DOMapplyButton).show(); + + } + }); + + }; + return that; + }()); } diff --git a/static/client/js/_modules/page.exposition.object.js b/static/client/js/_modules/page.exposition.object.js index b2c4b661..7fea2396 100644 --- a/static/client/js/_modules/page.exposition.object.js +++ b/static/client/js/_modules/page.exposition.object.js @@ -9,46 +9,8 @@ if (EXPO.exposition.object){ var com = EXPO.common, $waiter; // variables - var that = {}, - Note = function (it, opt) { - this.opt = opt; - this.DOMthis = it; - this.DOMbutton = it.querySelector('.'+opt.buttonClass); - this.DOMinput = it.querySelector('.'+opt.inputClass); - this.inputName = this.DOMinput.getAttribute('name'); - this.url = this.DOMbutton.getAttribute('href'); - this._controller(); - }; - Note.prototype = { - _init: function () { - - }, - _controller: function () { - var self = this; - $(this.DOMinput).on('blur', function () { - self.send(); - }); - $(this.DOMbutton).on('click', function () { - return false; - }); - }, - send: function () { - var data = {}, - response, - self = this, - handler = function (data) { - if (data.success){ - console.log('ok'); - $(self.DOMbutton).addClass('active'); - }else{ - console.log('data not send'); - } - }; - data[this.inputName] = this.DOMinput.value; - response = com.getRequest(data,this.url,handler); - } - }; + var that = {}; that.opt = {}; //свойства по умолчанию //private $(function () { @@ -61,16 +23,7 @@ if (EXPO.exposition.object){ $.extend(this.opt, options); var self = this, $visitButtons = $('.'+this.opt.visit.activeClass+', .'+this.opt.visit.passiveClass); - this.notes = []; - $('.'+this.opt.note.wrapClass).each(function () { - var note = new Note(this,self.opt.note); - self.notes.push(note); - }); - $('.'+this.opt.note.wrapDisabledClass).on('click', function () { - $.fancybox.open('#pw-login'); - return false; - }); com.opt.addCalendarText = this.opt.addCalendarText; com.opt.removeCalendarText = this.opt.removeCalendarText; /** @@ -124,7 +77,8 @@ if (EXPO.exposition.object){ $('.err',$form).removeClass("err"); $('.pwf-msg',$form).text(''); }; - if (data.success != true){ + + if (data.success !== true){ clearValue(); for (var k in data.errors){ if (data.errors.hasOwnProperty(k)) { diff --git a/static/client/js/_modules/page.index.js b/static/client/js/_modules/page.index.js deleted file mode 100644 index bc5725a2..00000000 --- a/static/client/js/_modules/page.index.js +++ /dev/null @@ -1,74 +0,0 @@ -var EXPO = EXPO || {}; //isolated namespace -if (EXPO.index) { - console.warn('WARNING: EXPO.eventsFeed is already defined!'); -} else { - EXPO.index = (function () { - // variables - var that = {}; - - //default module setting - that.opt = {}; - //dependence's - var com = EXPO.common; - //private - var Note = function (it, opt) { - this.opt = opt; - this.DOMthis = it; - this.DOMbutton = it.querySelector('.'+opt.buttonClass); - this.DOMinput = it.querySelector('.'+opt.inputClass); - this.inputName = this.DOMinput.getAttribute('name'); - this.url = this.DOMbutton.getAttribute('href'); - this._controller(); - }; - Note.prototype = { - _init: function () { - - }, - _controller: function () { - var self = this; - $(this.DOMinput).on('blur', function () { - self.send(); - }); - $(this.DOMbutton).on('click', function () { - return false; - }); - }, - send: function () { - var data = {}, - response, - self = this, - handler = function (data) { - if (data.success){ - console.log('ok'); - $(self.DOMbutton).addClass('active'); - }else{ - console.log('data not send'); - } - - }; - data[this.inputName] = this.DOMinput.value; - response = com.getRequest(data,this.url,handler); - } - }; - - /////////////////////////// - //инициализация общих свойств - that.init = function (options) { - // settings extending - $.extend(this.opt, options); - // begin of initialization - var self = this; - this.notes = []; - $('.'+this.opt.note.wrapClass).each(function () { - var note = new Note(this,self.opt.note); - self.notes.push(note); - }); - $('.'+this.opt.note.wrapDisabledClass).on('click', function () { - $.fancybox.open('#pw-login'); - return false; - }); - - }; - return that; - }()); -} diff --git a/static/client/js/main.js b/static/client/js/main.js index 2ed48561..676d273c 100644 --- a/static/client/js/main.js +++ b/static/client/js/main.js @@ -694,23 +694,6 @@ function placeInput(width){ $scrollContainer.mCustomScrollbar(customScrollOptions); }); - /* Открыть диалог подписки на нужной вкладке */ - $('#subscribe-sm').each(function () { - var $container = $(this); - var $links = $container.find('a'); - - $links.on('click', function () { - var $link = $(this); - var index = $links.index(this); - var popupSubscribe = $('#pw-subscribe'); - - $.fancybox(popupSubscribe, fbPopupOptions); - var $tabs = popupSubscribe.find('ul.tabs > li'); - $tabs.eq(index).trigger('click'); - return false; - }); - }); - /* Обработка поведения вкладок */ $("ul.tabs > li").on('click', function () { var $curTab = $(this); diff --git a/static/client/js/rejs/tops.js b/static/client/js/rejs/tops.js index 2d3d43d2..565cc5cd 100644 --- a/static/client/js/rejs/tops.js +++ b/static/client/js/rejs/tops.js @@ -72,7 +72,7 @@ $('div#' + PARENT_ID + ' ul li.cl-item').each(function(index, el) { $('div.page-body ul.cat-list li.cl-item[data-slug=\'' + $(el).data('slug') + '\']').not(el).remove(); }); - } + }; var insertTops = function (text) { var parent = document.getElementById(PARENT_ID); diff --git a/static/client/js/vendor.js b/static/client/js/vendor.js index e8902f2b..c6683dd7 100644 --- a/static/client/js/vendor.js +++ b/static/client/js/vendor.js @@ -4373,23 +4373,6 @@ function placeInput(width){ $scrollContainer.mCustomScrollbar(customScrollOptions); }); - /* Открыть диалог подписки на нужной вкладке */ - $('#subscribe-sm').each(function () { - var $container = $(this); - var $links = $container.find('a'); - - $links.on('click', function () { - var $link = $(this); - var index = $links.index(this); - var popupSubscribe = $('#pw-subscribe'); - - $.fancybox(popupSubscribe, fbPopupOptions); - var $tabs = popupSubscribe.find('ul.tabs > li'); - $tabs.eq(index).trigger('click'); - return false; - }); - }); - /* Обработка поведения вкладок */ $("ul.tabs > li").on('click', function () { var $curTab = $(this); diff --git a/static/client/js_min/_modules/block.exposition.list.min.js b/static/client/js_min/_modules/block.exposition.list.min.js index b9b78f66..cf8d4314 100644 --- a/static/client/js_min/_modules/block.exposition.list.min.js +++ b/static/client/js_min/_modules/block.exposition.list.min.js @@ -1 +1 @@ -var EXPO=EXPO||{};EXPO.exposition=EXPO.exposition||{},EXPO.exposition.list?console.warn("WARNING: EXPO.place.object is already defined!"):EXPO.exposition.list=function(){var t=EXPO.common,n={},o=function(t,n){this.opt=n,this.DOMthis=t,this.DOMbutton=t.querySelector("."+n.buttonClass),this.DOMinput=t.querySelector("."+n.inputClass),this.inputName=this.DOMinput.getAttribute("name"),this.url=this.DOMbutton.getAttribute("href"),this._controller()};return o.prototype={_init:function(){},_controller:function(){var t=this;$(this.DOMinput).on("blur",function(){t.send()}),$(this.DOMbutton).on("click",function(){return!1})},send:function(){var n,o={},i=this,e=function(t){t.success?(console.log("ok"),$(i.DOMbutton).addClass("active")):console.log("data not send")};o[this.inputName]=this.DOMinput.value,n=t.getRequest(o,this.url,e)}},n.opt={},$(function(){}),n.init=function(n){$.extend(this.opt,n),this.notes=[];var i=this;$("."+this.opt.note.wrapClass).each(function(){var t=new o(this,i.opt.note);i.notes.push(t)}),$("."+this.opt.note.wrapDisabledClass).on("click",function(){return $.fancybox.open("#pw-login"),!1}),t.opt.addCalendarText=this.opt.addCalendarText,t.opt.removeCalendarText=this.opt.removeCalendarText},n}(); \ No newline at end of file +var EXPO=EXPO||{};EXPO.exposition=EXPO.exposition||{},EXPO.exposition.list?console.warn("WARNING: EXPO.place.object is already defined!"):EXPO.exposition.list=function(){var t=EXPO.common,e={};return e.opt={},$(function(){}),e.init=function(e){$.extend(this.opt,e),t.opt.addCalendarText=this.opt.addCalendarText,t.opt.removeCalendarText=this.opt.removeCalendarText},e}(); \ No newline at end of file diff --git a/static/client/js_min/_modules/page.events.feed.min.js b/static/client/js_min/_modules/page.events.feed.min.js index b7575340..4d00f577 100644 --- a/static/client/js_min/_modules/page.events.feed.min.js +++ b/static/client/js_min/_modules/page.events.feed.min.js @@ -1 +1 @@ -var EXPO=EXPO||{};EXPO.events=EXPO.events||{},EXPO.events.feed?console.warn("WARNING: EXPO.eventsFeed is already defined!"):EXPO.events.feed=function(){var e={};e.opt={};var t=EXPO.common,i=function(e){this.opt=e,this.DOMbody=document.getElementById(e.bodyId)},n=function(e,t,i){e||(e=""),$.ajax({type:"GET",url:t,data:e,success:function(e){return"function"!=typeof i?e:void i(e)}})},s=function(e,t,i){return e.hasOwnProperty(t)&&(e[i]=e[t]),this},a=function(e){var t,i=0;for(t in e)e.hasOwnProperty(t)&&i++;return i},r=$(".wait-ajax.absolute"),c=function(e){var t=Object.keys(e).map(function(t){return encodeURIComponent(t)+"="+encodeURIComponent(e[t])}).join("&");return"?"+t};i.prototype={show:function(){$(this.DOMbody).slideDown()},hide:function(){$(this.DOMbody).hide()}};var l=function(e){this.opt=e;var i,n=this,s=0,a=$("#"+n.opt.subjectTriggerWrapId),r=n.opt.id,c=$("#"+r),l=$(".csb-menu-input",c),o=$("#"+this.opt.selectedItemsContainer,c),d=n.opt.defaultOn,h=n.opt.applyBtnClass,u=($("#"+n.opt.modalTrigger),document.getElementById(n.opt.bodyId),function(){p.hide()}),p=$(".wait-ajax.absolute");this.$modalInst=$("#"+r),this.itemsSelected={},this.tagsBoxItems={},this.sublist={},this.$inputFilter=$("#"+n.opt.filterInputId),this.$label=$(document.getElementById(this.opt.labelId)),this.$selectedItemsWrap=o,this.isReceived=!0,$(function(){for($(".topicChecks",a).on("change",function(){$(this).prop("checked")?n._setVisible($(this).val()):n._setUnvisible($(this).val())}),s=0;s2&&d?(n({term:t,form:l},c.opt.autoCompleteUrl,u),d=!1):0!=t.length||d||c.$inputFilter.hasClass("ui-autocomplete-input")&&(c.$inputFilter.placeComplete("destroy"),d=!0),!1}).click(function(){return!1})},_renderSublist:function(e,t,i){var n=this,s=0,a=t+"-sub",c=function(e){if(e.length){for(n.sublist[a]={},s;sT;T++)for(c=y[T],w=0;I>w;w++)c==_[w]&&F(i[w]);for(T=0;x>T;T++)c=y[T],c==S&&F(e);b.querySelectorAll(".final-tire")&&$("."+s+"."+r,b.querySelectorAll(".final-tire")).each(function(){F($("."+d,this)[0])})}else for(T=0;x>T;T++)c=y[T],c==S&&F(S)},F=function(e){var t=e.getAttribute("id");i._destroyTag(t),N()},E=function(e){var n=t.closest(e,a),s=n.querySelector("."+g),r=s.innerHTML,c=e.getAttribute("id"),l={id:c,text:r};i._addTag(c,l),N()},N=function(){c.find("."+f).length&&"~~id~~"!=c.find("."+f)[0].getAttribute(v)?c.addClass("visible"):c.removeClass("visible")},j=function(e){var t=$(e).children("li").children("."+s).find("."+d+":checked");t.each(function(){E(this)})},L=function(){var e=$(C).children("li").children("."+s).find("."+d+":checked");e.each(function(){F(this)})};i.strictMode?this.checked?(D(this),q(this),E(this)):(P(this),q(this),F(this)):this.checked?($(_).find("."+d)[0]&&_&&"~~id~~"!=$(_).find("."+d)[0].value&&q(this),B()?(w(this),D(this),q(k),E(k),L(C),k.getAttribute("id")!=x.getAttribute("id")||x.checked?A()&&(D(x),q(x),E(x)):(D(x),q(x),E(x))):(D(this),q(this),E(this)),_&&S(this)):(M()?(O(this),P(this),q(k),F(k),j(C),x.checked&&(P(x),F(x),j(I))):(P(this),q(this),F(this)),_&&(T(this),q(this))),h()}),$("."+i.opt.deleteTagClass,s).on("click",function(){var e=$(this).attr("data-checkbox-id"),t=$("#"+e);return t.prop("checked",!1),t.trigger("change"),i._refreshLabel(),c.children(".dna-clone").length||c.removeClass("visible"),!1}),$(".del-on-page").on("click",function(){var e=$(this).attr("data-checkbox-id");$("."+i.opt.deleteTagClass+'[data-checkbox-id="'+e+'"]',s).trigger("click")}),$(".clear",s).on("click",function(){return i.resetList(),!1}),$(".q-sel a",s).on("click",function(){var e=$(this),t=e.attr("data-name"),s=e.attr("data-id"),a={name:t,id:s},r=function(e){i._loadParentTree(e,function(){i._checkCheckBox(s)})};return n(a,i.opt.getParentUrl,r),!1}),$("."+o,s).on("click",function(){return i.applyHandler(this),!1}),$("."+i.opt.clearAllButtonClass,s).on("click",function(e){return e.preventDefault(),i.resetList(),!1})})};return o.prototype={_getAjax:function(e,t){var i=this;e||(e=""),$.ajax({type:"GET",url:i.opt.ajaxUrl,data:e,success:function(e){return"function"!=typeof t?(i.rawData=e,e):(i.rawData=e,void t(e))}})},_renderSublist:function(e,t,i){var n=this,s=0,a=t+"-sub",c=function(e){if(e.length){for(n.curDNA[a]={},s;s2&&o?(r.show(),n({term:t,form:c},a.opt.autoCompleteUrl,h),o=!1):0!=t.length||o||a.$inputFilter.hasClass("ui-autocomplete-input")&&(a.$inputFilter.autocomplete("destroy"),o=!0),!1}).click(function(){return!1})},_loadParentTree:function(e,t,i){var n,s,c,l,o=this,d=e,h=$("#id_"+o.opt.prefix+d.id),u=function(e){var n=$("#id_"+o.opt.prefix+d.id),h=0,u=function(e){r.hide(),h++,h==e&&(i||0===i?t(i):t())};r.hide(),n.length&&a(o.curDNA[s+"-sub"])==e&&(c={name:d.name,id:d.id},r.show(),l=$("#id_"+o.opt.prefix+d.id).closest(".level").children(".trigger").attr("data-template-id"),o._renderNested(c,u,l,d.id))},p=function(){r.hide(),i||0===i?t(i):t()};r.show(),d.hasOwnProperty("parent")?h.length?(c={name:d.name,id:d.id},l=h.closest(".level").children(".trigger").attr("data-template-id"),o._renderNested(c,function(){r.hide(),t()},l,d.id)):(n={name:d.parent.name,id:d.parent.id},s=$("#id_"+o.opt.prefix+d.parent.id).closest(".level").children(".trigger").attr("data-template-id"),o._renderSublist(n,s,u)):(n={name:d.name,id:d.id},s=$("#id_"+o.opt.prefix+d.id).closest(".level").children(".trigger").attr("data-template-id"),o._renderSublist(n,s,p))},applyHandler:function(e){EXPO.events.feed.modalWindow.close()},_refreshLabel:function(){var e=this.selectedWrap.children().length;e?this.$label.text(this.$label.attr("data-selected")):this.$label.text(this.$label.attr("data-default"))}},e.init=function(e){$.extend(this.opt,e);var n=this,s=function(){$(n.DOMform).find('input[name="~~name~~"]').remove()};"None"!=this.opt.searchData&&this.opt.searchData&&(this.previousSearch=JSON.parse(this.opt.searchData)),this.DOMform=document.getElementById(this.opt.formId),this.DOMhint=document.getElementById(this.opt.filter.hintId),$(this.DOMform).on("submit",function(){s()}),$.widget("custom.placeComplete",$.ui.autocomplete,{_renderItem:function(e,t){return $("
  • ").append($("").text(t.label)).append(' ('+t.cat+")").appendTo(e)}}),this.DOMapplyButton=document.getElementById(this.opt.applyButtonId),this.filterPane=new i(this.opt.filter),$("#"+this.opt.filter.buttonId).on("click",function(){return t.hasClass(this,n.opt.activeClass)?(t.removeClass(this,n.opt.activeClass),n.filterPane.hide()):(t.addClass(this,n.opt.activeClass),n.filterPane.show()),!1}),$("#"+n.opt.bodyId+" ."+n.opt.modalTriggerClass).on("click",function(e){return e.preventDefault(),n.modalWindow.pullData(this.getAttribute("href")),n.modalWindow.open(),!1}),$("#"+n.opt.applyButtonId).on("click",function(){return $(n.DOMform).submit(),!1}),this.modalWindow=new t.Modal(n.opt.modal),this.placesModal=new o(n.opt.place),this.subjModal=new l(n.opt.subject),$(function(){if(n.previousSearch.inputs.length){$(n.DOMhint).hide();for(var e=0;e2&&d?(n({term:t,form:l},c.opt.autoCompleteUrl,u),d=!1):0!=t.length||d||c.$inputFilter.hasClass("ui-autocomplete-input")&&(c.$inputFilter.placeComplete("destroy"),d=!0),!1}).click(function(){return!1})},_renderSublist:function(e,t,i){var n=this,s=0,a=t+"-sub",c=function(e){if(e.length){for(n.sublist[a]={},s;sT;T++)for(c=y[T],w=0;I>w;w++)c==_[w]&&F(i[w]);for(T=0;x>T;T++)c=y[T],c==S&&F(e);b.querySelectorAll(".final-tire")&&$("."+s+"."+r,b.querySelectorAll(".final-tire")).each(function(){F($("."+d,this)[0])})}else for(T=0;x>T;T++)c=y[T],c==S&&F(S)},F=function(e){var t=e.getAttribute("id");i._destroyTag(t),N()},E=function(e){var n=t.closest(e,a),s=n.querySelector("."+g),r=s.innerHTML,c=e.getAttribute("id"),l={id:c,text:r};i._addTag(c,l),N()},N=function(){c.find("."+f).length&&"~~id~~"!=c.find("."+f)[0].getAttribute(v)?c.addClass("visible"):c.removeClass("visible")},j=function(e){var t=$(e).children("li").children("."+s).find("."+d+":checked");t.each(function(){E(this)})},L=function(){var e=$(C).children("li").children("."+s).find("."+d+":checked");e.each(function(){F(this)})};i.strictMode?this.checked?(D(this),q(this),E(this)):(P(this),q(this),F(this)):this.checked?($(_).find("."+d)[0]&&_&&"~~id~~"!=$(_).find("."+d)[0].value&&q(this),B()?(w(this),D(this),q(k),E(k),L(C),k.getAttribute("id")!=x.getAttribute("id")||x.checked?A()&&(D(x),q(x),E(x)):(D(x),q(x),E(x))):(D(this),q(this),E(this)),_&&S(this)):(M()?(O(this),P(this),q(k),F(k),j(C),x.checked&&(P(x),F(x),j(I))):(P(this),q(this),F(this)),_&&(T(this),q(this))),h()}),$("."+i.opt.deleteTagClass,s).on("click",function(){var e=$(this).attr("data-checkbox-id"),t=$("#"+e);return t.prop("checked",!1),t.trigger("change"),i._refreshLabel(),c.children(".dna-clone").length||c.removeClass("visible"),!1}),$(".del-on-page").on("click",function(){var e=$(this).attr("data-checkbox-id");$("."+i.opt.deleteTagClass+'[data-checkbox-id="'+e+'"]',s).trigger("click")}),$(".clear",s).on("click",function(){return i.resetList(),!1}),$(".q-sel a",s).on("click",function(){var e=$(this),t=e.attr("data-name"),s=e.attr("data-id"),a={name:t,id:s},r=function(e){i._loadParentTree(e,function(){i._checkCheckBox(s)})};return n(a,i.opt.getParentUrl,r),!1}),$("."+o,s).on("click",function(){return i.applyHandler(this),!1}),$("."+i.opt.clearAllButtonClass,s).on("click",function(e){return e.preventDefault(),i.resetList(),!1})})};return o.prototype={_getAjax:function(e,t){var i=this;e||(e=""),$.ajax({type:"GET",url:i.opt.ajaxUrl,data:e,success:function(e){return"function"!=typeof t?(i.rawData=e,e):(i.rawData=e,void t(e))}})},_renderSublist:function(e,t,i){var n=this,s=0,a=t+"-sub",c=function(e){if(e.length){for(n.curDNA[a]={},s;s2&&o?(r.show(),n({term:t,form:c},a.opt.autoCompleteUrl,h),o=!1):0!=t.length||o||a.$inputFilter.hasClass("ui-autocomplete-input")&&(a.$inputFilter.autocomplete("destroy"),o=!0),!1}).click(function(){return!1})},_loadParentTree:function(e,t,i){var n,s,c,l,o=this,d=e,h=$("#id_"+o.opt.prefix+d.id),u=function(e){var n=$("#id_"+o.opt.prefix+d.id),h=0,u=function(e){r.hide(),h++,h==e&&(i||0===i?t(i):t())};r.hide(),n.length&&a(o.curDNA[s+"-sub"])==e&&(c={name:d.name,id:d.id},r.show(),l=$("#id_"+o.opt.prefix+d.id).closest(".level").children(".trigger").attr("data-template-id"),o._renderNested(c,u,l,d.id))},p=function(){r.hide(),i||0===i?t(i):t()};r.show(),d.hasOwnProperty("parent")?h.length?(c={name:d.name,id:d.id},l=h.closest(".level").children(".trigger").attr("data-template-id"),o._renderNested(c,function(){r.hide(),t()},l,d.id)):(n={name:d.parent.name,id:d.parent.id},s=$("#id_"+o.opt.prefix+d.parent.id).closest(".level").children(".trigger").attr("data-template-id"),o._renderSublist(n,s,u)):(n={name:d.name,id:d.id},s=$("#id_"+o.opt.prefix+d.id).closest(".level").children(".trigger").attr("data-template-id"),o._renderSublist(n,s,p))},applyHandler:function(e){EXPO.events.feed.modalWindow.close()},_refreshLabel:function(){var e=this.selectedWrap.children().length;e?this.$label.text(this.$label.attr("data-selected")):this.$label.text(this.$label.attr("data-default"))}},e.init=function(e){$.extend(this.opt,e);var n=this,s=function(){$(n.DOMform).find('input[name="~~name~~"]').remove()};"None"!=this.opt.searchData&&this.opt.searchData&&(this.previousSearch=JSON.parse(this.opt.searchData)),this.DOMform=document.getElementById(this.opt.formId),this.DOMhint=document.getElementById(this.opt.filter.hintId),$(this.DOMform).on("submit",function(){s()}),$.widget("custom.placeComplete",$.ui.autocomplete,{_renderItem:function(e,t){return $("
  • ").append($("").text(t.label)).append(' ('+t.cat+")").appendTo(e)}}),this.DOMapplyButton=document.getElementById(this.opt.applyButtonId),this.filterPane=new i(this.opt.filter),$("#"+this.opt.filter.buttonId).on("click",function(){return t.hasClass(this,n.opt.activeClass)?(t.removeClass(this,n.opt.activeClass),n.filterPane.hide()):(t.addClass(this,n.opt.activeClass),n.filterPane.show()),!1}),$("#"+n.opt.bodyId+" ."+n.opt.modalTriggerClass).on("click",function(e){return e.preventDefault(),n.modalWindow.pullData(this.getAttribute("href")),n.modalWindow.open(),!1}),$("#"+n.opt.applyButtonId).on("click",function(){return $(n.DOMform).submit(),!1}),this.modalWindow=new t.Modal(n.opt.modal),this.placesModal=new o(n.opt.place),this.subjModal=new l(n.opt.subject),$(function(){if(n.previousSearch.inputs.length){$(n.DOMhint).hide();for(var e=0;eS.slides.length&&(S.loopedSlides=S.slides.length);var e,i="",n="",a="",o=S.slides.length,s=Math.floor(S.loopedSlides/o),r=S.loopedSlides%o;for(e=0;s*o>e;e++){var l=e;e>=o&&(l=e-o*Math.floor(e/o)),a+=S.slides[l].outerHTML}for(e=0;r>e;e++)n+=S.slides[e].outerHTML;for(e=o-r;o>e;e++)i+=S.slides[e].outerHTML;for(_.innerHTML=i+a+_.innerHTML+a+n,S.loopCreated=!0,S.calcSlides(),e=0;e=S.slides.length-S.loopedSlides)&&S.slides[e].setData("looped",!0);S.callPlugins("onCreateLoop")}},S.fixLoop=function(){var e;S.activeIndexS.slides.length-2*t.slidesPerView&&(e=-S.slides.length+S.activeIndex+S.loopedSlides,S.swipeTo(e,0,!1))},S.loadSlides=function(){var e="";S.activeLoaderIndex=0;for(var i=t.loader.slides,n=t.loader.loadAllSlides?i.length:t.slidesPerView*(1+t.loader.surroundGroups),a=0;n>a;a++)e="outer"==t.loader.slidesHTMLType?e+i[a]:e+("<"+t.slideElement+' class="'+t.slideClass+'" data-swiperindex="'+a+'">'+i[a]+"");S.wrapper.innerHTML=e,S.calcSlides(!0),t.loader.loadAllSlides||S.wrapperTransitionEnd(S.reloadSlides,!0)},S.reloadSlides=function(){var e=t.loader.slides,i=parseInt(S.activeSlide().data("swiperindex"),10);if(!(0>i||i>e.length-1)){S.activeLoaderIndex=i;var n=Math.max(0,i-t.slidesPerView*t.loader.surroundGroups),a=Math.min(i+t.slidesPerView*(1+t.loader.surroundGroups)-1,e.length-1);if(i>0&&(S.setWrapperTranslate(-T*(i-n)),S.setWrapperTransition(0)),"reload"===t.loader.logic){for(var o=S.wrapper.innerHTML="",i=n;a>=i;i++)o+="outer"==t.loader.slidesHTMLType?e[i]:"<"+t.slideElement+' class="'+t.slideClass+'" data-swiperindex="'+i+'">'+e[i]+"";S.wrapper.innerHTML=o}else{for(var o=1e3,s=0,i=0;ir||r>a?S.wrapper.removeChild(S.slides[i]):(o=Math.min(r,o),s=Math.max(r,s))}for(i=n;a>=i;i++)o>i&&(n=document.createElement(t.slideElement),n.className=t.slideClass,n.setAttribute("data-swiperindex",i),n.innerHTML=e[i],S.wrapper.insertBefore(n,S.wrapper.firstChild)),i>s&&(n=document.createElement(t.slideElement),n.className=t.slideClass,n.setAttribute("data-swiperindex",i),n.innerHTML=e[i],S.wrapper.appendChild(n))}S.reInit(!0)}},S.calcSlides(),0e}(),ie10:window.navigator.msPointerEnabled}},(window.jQuery||window.Zepto)&&function(e){e.fn.swiper=function(t){return t=new Swiper(e(this)[0],t),e(this).data("swiper",t),t}}(window.jQuery||window.Zepto),"undefined"!=typeof module&&(module.exports=Swiper),!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports?module.exports=e:e(jQuery)}(function(e){function t(t){var s=t||window.event,r=l.call(arguments,1),c=0,h=0,u=0,p=0,f=0,g=0;if(t=e.event.fix(s),t.type="mousewheel","detail"in s&&(u=-1*s.detail),"wheelDelta"in s&&(u=s.wheelDelta),"wheelDeltaY"in s&&(u=s.wheelDeltaY),"wheelDeltaX"in s&&(h=-1*s.wheelDeltaX),"axis"in s&&s.axis===s.HORIZONTAL_AXIS&&(h=-1*u,u=0),c=0===u?h:u,"deltaY"in s&&(u=-1*s.deltaY,c=u),"deltaX"in s&&(h=s.deltaX,0===u&&(c=-1*h)),0!==u||0!==h){if(1===s.deltaMode){var m=e.data(this,"mousewheel-line-height");c*=m,u*=m,h*=m}else if(2===s.deltaMode){var v=e.data(this,"mousewheel-page-height");c*=v,u*=v,h*=v}if(p=Math.max(Math.abs(u),Math.abs(h)),(!o||o>p)&&(o=p,n(s,p)&&(o/=40)),n(s,p)&&(c/=40,h/=40,u/=40),c=Math[c>=1?"floor":"ceil"](c/o),h=Math[h>=1?"floor":"ceil"](h/o),u=Math[u>=1?"floor":"ceil"](u/o),d.settings.normalizeOffset&&this.getBoundingClientRect){var w=this.getBoundingClientRect();f=t.clientX-w.left,g=t.clientY-w.top}return t.deltaX=h,t.deltaY=u,t.deltaFactor=o,t.offsetX=f,t.offsetY=g,t.deltaMode=0,r.unshift(t,c,h,u),a&&clearTimeout(a),a=setTimeout(i,200),(e.event.dispatch||e.event.handle).apply(this,r)}}function i(){o=null}function n(e,t){return d.settings.adjustOldDeltas&&"mousewheel"===e.type&&t%120===0}var a,o,s=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],r="onwheel"in document||document.documentMode>=9?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],l=Array.prototype.slice;if(e.event.fixHooks)for(var c=s.length;c;)e.event.fixHooks[s[--c]]=e.event.mouseHooks;var d=e.event.special.mousewheel={version:"3.1.11",setup:function(){if(this.addEventListener)for(var i=r.length;i;)this.addEventListener(r[--i],t,!1);else this.onmousewheel=t;e.data(this,"mousewheel-line-height",d.getLineHeight(this)),e.data(this,"mousewheel-page-height",d.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var i=r.length;i;)this.removeEventListener(r[--i],t,!1);else this.onmousewheel=null;e.removeData(this,"mousewheel-line-height"),e.removeData(this,"mousewheel-page-height")},getLineHeight:function(t){var i=e(t)["offsetParent"in e.fn?"offsetParent":"parent"]();return i.length||(i=e("body")),parseInt(i.css("fontSize"),10)},getPageHeight:function(t){return e(t).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};e.fn.extend({mousewheel:function(e){return e?this.bind("mousewheel",e):this.trigger("mousewheel")},unmousewheel:function(e){return this.unbind("mousewheel",e)}})}),function(e,t,i){!function(e){e(jQuery)}(function(i){var n="mCustomScrollbar",a="mCS",o=".mCustomScrollbar",s={setWidth:!1,setHeight:!1,setTop:0,setLeft:0,axis:"y",scrollbarPosition:"inside",scrollInertia:950,autoDraggerLength:!0,autoHideScrollbar:!1,autoExpandScrollbar:!1,alwaysShowScrollbar:0,snapAmount:null,snapOffset:0,mouseWheel:{enable:!0,scrollAmount:"auto",axis:"y",preventDefault:!1,deltaFactor:"auto",normalizeDelta:!1,invert:!1,disableOver:["select","option","keygen","datalist","textarea"]},scrollButtons:{enable:!1,scrollType:"stepless",scrollAmount:"auto"},keyboard:{enable:!0,scrollType:"stepless",scrollAmount:"auto"},contentTouchScroll:25,advanced:{autoExpandHorizontalScroll:!1,autoScrollOnFocus:"input,textarea,select,button,datalist,keygen,a[tabindex],area,object,[contenteditable='true']",updateOnContentResize:!0,updateOnImageLoad:!0,updateOnSelectorChange:!1},theme:"light",callbacks:{onScrollStart:!1,onScroll:!1,onTotalScroll:!1,onTotalScrollBack:!1,whileScrolling:!1,onTotalScrollOffset:0,onTotalScrollBackOffset:0,alwaysTriggerOffsets:!0,onOverflowY:!1,onOverflowX:!1,onOverflowYNone:!1,onOverflowXNone:!1},live:!1,liveSelector:null},r=0,l={},c=function(e){l[e]&&(clearTimeout(l[e]),p._delete.call(null,l[e]))},d=e.attachEvent&&!e.addEventListener?1:0,h=!1,u={init:function(e){var e=i.extend(!0,{},s,e),t=p._selector.call(this);if(e.live){var n=e.liveSelector||this.selector||o,d=i(n);if("off"===e.live)return void c(n);l[n]=setTimeout(function(){d.mCustomScrollbar(e),"once"===e.live&&d.length&&c(n)},500)}else c(n);return e.setWidth=e.set_width?e.set_width:e.setWidth,e.setHeight=e.set_height?e.set_height:e.setHeight,e.axis=e.horizontalScroll?"x":p._findAxis.call(null,e.axis),e.scrollInertia=e.scrollInertia>0&&e.scrollInertia<17?17:e.scrollInertia,"object"!=typeof e.mouseWheel&&1==e.mouseWheel&&(e.mouseWheel={enable:!0,scrollAmount:"auto",axis:"y",preventDefault:!1,deltaFactor:"auto",normalizeDelta:!1,invert:!1}),e.mouseWheel.scrollAmount=e.mouseWheelPixels?e.mouseWheelPixels:e.mouseWheel.scrollAmount,e.mouseWheel.normalizeDelta=e.advanced.normalizeMouseWheelDelta?e.advanced.normalizeMouseWheelDelta:e.mouseWheel.normalizeDelta,e.scrollButtons.scrollType=p._findScrollButtonsType.call(null,e.scrollButtons.scrollType),p._theme.call(null,e),i(t).each(function(){var t=i(this);if(!t.data(a)){t.data(a,{idx:++r,opt:e,scrollRatio:{y:null,x:null},overflowed:null,contentReset:{y:null,x:null},bindEvents:!1,tweenRunning:!1,sequential:{},langDir:t.css("direction"),cbOffsets:null,trigger:null});var n=t.data(a).opt,o=t.data("mcs-axis"),s=t.data("mcs-scrollbar-position"),l=t.data("mcs-theme");o&&(n.axis=o),s&&(n.scrollbarPosition=s),l&&(n.theme=l,p._theme.call(null,n)),p._pluginMarkup.call(this),u.update.call(null,t)}})},update:function(e){var t=e||p._selector.call(this);return i(t).each(function(){var e=i(this);if(e.data(a)){var t=e.data(a),n=t.opt,o=i("#mCSB_"+t.idx+"_container"),s=[i("#mCSB_"+t.idx+"_dragger_vertical"),i("#mCSB_"+t.idx+"_dragger_horizontal")];if(!o.length)return;t.tweenRunning&&p._stop.call(null,e),e.hasClass("mCS_disabled")&&e.removeClass("mCS_disabled"),e.hasClass("mCS_destroyed")&&e.removeClass("mCS_destroyed"),p._maxHeight.call(this),p._expandContentHorizontally.call(this),"y"===n.axis||n.advanced.autoExpandHorizontalScroll||o.css("width",p._contentWidth(o.children())),t.overflowed=p._overflowed.call(this),p._scrollbarVisibility.call(this),n.autoDraggerLength&&p._setDraggerLength.call(this),p._scrollRatio.call(this),p._bindEvents.call(this);var r=[Math.abs(o[0].offsetTop),Math.abs(o[0].offsetLeft)];"x"!==n.axis&&(t.overflowed[0]?s[0].height()>s[0].parent().height()?p._resetContentPosition.call(this):(p._scrollTo.call(this,e,r[0].toString(),{dir:"y",dur:0,overwrite:"none"}),t.contentReset.y=null):(p._resetContentPosition.call(this),"y"===n.axis?p._unbindEvents.call(this):"yx"===n.axis&&t.overflowed[1]&&p._scrollTo.call(this,e,r[1].toString(),{dir:"x",dur:0,overwrite:"none"}))),"y"!==n.axis&&(t.overflowed[1]?s[1].width()>s[1].parent().width()?p._resetContentPosition.call(this):(p._scrollTo.call(this,e,r[1].toString(),{dir:"x",dur:0,overwrite:"none"}),t.contentReset.x=null):(p._resetContentPosition.call(this),"x"===n.axis?p._unbindEvents.call(this):"yx"===n.axis&&t.overflowed[0]&&p._scrollTo.call(this,e,r[0].toString(),{dir:"y",dur:0,overwrite:"none"}))),p._autoUpdate.call(this)}})},scrollTo:function(e,t){if("undefined"!=typeof e&&null!=e){var n=p._selector.call(this);return i(n).each(function(){var n=i(this);if(n.data(a)){var o=n.data(a),s=o.opt,r={trigger:"external",scrollInertia:s.scrollInertia,scrollEasing:"mcsEaseInOut",moveDragger:!1,timeout:60,callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},l=i.extend(!0,{},r,t),c=p._arr.call(this,e),d=l.scrollInertia>0&&l.scrollInertia<17?17:l.scrollInertia;c[0]=p._to.call(this,c[0],"y"),c[1]=p._to.call(this,c[1],"x"),l.moveDragger&&(c[0]*=o.scrollRatio.y,c[1]*=o.scrollRatio.x),l.dur=d,setTimeout(function(){null!==c[0]&&"undefined"!=typeof c[0]&&"x"!==s.axis&&o.overflowed[0]&&(l.dir="y",l.overwrite="all",p._scrollTo.call(this,n,c[0].toString(),l)),null!==c[1]&&"undefined"!=typeof c[1]&&"y"!==s.axis&&o.overflowed[1]&&(l.dir="x",l.overwrite="none",p._scrollTo.call(this,n,c[1].toString(),l))},l.timeout)}})}},stop:function(){var e=p._selector.call(this);return i(e).each(function(){var e=i(this);e.data(a)&&p._stop.call(null,e)})},disable:function(e){var t=p._selector.call(this);return i(t).each(function(){var t=i(this);if(t.data(a)){var n=t.data(a);n.opt;p._autoUpdate.call(this,"remove"),p._unbindEvents.call(this),e&&p._resetContentPosition.call(this),p._scrollbarVisibility.call(this,!0),t.addClass("mCS_disabled")}})},destroy:function(){var e=p._selector.call(this);return i(e).each(function(){var t=i(this);if(t.data(a)){var o=t.data(a),s=o.opt,r=i("#mCSB_"+o.idx),l=i("#mCSB_"+o.idx+"_container"),d=i(".mCSB_"+o.idx+"_scrollbar");s.live&&c(e),p._autoUpdate.call(this,"remove"),p._unbindEvents.call(this),p._resetContentPosition.call(this),t.removeData(a),p._delete.call(null,this.mcs),d.remove(),r.replaceWith(l.contents()),t.removeClass(n+" _"+a+"_"+o.idx+" mCS-autoHide mCS-dir-rtl mCS_no_scrollbar mCS_disabled").addClass("mCS_destroyed")}})}},p={_selector:function(){return"object"!=typeof i(this)||i(this).length<1?o:this},_theme:function(e){var t=["rounded","rounded-dark","rounded-dots","rounded-dots-dark"],n=["rounded-dots","rounded-dots-dark","3d","3d-dark","3d-thick","3d-thick-dark","inset","inset-dark","inset-2","inset-2-dark","inset-3","inset-3-dark"],a=["minimal","minimal-dark"],o=["minimal","minimal-dark"],s=["minimal","minimal-dark"];e.autoDraggerLength=i.inArray(e.theme,t)>-1?!1:e.autoDraggerLength,e.autoExpandScrollbar=i.inArray(e.theme,n)>-1?!1:e.autoExpandScrollbar,e.scrollButtons.enable=i.inArray(e.theme,a)>-1?!1:e.scrollButtons.enable,e.autoHideScrollbar=i.inArray(e.theme,o)>-1?!0:e.autoHideScrollbar,e.scrollbarPosition=i.inArray(e.theme,s)>-1?"outside":e.scrollbarPosition},_findAxis:function(e){return"yx"===e||"xy"===e||"auto"===e?"yx":"x"===e||"horizontal"===e?"x":"y"},_findScrollButtonsType:function(e){return"stepped"===e||"pixels"===e||"step"===e||"click"===e?"stepped":"stepless"},_pluginMarkup:function(){var e=i(this),t=e.data(a),o=t.opt,s=o.autoExpandScrollbar?" mCSB_scrollTools_onDrag_expand":"",r=["
    ","
    "],l="yx"===o.axis?"mCSB_vertical_horizontal":"x"===o.axis?"mCSB_horizontal":"mCSB_vertical",c="yx"===o.axis?r[0]+r[1]:"x"===o.axis?r[1]:r[0],d="yx"===o.axis?"
    ":"",h=o.autoHideScrollbar?" mCS-autoHide":"",u="x"!==o.axis&&"rtl"===t.langDir?" mCS-dir-rtl":"";o.setWidth&&e.css("width",o.setWidth),o.setHeight&&e.css("height",o.setHeight),o.setLeft="y"!==o.axis&&"rtl"===t.langDir?"989999px":o.setLeft,e.addClass(n+" _"+a+"_"+t.idx+h+u).wrapInner("
    ");var f=i("#mCSB_"+t.idx),g=i("#mCSB_"+t.idx+"_container");"y"===o.axis||o.advanced.autoExpandHorizontalScroll||g.css("width",p._contentWidth(g.children())),"outside"===o.scrollbarPosition?("static"===e.css("position")&&e.css("position","relative"),e.css("overflow","visible"),f.addClass("mCSB_outside").after(c)):(f.addClass("mCSB_inside").append(c),g.wrap(d)),p._scrollButtons.call(this);var m=[i("#mCSB_"+t.idx+"_dragger_vertical"),i("#mCSB_"+t.idx+"_dragger_horizontal")];m[0].css("min-height",m[0].height()),m[1].css("min-width",m[1].width())},_contentWidth:function(e){return Math.max.apply(Math,e.map(function(){return i(this).outerWidth(!0)}).get())},_expandContentHorizontally:function(){var e=i(this),t=e.data(a),n=t.opt,o=i("#mCSB_"+t.idx+"_container");n.advanced.autoExpandHorizontalScroll&&"y"!==n.axis&&o.css({position:"absolute",width:"auto"}).wrap("
    ").css({width:Math.ceil(o[0].getBoundingClientRect().right+.4)-Math.floor(o[0].getBoundingClientRect().left),position:"relative"}).unwrap()},_scrollButtons:function(){var e=i(this),t=e.data(a),n=t.opt,o=i(".mCSB_"+t.idx+"_scrollbar:first"),s=["","","",""],r=["x"===n.axis?s[2]:s[0],"x"===n.axis?s[3]:s[1],s[2],s[3]];n.scrollButtons.enable&&o.prepend(r[0]).append(r[1]).next(".mCSB_scrollTools").prepend(r[2]).append(r[3])},_maxHeight:function(){var e=i(this),t=e.data(a),n=(t.opt,i("#mCSB_"+t.idx)),o=e.css("max-height"),s=-1!==o.indexOf("%"),r=e.css("box-sizing");if("none"!==o){var l=s?e.parent().height()*parseInt(o)/100:parseInt(o);"border-box"===r&&(l-=e.innerHeight()-e.height()+(e.outerHeight()-e.innerHeight())),n.css("max-height",Math.round(l))}},_setDraggerLength:function(){var e=i(this),t=e.data(a),n=i("#mCSB_"+t.idx),o=i("#mCSB_"+t.idx+"_container"),s=[i("#mCSB_"+t.idx+"_dragger_vertical"),i("#mCSB_"+t.idx+"_dragger_horizontal")],r=[n.height()/o.outerHeight(!1),n.width()/o.outerWidth(!1)],l=[parseInt(s[0].css("min-height")),Math.round(r[0]*s[0].parent().height()),parseInt(s[1].css("min-width")),Math.round(r[1]*s[1].parent().width())],c=d&&l[1]n.height(),r>n.width()]},_resetContentPosition:function(){var e=i(this),t=e.data(a),n=t.opt,o=i("#mCSB_"+t.idx),s=i("#mCSB_"+t.idx+"_container"),r=[i("#mCSB_"+t.idx+"_dragger_vertical"),i("#mCSB_"+t.idx+"_dragger_horizontal")];if(p._stop(e),("x"!==n.axis&&!t.overflowed[0]||"y"===n.axis&&t.overflowed[0])&&(r[0].add(s).css("top",0),p._scrollTo(e,"_resetY")),"y"!==n.axis&&!t.overflowed[1]||"x"===n.axis&&t.overflowed[1]){var l=dx=0;"rtl"===t.langDir&&(l=o.width()-s.outerWidth(!1),dx=Math.abs(l/t.scrollRatio.x)),s.css("left",l),r[1].css("left",dx),p._scrollTo(e,"_resetX")}},_bindEvents:function(){function e(){s=setTimeout(function(){i.event.special.mousewheel?(clearTimeout(s),p._mousewheel.call(t[0])):e()},1e3)}var t=i(this),n=t.data(a),o=n.opt;if(!n.bindEvents){if(p._draggable.call(this),o.contentTouchScroll&&p._contentDraggable.call(this),o.mouseWheel.enable){var s;e()}p._draggerRail.call(this),p._wrapperScroll.call(this),o.advanced.autoScrollOnFocus&&p._focus.call(this),o.scrollButtons.enable&&p._buttons.call(this),o.keyboard.enable&&p._keyboard.call(this),n.bindEvents=!0}},_unbindEvents:function(){var e=i(this),n=e.data(a),o=a+"_"+n.idx,s=".mCSB_"+n.idx+"_scrollbar",r=i("#mCSB_"+n.idx+",#mCSB_"+n.idx+"_container,#mCSB_"+n.idx+"_container_wrapper,"+s+" .mCSB_draggerContainer,#mCSB_"+n.idx+"_dragger_vertical,#mCSB_"+n.idx+"_dragger_horizontal,"+s+">a"),l=i("#mCSB_"+n.idx+"_container");n.bindEvents&&(i(t).unbind("."+o),r.each(function(){i(this).unbind("."+o)}),clearTimeout(e[0]._focusTimeout),p._delete.call(null,e[0]._focusTimeout),clearTimeout(n.sequential.step),p._delete.call(null,n.sequential.step),clearTimeout(l[0].onCompleteTimeout),p._delete.call(null,l[0].onCompleteTimeout),n.bindEvents=!1)},_scrollbarVisibility:function(e){var t=i(this),n=t.data(a),o=n.opt,s=i("#mCSB_"+n.idx+"_container_wrapper"),r=s.length?s:i("#mCSB_"+n.idx+"_container"),l=[i("#mCSB_"+n.idx+"_scrollbar_vertical"),i("#mCSB_"+n.idx+"_scrollbar_horizontal")],c=[l[0].find(".mCSB_dragger"),l[1].find(".mCSB_dragger")];"x"!==o.axis&&(n.overflowed[0]&&!e?(l[0].add(c[0]).add(l[0].children("a")).css("display","block"),r.removeClass("mCS_no_scrollbar_y mCS_y_hidden")):(o.alwaysShowScrollbar?(2!==o.alwaysShowScrollbar&&c[0].add(l[0].children("a")).css("display","none"),r.removeClass("mCS_y_hidden")):(l[0].css("display","none"),r.addClass("mCS_y_hidden")),r.addClass("mCS_no_scrollbar_y"))),"y"!==o.axis&&(n.overflowed[1]&&!e?(l[1].add(c[1]).add(l[1].children("a")).css("display","block"),r.removeClass("mCS_no_scrollbar_x mCS_x_hidden")):(o.alwaysShowScrollbar?(2!==o.alwaysShowScrollbar&&c[1].add(l[1].children("a")).css("display","none"),r.removeClass("mCS_x_hidden")):(l[1].css("display","none"),r.addClass("mCS_x_hidden")),r.addClass("mCS_no_scrollbar_x"))),n.overflowed[0]||n.overflowed[1]?t.removeClass("mCS_no_scrollbar"):t.addClass("mCS_no_scrollbar")},_coordinates:function(e){var t=e.type;switch(t){case"pointerdown":case"MSPointerDown":case"pointermove":case"MSPointerMove":case"pointerup":case"MSPointerUp":return[e.originalEvent.pageY,e.originalEvent.pageX];case"touchstart":case"touchmove":case"touchend":var i=e.originalEvent.touches[0]||e.originalEvent.changedTouches[0];return[i.pageY,i.pageX];default:return[e.pageY,e.pageX]}},_draggable:function(){function e(e){var t=m.find("iframe");if(t.length){var i=e?"auto":"none";t.css("pointer-events",i)}}function n(e,t,i,n){if(m[0].idleTimer=u.scrollInertia<233?250:0,o.attr("id")===g[1])var a="x",s=(o[0].offsetLeft-t+n)*c.scrollRatio.x;else var a="y",s=(o[0].offsetTop-e+i)*c.scrollRatio.y;p._scrollTo(l,s.toString(),{dir:a,drag:!0})}var o,s,r,l=i(this),c=l.data(a),u=c.opt,f=a+"_"+c.idx,g=["mCSB_"+c.idx+"_dragger_vertical","mCSB_"+c.idx+"_dragger_horizontal"],m=i("#mCSB_"+c.idx+"_container"),v=i("#"+g[0]+",#"+g[1]);v.bind("mousedown."+f+" touchstart."+f+" pointerdown."+f+" MSPointerDown."+f,function(n){if(n.stopImmediatePropagation(),n.preventDefault(),p._mouseBtnLeft(n)){h=!0,d&&(t.onselectstart=function(){return!1}),e(!1),p._stop(l),o=i(this);var a=o.offset(),c=p._coordinates(n)[0]-a.top,f=p._coordinates(n)[1]-a.left,g=o.height()+a.top,m=o.width()+a.left;g>c&&c>0&&m>f&&f>0&&(s=c,r=f),p._onDragClasses(o,"active",u.autoExpandScrollbar)}}).bind("touchmove."+f,function(e){e.stopImmediatePropagation(),e.preventDefault();var t=o.offset(),i=p._coordinates(e)[0]-t.top,a=p._coordinates(e)[1]-t.left;n(s,r,i,a)}),i(t).bind("mousemove."+f+" pointermove."+f+" MSPointerMove."+f,function(e){if(o){var t=o.offset(),i=p._coordinates(e)[0]-t.top,a=p._coordinates(e)[1]-t.left;if(s===i)return;n(s,r,i,a)}}).add(v).bind("mouseup."+f+" touchend."+f+" pointerup."+f+" MSPointerUp."+f,function(i){o&&(p._onDragClasses(o,"active",u.autoExpandScrollbar),o=null),h=!1,d&&(t.onselectstart=null),e(!0)})},_contentDraggable:function(){function e(e,t){var i=[1.5*t,2*t,t/1.5,t/2];return e>90?t>4?i[0]:i[3]:e>60?t>3?i[3]:i[2]:e>30?t>8?i[1]:t>6?i[0]:t>4?t:i[2]:t>8?t:i[3]}function t(e,t,i,n,a,o){e&&p._scrollTo(v,e.toString(),{dur:t,scrollEasing:i,dir:n,overwrite:a,drag:o})}var n,o,s,r,l,c,d,u,f,g,m,v=i(this),w=v.data(a),b=w.opt,x=a+"_"+w.idx,y=i("#mCSB_"+w.idx),C=i("#mCSB_"+w.idx+"_container"),S=[i("#mCSB_"+w.idx+"_dragger_vertical"),i("#mCSB_"+w.idx+"_dragger_horizontal")],_=[],T=[],k=0,E="yx"===b.axis?"none":"all";C.bind("touchstart."+x+" pointerdown."+x+" MSPointerDown."+x,function(e){if(p._pointerTouch(e)&&!h){var t=C.offset();n=p._coordinates(e)[0]-t.top,o=p._coordinates(e)[1]-t.left}}).bind("touchmove."+x+" pointermove."+x+" MSPointerMove."+x,function(e){if(p._pointerTouch(e)&&!h){e.stopImmediatePropagation(),c=p._getTime();var i=y.offset(),a=p._coordinates(e)[0]-i.top,s=p._coordinates(e)[1]-i.left,r="mcsLinearOut";if(_.push(a),T.push(s),w.overflowed[0])var l=S[0].parent().height()-S[0].height(),d=n-a>0&&a-n>-(l*w.scrollRatio.y);if(w.overflowed[1])var u=S[1].parent().width()-S[1].width(),f=o-s>0&&s-o>-(u*w.scrollRatio.x);(d||f)&&e.preventDefault(),g="yx"===b.axis?[n-a,o-s]:"x"===b.axis?[null,o-s]:[n-a,null],C[0].idleTimer=250,w.overflowed[0]&&t(g[0],k,r,"y","all",!0),w.overflowed[1]&&t(g[1],k,r,"x",E,!0)}}),y.bind("touchstart."+x+" pointerdown."+x+" MSPointerDown."+x,function(e){if(p._pointerTouch(e)&&!h){e.stopImmediatePropagation(),p._stop(v),l=p._getTime();var t=y.offset();s=p._coordinates(e)[0]-t.top,r=p._coordinates(e)[1]-t.left,_=[],T=[]}}).bind("touchend."+x+" pointerup."+x+" MSPointerUp."+x,function(i){if(p._pointerTouch(i)&&!h){i.stopImmediatePropagation(),d=p._getTime();var n=y.offset(),a=p._coordinates(i)[0]-n.top,o=p._coordinates(i)[1]-n.left;if(!(d-c>30)){f=1e3/(d-l);var v="mcsEaseOut",x=2.5>f,S=x?[_[_.length-2],T[T.length-2]]:[0,0];u=x?[a-S[0],o-S[1]]:[a-s,o-r];var k=[Math.abs(u[0]),Math.abs(u[1])];f=x?[Math.abs(u[0]/4),Math.abs(u[1]/4)]:[f,f];var M=[Math.abs(C[0].offsetTop)-u[0]*e(k[0]/f[0],f[0]),Math.abs(C[0].offsetLeft)-u[1]*e(k[1]/f[1],f[1])];g="yx"===b.axis?[M[0],M[1]]:"x"===b.axis?[null,M[1]]:[M[0],null],m=[4*k[0]+b.scrollInertia,4*k[1]+b.scrollInertia];var P=parseInt(b.contentTouchScroll)||0;g[0]=k[0]>P?g[0]:0,g[1]=k[1]>P?g[1]:0,w.overflowed[0]&&t(g[0],m[0],v,"y",E,!1),w.overflowed[1]&&t(g[1],m[1],v,"x",E,!1)}}})},_mousewheel:function(){function e(e){var t=null;try{var i=e.contentDocument||e.contentWindow.document;t=i.body.innerHTML}catch(n){}return null!==t}var t=i(this),n=t.data(a);if(n){var o=n.opt,s=a+"_"+n.idx,r=i("#mCSB_"+n.idx),l=[i("#mCSB_"+n.idx+"_dragger_vertical"),i("#mCSB_"+n.idx+"_dragger_horizontal")],c=i("#mCSB_"+n.idx+"_container").find("iframe"),h=r; c.length&&c.each(function(){var t=this;e(t)&&(h=h.add(i(t).contents().find("body")))}),h.bind("mousewheel."+s,function(e,a){if(p._stop(t),!p._disableMousewheel(t,e.target)){var s="auto"!==o.mouseWheel.deltaFactor?parseInt(o.mouseWheel.deltaFactor):d&&e.deltaFactor<100?100:e.deltaFactor||100;if("x"===o.axis||"x"===o.mouseWheel.axis)var c="x",h=[Math.round(s*n.scrollRatio.x),parseInt(o.mouseWheel.scrollAmount)],u="auto"!==o.mouseWheel.scrollAmount?h[1]:h[0]>=r.width()?.9*r.width():h[0],f=Math.abs(i("#mCSB_"+n.idx+"_container")[0].offsetLeft),g=l[1][0].offsetLeft,m=l[1].parent().width()-l[1].width(),v=e.deltaX||e.deltaY||a;else var c="y",h=[Math.round(s*n.scrollRatio.y),parseInt(o.mouseWheel.scrollAmount)],u="auto"!==o.mouseWheel.scrollAmount?h[1]:h[0]>=r.height()?.9*r.height():h[0],f=Math.abs(i("#mCSB_"+n.idx+"_container")[0].offsetTop),g=l[0][0].offsetTop,m=l[0].parent().height()-l[0].height(),v=e.deltaY||a;"y"===c&&!n.overflowed[0]||"x"===c&&!n.overflowed[1]||(o.mouseWheel.invert&&(v=-v),o.mouseWheel.normalizeDelta&&(v=0>v?-1:1),(v>0&&0!==g||0>v&&g!==m||o.mouseWheel.preventDefault)&&(e.stopImmediatePropagation(),e.preventDefault()),p._scrollTo(t,(f-v*u).toString(),{dir:c}))}})}},_disableMousewheel:function(e,t){var n=t.nodeName.toLowerCase(),o=e.data(a).opt.mouseWheel.disableOver,s=["select","textarea"];return i.inArray(n,o)>-1&&!(i.inArray(n,s)>-1&&!i(t).is(":focus"))},_draggerRail:function(){var e=i(this),t=e.data(a),n=a+"_"+t.idx,o=i("#mCSB_"+t.idx+"_container"),s=o.parent(),r=i(".mCSB_"+t.idx+"_scrollbar .mCSB_draggerContainer");r.bind("touchstart."+n+" pointerdown."+n+" MSPointerDown."+n,function(e){h=!0}).bind("touchend."+n+" pointerup."+n+" MSPointerUp."+n,function(e){h=!1}).bind("click."+n,function(n){if(i(n.target).hasClass("mCSB_draggerContainer")||i(n.target).hasClass("mCSB_draggerRail")){p._stop(e);var a=i(this),r=a.find(".mCSB_dragger");if(a.parent(".mCSB_scrollTools_horizontal").length>0){if(!t.overflowed[1])return;var l="x",c=n.pageX>r.offset().left?-1:1,d=Math.abs(o[0].offsetLeft)-c*(.9*s.width())}else{if(!t.overflowed[0])return;var l="y",c=n.pageY>r.offset().top?-1:1,d=Math.abs(o[0].offsetTop)-c*(.9*s.height())}p._scrollTo(e,d.toString(),{dir:l,scrollEasing:"mcsEaseInOut"})}})},_focus:function(){var e=i(this),n=e.data(a),o=n.opt,s=a+"_"+n.idx,r=i("#mCSB_"+n.idx+"_container"),l=r.parent();r.bind("focusin."+s,function(n){var a=i(t.activeElement),s=r.find(".mCustomScrollBox").length,c=0;a.is(o.advanced.autoScrollOnFocus)&&(p._stop(e),clearTimeout(e[0]._focusTimeout),e[0]._focusTimer=s?(c+17)*s:0,e[0]._focusTimeout=setTimeout(function(){var t=[a.offset().top-r.offset().top,a.offset().left-r.offset().left],i=[r[0].offsetTop,r[0].offsetLeft],n=[i[0]+t[0]>=0&&i[0]+t[0]=0&&i[0]+t[1]a");l.bind("mousedown."+s+" touchstart."+s+" pointerdown."+s+" MSPointerDown."+s+" mouseup."+s+" touchend."+s+" pointerup."+s+" MSPointerUp."+s+" mouseout."+s+" pointerout."+s+" MSPointerOut."+s+" click."+s,function(a){function s(t,i){o.scrollAmount=n.snapAmount||n.scrollButtons.scrollAmount,p._sequentialScroll.call(this,e,t,i)}if(a.preventDefault(),p._mouseBtnLeft(a)){var r=i(this).attr("class");switch(o.type=n.scrollButtons.scrollType,a.type){case"mousedown":case"touchstart":case"pointerdown":case"MSPointerDown":if("stepped"===o.type)return;h=!0,t.tweenRunning=!1,s("on",r);break;case"mouseup":case"touchend":case"pointerup":case"MSPointerUp":case"mouseout":case"pointerout":case"MSPointerOut":if("stepped"===o.type)return;h=!1,o.dir&&s("off",r);break;case"click":if("stepped"!==o.type||t.tweenRunning)return;s("on",r)}}})},_keyboard:function(){var e=i(this),n=e.data(a),o=n.opt,s=n.sequential,r=a+"_"+n.idx,l=i("#mCSB_"+n.idx),c=i("#mCSB_"+n.idx+"_container"),d=c.parent(),h="input,textarea,select,datalist,keygen,[contenteditable='true']";l.attr("tabindex","0").bind("blur."+r+" keydown."+r+" keyup."+r,function(a){function r(t,i){s.type=o.keyboard.scrollType,s.scrollAmount=o.snapAmount||o.keyboard.scrollAmount,"stepped"===s.type&&n.tweenRunning||p._sequentialScroll.call(this,e,t,i)}switch(a.type){case"blur":n.tweenRunning&&s.dir&&r("off",null);break;case"keydown":case"keyup":var l=a.keyCode?a.keyCode:a.which,u="on";if("x"!==o.axis&&(38===l||40===l)||"y"!==o.axis&&(37===l||39===l)){if((38===l||40===l)&&!n.overflowed[0]||(37===l||39===l)&&!n.overflowed[1])return;"keyup"===a.type&&(u="off"),i(t.activeElement).is(h)||(a.preventDefault(),a.stopImmediatePropagation(),r(u,l))}else if(33===l||34===l){if((n.overflowed[0]||n.overflowed[1])&&(a.preventDefault(),a.stopImmediatePropagation()),"keyup"===a.type){p._stop(e);var f=34===l?-1:1;if("x"===o.axis||"yx"===o.axis&&n.overflowed[1]&&!n.overflowed[0])var g="x",m=Math.abs(c[0].offsetLeft)-f*(.9*d.width());else var g="y",m=Math.abs(c[0].offsetTop)-f*(.9*d.height());p._scrollTo(e,m.toString(),{dir:g,scrollEasing:"mcsEaseInOut"})}}else if((35===l||36===l)&&!i(t.activeElement).is(h)&&((n.overflowed[0]||n.overflowed[1])&&(a.preventDefault(),a.stopImmediatePropagation()),"keyup"===a.type)){if("x"===o.axis||"yx"===o.axis&&n.overflowed[1]&&!n.overflowed[0])var g="x",m=35===l?Math.abs(d.width()-c.outerWidth(!1)):0;else var g="y",m=35===l?Math.abs(d.height()-c.outerHeight(!1)):0;p._scrollTo(e,m.toString(),{dir:g,scrollEasing:"mcsEaseInOut"})}}})},_sequentialScroll:function(e,t,n){function o(t){var i="stepped"!==c.type,n=t?i?l.scrollInertia/1.5:l.scrollInertia:1e3/60,a=t?i?7.5:40:2.5,s=[Math.abs(d[0].offsetTop),Math.abs(d[0].offsetLeft)],h=[r.scrollRatio.y>10?10:r.scrollRatio.y,r.scrollRatio.x>10?10:r.scrollRatio.x],u="x"===c.dir[0]?s[1]+c.dir[1]*(h[1]*a):s[0]+c.dir[1]*(h[0]*a),f="x"===c.dir[0]?s[1]+c.dir[1]*parseInt(c.scrollAmount):s[0]+c.dir[1]*parseInt(c.scrollAmount),g="auto"!==c.scrollAmount?f:u,m=t?i?"mcsLinearOut":"mcsEaseInOut":"mcsLinear",v=t?!0:!1;return t&&17>n&&(g="x"===c.dir[0]?s[1]:s[0]),p._scrollTo(e,g.toString(),{dir:c.dir[0],scrollEasing:m,dur:n,onComplete:v}),t?void(c.dir=!1):(clearTimeout(c.step),void(c.step=setTimeout(function(){o()},n)))}function s(){clearTimeout(c.step),p._stop(e)}var r=e.data(a),l=r.opt,c=r.sequential,d=i("#mCSB_"+r.idx+"_container"),h="stepped"===c.type?!0:!1;switch(t){case"on":if(c.dir=["mCSB_buttonRight"===n||"mCSB_buttonLeft"===n||39===n||37===n?"x":"y","mCSB_buttonUp"===n||"mCSB_buttonLeft"===n||38===n||37===n?-1:1],p._stop(e),p._isNumeric(n)&&"stepped"===c.type)return;o(h);break;case"off":s(),(h||r.tweenRunning&&c.dir)&&o(!0)}},_arr:function(e){var t=i(this).data(a).opt,n=[];return"function"==typeof e&&(e=e()),e instanceof Array?n=e.length>1?[e[0],e[1]]:"x"===t.axis?[null,e[0]]:[e[0],null]:(n[0]=e.y?e.y:e.x||"x"===t.axis?null:e,n[1]=e.x?e.x:e.y||"y"===t.axis?null:e),"function"==typeof n[0]&&(n[0]=n[0]()),"function"==typeof n[1]&&(n[1]=n[1]()),n},_to:function(e,t){if(null!=e&&"undefined"!=typeof e){var n=i(this),o=n.data(a),s=o.opt,r=i("#mCSB_"+o.idx+"_container"),l=r.parent(),c=typeof e;t||(t="x"===s.axis?"x":"y");var d="x"===t?r.outerWidth(!1):r.outerHeight(!1),h="x"===t?r.offset().left:r.offset().top,f="x"===t?r[0].offsetLeft:r[0].offsetTop,g="x"===t?"left":"top";switch(c){case"function":return e();case"object":if(e.nodeType)var m="x"===t?i(e).offset().left:i(e).offset().top;else if(e.jquery){if(!e.length)return;var m="x"===t?e.offset().left:e.offset().top}return m-h;case"string":case"number":if(p._isNumeric.call(null,e))return Math.abs(e);if(-1!==e.indexOf("%"))return Math.abs(d*parseInt(e)/100);if(-1!==e.indexOf("-="))return Math.abs(f-parseInt(e.split("-=")[1]));if(-1!==e.indexOf("+=")){var v=f+parseInt(e.split("+=")[1]);return v>=0?0:Math.abs(v)}if(-1!==e.indexOf("px")&&p._isNumeric.call(null,e.split("px")[0]))return Math.abs(e.split("px")[0]);if("top"===e||"left"===e)return 0;if("bottom"===e)return Math.abs(l.height()-r.outerHeight(!1));if("right"===e)return Math.abs(l.width()-r.outerWidth(!1));if("first"===e||"last"===e){var w=r.find(":"+e),m="x"===t?i(w).offset().left:i(w).offset().top;return m-h}if(i(e).length){var m="x"===t?i(e).offset().left:i(e).offset().top;return m-h}return r.css(g,e),void u.update.call(null,n[0])}}},_autoUpdate:function(e){function t(){clearTimeout(h[0].autoUpdate),h[0].autoUpdate=setTimeout(function(){return d.advanced.updateOnSelectorChange&&(f=s(),f!==x)?(r(),void(x=f)):(d.advanced.updateOnContentResize&&(g=[h.outerHeight(!1),h.outerWidth(!1),v.height(),v.width(),b()[0],b()[1]],(g[0]!==y[0]||g[1]!==y[1]||g[2]!==y[2]||g[3]!==y[3]||g[4]!==y[4]||g[5]!==y[5])&&(r(),y=g)),d.advanced.updateOnImageLoad&&(m=n(),m!==C&&(h.find("img").each(function(){o(this.src)}),C=m)),void((d.advanced.updateOnSelectorChange||d.advanced.updateOnContentResize||d.advanced.updateOnImageLoad)&&t()))},60)}function n(){var e=0;return d.advanced.updateOnImageLoad&&(e=h.find("img").length),e}function o(e){function t(e,t){return function(){return t.apply(e,arguments)}}function i(){this.onload=null,r()}var n=new Image;n.onload=t(n,i),n.src=e}function s(){d.advanced.updateOnSelectorChange===!0&&(d.advanced.updateOnSelectorChange="*");var e=0,t=h.find(d.advanced.updateOnSelectorChange);return d.advanced.updateOnSelectorChange&&t.length>0&&t.each(function(){e+=i(this).height()+i(this).width()}),e}function r(){clearTimeout(h[0].autoUpdate),u.update.call(null,l[0])}var l=i(this),c=l.data(a),d=c.opt,h=i("#mCSB_"+c.idx+"_container");if(e)return clearTimeout(h[0].autoUpdate),void p._delete.call(null,h[0].autoUpdate);var f,g,m,v=h.parent(),w=[i("#mCSB_"+c.idx+"_scrollbar_vertical"),i("#mCSB_"+c.idx+"_scrollbar_horizontal")],b=function(){return[w[0].is(":visible")?w[0].outerHeight(!0):0,w[1].is(":visible")?w[1].outerWidth(!0):0]},x=s(),y=[h.outerHeight(!1),h.outerWidth(!1),v.height(),v.width(),b()[0],b()[1]],C=n();t()},_snapAmount:function(e,t,i){return Math.round(e/t)*t-i},_stop:function(e){var t=e.data(a),n=i("#mCSB_"+t.idx+"_container,#mCSB_"+t.idx+"_container_wrapper,#mCSB_"+t.idx+"_dragger_vertical,#mCSB_"+t.idx+"_dragger_horizontal");n.each(function(){p._stopTween.call(this)})},_scrollTo:function(e,t,n){function o(e){return l&&c.callbacks[e]&&"function"==typeof c.callbacks[e]}function s(){return[c.callbacks.alwaysTriggerOffsets||b>=x[0]+C,c.callbacks.alwaysTriggerOffsets||-S>=b]}function r(){var t=[f[0].offsetTop,f[0].offsetLeft],i=[v[0].offsetTop,v[0].offsetLeft],a=[f.outerHeight(!1),f.outerWidth(!1)],o=[u.height(),u.width()];e[0].mcs={content:f,top:t[0],left:t[1],draggerTop:i[0],draggerLeft:i[1],topPct:Math.round(100*Math.abs(t[0])/(Math.abs(a[0])-o[0])),leftPct:Math.round(100*Math.abs(t[1])/(Math.abs(a[1])-o[1])),direction:n.dir}}var l=e.data(a),c=l.opt,d={trigger:"internal",dir:"y",scrollEasing:"mcsEaseOut",drag:!1,dur:c.scrollInertia,overwrite:"all",callbacks:!0,onStart:!0,onUpdate:!0,onComplete:!0},n=i.extend(d,n),h=[n.dur,n.drag?0:n.dur],u=i("#mCSB_"+l.idx),f=i("#mCSB_"+l.idx+"_container"),g=c.callbacks.onTotalScrollOffset?p._arr.call(e,c.callbacks.onTotalScrollOffset):[0,0],m=c.callbacks.onTotalScrollBackOffset?p._arr.call(e,c.callbacks.onTotalScrollBackOffset):[0,0];if(l.trigger=n.trigger,"_resetY"!==t||l.contentReset.y||(o("onOverflowYNone")&&c.callbacks.onOverflowYNone.call(e[0]),l.contentReset.y=1),"_resetX"!==t||l.contentReset.x||(o("onOverflowXNone")&&c.callbacks.onOverflowXNone.call(e[0]),l.contentReset.x=1),"_resetY"!==t&&"_resetX"!==t){switch(!l.contentReset.y&&e[0].mcs||!l.overflowed[0]||(o("onOverflowY")&&c.callbacks.onOverflowY.call(e[0]),l.contentReset.x=null),!l.contentReset.x&&e[0].mcs||!l.overflowed[1]||(o("onOverflowX")&&c.callbacks.onOverflowX.call(e[0]),l.contentReset.x=null),c.snapAmount&&(t=p._snapAmount(t,c.snapAmount,c.snapOffset)),n.dir){case"x":var v=i("#mCSB_"+l.idx+"_dragger_horizontal"),w="left",b=f[0].offsetLeft,x=[u.width()-f.outerWidth(!1),v.parent().width()-v.width()],y=[t,0===t?0:t/l.scrollRatio.x],C=g[1],S=m[1],_=C>0?C/l.scrollRatio.x:0,T=S>0?S/l.scrollRatio.x:0;break;case"y":var v=i("#mCSB_"+l.idx+"_dragger_vertical"),w="top",b=f[0].offsetTop,x=[u.height()-f.outerHeight(!1),v.parent().height()-v.height()],y=[t,0===t?0:t/l.scrollRatio.y],C=g[0],S=m[0],_=C>0?C/l.scrollRatio.y:0,T=S>0?S/l.scrollRatio.y:0}y[1]<0||0===y[0]&&0===y[1]?y=[0,0]:y[1]>=x[1]?y=[x[0],x[1]]:y[0]=-y[0],e[0].mcs||r(),clearTimeout(f[0].onCompleteTimeout),(l.tweenRunning||!(0===b&&y[0]>=0||b===x[0]&&y[0]<=x[0]))&&(p._tweenTo.call(null,v[0],w,Math.round(y[1]),h[1],n.scrollEasing),p._tweenTo.call(null,f[0],w,Math.round(y[0]),h[0],n.scrollEasing,n.overwrite,{onStart:function(){n.callbacks&&n.onStart&&!l.tweenRunning&&(o("onScrollStart")&&(r(),c.callbacks.onScrollStart.call(e[0])),l.tweenRunning=!0,p._onDragClasses(v),l.cbOffsets=s())},onUpdate:function(){n.callbacks&&n.onUpdate&&o("whileScrolling")&&(r(),c.callbacks.whileScrolling.call(e[0]))},onComplete:function(){if(n.callbacks&&n.onComplete){"yx"===c.axis&&clearTimeout(f[0].onCompleteTimeout);var t=f[0].idleTimer||0;f[0].onCompleteTimeout=setTimeout(function(){o("onScroll")&&(r(),c.callbacks.onScroll.call(e[0])),o("onTotalScroll")&&y[1]>=x[1]-_&&l.cbOffsets[0]&&(r(),c.callbacks.onTotalScroll.call(e[0])),o("onTotalScrollBack")&&y[1]<=T&&l.cbOffsets[1]&&(r(),c.callbacks.onTotalScrollBack.call(e[0])),l.tweenRunning=!1,f[0].idleTimer=0,p._onDragClasses(v,"hide")},t)}}}))}},_tweenTo:function(t,i,n,a,o,s,r){function l(){t._mcsstop||(x||m.call(),x=p._getTime()-b,c(),x>=t._mcstime&&(t._mcstime=x>t._mcstime?x+f-(x-t._mcstime):x+f-1,t._mcstime0?(t._mcscurrVal=u(t._mcstime,y,S,a,o),C[i]=Math.round(t._mcscurrVal)+"px"):C[i]=n+"px",v.call()}function d(){f=1e3/60,t._mcstime=x+f,g=e.requestAnimationFrame?e.requestAnimationFrame:function(e){return c(),setTimeout(e,.01)},t._mcsid=g(l)}function h(){null!=t._mcsid&&(e.requestAnimationFrame?e.cancelAnimationFrame(t._mcsid):clearTimeout(t._mcsid),t._mcsid=null)}function u(e,t,i,n,a){switch(a){case"linear":case"mcsLinear":return i*e/n+t;case"mcsLinearOut":return e/=n,e--,i*Math.sqrt(1-e*e)+t;case"easeInOutSmooth":return e/=n/2,1>e?i/2*e*e+t:(e--,-i/2*(e*(e-2)-1)+t);case"easeInOutStrong":return e/=n/2,1>e?i/2*Math.pow(2,10*(e-1))+t:(e--,i/2*(-Math.pow(2,-10*e)+2)+t);case"easeInOut":case"mcsEaseInOut":return e/=n/2,1>e?i/2*e*e*e+t:(e-=2,i/2*(e*e*e+2)+t);case"easeOutSmooth":return e/=n,e--,-i*(e*e*e*e-1)+t;case"easeOutStrong":return i*(-Math.pow(2,-10*e/n)+1)+t;case"easeOut":case"mcsEaseOut":default:var o=(e/=n)*e,s=o*e;return t+i*(.499999999999997*s*o+-2.5*o*o+5.5*s+-6.5*o+4*e)}}var f,g,r=r||{},m=r.onStart||function(){},v=r.onUpdate||function(){},w=r.onComplete||function(){},b=p._getTime(),x=0,y=t.offsetTop,C=t.style;"left"===i&&(y=t.offsetLeft);var S=n-y;t._mcsstop=0,"none"!==s&&h(),d()},_getTime:function(){return e.performance&&e.performance.now?e.performance.now():e.performance&&e.performance.webkitNow?e.performance.webkitNow():Date.now?Date.now():(new Date).getTime()},_stopTween:function(){var t=this;null!=t._mcsid&&(e.requestAnimationFrame?e.cancelAnimationFrame(t._mcsid):clearTimeout(t._mcsid),t._mcsid=null,t._mcsstop=1)},_delete:function(e){try{delete e}catch(t){e=null}},_mouseBtnLeft:function(e){return!(e.which&&1!==e.which)},_pointerTouch:function(e){var t=e.originalEvent.pointerType;return!(t&&"touch"!==t&&2!==t)},_isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)}};i.fn[n]=function(e){return u[e]?u[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&&e?void i.error("Method "+e+" does not exist"):u.init.apply(this,arguments)},i[n]=function(e){return u[e]?u[e].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof e&&e?void i.error("Method "+e+" does not exist"):u.init.apply(this,arguments)},i[n].defaults=s,e[n]=!0,i(e).load(function(){i(o)[n]()})})}(window,document),function(e,t,i,n){"use strict";var a=i("html"),o=i(e),s=i(t),r=i.fancybox=function(){r.open.apply(this,arguments)},l=navigator.userAgent.match(/msie/i),c=null,d=t.createTouch!==n,h=function(e){return e&&e.hasOwnProperty&&e instanceof i},u=function(e){return e&&"string"===i.type(e)},p=function(e){return u(e)&&e.indexOf("%")>0},f=function(e){return e&&!(e.style.overflow&&"hidden"===e.style.overflow)&&(e.clientWidth&&e.scrollWidth>e.clientWidth||e.clientHeight&&e.scrollHeight>e.clientHeight)},g=function(e,t){var i=parseInt(e,10)||0;return t&&p(e)&&(i=r.getViewport()[t]/100*i),Math.ceil(i)},m=function(e,t){return g(e,t)+"px"};i.extend(r,{version:"2.1.5",defaults:{padding:15,margin:20,width:800,height:600,minWidth:100,minHeight:100,maxWidth:9999,maxHeight:9999,pixelRatio:1,autoSize:!0,autoHeight:!1,autoWidth:!1,autoResize:!0,autoCenter:!d,fitToView:!0,aspectRatio:!1,topRatio:.5,leftRatio:.5,scrolling:"auto",wrapCSS:"",arrows:!0,closeBtn:!0,closeClick:!1,nextClick:!1,mouseWheel:!0,autoPlay:!1,playSpeed:3e3,preload:3,modal:!1,loop:!0,ajax:{dataType:"html",headers:{"X-fancyBox":!0}},iframe:{scrolling:"auto",preload:!0},swf:{wmode:"transparent",allowfullscreen:"true",allowscriptaccess:"always"},keys:{next:{13:"left",34:"up",39:"left",40:"up"},prev:{8:"right",33:"down",37:"right",38:"down"},close:[27],play:[32],toggle:[70]},direction:{next:"left",prev:"right"},scrollOutside:!0,index:0,type:null,href:null,content:null,title:null,tpl:{wrap:'
    ',image:'',iframe:'",error:'

    The requested content cannot be loaded.
    Please try again later.

    ',closeBtn:'
    ',next:'',prev:''},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0,openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:i.noop,beforeLoad:i.noop,afterLoad:i.noop,beforeShow:i.noop,afterShow:i.noop,beforeChange:i.noop,beforeClose:i.noop,afterClose:i.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1,isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(e,t){return e&&(i.isPlainObject(t)||(t={}),!1!==r.close(!0))?(i.isArray(e)||(e=h(e)?i(e).get():[e]),i.each(e,function(a,o){var s,l,c,d,p,f,g,m={};"object"===i.type(o)&&(o.nodeType&&(o=i(o)),h(o)?(m={href:o.data("fancybox-href")||o.attr("href"),title:o.data("fancybox-title")||o.attr("title"),isDom:!0,element:o},i.metadata&&i.extend(!0,m,o.metadata())):m=o),s=t.href||m.href||(u(o)?o:null),l=t.title!==n?t.title:m.title||"",c=t.content||m.content,d=c?"html":t.type||m.type,!d&&m.isDom&&(d=o.data("fancybox-type"),d||(p=o.prop("class").match(/fancybox\.(\w+)/),d=p?p[1]:null)),u(s)&&(d||(r.isImage(s)?d="image":r.isSWF(s)?d="swf":"#"===s.charAt(0)?d="inline":u(o)&&(d="html",c=o)),"ajax"===d&&(f=s.split(/\s+/,2),s=f.shift(),g=f.shift())),c||("inline"===d?s?c=i(u(s)?s.replace(/.*(?=#[^\s]+$)/,""):s):m.isDom&&(c=o):"html"===d?c=s:d||s||!m.isDom||(d="inline",c=o)),i.extend(m,{href:s,type:d,content:c,title:l,selector:g}),e[a]=m}),r.opts=i.extend(!0,{},r.defaults,t),t.keys!==n&&(r.opts.keys=t.keys?i.extend({},r.defaults.keys,t.keys):!1),r.group=e,r._start(r.opts.index)):void 0},cancel:function(){var e=r.coming;e&&!1!==r.trigger("onCancel")&&(r.hideLoading(),r.ajaxLoad&&r.ajaxLoad.abort(),r.ajaxLoad=null,r.imgPreload&&(r.imgPreload.onload=r.imgPreload.onerror=null),e.wrap&&e.wrap.stop(!0,!0).trigger("onReset").remove(),r.coming=null,r.current||r._afterZoomOut(e))},close:function(e){r.cancel(),!1!==r.trigger("beforeClose")&&(r.unbindEvents(),r.isActive&&(r.isOpen&&e!==!0?(r.isOpen=r.isOpened=!1,r.isClosing=!0,i(".fancybox-item, .fancybox-nav").remove(),r.wrap.stop(!0,!0).removeClass("fancybox-opened"),r.transitions[r.current.closeMethod]()):(i(".fancybox-wrap").stop(!0).trigger("onReset").remove(),r._afterZoomOut())))},play:function(e){var t=function(){clearTimeout(r.player.timer)},i=function(){t(),r.current&&r.player.isActive&&(r.player.timer=setTimeout(r.next,r.current.playSpeed))},n=function(){t(),s.unbind(".player"),r.player.isActive=!1,r.trigger("onPlayEnd")},a=function(){r.current&&(r.current.loop||r.current.index=a.index?"next":"prev"],r.router=i||"jumpto",a.loop&&(0>e&&(e=a.group.length+e%a.group.length),e%=a.group.length),a.group[e]!==n&&(r.cancel(),r._start(e)))},reposition:function(e,t){var n,a=r.current,o=a?a.wrap:null;o&&(n=r._getPosition(t),e&&"scroll"===e.type?(delete n.position,o.stop(!0,!0).animate(n,200)):(o.css(n),a.pos=i.extend({},a.dim,n)))},update:function(e){var t=e&&e.type,i=!t||"orientationchange"===t;i&&(clearTimeout(c),c=null),r.isOpen&&!c&&(c=setTimeout(function(){var n=r.current;n&&!r.isClosing&&(r.wrap.removeClass("fancybox-tmp"),(i||"load"===t||"resize"===t&&n.autoResize)&&r._setDimension(),"scroll"===t&&n.canShrink||r.reposition(e),r.trigger("onUpdate"),c=null)},i&&!d?0:300))},toggle:function(e){r.isOpen&&(r.current.fitToView="boolean"===i.type(e)?e:!r.current.fitToView,d&&(r.wrap.removeAttr("style").addClass("fancybox-tmp"),r.trigger("onUpdate")),r.update())},hideLoading:function(){s.unbind(".loading"),i("#fancybox-loading").remove()},showLoading:function(){var e,t;r.hideLoading(),e=i('
    ').click(r.cancel).appendTo("body"),s.bind("keydown.loading",function(e){27===(e.which||e.keyCode)&&(e.preventDefault(),r.cancel())}),r.defaults.fixed||(t=r.getViewport(),e.css({position:"absolute",top:.5*t.h+t.y,left:.5*t.w+t.x}))},getViewport:function(){var t=r.current&&r.current.locked||!1,i={x:o.scrollLeft(),y:o.scrollTop()};return t?(i.w=t[0].clientWidth,i.h=t[0].clientHeight):(i.w=d&&e.innerWidth?e.innerWidth:o.width(),i.h=d&&e.innerHeight?e.innerHeight:o.height()),i},unbindEvents:function(){r.wrap&&h(r.wrap)&&r.wrap.unbind(".fb"),s.unbind(".fb"),o.unbind(".fb")},bindEvents:function(){var e,t=r.current;t&&(o.bind("orientationchange.fb"+(d?"":" resize.fb")+(t.autoCenter&&!t.locked?" scroll.fb":""),r.update),e=t.keys,e&&s.bind("keydown.fb",function(a){var o=a.which||a.keyCode,s=a.target||a.srcElement;return 27===o&&r.coming?!1:void(a.ctrlKey||a.altKey||a.shiftKey||a.metaKey||s&&(s.type||i(s).is("[contenteditable]"))||i.each(e,function(e,s){return t.group.length>1&&s[o]!==n?(r[e](s[o]),a.preventDefault(),!1):i.inArray(o,s)>-1?(r[e](),a.preventDefault(),!1):void 0}))}),i.fn.mousewheel&&t.mouseWheel&&r.wrap.bind("mousewheel.fb",function(e,n,a,o){for(var s=e.target||null,l=i(s),c=!1;l.length&&!(c||l.is(".fancybox-skin")||l.is(".fancybox-wrap"));)c=f(l[0]),l=i(l).parent();0===n||c||r.group.length>1&&!t.canShrink&&(o>0||a>0?r.prev(o>0?"down":"left"):(0>o||0>a)&&r.next(0>o?"up":"right"),e.preventDefault())}))},trigger:function(e,t){var n,a=t||r.coming||r.current;if(a){if(i.isFunction(a[e])&&(n=a[e].apply(a,Array.prototype.slice.call(arguments,1))),n===!1)return!1;a.helpers&&i.each(a.helpers,function(t,n){n&&r.helpers[t]&&i.isFunction(r.helpers[t][e])&&r.helpers[t][e](i.extend(!0,{},r.helpers[t].defaults,n),a)}),s.trigger(e)}},isImage:function(e){return u(e)&&e.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg)((\?|#).*)?$)/i)},isSWF:function(e){return u(e)&&e.match(/\.(swf)((\?|#).*)?$/i)},_start:function(e){var t,n,a,o,s,l={};if(e=g(e),t=r.group[e]||null,!t)return!1;if(l=i.extend(!0,{},r.opts,t),o=l.margin,s=l.padding,"number"===i.type(o)&&(l.margin=[o,o,o,o]),"number"===i.type(s)&&(l.padding=[s,s,s,s]),l.modal&&i.extend(!0,l,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}}),l.autoSize&&(l.autoWidth=l.autoHeight=!0),"auto"===l.width&&(l.autoWidth=!0),"auto"===l.height&&(l.autoHeight=!0),l.group=r.group,l.index=e,r.coming=l,!1===r.trigger("beforeLoad"))return void(r.coming=null);if(a=l.type,n=l.href,!a)return r.coming=null,r.current&&r.router&&"jumpto"!==r.router?(r.current.index=e,r[r.router](r.direction)):!1;if(r.isActive=!0,("image"===a||"swf"===a)&&(l.autoHeight=l.autoWidth=!1,l.scrolling="visible"),"image"===a&&(l.aspectRatio=!0),"iframe"===a&&d&&(l.scrolling="scroll"),l.wrap=i(l.tpl.wrap).addClass("fancybox-"+(d?"mobile":"desktop")+" fancybox-type-"+a+" fancybox-tmp "+l.wrapCSS).appendTo(l.parent||"body"),i.extend(l,{skin:i(".fancybox-skin",l.wrap),outer:i(".fancybox-outer",l.wrap),inner:i(".fancybox-inner",l.wrap)}),i.each(["Top","Right","Bottom","Left"],function(e,t){l.skin.css("padding"+t,m(l.padding[e]))}),r.trigger("onReady"),"inline"===a||"html"===a){if(!l.content||!l.content.length)return r._error("content")}else if(!n)return r._error("href");"image"===a?r._loadImage():"ajax"===a?r._loadAjax():"iframe"===a?r._loadIframe():r._afterLoad()},_error:function(e){i.extend(r.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:e,content:r.coming.tpl.error}),r._afterLoad()},_loadImage:function(){var e=r.imgPreload=new Image;e.onload=function(){this.onload=this.onerror=null,r.coming.width=this.width/r.opts.pixelRatio,r.coming.height=this.height/r.opts.pixelRatio,r._afterLoad()},e.onerror=function(){this.onload=this.onerror=null,r._error("image")},e.src=r.coming.href,e.complete!==!0&&r.showLoading()},_loadAjax:function(){var e=r.coming;r.showLoading(),r.ajaxLoad=i.ajax(i.extend({},e.ajax,{url:e.href,error:function(e,t){r.coming&&"abort"!==t?r._error("ajax",e):r.hideLoading()},success:function(t,i){"success"===i&&(e.content=t,r._afterLoad())}}))},_loadIframe:function(){var e=r.coming,t=i(e.tpl.iframe.replace(/\{rnd\}/g,(new Date).getTime())).attr("scrolling",d?"auto":e.iframe.scrolling).attr("src",e.href);i(e.wrap).bind("onReset",function(){try{i(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(e){}}),e.iframe.preload&&(r.showLoading(),t.one("load",function(){i(this).data("ready",1),d||i(this).bind("load.fb",r.update),i(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show(),r._afterLoad()})),e.content=t.appendTo(e.inner),e.iframe.preload||r._afterLoad()},_preloadImages:function(){var e,t,i=r.group,n=r.current,a=i.length,o=n.preload?Math.min(n.preload,a-1):0;for(t=1;o>=t;t+=1)e=i[(n.index+t)%a],"image"===e.type&&e.href&&((new Image).src=e.href)},_afterLoad:function(){var e,t,n,a,o,s,l=r.coming,c=r.current,d="fancybox-placeholder";if(r.hideLoading(),l&&r.isActive!==!1){if(!1===r.trigger("afterLoad",l,c))return l.wrap.stop(!0).trigger("onReset").remove(),void(r.coming=null);switch(c&&(r.trigger("beforeChange",c),c.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove()),r.unbindEvents(),e=l,t=l.content,n=l.type,a=l.scrolling,i.extend(r,{wrap:e.wrap,skin:e.skin,outer:e.outer,inner:e.inner,current:e,previous:c}),o=e.href,n){case"inline":case"ajax":case"html":e.selector?t=i("
    ").html(t).find(e.selector):h(t)&&(t.data(d)||t.data(d,i('
    ').insertAfter(t).hide()),t=t.show().detach(),e.wrap.bind("onReset",function(){i(this).find(t).length&&t.hide().replaceAll(t.data(d)).data(d,!1)}));break;case"image":t=e.tpl.image.replace("{href}",o);break;case"swf":t='',s="",i.each(e.swf,function(e,i){t+='',s+=" "+e+'="'+i+'"'}),t+='"}h(t)&&t.parent().is(e.inner)||e.inner.append(t),r.trigger("beforeShow"),e.inner.css("overflow","yes"===a?"scroll":"no"===a?"hidden":a),r._setDimension(),r.reposition(),r.isOpen=!1,r.coming=null,r.bindEvents(),r.isOpened?c.prevMethod&&r.transitions[c.prevMethod]():i(".fancybox-wrap").not(e.wrap).stop(!0).trigger("onReset").remove(),r.transitions[r.isOpened?e.nextMethod:e.openMethod](),r._preloadImages()}},_setDimension:function(){var e,t,n,a,o,s,l,c,d,h,u,f,v,w,b,x=r.getViewport(),y=0,C=!1,S=!1,_=r.wrap,T=r.skin,k=r.inner,E=r.current,M=E.width,P=E.height,I=E.minWidth,L=E.minHeight,O=E.maxWidth,B=E.maxHeight,D=E.scrolling,A=E.scrollOutside?E.scrollbarWidth:0,R=E.margin,W=g(R[1]+R[3]),H=g(R[0]+R[2]);if(_.add(T).add(k).width("auto").height("auto").removeClass("fancybox-tmp"),e=g(T.outerWidth(!0)-T.width()),t=g(T.outerHeight(!0)-T.height()),n=W+e,a=H+t,o=p(M)?(x.w-n)*g(M)/100:M,s=p(P)?(x.h-a)*g(P)/100:P,"iframe"===E.type){if(w=E.content,E.autoHeight&&1===w.data("ready"))try{w[0].contentWindow.document.location&&(k.width(o).height(9999),b=w.contents().find("body"),A&&b.css("overflow-x","hidden"),s=b.outerHeight(!0))}catch(N){}}else(E.autoWidth||E.autoHeight)&&(k.addClass("fancybox-tmp"),E.autoWidth||k.width(o),E.autoHeight||k.height(s),E.autoWidth&&(o=k.width()),E.autoHeight&&(s=k.height()),k.removeClass("fancybox-tmp"));if(M=g(o),P=g(s),d=o/s,I=g(p(I)?g(I,"w")-n:I),O=g(p(O)?g(O,"w")-n:O),L=g(p(L)?g(L,"h")-a:L),B=g(p(B)?g(B,"h")-a:B),l=O,c=B,E.fitToView&&(O=Math.min(x.w-n,O),B=Math.min(x.h-a,B)),f=x.w-W,v=x.h-H,E.aspectRatio?(M>O&&(M=O,P=g(M/d)),P>B&&(P=B,M=g(P*d)),I>M&&(M=I,P=g(M/d)),L>P&&(P=L,M=g(P*d))):(M=Math.max(I,Math.min(M,O)),E.autoHeight&&"iframe"!==E.type&&(k.width(M),P=k.height()),P=Math.max(L,Math.min(P,B))),E.fitToView)if(k.width(M).height(P),_.width(M+e),h=_.width(),u=_.height(),E.aspectRatio)for(;(h>f||u>v)&&M>I&&P>L&&!(y++>19);)P=Math.max(L,Math.min(B,P-10)),M=g(P*d),I>M&&(M=I,P=g(M/d)),M>O&&(M=O,P=g(M/d)),k.width(M).height(P),_.width(M+e),h=_.width(),u=_.height();else M=Math.max(I,Math.min(M,M-(h-f))),P=Math.max(L,Math.min(P,P-(u-v)));A&&"auto"===D&&s>P&&f>M+e+A&&(M+=A),k.width(M).height(P),_.width(M+e),h=_.width(),u=_.height(),C=(h>f||u>v)&&M>I&&P>L,S=E.aspectRatio?l>M&&c>P&&o>M&&s>P:(l>M||c>P)&&(o>M||s>P),i.extend(E,{dim:{width:m(h),height:m(u)},origWidth:o,origHeight:s,canShrink:C,canExpand:S,wPadding:e,hPadding:t,wrapSpace:u-T.outerHeight(!0),skinSpace:T.height()-P}),!w&&E.autoHeight&&P>L&&B>P&&!S&&k.height("auto")},_getPosition:function(e){var t=r.current,i=r.getViewport(),n=t.margin,a=r.wrap.width()+n[1]+n[3],o=r.wrap.height()+n[0]+n[2],s={position:"absolute",top:n[0],left:n[3]};return t.autoCenter&&t.fixed&&!e&&o<=i.h&&a<=i.w?s.position="fixed":t.locked||(s.top+=i.y,s.left+=i.x),s.top=m(Math.max(s.top,s.top+(i.h-o)*t.topRatio)),s.left=m(Math.max(s.left,s.left+(i.w-a)*t.leftRatio)),s},_afterZoomIn:function(){var e=r.current;e&&(r.isOpen=r.isOpened=!0,r.wrap.css("overflow","visible").addClass("fancybox-opened"), r.update(),(e.closeClick||e.nextClick&&r.group.length>1)&&r.inner.css("cursor","pointer").bind("click.fb",function(t){i(t.target).is("a")||i(t.target).parent().is("a")||(t.preventDefault(),r[e.closeClick?"close":"next"]())}),e.closeBtn&&i(e.tpl.closeBtn).appendTo(r.skin).bind("click.fb",function(e){e.preventDefault(),r.close()}),e.arrows&&r.group.length>1&&((e.loop||e.index>0)&&i(e.tpl.prev).appendTo(r.outer).bind("click.fb",r.prev),(e.loop||e.index
    ').appendTo(r.coming?r.coming.parent:e.parent),this.fixed=!1,e.fixed&&r.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(e){var t=this;e=i.extend({},this.defaults,e),this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(e),this.fixed||(o.bind("resize.overlay",i.proxy(this.update,this)),this.update()),e.closeClick&&this.overlay.bind("click.overlay",function(e){return i(e.target).hasClass("fancybox-overlay")?(r.isActive?r.close():t.close(),!1):void 0}),this.overlay.css(e.css).show()},close:function(){var e,t;o.unbind("resize.overlay"),this.el.hasClass("fancybox-lock")&&(i(".fancybox-margin").removeClass("fancybox-margin"),e=o.scrollTop(),t=o.scrollLeft(),this.el.removeClass("fancybox-lock"),o.scrollTop(e).scrollLeft(t)),i(".fancybox-overlay").remove().hide(),i.extend(this,{overlay:null,fixed:!1})},update:function(){var e,i="100%";this.overlay.width(i).height("100%"),l?(e=Math.max(t.documentElement.offsetWidth,t.body.offsetWidth),s.width()>e&&(i=s.width())):s.width()>o.width()&&(i=s.width()),this.overlay.width(i).height(s.height())},onReady:function(e,t){var n=this.overlay;i(".fancybox-overlay").stop(!0,!0),n||this.create(e),e.locked&&this.fixed&&t.fixed&&(n||(this.margin=s.height()>o.height()?i("html").css("margin-right").replace("px",""):!1),t.locked=this.overlay.append(t.wrap),t.fixed=!1),e.showEarly===!0&&this.beforeShow.apply(this,arguments)},beforeShow:function(e,t){var n,a;t.locked&&(this.margin!==!1&&(i("*").filter(function(){return"fixed"===i(this).css("position")&&!i(this).hasClass("fancybox-overlay")&&!i(this).hasClass("fancybox-wrap")}).addClass("fancybox-margin"),this.el.addClass("fancybox-margin")),n=o.scrollTop(),a=o.scrollLeft(),this.el.addClass("fancybox-lock"),o.scrollTop(n).scrollLeft(a)),this.open(e)},onUpdate:function(){this.fixed||this.update()},afterClose:function(e){this.overlay&&!r.coming&&this.overlay.fadeOut(e.speedOut,i.proxy(this.close,this))}},r.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(e){var t,n,a=r.current,o=a.title,s=e.type;if(i.isFunction(o)&&(o=o.call(a.element,a)),u(o)&&""!==i.trim(o)){switch(t=i('
    '+o+"
    "),s){case"inside":n=r.skin;break;case"outside":n=r.wrap;break;case"over":n=r.inner;break;default:n=r.skin,t.appendTo("body"),l&&t.width(t.width()),t.wrapInner(''),r.current.margin[2]+=Math.abs(g(t.css("margin-bottom")))}t["top"===e.position?"prependTo":"appendTo"](n)}}},i.fn.fancybox=function(e){var t,n=i(this),a=this.selector||"",o=function(o){var s,l,c=i(this).blur(),d=t;o.ctrlKey||o.altKey||o.shiftKey||o.metaKey||c.is(".fancybox-wrap")||(s=e.groupAttr||"data-fancybox-group",l=c.attr(s),l||(s="rel",l=c.get(0)[s]),l&&""!==l&&"nofollow"!==l&&(c=a.length?i(a):n,c=c.filter("["+s+'="'+l+'"]'),d=c.index(this)),e.index=d,r.open(c,e)!==!1&&o.preventDefault())};return e=e||{},t=e.index||0,a&&e.live!==!1?s.undelegate(a,"click.fb-start").delegate(a+":not('.fancybox-item, .fancybox-nav')","click.fb-start",o):n.unbind("click.fb-start").bind("click.fb-start",o),this.filter("[data-fancybox-start=1]").trigger("click"),this},s.ready(function(){var t,o;i.scrollbarWidth===n&&(i.scrollbarWidth=function(){var e=i('
    ').appendTo("body"),t=e.children(),n=t.innerWidth()-t.height(99).innerWidth();return e.remove(),n}),i.support.fixedPosition===n&&(i.support.fixedPosition=function(){var e=i('
    ').appendTo("body"),t=20===e[0].offsetTop||15===e[0].offsetTop;return e.remove(),t}()),i.extend(r.defaults,{scrollbarWidth:i.scrollbarWidth(),fixed:i.support.fixedPosition,parent:i("body")}),t=i(e).width(),a.addClass("fancybox-lock-test"),o=i(e).width(),a.removeClass("fancybox-lock-test"),i("").appendTo("head")})}(window,document,jQuery),function(e,t,i){function n(e){var t={},n=/^jQuery\d+$/;return i.each(e.attributes,function(e,i){i.specified&&!n.test(i.name)&&(t[i.name]=i.value)}),t}function a(e,t){var n=this,a=i(n);if(n.value==a.attr("placeholder")&&a.hasClass("placeholder"))if(a.data("placeholder-password")){if(a=a.hide().next().show().attr("id",a.removeAttr("id").data("placeholder-id")),e===!0)return a[0].value=t;a.focus()}else n.value="",a.removeClass("placeholder"),n==s()&&n.select()}function o(){var e,t=this,o=i(t),s=this.id;if(""==t.value){if("password"==t.type){if(!o.data("placeholder-textinput")){try{e=o.clone().attr({type:"text"})}catch(r){e=i("").attr(i.extend(n(this),{type:"text"}))}e.removeAttr("name").data({"placeholder-password":o,"placeholder-id":s}).bind("focus.placeholder",a),o.data({"placeholder-textinput":e,"placeholder-id":s}).before(e)}o=o.removeAttr("id").hide().prev().attr("id",s).show()}o.addClass("placeholder"),o[0].value=o.attr("placeholder")}else o.removeClass("placeholder")}function s(){try{return t.activeElement}catch(e){}}var r,l,c="placeholder"in t.createElement("input"),d="placeholder"in t.createElement("textarea"),h=i.fn,u=i.valHooks,p=i.propHooks;c&&d?(l=h.placeholder=function(){return this},l.input=l.textarea=!0):(l=h.placeholder=function(){var e=this;return e.filter((c?"textarea":":input")+"[placeholder]").not(".placeholder").bind({"focus.placeholder":a,"blur.placeholder":o}).data("placeholder-enabled",!0).trigger("blur.placeholder"),e},l.input=c,l.textarea=d,r={get:function(e){var t=i(e),n=t.data("placeholder-password");return n?n[0].value:t.data("placeholder-enabled")&&t.hasClass("placeholder")?"":e.value},set:function(e,t){var n=i(e),r=n.data("placeholder-password");return r?r[0].value=t:n.data("placeholder-enabled")?(""==t?(e.value=t,e!=s()&&o.call(e)):n.hasClass("placeholder")?a.call(e,!0,t)||(e.value=t):e.value=t,n):e.value=t}},c||(u.input=r,p.value=r),d||(u.textarea=r,p.value=r),i(function(){i(t).delegate("form","submit.placeholder",function(){var e=i(".placeholder",this).each(a);setTimeout(function(){e.each(o)},10)})}),i(e).bind("beforeunload.placeholder",function(){i(".placeholder").each(function(){this.value=""})}))}(this,document,jQuery),function(){var e,t;jQuery.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=jQuery.uaMatch(navigator.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),jQuery.browser=t,jQuery.sub=function(){function e(t,i){return new e.fn.init(t,i)}jQuery.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(i,n){return n&&n instanceof jQuery&&!(n instanceof e)&&(n=e(n)),jQuery.fn.init.call(this,i,n,t)},e.fn.init.prototype=e.fn;var t=e(document);return e}}(),function(e){e.fn.photoTag=function(t){function i(e){e.parent().css({overflow:"visible"}),e.parent().find(".utag-bot, .utag-top, .utag-right, .utag-left").show(),e.parent().find(".utag-bot").css({top:e.parent().css("height")}),e.parent().find(".utag-right").css({height:e.parent().css("height"),left:e.parent().css("width")}),e.parent().find(".utag-left").css({height:e.parent().css("height")}),e.parent().stop().animate({opacity:1},500)}function n(e){e.parent().stop().animate({opacity:0},500,function(){e.parent().css({overflow:"hidden"})}),e.parent().find(".utag-bot, .utag-top, .utag-right, .utag-left").hide()}function a(e){e.css({overflow:"visible"}),e.find(".utag-bot, .utag-top, .utag-right, .utag-left").show(),e.find(".utag-bot").css({top:e.css("height")}),e.find(".utag-right").css({height:e.css("height"),left:e.css("width")}),e.find(".utag-left").css({height:e.css("height")}),e.stop().animate({opacity:1},500)}function o(e){e.stop().animate({opacity:0},500,function(){e.css({overflow:"hidden"})}),e.find(".utag-bot, .utag-top, .utag-right, .utag-left").hide()}function s(){e(".highlight-tag").each(function(){e(this).mouseenter(function(){a(e("#photoTag-tag_"+e(this).attr("tag-id")))}).mouseleave(function(){o(e("#photoTag-tag_"+e(this).attr("tag-id")))})})}var r={deleteTagsUrl:"/photo/delete-tag/",addTagUrl:"/add-tag.php",parametersForNewTag:{name:{parameterKey:"name",isAutocomplete:!0,label:"Name"}},parametersForRequest:["image-id","album-id"],literals:{communicationProblem:"Произошла ошибка. Изменения не сохранены.",saveTag:"Добавить",cancelTag:"",addNewTag:"Отметить человека",removeTag:"X"},tag:{tagIdParameter:"tag-id",defaultWidth:100,defaultHeight:100,isResizable:!0,minWidth:50,minHeight:50,maxWidth:150,maxHeight:150,cssClass:"photoTag-tag",idPrefix:"photoTag-tag_",showDeleteLinkOnTag:!0,deleteLinkCssClass:"photoTag-delete",deleteLinkIdPrefix:"photoTag-delete_",flashAfterCreation:!0,newTagFormWidth:170,newTagFormClass:"photoTag-newTagForm"},imageWrapBox:{cssClass:"photoTag-wrap",idPrefix:"photoTag-wrap_",addNewLinkIdPrefix:"photoTag-add_",controlPaneIdPrefix:"photoTag-cpanel_",showTagList:!0,tagListCssClass:"photoTag-taglist",tagListIdPrefix:"photoTag-taglist_",tagListRemoveItemIdPrefix:"photoTag-removeTag",canvasIdPrefix:"photoTag-canvas_",controlPanelHeight:25},showAddTagLinks:!0,externalAddTagLinks:{bind:!0,selector:".addTag"},isEnabledToEditTags:!0,manageError:"internal function, user can bind a new one. function(response)",beforeTagRequest:"bind by user, function( parameters )"},l={tags:{}},t=e.extend(!0,r,t),c=function(i){var n={};return e.each(t.parametersForRequest,function(e,t){var a=i.attr("data-"+t);a&&(n[t]=a)}),n},d=function(i){e.isFunction(t.manageError)?t.manageError(i):i.message?alert(i.message):alert(t.literals.communicationProblem)},h=function(a,o){a.click(function(s){s.preventDefault();var r=a.attr("href").substring(1),l=c(o);l[t.tag.tagIdParameter]=r,e.getJSON(t.deleteTagsUrl,l,function(e){e.result||d(e)}),e("#"+t.tag.deleteLinkIdPrefix+r).parents().eq(1).remove(),e("#"+t.imageWrapBox.tagListRemoveItemIdPrefix+r).parent().remove();var h=e("span.comma"),u=e("a.highlight-tag");return e("ul.photoTag-taglist li").last().find(h).remove(),e("ul.photoTag-taglist li").last().find(u).mouseover(function(){i(e("#photoTag-tag_"+e(this).attr("tag-id")).find(".taghover"))}).mouseleave(function(){n(e("#photoTag-tag_"+e(this).attr("tag-id")).find(".taghover"))}),!1})},u=function(i,n,a){e(i).click(function(i){i.preventDefault(),0==e("#"+t.tag.idPrefix+"expo").length&&(S(a),e("#"+t.imageWrapBox.idPrefix+a).append(C(n)),m(e("#"+t.tag.idPrefix+"expo"),n,a))})},p=function(t,i){var n=(e(this),e(this).position()),a=n.left,o=n.top;e("#expoTagBoxForm")&&e("#expoTagBoxForm").css({top:o,left:a+e(this).width()+10}),e("#photoTag-tag_expo .utag-right").css({height:e(this).height(),left:e(this).width()}),e("#photoTag-tag_expo .utag-left").css({height:e(this).height()}),e("#photoTag-tag_expo .utag-bot").css({top:e(this).height()})},f=function(t,i){e("#expoTagBoxForm")&&e("#expoTagBoxForm").css({display:"none"})},g=function(t,i){var n=(e(this),e(this).position()),a=n.left,o=n.top;e("#expoTagBoxForm")&&e("#expoTagBoxForm").css({display:"block",top:o,left:a+e(this).width()+10})},m=function(i,n,a){i.draggable({containment:n,cursor:"move",drag:p,start:f,stop:g,grid:[1,1]}),i.resizable({handles:"n, e, s, w, ne, se, sw, nw",maxHeight:n.height(),maxWidth:n.width(),minHeight:t.tag.minHeight,minWidth:t.tag.minWidth,containment:n,resize:p}),v(i,n,a),e(".utag-bot").css({top:t.tag.defaultWidth}),e(".utag-right").css({height:t.tag.defaultHeight,left:t.tag.defaultWidth}),e(".utag-left").css({height:t.tag.defaultHeight})},v=function(i,n,a){var o=e('
    '),r=e('
    '),l=e(i).position();r.css({position:"absolute",top:l.top,left:l.left+i.width()+10,width:t.tag.newTagFormWidth}),r.append(e('
    '));var c=e("#"+t.imageWrapBox.idPrefix+a);c.append(r),e("#expoNewTagFormContent").append(o),e.each(t.parametersForNewTag,function(t,i){var n=e('
    ');if(i.label){var a=e("");e("
    ");a.append(i.label),e("#expoNewTagForm").append(a)}e("#expoNewTagForm").append(n),e("#expoInput_name").bind("keydown",function(t){t.keyCode===e.ui.keyCode.TAB&&e(this).data("ui-autocomplete").menu.active&&t.preventDefault()}).autocomplete({appendTo:e(".ptListHolder"),minLength:1,source:function(t,i){var n=e.ui.autocomplete.escapeRegex(t.term),a=new RegExp("^"+n,"i"),o=e.grep(photoTagData,function(e){return a.test(e.label||e.value||e)}),s=new RegExp(n,"i"),r=e.grep(photoTagData,function(t){return e.inArray(t,o)<0&&s.test(t.label||t.value||t)});i(o.concat(r))},focus:function(){return!1},select:function(t,i){e("#hidden_expoInput_name").val(i.item.id)}}),e("#expoInput_name").parent().append(e(''))});var h=e('");e("#expoNewTagForm").append(h);var u=e("");e("#expoNewTagForm").append(u);var p=e('');p.click(function(e){return e.preventDefault(),w(),_(a),!1}),e("#expoNewTagForm").append(p),e("#expoNewTagForm").submit(function(i){i.preventDefault();var o=e("#"+t.tag.idPrefix+"expo"),r={left:o.position().left,top:o.position().top,width:o.width(),height:o.height()};e.getJSON(t.addTagUrl+"?"+e.param(r)+"&"+e(this).serialize(),function(i){if(void 0!=i.result&&!i.result)return void d(i);var o=x(i.tag,n);e("#"+t.imageWrapBox.idPrefix+a).append(o),s(),E(o,i.tag,n,a)}),w(),_(a)})},w=function(){e("#"+t.tag.idPrefix+"expo").remove(),e("#expoTagBoxForm").remove()},b=function(i,n,a,o){var s=e('
    '),r={position:"absolute",top:Math.round(a.top)+"px",left:Math.round(a.left)+"px",height:n.height+"px",width:n.width+"px",opacity:o};return s.css(r),s.append(' 
    '),s},x=function(i,n){i.height&&i.width||(i.height=t.tag.defaultHeight,i.width=t.tag.defaultWidth);var a={width:i.width,height:i.height},o={top:i.top,left:i.left},s=b(i.id,a,o,0),r=e("
    ");if(r.append(i.text.replace(/ /g," ")),s.append(r),t.isEnabledToEditTags&&i.isDeleteEnable&&t.tag.showDeleteLinkOnTag){var l=e('');h(l,n)}return s.find(".taghover").append(l),s},y=function(a,o){e(".photoTag-taglist").html().length>0&&e(".photoTag-taglist li").last().append(', ');var s=e("
  • ");if(a.url){var r=e(''+a.text+"");s.append(r)}else s.append(a.text);if(a.isDeleteEnable){var l=e('  ');h(l,o),s.append(l)}var c=e("a.highlight-tag");return e("ul.photoTag-taglist li").last().find(c).mouseover(function(){i(e("#photoTag-tag_"+e(this).attr("tag-id")).find(".taghover"))}).mouseleave(function(){n(e("#photoTag-tag_"+e(this).attr("tag-id")).find(".taghover"))}),s},C=function(e,i){var n={width:t.tag.defaultWidth,height:t.tag.defaultHeight},a={top:e.height()/2-n.height/2,left:e.width()/2-n.width/2};l.expoId++;var o=b("expo",n,a,1);return o},S=function(t){e.each(l.tags[t],function(){e(this).css({opacity:0}),e(this).hide()})},_=function(t){e.each(l.tags[t],function(){e(this).show()})},T=function(i,n){var a=e(''+t.literals.addNewTag+"");return u(a,i,n),a},k=function(i,n){var a=i.height(),o=i.width(),s=e('
    '),r=e('
    ');s.append(r);var l=e('
    ');if(s.append(l),i.wrap(s),t.externalAddTagLinks.bind){var c=e(t.externalAddTagLinks.selector);c.each(function(){u(this,i,n)})}else e("#"+t.imageWrapBox.controlPaneIdPrefix+n).append(T(i,n));var d=e("
    ");if(e("#"+t.imageWrapBox.canvasIdPrefix+n).wrap(d),t.imageWrapBox.showTagList){var h=e('');e(".pg-photo-descr#imgid"+n).append(h)}},E=function(a,o,s,r){if(t.tag.flashAfterCreation&&(e(a).css({opacity:1}),e(a).stop().animate({opacity:0},800)),t.imageWrapBox.showTagList){var l=y(o,s);e("#"+t.imageWrapBox.tagListIdPrefix+r).append(l);var c=e("a.highlight-tag");e("ul.photoTag-taglist li").last().find(c).mouseover(function(){i(e("#photoTag-tag_"+e(this).attr("tag-id")).find(".taghover"))}).mouseleave(function(){n(e("#photoTag-tag_"+e(this).attr("tag-id")).find(".taghover"))})}},M=function(i,n){k(n,i.id);var a=l.tags[i.id]={};e.each(i.Tags,function(){var o=x(this,n);a[this.id]=o,e("#"+t.imageWrapBox.idPrefix+i.id).append(o),s(),E(o,this,n,i.id)})};return this.each(function(){var i=e(this),n=c(i);(!e.isFunction(t.beforeTagRequest)||t.beforeTagRequest(n))&&e.getJSON(t.requestTagsUrl,n,function(n){return void 0==n.result||n.result?(n.options&&(t=e.extend(!0,t,n.options)),void e.each(n.Image,function(){M(this,i)})):void d(n)})}),this}}(jQuery);var dna={clone:function(e,t,i){var n=$.extend({fade:!1,top:!1,container:null,empty:!1,html:!1,callback:null},i),a=dna.store.getTemplate(e);a.nested&&!n.container&&dna.core.berserk("Container missing for nested template: "+e),n.empty&&dna.empty(e);for(var o=t instanceof Array?t:[t],s=$(),r=0;r0&&i(window,e.split(".")),n}},dna.ui={toElem:function(e,t){return e instanceof jQuery?e:e?$(e.target):$(t)},deleteElem:function(e){var t=dna.ui.toElem(e,this);return dna.core.remove(t),t},slideFade:function(e,t,i){function n(){e.css(r)}var a={opacity:0,transition:"opacity 0s ease 0s"},o={opacity:1,transition:"opacity 0.4s ease-in"},s={opacity:0,transition:"opacity 0.4s ease-out"},r={transition:"opacity 0s ease 0s"};return window.setTimeout(n,1e3),i?e.css(a).hide().slideDown({complete:t}).css(o):e.css(s).slideUp({complete:t}),e},slideFadeIn:function(e,t){return dna.ui.slideFade(e,t,!0)},slideFadeOut:function(e,t){return dna.ui.slideFade(e,t,!1)},slideFadeToggle:function(e,t){return dna.ui.slideFade(e,t,e.is(":hidden"))},slideFadeDelete:function(e){return dna.ui.slideFadeOut(e,dna.ui.deleteElem)},slidingFlasher:function(e,t){return e.is(":hidden")?dna.ui.slideFadeIn(e,t):e.hide().fadeIn()},smoothMove:function(e,t){function i(){var i=n.clone();t?e.after(n.hide()).before(i):e.before(n.hide()).after(i),dna.ui.slideFadeIn(n),dna.ui.slideFadeDelete(i)}var n=t?e.prev():e.next();n.length&&i()},focus:function(e){return e.focus()}},dna.placeholder={setup:function(){function e(){var e=$(this).stop();return dna.getClones(e.data().placeholder).length?e.fadeOut():e.fadeIn()}$("[data-placeholder]").each(e)}},$(dna.placeholder.setup),dna.pageToken={put:function(e,t){return sessionStorage[e+window.location.pathname]=JSON.stringify(t),t},get:function(e,t){var i=sessionStorage[e+window.location.pathname];return void 0===i?t:JSON.parse(i)}},dna.panels={key:function(e){return"#"+e.attr("id")+"-panels"},display:function(e,t,i){function n(){dna.pageToken.put(s,t),i&&o.data().hash&&window.history.pushState(null,null,"#"+o.data().hash)}var a,o,s=dna.panels.key(e),r=e.find(".menu-item");void 0===t&&(t=dna.pageToken.get(s,0)),t=Math.max(0,Math.min(t,r.length-1)),r.removeClass("selected").eq(t).addClass("selected"),a=$(s).children().hide().removeClass("displayed"),o=a.eq(t).fadeIn().addClass("displayed"),n(),dna.util.apply(e.data().callback,o)},rotate:function(e){var t=$(e.target).closest(".menu-item"),i=t.closest(".dna-menu");dna.panels.display(i,i.find(".menu-item").index(t),!0)},reload:function(e){dna.panels.display($("#"+e))},refresh:function(){function e(e){return e.filter("[data-hash="+n+"]").index()}function t(e){return e.first().closest(".dna-template").length>0}function i(){var i=$(this),a=dna.panels.key(i),o=$(a).children().addClass("panel");if(0===i.find(".menu-item").length&&i.children().addClass("menu-item"),!t(o)&&!t(i.children())){var s=n&&o.first().data().hash?e(o):dna.pageToken.get(a,0);dna.panels.display(i,s)}}var n=window.location.hash.slice(1);$(".dna-menu").each(i)},setup:function(){dna.panels.refresh(),$(document).on("click",".dna-menu .menu-item",dna.panels.rotate)}},$(dna.panels.setup),dna.compile={regexDnaField:/^[\s]*(~~|\{\{).*(~~|\}\})[\s]*$/,regexDnaBasePair:/~~|{{|}}/,regexDnaBasePairs:/~~|\{\{|\}\}/g,setupNucleotide:function(e){return void 0===e.data().dnaRules&&(e.data().dnaRules={}),e.addClass("dna-nucleotide")},isDnaField:function(){var e=$(this)[0].childNodes[0];return e&&e.nodeValue&&e.nodeValue.match(dna.compile.regexDnaField)},field:function(){var e=dna.compile.setupNucleotide($(this));return e.data().dnaRules.text=$.trim(e.text()).replace(dna.compile.regexDnaBasePairs,""),e.empty()},propsAndAttrs:function(){function e(e,t){s.push(e),e=e.replace(/^data-prop-/,"").toLowerCase(),t=t.replace(dna.compile.regexDnaBasePairs,""),a.push(e,t),"checked"===e&&n.is("input")?n.addClass("dna-update-model").data().dnaField=t:"selected"===e&&n.is("option")&&(n.parent().addClass("dna-update-model").end().data().dnaField=t)}function t(e,t){var i=t.split(dna.compile.regexDnaBasePair);"[value]"===i[1]&&(i[1]=!0),o.push(e.replace(/^data-attr-/,""),i),s.push(e);var a="input:not(:checkbox, :radio)";"value"===e&&n.is(a)&&""===i[0]&&""===i[2]&&(n.addClass("dna-update-model").data().dnaField=i[1])}function i(){/^data-prop-/.test(this.name)?e(this.name,this.value):3===this.value.split(dna.compile.regexDnaBasePair).length&&t(this.name,this.value)}var n=$(this),a=[],o=[],s=[];return $.each(n.get(0).attributes,i),a.length>0&&(dna.compile.setupNucleotide(n).data().dnaRules.props=a),o.length>0&&(dna.compile.setupNucleotide(n).data().dnaRules.attrs=o),n.data().transform&&(dna.compile.setupNucleotide(n).data().dnaRules.transform=n.data().transform),n.data().callback&&(dna.compile.setupNucleotide(n).data().dnaRules.callback=n.data().callback),n.removeAttr(s.join(" "))},getDataField:function(e,t){return $.trim(e.data(t).replace(dna.compile.regexDnaBasePairs,""))},subTemplateName:function(e,t){var i=e instanceof jQuery?dna.getClone(e).data().dnaRules.template:e;return i+"-"+t+"-instance"},rules:function(e,t,i){function n(){var e=dna.compile.setupNucleotide($(this)),n=dna.compile.getDataField(e,t);e.data().dnaRules[t]=i?n.split(","):n}return e.filter("[data-"+t+"]").each(n).removeAttr("data-"+t)},separators:function(e){function t(){return 3===this.nodeType&&!/\S/.test(this.nodeValue)}function i(e,i,n){i&&(e.contents().last().filter(t).remove(),e.append($("").addClass(n).html(i)))}function n(){var e=$(this);i(e,e.data().separator,"dna-separator"),i(e,e.data().lastSeparator,"dna-last-separator")}e.find(".dna-template, .dna-sub-clone").addBack().each(n)},template:function(e){function t(){$(this).data().dnaRules={template:$(this).attr("id")}}function i(){$(this).attr("type",$(this).data().attrType)}var n=$("#"+e);n.length||dna.core.berserk("Template not found: "+e),n.find(".dna-template").addBack().each(t).removeAttr("id");var a=n.find("*").addBack();return a.filter(dna.compile.isDnaField).each(dna.compile.field),dna.compile.rules(a,"array").addClass("dna-sub-clone"),dna.compile.rules(a,"class",!0),dna.compile.rules(a,"require"),dna.compile.rules(a,"missing"),dna.compile.rules(a,"truthy"),dna.compile.rules(a,"falsey"),dna.compile.rules(a.filter("select"),"option").addClass("dna-update-model"),a.each(dna.compile.propsAndAttrs),dna.compile.separators(n),$("input[data-attr-type]").each(i),dna.store.stash(n)}},dna.store={templates:{},stash:function(e){function t(){var e=$(this),t=e.data().dnaRules.template,i={name:t,elem:e,container:e.parent().addClass("dna-container").addClass("dna-contains-"+t),nested:0!==e.parent().closest(".dna-clone").length,separators:e.find(".dna-separator, .dna-last-separator").length,index:e.index(), -elemsAbove:e.index()>0,elemsBelow:e.nextAll().length>0,clones:0};dna.store.templates[t]=i,e.removeClass("dna-template").addClass("dna-clone").addClass(t).detach()}function i(){var e=$(this),t=e.data().dnaRules.array,i=dna.compile.subTemplateName(n,t);dna.compile.setupNucleotide(e.parent().addClass("dna-array")).data().dnaRules.loop={name:i,field:t},e.data().dnaRules.template=i}var n=e.data().dnaRules.template;return e.find(".dna-template").addBack().each(t),e.find(".dna-sub-clone").each(i).each(t),dna.store.templates[n]},getTemplate:function(e){return dna.store.templates[e]||dna.compile.template(e)}},dna.events={initializers:[],elementSetup:function(e,t){function i(){dna.util.apply($(this).data().onLoad,[$(this),t])}var n="[data-on-load]",a=e?e.find(n).addBack(n):$(n);return a.not(".dna-initialized").each(i).addClass("dna-initialized")},runInitializers:function(e,t){function i(){var t=this.selector?e.find(this.selector).addBack(this.selector):e;dna.util.apply(this.func,[t.addClass("dna-initialized")].concat(this.params))}return dna.events.elementSetup(e,t),$.each(dna.events.initializers,i),e},setup:function(){function e(e,t,i){return e=e.closest("[data-"+t+"]"),dna.util.apply(e.data(t),[e,i])}function t(t){function i(e){return e.dnaRules&&e.dnaRules.option||e.dnaField}function n(e,t){dna.getModel(e)[i(e.data())]=t(e)}function a(e){return e.val()}function o(e){return e.is(":checked")}function s(){n($(this),o)}function r(){var e=dna.getClone(l,{main:!0});0!==e.length&&(l.is("input:checkbox")?n(l,o):l.is("input:radio")?$("input:radio[name="+l.attr("name")+"]").each(s):l.is("input")||l.data().dnaRules.option?n(l,a):l.is("select")&&l.find("option").each(s),dna.refresh(e))}var l=$(t.target);l.hasClass("dna-update-model")&&r(),e(l,t.type.replace("key","key-"),t)}function i(t){13===t.which&&e($(t.target),"enter-key",t)}function n(t){function i(){function i(){o.dnaLastUpdated=Date.now(),o.dnaTimeoutId=void 0,e(a,"smart-update",t)}var s=o.smartThrottle?Number(o.smartThrottle):n;o.dnaLastValue=a.val(),o.dnaTimeoutId||(Date.now()1&&(e.toggleClass(i[1],a),i[2]&&e.toggleClass(i[2],!a))}function c(e,i){function a(e){dna.core.inject($(this),s[e],e,n)}function o(){r.remove(),dna.clone(i.name,s,{container:e,html:n.html})}var s=dna.util.value(t,i.field),r=e.children("."+i.name.replace(/[.]/g,"\\."));s?s.length===r.length?r.each(a):o():t[i.field]=[]}function d(){var e=$(this),i=e.data().dnaRules;i.transform&&dna.util.apply(i.transform,t),i.text&&a(e,i.text),i.props&&o(e,i.props),i.attrs&&s(e,i.attrs),i["class"]&&l(e,i["class"]),i.require&&e.toggle(void 0!==dna.util.value(t,i.require)),i.missing&&e.toggle(void 0===dna.util.value(t,i.missing)),i.truthy&&e.toggle(dna.util.realTruth(dna.util.value(t,i.truthy))),i.falsey&&e.toggle(!dna.util.realTruth(dna.util.value(t,i.falsey))),i.loop&&c(e,i.loop),i.option&&r(e,dna.util.value(t,i.option)),i.callback&&dna.util.apply(i.callback,e)}function h(e){e.filter(".dna-nucleotide").each(d),e.length&&h(e.children().not(".dna-sub-clone"))}return h(e),e.data().dnaModel=t,e},replicate:function(e,t,i,n){function a(){var t=r.children("."+e.name);t.find(".dna-separator").show().end().last().find(".dna-separator").hide(),t.find(".dna-last-separator").hide().end().eq(-2).find(".dna-last-separator").show().closest(".dna-clone").find(".dna-separator").hide()}var o=e.elem.clone(!0,!0);e.clones++,dna.core.inject(o,t,i,n);var s=".dna-contains-"+e.name.replace(/[.]/g,"\\."),r=n.container?n.container.find(s).addBack(s):e.container;return n.top&&!e.elemsAbove?r.prepend(o):n.top||e.elemsBelow?n.top?r.children().eq(e.index-1).after(o):r.children().eq(e.index+r.children().filter(".dna-clone").length).before(o):r.append(o),e.separators&&a(),dna.events.runInitializers(o,t),n.callback&&n.callback(o,t),n.fade&&dna.ui.slideFadeIn(o),o},remove:function(e){return e.remove(),dna.placeholder.setup(),e},berserk:function(e){throw"dna.js error -> "+e}},function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e(jQuery)}(function(e,t){"use strict";function i(e,t){this.container=e,this.options=t,this.init()}function n(t,i){this.widget=t,this.options=e.extend({},i),this.detectService(),this.service&&this.init()}function a(e){function t(e,t){return t.toUpper()}var i={},n=e.data();for(var a in n){var o=n[a];"yes"===o?o=!0:"no"===o&&(o=!1),i[a.replace(/-(\w)/g,t)]=o}return i}function o(e,t){return s(e,t,encodeURIComponent)}function s(e,t,i){return e.replace(/\{([^\}]+)\}/g,function(e,n){return n in t?i?i(t[n]):t[n]:e})}function r(e,t){var i=h+e;return i+" "+i+"_"+t}function l(t,i){function n(s){"keydown"===s.type&&27!==s.which||e(s.target).closest(t).length||(t.removeClass(u),a.off(o,n),e.isFunction(i)&&i())}var a=e(document),o="click touchstart keydown";a.on(o,n)}function c(e){var t=10;if(document.documentElement.getBoundingClientRect){var i=parseInt(e.css("left"),10),n=parseInt(e.css("top"),10),a=e[0].getBoundingClientRect();a.leftwindow.innerWidth-t&&e.css("left",window.innerWidth-a.right-t+i),a.topwindow.innerHeight-t&&e.css("top",window.innerHeight-a.bottom-t+n)}e.addClass(u)}var d="social-likes",h=d+"__",u=d+"_opened",p="https:"===location.protocol?"https:":"http:",f={facebook:{counterUrl:"https://graph.facebook.com/fql?q=SELECT+total_count+FROM+link_stat+WHERE+url%3D%22{url}%22&callback=?",convertNumber:function(e){return e.data[0].total_count},popupUrl:"https://www.facebook.com/sharer/sharer.php?u={url}",popupWidth:600,popupHeight:359},twitter:{popupUrl:"https://twitter.com/intent/tweet?url={url}&text={title}",popupWidth:600,popupHeight:250,click:function(){return/[\.\?:\-–—]\s*$/.test(this.options.title)||(this.options.title+=":"),!0}},mailru:{counterUrl:p+"//connect.mail.ru/share_count?url_list={url}&callback=1&func=?",convertNumber:function(e){for(var t in e)if(e.hasOwnProperty(t))return e[t].shares},popupUrl:"https://connect.mail.ru/share?share_url={url}&title={title}",popupWidth:492,popupHeight:500},vkontakte:{counterUrl:"https://vk.com/share.php?act=count&url={url}&index={index}",counter:function(t,i){var n=f.vkontakte;n._||(n._=[],window.VK||(window.VK={}),window.VK.Share={count:function(e,t){n._[e].resolve(t)}});var a=n._.length;n._.push(i),e.getScript(o(t,{index:a})).fail(i.reject)},popupUrl:"https://vk.com/share.php?url={url}&title={title}",popupWidth:655,popupHeight:450},odnoklassniki:{counterUrl:p+"//connect.ok.ru/dk?st.cmd=extLike&ref={url}&uid={index}",counter:function(t,i){var n=f.odnoklassniki;n._||(n._=[],window.ODKL||(window.ODKL={}),window.ODKL.updateCount=function(e,t){n._[e].resolve(t)});var a=n._.length;n._.push(i),e.getScript(o(t,{index:a})).fail(i.reject)},popupUrl:"https://connect.ok.ru/dk?st.cmd=WidgetSharePreview&service=odnoklassniki&st.shareUrl={url}",popupWidth:580,popupHeight:336},plusone:{counterUrl:p+"//share.yandex.ru/gpp.xml?url={url}&callback=?",convertNumber:function(e){return parseInt(e.replace(/\D/g,""),10)},popupUrl:"https://plus.google.com/share?url={url}",popupWidth:500,popupHeight:550},pinterest:{counterUrl:p+"//api.pinterest.com/v1/urls/count.json?url={url}&callback=?",convertNumber:function(e){return e.count},popupUrl:"https://pinterest.com/pin/create/button/?url={url}&description={title}",popupWidth:740,popupHeight:550}},g={promises:{},fetch:function(t,i,n){g.promises[t]||(g.promises[t]={});var a=g.promises[t];if(!n.forceUpdate&&a[i])return a[i];var s=e.extend({},f[t],n),r=e.Deferred(),l=s.counterUrl&&o(s.counterUrl,{url:i});return l&&e.isFunction(s.counter)?s.counter(l,r):s.counterUrl?e.getJSON(l).done(function(t){try{var i=t;e.isFunction(s.convertNumber)&&(i=s.convertNumber(t)),r.resolve(i)}catch(n){r.reject()}}).fail(r.reject):r.reject(),a[i]=r.promise(),a[i]}};e.fn.socialLikes=function(t){return this.each(function(){var n=e(this),o=n.data(d);o?e.isPlainObject(t)&&o.update(t):(o=new i(n,e.extend({},e.fn.socialLikes.defaults,t,a(n))),n.data(d,o))})},e.fn.socialLikes.defaults={url:window.location.href.replace(window.location.hash,""),title:document.title,counters:!0,zeroes:!1,wait:500,timeout:1e4,popupCheckInterval:500,singleTitle:"Share"},i.prototype={init:function(){this.container.addClass(d),this.single=this.container.hasClass(d+"_single"),this.initUserButtons(),this.countersLeft=0,this.number=0,this.container.on("counter."+d,e.proxy(this.updateCounter,this));var t=this.container.children();this.makeSingleButton(),this.buttons=[],t.each(e.proxy(function(t,i){var a=new n(e(i),this.options);this.buttons.push(a),a.options.counterUrl&&this.countersLeft++},this)),this.options.counters?(this.timer=setTimeout(e.proxy(this.appear,this),this.options.wait),this.timeout=setTimeout(e.proxy(this.ready,this,!0),this.options.timeout)):this.appear()},initUserButtons:function(){!this.userButtonInited&&window.socialLikesButtons&&e.extend(!0,f,socialLikesButtons),this.userButtonInited=!0},makeSingleButton:function(){if(this.single){var t=this.container;t.addClass(d+"_vertical"),t.wrap(e("
    ",{"class":d+"_single-w"})),t.wrapInner(e("
    ",{"class":d+"__single-container"}));var i=t.parent(),n=e("
    ",{"class":r("widget","single")}),a=e(s('
    {title}
    ',{buttonCls:r("button","single"),iconCls:r("icon","single"),title:this.options.singleTitle}));n.append(a),i.append(n),n.on("click",function(){var e=d+"__widget_active";return n.toggleClass(e),n.hasClass(e)?(t.css({left:-(t.width()-n.width())/2,top:-t.height()}),c(t),l(t,function(){n.removeClass(e)})):t.removeClass(u),!1}),this.widget=n}},update:function(t){if(t.forceUpdate||t.url!==this.options.url){this.number=0,this.countersLeft=this.buttons.length,this.widget&&this.widget.find("."+d+"__counter").remove(),e.extend(this.options,t);for(var i=0;i",{"class":r("counter","single")}),this.widget.append(t)),t}},n.prototype={init:function(){this.detectParams(),this.initHtml(),setTimeout(e.proxy(this.initCounter,this),0)},update:function(t){e.extend(this.options,{forceUpdate:!1},t),this.widget.find("."+d+"__counter").remove(),this.initCounter()},detectService:function(){var t=this.widget.data("service");if(!t){for(var i=this.widget[0],n=i.classList||i.className.split(" "),a=0;a",{"class":this.getElementClassNames("button"),html:i.html()});if(t.clickUrl){var s=o(t.clickUrl,{url:t.url,title:t.title}),r=e("",{href:s});this.cloneDataAttrs(i,r),i.replaceWith(r),this.widget=i=r}else i.on("click",e.proxy(this.click,this));i.removeClass(this.service),i.addClass(this.getElementClassNames("widget")),a.prepend(e("",{"class":this.getElementClassNames("icon")})),i.empty().append(a),this.button=a},initCounter:function(){if(this.options.counters)if(this.options.counterNumber)this.updateCounter(this.options.counterNumber);else{var t={counterUrl:this.options.counterUrl,forceUpdate:this.options.forceUpdate};g.fetch(this.service,this.options.url,t).always(e.proxy(this.updateCounter,this))}},cloneDataAttrs:function(e,t){var i=e.data();for(var n in i)i.hasOwnProperty(n)&&t.data(n,i[n])},getElementClassNames:function(e){return r(e,this.service)},updateCounter:function(t){t=parseInt(t,10)||0;var i={"class":this.getElementClassNames("counter"),text:t};t||this.options.zeroes||(i["class"]+=" "+d+"__counter_empty",i.text="");var n=e("",i);this.widget.append(n),this.widget.trigger("counter."+d,[this.service,t])},click:function(t){var i=this.options,n=!0;if(e.isFunction(i.click)&&(n=i.click.call(this,t)),n){var a=o(i.popupUrl,{url:i.url,title:i.title});a=this.addAdditionalParamsToUrl(a),this.openPopup(a,{width:i.popupWidth,height:i.popupHeight})}return!1},addAdditionalParamsToUrl:function(t){var i=e.param(e.extend(this.widget.data(),this.options.data));if(e.isEmptyObject(i))return t;var n=-1===t.indexOf("?")?"?":"&";return t+n+i},openPopup:function(t,i){var n=Math.round(screen.width/2-i.width/2),a=0;screen.height>i.height&&(a=Math.round(screen.height/3-i.height/2));var o=window.open(t,"sl_"+this.service,"left="+n+",top="+a+",width="+i.width+",height="+i.height+",personalbar=0,toolbar=0,scrollbars=1,resizable=1");if(o){o.focus(),this.widget.trigger("popup_opened."+d,[this.service,o]);var s=setInterval(e.proxy(function(){o.closed&&(clearInterval(s),this.widget.trigger("popup_closed."+d,this.service))},this),this.options.popupCheckInterval)}else location.href=t}},e(function(){e("."+d).socialLikes()})});var map;!function(e){var t=e(window),i=(e("html"),e("body"),e(document));e.widget("custom.catcomplete",e.ui.autocomplete,{_renderMenu:function(t,i){var n=this,a="";e.each(i,function(e,i){i.category!=a&&(t.append("
  • "+i.category+"
  • "),a=i.category),n._renderItemData(t,i)})}}),e(function(){function n(e){return(e.getDate()<10?"0":"")+e.getDate()+"."+(e.getMonth()<9?"0":"")+(e.getMonth()+1)+"."+e.getFullYear()}e("#send_message_form").on("submit",function(t){t.preventDefault(),$this=e(this);var i=$this.serialize(),n=$this.attr("action");e.post(n,i,function(t){t.success&&(e.fancybox.close(),$this.find("#id_body").val(""))})}),e("#reply_form").on("submit",function(t){t.preventDefault(),$this=e(this);var i=$this.serialize(),n=e("#reply_message").val(),a="/profile/messages/reply/"+n+"/";e.post(a,i,function(t){t.success&&(e.fancybox.close(),$this.find("#id_recipient").val(""),$this.find("#id_body").val(""))})}),e(".visit, .unvisit").on("click",function(t){t.preventDefault();var i=e(this),n=e(this).attr("href");e.get(n,function(t){t.not_authorized?e.fancybox.open("#pw-login"):t.success&&(t["in"]?i.hasClass("visit")&&(i.hide(),i.siblings(".unvisit").show()):i.hasClass("unvisit")&&(i.hide(),i.siblings(".visit").show()))})}),e("#paswd_change").on("submit",function(t){t.preventDefault();var i=e(this).serialize(),n="/profile/change-password/",a=e(this);e.post(n,i,function(t){if(t.success)e("#paswd_change .mf-success").fadeIn(300),setTimeout(function(){e("#paswd_change .mf-success").fadeOut(300)},3e3),a.find("#id_old password").val("");else{e("#paswd_change .mf-error").parent().remove();var i=e("
    ").attr("class","mf-line").append(e("
    ").attr("class","mf-error").append(t.errors[0]));a.find(".mf-buttons-line").before(i)}})}),e(".reg").on("click",function(t){t.preventDefault(),e(".register").click()}),e.fn.customSelect=function(){return e(this).each(function(){var t=e(this),i=t.children("option"),n=t.children("option").length,a=e(":selected",t);t.addClass("s-hidden"),t.wrap('
    '),t.after('
    ');var o=t.next("div.custom-select-wrap"),s=o.children(".custom-select-text"),r=0!=a.length?a.text():t.children("option").eq(0).text();s.text(r),0!=i.index(a)||t.children("option").eq(0).val()&&t.children("option").eq(0).attr("value")||s.addClass("placeholder");for(var l=e('
    ').insertAfter(o),c=l.find(".scroll-content"),d=e("
    {% endblock %} diff --git a/templates/client/base_catalog.html b/templates/client/base_catalog.html index d2128a4c..0ae3beb4 100644 --- a/templates/client/base_catalog.html +++ b/templates/client/base_catalog.html @@ -53,7 +53,9 @@ {% block aside_vk %}
    - {% include 'client/includes/social_widjet.html' %} + {% if not request.GET.debug == '1' %} + {% include 'client/includes/social_widjet.html' %} + {% endif %}
    {% endblock %} @@ -115,6 +117,5 @@ {% endblock %} {% block popup %} - {% include 'client/popups/announces.html' %} {% include 'client/popups/announce_subscription.html' %} {% endblock %} diff --git a/templates/client/base_page.html b/templates/client/base_page.html index 7bd30a18..ae494af4 100644 --- a/templates/client/base_page.html +++ b/templates/client/base_page.html @@ -46,7 +46,9 @@ {% block aside_vk %}
    - {% include 'client/includes/social_widjet.html' %} + {% if not request.GET.debug == '1' %} + {% include 'client/includes/social_widjet.html' %} + {% endif %}
    {% endblock %} diff --git a/templates/client/blank.html b/templates/client/blank.html index db0f68f3..900c44d0 100644 --- a/templates/client/blank.html +++ b/templates/client/blank.html @@ -169,7 +169,7 @@ This template include basic anf main styles and js files, {% block main_part %}{% endblock %} - {% block top %}{% endblock %} +{# {% block top %}{% endblock %}#} {% block search %}{% endblock %} diff --git a/templates/client/includes/announces.html b/templates/client/includes/announces.html index 9f9e93a6..f5f15df4 100644 --- a/templates/client/includes/announces.html +++ b/templates/client/includes/announces.html @@ -1,13 +1,13 @@ {% load i18n %} {% load staticfiles %} -
    @@ -110,6 +109,7 @@ {% trans 'фото' %} {% endif %}
    +

    @@ -165,10 +165,6 @@ {% endif %} {% endwith %} -{#

     {% trans 'Подписаться на новости' %}   {% blocktrans with name=event.name|safe %}Получайте актуальную информацию о концеренции {{ name }} на свой email{% endblocktrans %}

    #} - - -{# {% include 'client/includes/conference/conference_services.html' with event=event %}#} {% include 'client/includes/event_steps.html' with event=event %}
    @@ -583,12 +579,6 @@ somebodyId:"somebody", nobodyId:"nobody" }, - note:{ - wrapClass:'note-wrap', - wrapDisabledClass:'note-wrap-disabled', - buttonClass:'note-button', - inputClass:'note-text' - }, advertise:{ id:"advert-member-form" }, diff --git a/templates/client/includes/conference/conference_services.html b/templates/client/includes/conference/conference_services.html deleted file mode 100644 index b98f4d71..00000000 --- a/templates/client/includes/conference/conference_services.html +++ /dev/null @@ -1,13 +0,0 @@ -{% load i18n %} - -
    -
      - {% with services=object.get_services_detail %} - {% for service in services %} -
    • - {{ service.name }} -
    • - {% endfor %} - {% endwith %} -
    -
    \ No newline at end of file diff --git a/templates/client/includes/event_list.html b/templates/client/includes/event_list.html index f478270b..705b835e 100644 --- a/templates/client/includes/event_list.html +++ b/templates/client/includes/event_list.html @@ -15,12 +15,12 @@
    {% endif %} {% endif %} -
    +
    {% with obj=obj %} {% include 'client/includes/show_logo.html' %} {% endwith %}
    - +
    {% if user.is_staff %} @@ -68,21 +68,11 @@
    -
    - {% trans 'услуги' %} -
    - -
    -
    {% with event=obj user=user %} {% include 'client/includes/calendar_button.html' %} {% endwith %} - {% trans 'заметка' %} + {% trans 'заметка' %}
    diff --git a/templates/client/includes/event_steps.html b/templates/client/includes/event_steps.html index c351903d..fc64830d 100644 --- a/templates/client/includes/event_steps.html +++ b/templates/client/includes/event_steps.html @@ -38,19 +38,18 @@
    diff --git a/templates/client/includes/events/filter_result.html b/templates/client/includes/events/filter_result.html index 25e0da76..f293dca8 100644 --- a/templates/client/includes/events/filter_result.html +++ b/templates/client/includes/events/filter_result.html @@ -8,106 +8,106 @@ {% endif %}
      - - {# START FOR #} - {% for result in query %} -
    • -
      - - - {% if result.object.canceled %} -
      - {% elif result.object.expohit %} -
      - {% endif %} - -
      - {% with obj=result.object %} - {% include 'client/includes/show_logo.html' %} - {% endwith %} -
      -
      - -
      -
      - - {% if result.object.quality_label.rsva.is_set %} -
      - -
      - {% endif %} - {% if result.object.quality_label.exporating.is_set %} -
      - -
      - {% endif %} - {% if result.object.quality_label.ufi.is_set %} -
      - -
      - {% endif %} - -
      - -
      -
      - {{ result.object.main_title|safe }} -
      -
      - -
      -
      - - {% with obj=result.object %} - {% include 'client/includes/show_date_block.html' %} - {% endwith %} - -
      - - {% if result.object.country %} -
      - {{ result.object.country }}, {{ result.object.city }} - - {% if result.object.place %} - , {{ result.object.place }} - {% endif %} - -
      - {% endif %} - -
      -
      - -
      -
      - {% include 'client/includes/exposition/services.html' with obj=result.object %} - {% include 'client/includes/calendar_button.html' with obj=result.object %} -
      -
      - {% include 'client/buttons/booking_button.html' with object=result.object %} -
      -
      -
      - -
      -
      - - {% if result.object.visitors %} - {{ result.object.visitors }} - {% endif %} - - {% if result.object.members %} - {{ result.object.members }} - {% endif %} - -
      -
      - {% include 'client/includes/exposition/tags.html' with obj=result.object %} -
      -
      -
    • - - {% if not request.is_ajax %} + + {# START FOR #} + {% for result in query %} +
    • +
      + + + {% if result.object.canceled %} +
      + {% elif result.object.expohit %} +
      + {% endif %} + +
      + {% with obj=result.object %} + {% include 'client/includes/show_logo.html' %} + {% endwith %} +
      +
      + +
      +
      + + {% if result.object.quality_label.rsva.is_set %} +
      + +
      + {% endif %} + {% if result.object.quality_label.exporating.is_set %} +
      + +
      + {% endif %} + {% if result.object.quality_label.ufi.is_set %} +
      + +
      + {% endif %} + +
      + +
      +
      + {{ result.object.main_title|safe }} +
      +
      + +
      +
      + + {% with obj=result.object %} + {% include 'client/includes/show_date_block.html' %} + {% endwith %} + +
      + + {% if result.object.country %} +
      + {{ result.object.country }}, {{ result.object.city }} + + {% if result.object.place %} + , {{ result.object.place }} + {% endif %} + +
      + {% endif %} + +
      +
      + +
      +
      + {% include 'client/includes/exposition/services.html' with obj=result.object %} + {% include 'client/includes/calendar_button.html' with obj=result.object %} +
      +
      + {% include 'client/buttons/booking_button.html' with object=result.object %} +
      +
      +
      + +
      +
      + + {% if result.object.visitors %} + {{ result.object.visitors }} + {% endif %} + + {% if result.object.members %} + {{ result.object.members }} + {% endif %} + +
      +
      + {% include 'client/includes/exposition/tags.html' with obj=result.object %} +
      +
      +
    • + + {% if not request.is_ajax %} {% if forloop.counter == 5 or objects|length < 5 %} {% include 'client/includes/banners/catalog_inner_2.html' %} {% endif %} @@ -115,32 +115,26 @@ {% if forloop.counter == 10 %} {% include 'client/includes/banners/catalog_inner.html' %} {%endif %} - {% endif %} + {% endif %} - {% endfor %} - {# END FOR #} + {% endfor %} + {# END FOR #}
    {% block scripts %} - - {% if request.GET.debug == '1' %} - - {% else %} - - {% endif %} - - + + {% if request.GET.debug == '1' %} + + {% else %} + + {% endif %} + + {% endblock %} diff --git a/templates/client/includes/exposition/expo_list_paid.html b/templates/client/includes/exposition/expo_list_paid.html index 28bc1e82..25f9cb08 100644 --- a/templates/client/includes/exposition/expo_list_paid.html +++ b/templates/client/includes/exposition/expo_list_paid.html @@ -5,114 +5,114 @@ {% if objects %}
      - {% for obj in objects %} -
    • -
      - - {% if obj.canceled %} -
      - {% else %} - {% if obj.expohit %} -
      - {% endif %} - {% endif %} -
      - {% with obj=obj %} - {% include 'client/includes/show_logo.html' %} - {% endwith %} -
      -
      -
      -
      - {% if obj.quality_label.ufi.is_set %} -
      - -
      - {% endif %} -
      - -
      -
      - {{ obj.main_title|safe }} -
      -
      -
      -
      - {% with obj=obj %} - {% include 'client/includes/show_date_block.html' %} - {% endwith %} -
      - {% if obj.country %} -
      - {{ obj.country }}, {{ obj.city }} - {% if obj.place %} - , {{ obj.place }} - {% endif %} -
      - {% endif %} -
      -
      -
      -
      - {% include 'client/includes/exposition/services.html' with obj=obj %} - {% include 'client/includes/calendar_button.html' with obj=obj%} - {% if request.user.is_admin %} - - {% endif %} -
      -
      -
      - {% include 'client/buttons/booking_button.html' with object=obj %} -
      -
      -
      -
      -
      - {% if obj.visitors %} - {{ obj.visitors }} - {% endif %} - {% if obj.members %} - {{ obj.members }} - {% endif %} -
      -
      - {% include 'client/includes/exposition/tags.html' with obj=obj %} -
      -
      -
    • + {% for obj in objects %} +
    • +
      + + {% if obj.canceled %} +
      + {% else %} + {% if obj.expohit %} +
      + {% endif %} + {% endif %} +
      + {% with obj=obj %} + {% include 'client/includes/show_logo.html' %} + {% endwith %} +
      +
      +
      +
      + {% if obj.quality_label.ufi.is_set %} +
      + +
      + {% endif %} +
      + +
      +
      + {{ obj.main_title|safe }} +
      +
      +
      +
      + {% with obj=obj %} + {% include 'client/includes/show_date_block.html' %} + {% endwith %} +
      + {% if obj.country %} +
      + {{ obj.country }}, {{ obj.city }} + {% if obj.place %} + , {{ obj.place }} + {% endif %} +
      + {% endif %} +
      +
      +
      +
      + {% include 'client/includes/exposition/services.html' with obj=obj %} + {% include 'client/includes/calendar_button.html' with obj=obj%} + {% if request.user.is_admin %} + + {% endif %} +
      +
      +
      + {% include 'client/buttons/booking_button.html' with object=obj %} +
      +
      +
      +
      +
      + {% if obj.visitors %} + {{ obj.visitors }} + {% endif %} + {% if obj.members %} + {{ obj.members }} + {% endif %} +
      +
      + {% include 'client/includes/exposition/tags.html' with obj=obj %} +
      +
      +
    • - {% if forloop.counter == 8 %} + {% if forloop.counter == 8 %} {% if not NO_EXTERNAL_JS %} - - + + {% endif %} - - {%endif %} - {% endfor %} + + {%endif %} + {% endfor %}
    {% else %} @@ -133,15 +133,9 @@ {% else %} {% endif %} {% endblock %} diff --git a/templates/client/includes/exposition/expo_paid.html b/templates/client/includes/exposition/expo_paid.html index 143a4961..ee2446c8 100644 --- a/templates/client/includes/exposition/expo_paid.html +++ b/templates/client/includes/exposition/expo_paid.html @@ -429,12 +429,6 @@ somebodyId:"somebody", nobodyId:"nobody" }, - note:{ - wrapClass:'note-wrap', - wrapDisabledClass:'note-wrap-disabled', - buttonClass:'note-button', - inputClass:'note-text' - }, advertise:{ id:"advert-member-form" }, diff --git a/templates/client/includes/exposition/exposition_list.html b/templates/client/includes/exposition/exposition_list.html index 55a25cbb..2c1db0ae 100644 --- a/templates/client/includes/exposition/exposition_list.html +++ b/templates/client/includes/exposition/exposition_list.html @@ -139,12 +139,6 @@ - {% else %} - - {% endif %} - - + + {% if request.GET.debug == '1' %} + + {% else %} + + {% endif %} + + {% endblock %} diff --git a/templates/client/includes/exposition/services.html b/templates/client/includes/exposition/services.html index ec8a50a9..d841af4f 100644 --- a/templates/client/includes/exposition/services.html +++ b/templates/client/includes/exposition/services.html @@ -15,12 +15,6 @@ {% elif obj.partner %}
  • {% trans 'Официальный сайт' %}
  • {% trans 'Билеты' %}
  • - {% else %} - {% with services=obj.get_services %} - {% for service in services %} -
  • {{ service.name }}
  • - {% endfor %} - {% endwith %} {% endif %}
    diff --git a/templates/client/includes/exposition/statistic.html b/templates/client/includes/exposition/statistic.html index eafc4341..e53d277c 100644 --- a/templates/client/includes/exposition/statistic.html +++ b/templates/client/includes/exposition/statistic.html @@ -154,14 +154,3 @@ - -
    -
      - {% with services=exposition.get_services %} - {% for service in services %} -
    • {{ service.name }}
    • - {% endfor %} - {% endwith %} -
    -
    - diff --git a/templates/client/includes/services.html b/templates/client/includes/services.html index ca56f4dd..e8c87c25 100644 --- a/templates/client/includes/services.html +++ b/templates/client/includes/services.html @@ -4,7 +4,7 @@
    diff --git a/templates/client/index.html b/templates/client/index.html index 04a172fc..e8b3a486 100644 --- a/templates/client/index.html +++ b/templates/client/index.html @@ -100,10 +100,6 @@ {% include 'client/includes/online_consult.html' %} - {% comment %} - - {% include 'client/includes/announces.html' %} - {% endcomment %} {% include 'client/includes/services.html' %} @@ -211,21 +207,5 @@
    - {% if request.GET.debug == '1' %} - - {% else %} - - - {% endif %} - - + {% endblock %} diff --git a/templates/client/newsletters/announce_template.html b/templates/client/newsletters/announce_template.html deleted file mode 100644 index 104a6cfd..00000000 --- a/templates/client/newsletters/announce_template.html +++ /dev/null @@ -1,312 +0,0 @@ -{% load static %} - - - - Тестовове письмо - - - - - - - -
    - - - - - - -
    - - - - -
      -
    • RSS
    • -
    • Facebook
    • -
    • LinkedIn
    • -
    • В контакте
    • -
    • Twitter
    • -
    -
    - - - - - - - - - -
    Выставки в Москве по тематике: Мебель, Дизайн интерьеров
    - - - - - - - - - - - - - - - - - - - - - -
    - - - - -
    -
    -

    Foire de Pau 2013

    -

    Международная ярмарка потребительских товаров

    - добавить в расписание -
    Россия, Москва, ЦВК «Экспоцентр»
    -
    - с 5 по 20 октября -
    - - - - -
    -
    -

    Foire de Pau 2013

    -

    Международная ярмарка потребительских товаров

    - добавить в расписание -
    Россия, Москва, ЦВК «Экспоцентр»
    -
    - с 5 по 20 октября -
    - - - - -
    -
    -

    Foire de Pau 2013

    -

    Международная ярмарка потребительских товаров

    - добавить в расписание -
    Россия, Москва, ЦВК «Экспоцентр»
    -
    - с 5 по 20 октября -
    - - - -
    - - - - - - - - - - -
    Новости событий
    - - - - - - - - - - - - - - - - - - -
    - - - - -
    -
    - - - - - -

    Foire de Pau 2013

    05.10.2013
    - -

    VII Международный форум «АтомЭко 2013» пройдет 30-31 октября в Москве под знаком нулевого ущерба для экологии. Главная тема VIIМеждународного Форума «АтомЭко 2013»: «Атомная энергетика – стратегия нулевого ущерба», где будут обсуждаться вопросы по обращению с радиоактивными отходами (РАО) и отработавшим ...

    - -
    - - - - -
    -
    - - - - - -

    Foire de Pau 2013

    05.10.2013
    - -

    VII Международный форум «АтомЭко 2013» пройдет 30-31 октября в Москве под знаком нулевого ущерба для экологии. Главная тема VIIМеждународного Форума «АтомЭко 2013»: «Атомная энергетика – стратегия нулевого ущерба», где будут обсуждаться вопросы по обращению с радиоактивными отходами (РАО) и отработавшим ...

    - -
    - - - - -
    -
    - - - - - -

    Foire de Pau 2013

    05.10.2013
    - -

    VII Международный форум «АтомЭко 2013» пройдет 30-31 октября в Москве под знаком нулевого ущерба для экологии. Главная тема VIIМеждународного Форума «АтомЭко 2013»: «Атомная энергетика – стратегия нулевого ущерба», где будут обсуждаться вопросы по обращению с радиоактивными отходами (РАО) и отработавшим ...

    - -
    - - - -
    - - - - - - - - - -
    Фоторепортаж: Международный форум «АтомЭко 2013»
    - - - - - - - -
    - - - - - - - - - -
    - -

    Идея Russian Affiliate Congress and Expo возникла в ответ на необходимость развития бизнеса России и стран СНГ в соответствии с мировыми тенденциями. Партнерские программы — один из наиболее эффективных и широко применяемых на западе инструментов интернет маркетинга, доля которого на рынке интернет продвижения развитых стран около 40 %, для сравнения в России и странах СНГ на этот сегмент приходится около 10%. Разница очевидна.

    - -
    - - - -
    - - - - - -
    - - - - - - - - -
    Аналитика для профессионалов
    - - - - - - - - -
    - - - - -
    -
    - -

    Древние славянские практики для оздоровления души и тела презентуют на красноярской Ярмарке здоровья

    -

    VII Международный форум «АтомЭко 2013» пройдет 30-31 октября в Москве под знаком нулевого ущерба для экологии. Главная тема VIIМеждународного Форума «АтомЭко 2013»: «Атомная энергетика – стратегия нулевого ущерба», где будут обсуждаться вопросы по обращению с радиоактивными отходами (РАО) и отработавшим ...

    - -
    - -
    - - - - - - -
    - - - -
    - - - - - - -
    - Чтобы отписаться от этой рассылки, перейдите по ссылке - - © 2018 — 2013 Expomap.ru -
    - -
    - - \ No newline at end of file diff --git a/templates/client/newsletters/mailing_settings.html b/templates/client/newsletters/mailing_settings.html index 60e1929c..d0a75079 100644 --- a/templates/client/newsletters/mailing_settings.html +++ b/templates/client/newsletters/mailing_settings.html @@ -70,36 +70,55 @@ {{ form.email }}
    - + {% comment %}{% endcomment %} + {% trans 'Выбрать рубрики' %} {% endif %} -
    +

    {% trans 'Какие события включать в ваше письмо?' %}

    -

    {% trans 'Ваши темы:' %}

    -
      - {% for theme in object.themes.all %} -
    • - - {{ theme }} - × -
    • - {% endfor %} - {% for tag in object.tags.all %} -
    • - - {{ tag }} - × -
    • - {% endfor %} -
    - {% trans 'Уточнить темы' %} +
    +

    {% trans 'Ваши темы:' %}

    +

    Отметьте темы, по которым вы хотите получать анонсы событий

    + + {% if not user.is_authenticated %} + + {% endif %} + +
      + {% for theme in object.themes.all %} +
    • + + {{ theme }} + × +
    • + {% endfor %} + {% for tag in object.tags.all %} +
    • + + {{ tag }} + × +
    • + {% endfor %} +
    + + {% comment %}{% trans 'Уточнить темы' %}{% endcomment %} + {% trans 'Выбрать из полного списка' %} + +

    {% trans 'Ваши гео-фильтры:' %}

    @@ -169,37 +188,7 @@
    -
    -
    -

    {% trans 'Регулярность получения писем' %}

    -
    -
    -
      - {% for field in form.periodic %} -
    • - -
    • - {% endfor %} -
    -
    -
    - {% for field in form.periodic_day %} - - {% endfor %} -
    -
    -
    -
    +
    {% if not user.is_authenticated %} diff --git a/templates/client/place/place_detail.html b/templates/client/place/place_detail.html index c82a8a2d..026d9da0 100644 --- a/templates/client/place/place_detail.html +++ b/templates/client/place/place_detail.html @@ -260,20 +260,7 @@
    -
    - {% trans 'услуги' %} - -
    - -
    -
    - {% trans 'в расписание' %} - {% trans 'заметка' %}
    diff --git a/templates/client/place/place_exposition_list.html b/templates/client/place/place_exposition_list.html index d5ec003c..a60ecd5b 100644 --- a/templates/client/place/place_exposition_list.html +++ b/templates/client/place/place_exposition_list.html @@ -60,20 +60,7 @@
    -
    - {% trans 'услуги' %} - -
    - -
    -
    - {% trans 'в расписание' %} - {% trans 'заметка' %}
    diff --git a/templates/client/popups/announces.html b/templates/client/popups/announces.html deleted file mode 100644 index 3351f73a..00000000 --- a/templates/client/popups/announces.html +++ /dev/null @@ -1,58 +0,0 @@ -{% load i18n %} - - \ No newline at end of file diff --git a/templates/client/specialist_catalog/catalog_detailed.html b/templates/client/specialist_catalog/catalog_detailed.html index d9f4776a..43df105a 100644 --- a/templates/client/specialist_catalog/catalog_detailed.html +++ b/templates/client/specialist_catalog/catalog_detailed.html @@ -230,9 +230,9 @@
    {# вместо формы выше временно ставим ссылку на партнёров #} {% if object.type == 1 %} - {% trans 'заказать услугу' %} + {% trans 'найти переводчика' %} {% else %} - {% trans 'заказать услугу' %} + {% trans 'найти переводчика' %} {% endif %}