You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1625 lines
50 KiB
1625 lines
50 KiB
var map;
|
|
|
|
function mapInit() {
|
|
var canvas = document.getElementById('map-canvas');
|
|
var coords = canvas.getAttribute('data-coords');
|
|
var commaPos = coords.indexOf(',');
|
|
var lat = parseFloat(coords.substring(0, commaPos));
|
|
var lng = parseFloat(coords.substring(commaPos + 1, coords.length));
|
|
var myLatlng = new google.maps.LatLng(lat, lng);
|
|
var mapOptions = {
|
|
zoom: 15,
|
|
center: myLatlng
|
|
};
|
|
map = new google.maps.Map(canvas, mapOptions);
|
|
|
|
var marker = new google.maps.Marker({
|
|
position: myLatlng,
|
|
map: map
|
|
});
|
|
}
|
|
/* */
|
|
function addError(inputId, msg){
|
|
var $input = $('#reg_form '+ inputId);
|
|
var $error = $("<div>").attr("class", "pwf-msg").append(
|
|
$("<div>").attr("class", "msg-error").append(msg)
|
|
);
|
|
|
|
$input.parent().parent().append($error)
|
|
|
|
}
|
|
|
|
!function ($) {
|
|
|
|
var $win = $(window);
|
|
var $html = $('html');
|
|
var $body = $('body');
|
|
var $doc = $(document);
|
|
|
|
$.widget( "custom.catcomplete", $.ui.autocomplete, {
|
|
_renderMenu: function( ul, items ) {
|
|
var that = this,
|
|
currentCategory = "";
|
|
$.each( items, function( index, item ) {
|
|
if ( item.category != currentCategory ) {
|
|
ul.append( "<li class='ui-autocomplete-category'>" + item.category + "</li>" );
|
|
currentCategory = item.category;
|
|
}
|
|
that._renderItemData( ul, item );
|
|
});
|
|
}
|
|
});
|
|
|
|
/* submiting registration form */
|
|
$(function () {
|
|
$('#send_message_form').on('submit', function(event){
|
|
event.preventDefault();
|
|
$this = $(this);
|
|
var formData = $this.serialize();
|
|
var url = $this.attr('action')
|
|
$.post(url, formData, function(data){
|
|
if (data.success){
|
|
$.fancybox.close();
|
|
$this.find('#id_body').val('')
|
|
}
|
|
});
|
|
});
|
|
$('#reply_form').on('submit', function(event){
|
|
event.preventDefault();
|
|
$this = $(this);
|
|
var formData = $this.serialize();
|
|
var reply_message = $('#reply_message').val()
|
|
var url = '/profile/messages/reply/'+reply_message+'/'
|
|
|
|
$.post(url, formData, function(data){
|
|
if (data.success){
|
|
$.fancybox.close();
|
|
$this.find('#id_recipient').val('')
|
|
$this.find('#id_body').val('')
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
$('.visit').on('click', function(event){
|
|
event.preventDefault();
|
|
var url = $(this).attr('href');
|
|
$.get(url, function(data){
|
|
if (data.not_authorized){
|
|
$.fancybox.open('#pw-login');
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
$('.addcalendar').on('click', function(event){
|
|
event.preventDefault();
|
|
var url = $(this).attr('href');
|
|
$.get(url, function(data){
|
|
if (data.not_authorized){
|
|
$.fancybox.open('#pw-login');
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
$('#reg_form').on('submit', function(event){
|
|
event.preventDefault();
|
|
var formData = $(this).serialize();
|
|
var url = '/register/';
|
|
|
|
$.post(url, formData, function(data){
|
|
if(data.success){
|
|
//register success
|
|
|
|
// remove input values
|
|
$('#reg_form input').each(function(i){
|
|
$(this).val("");
|
|
});
|
|
// close popup
|
|
$.fancybox.close();
|
|
|
|
}
|
|
else{
|
|
// hide help messages
|
|
$("#reg_form .msg-help:visible").hide();
|
|
// delete previous errors
|
|
$("#reg_form .msg-error").parent().remove();
|
|
|
|
// generate new errors
|
|
var form_inputs = ['first_name', 'last_name', 'email', 'password1', 'password2']
|
|
for(var i= 0; i < form_inputs.length; i++){
|
|
if(form_inputs[i] in data){
|
|
var input_id = '#id_'+form_inputs[i];
|
|
addError(input_id, data[form_inputs[i]])
|
|
}
|
|
}
|
|
}
|
|
});
|
|
});
|
|
/* submiting change password form */
|
|
$('#paswd_change').on('submit', function(event){
|
|
event.preventDefault();
|
|
var formData = $(this).serialize();
|
|
var url = '/profile/change-password/';
|
|
var $form = $(this);
|
|
$.post(url, formData, function(data){
|
|
if (data.success){
|
|
$('#paswd_change .mf-success').fadeIn(300);
|
|
setTimeout(function(){
|
|
$('#paswd_change .mf-success').fadeOut(300);
|
|
}, 3000);
|
|
$form.find('#id_old password').val('')
|
|
|
|
}
|
|
else{
|
|
// remove previous error
|
|
$('#paswd_change .mf-error').parent().remove();
|
|
// add new error
|
|
var $element = $("<div>").attr("class", "mf-line").append(
|
|
$("<div>").attr("class", "mf-error").append(data.errors[0]))
|
|
$form.find('.mf-buttons-line').before($element);
|
|
}
|
|
});
|
|
});
|
|
$('.reg').on('click', function(event){
|
|
event.preventDefault();
|
|
$('.register').click();
|
|
});
|
|
|
|
|
|
/* Нестандартное оформление для поля select */
|
|
$.fn.customSelect = function () {
|
|
return $(this).each(function() {
|
|
|
|
var $this = $(this);
|
|
var $options = $this.children('option');
|
|
var numberOfOptions = $this.children('option').length;
|
|
var $selected = $(":selected", $this);
|
|
console.log($selected);
|
|
// Hides the select element
|
|
$this.addClass('s-hidden');
|
|
|
|
// Wrap the select element in a div
|
|
$this.wrap('<div class="custom-select"></div>');
|
|
|
|
// Insert a styled div to sit over the top of the hidden select element
|
|
$this.after('<div class="custom-select-wrap"><div class="custom-select-text"></div></div>');
|
|
|
|
// Cache the styled div
|
|
var $styledSelect = $this.next('div.custom-select-wrap');
|
|
var $styledSelectText = $styledSelect.children('.custom-select-text');
|
|
|
|
// Show the first select option in the styled div
|
|
$styledSelectText.text($this.children('option').eq(0).text());
|
|
|
|
if ( $options.index($selected) == 0 && (!$this.children('option').eq(0).val() || !$this.children('option').eq(0).attr('value')) ) {
|
|
$styledSelectText.addClass('placeholder');
|
|
}
|
|
|
|
var $menu = $('<div class="cs-menu-wrap options"><div class="scroll-container"><div class="scroll-content clearfix"></div></div></div>').insertAfter($styledSelect);
|
|
var $optionsWrap = $menu.find('.scroll-content');
|
|
|
|
// Insert an unordered list after the styled div and also cache the list
|
|
var $list = $('<ul />').appendTo($optionsWrap);
|
|
|
|
// Insert a list item into the unordered list for each select option
|
|
for (var i = 0; i < numberOfOptions; i++) {
|
|
var oText = ($this.children('option').eq(i).text() != '') ? $this.children('option').eq(i).html() : ' ';
|
|
$('<li />', {
|
|
html: oText,
|
|
'data-value': $this.children('option').eq(i).val()
|
|
}).appendTo($list);
|
|
}
|
|
|
|
// Cache the list items
|
|
var $listItems = $list.children('li');
|
|
|
|
// Show the unordered list when the styled div is clicked (also hides it if the div is clicked again)
|
|
$styledSelect.on('click', function(e) {
|
|
e.stopPropagation();
|
|
//$('div.styledSelect.active').each(function() {
|
|
$('div.styledSelect.active').each(function() {
|
|
$(this).removeClass('active').next('.options').hide();
|
|
});
|
|
$('div.custom-select-wrap.active').not(this).each(function() {
|
|
$(this).removeClass('active').next('.options').hide();
|
|
});
|
|
if (!$this.prop('disabled')) {
|
|
$(this).toggleClass('active').next('.options').toggle();
|
|
}
|
|
});
|
|
|
|
// Hides the unordered list when a list item is clicked and updates the styled div to show the selected list item
|
|
// Updates the select element to have the value of the equivalent option
|
|
$listItems.on('click', function(e) {
|
|
var $el = $(this);
|
|
e.stopPropagation();
|
|
$styledSelectText.text($el.text());
|
|
$styledSelect.removeClass('active');
|
|
$this.val($el.data('value'));
|
|
if ( $el.index() == 0 && (!$this.children('option').eq(0).val() || !$this.children('option').eq(0).attr('value')) ) {
|
|
$styledSelectText.addClass('placeholder');
|
|
} else {
|
|
$styledSelectText.removeClass('placeholder');
|
|
}
|
|
$menu.hide();
|
|
});
|
|
|
|
// Hides the unordered list when clicking outside of it
|
|
$(document).on('click', function() {
|
|
$styledSelect.removeClass('active');
|
|
$menu.hide();
|
|
});
|
|
|
|
});
|
|
};
|
|
$("select:not([multiple])").customSelect();
|
|
|
|
/* Нестандартное оформление для поля checkbox */
|
|
$.fn.customRadioCheck = function () {
|
|
return $(this).each(function () {
|
|
var $el = $(this);
|
|
var type = $el.attr("type");
|
|
var $label = $el.closest("label");
|
|
var $customCheckbox = $el.wrap("<span class='custom-"+ type +"' />").parent();
|
|
$label.addClass("custom-radio-check");
|
|
function setState () {
|
|
if (type == 'radio') {
|
|
var name = $el.attr('name');
|
|
var $radios = $('input[type="radio"]').filter('[name="' + name + '"]');
|
|
$radios.each(function () {
|
|
var $container = $(this).closest('.custom-radio');
|
|
$container.removeClass('checked');
|
|
if ($(this).is(':checked')) {
|
|
$container.addClass('checked');
|
|
}
|
|
});
|
|
} else {
|
|
if ($el.prop("checked")) {
|
|
$customCheckbox.addClass("checked");
|
|
} else {
|
|
$customCheckbox.removeClass("checked");
|
|
}
|
|
}
|
|
$el.trigger('blur');
|
|
}
|
|
setState();
|
|
$el.on("change", setState);
|
|
});
|
|
};
|
|
|
|
$("input[type='checkbox'], input[type='radio']").customRadioCheck();
|
|
|
|
/* Обработка autocomplete в полях поиска
|
|
* используется jQuery UI Autocomplete
|
|
* */
|
|
$('input.topicChecks').each(function() {
|
|
|
|
if ($(this).prop('checked')==false) {
|
|
|
|
$('li.level1.'+$(this).val()+'').each(function() {
|
|
$(this).find('>label.active').first().trigger('click');
|
|
$(this).find('ul li label.active').trigger('click');
|
|
$(this).hide().addClass('noAC').find('li').each(function() {
|
|
$(this).addClass('noAC');
|
|
});
|
|
})
|
|
}
|
|
else {
|
|
$('li.level1.'+$(this).val()+'').each(function() {
|
|
$(this).fadeIn();
|
|
$(this).removeClass('noAC').find('.noAC').each(function() {
|
|
$(this).removeClass('noAC');
|
|
});
|
|
|
|
});
|
|
};
|
|
});
|
|
|
|
var data=[];
|
|
function rebuildTopicsAC() {
|
|
data=[];
|
|
$('.topics-list').find('li:not(.noAC)').each(
|
|
function() {
|
|
if ($(this).find('a').text().length>0) {
|
|
data.push({sid: $(this).find('>label span input').attr('value'),type: $(this).attr('data-type'), category: '', label: $(this).find('>a').text()});
|
|
}
|
|
else {
|
|
data.push({sid: $(this).find('>label span input').attr('value'),type: $(this).attr('data-type'), category: $(this).parents().eq(1).find('>a').text()+':', label: $(this).text() });
|
|
}
|
|
|
|
}
|
|
);
|
|
|
|
$('input[type="text"].topicAC').each(function () {
|
|
var $input = $(this);
|
|
var $iWrap = $($input.parent());
|
|
var $acWrap = $('<div class="sf-autocomplete"><div class="sfa-wrap"></div></div>');
|
|
var $acSect = $acWrap.find('.sfa-wrap');
|
|
$iWrap.parent().append('<input id="top_ac_hidden" style="display:none;">');
|
|
$acWrap.appendTo($iWrap);
|
|
|
|
$input.catcomplete({
|
|
appendTo: $acSect,
|
|
delay: 0,
|
|
source: data,
|
|
open: function () {
|
|
$acSect.addClass('show').parent().addClass('show');
|
|
},
|
|
close: function () {
|
|
$acSect.removeClass('show').parent().removeClass('show');
|
|
},
|
|
select: function( event, ui ) {
|
|
//var item_to_select=ui.item.label;
|
|
var input_ID=ui.item.sid;
|
|
$('#top_ac_hidden').val(ui.item.id);
|
|
if ($('input[value="'+input_ID+'"]').parents().eq(1).hasClass('active')) {
|
|
$('#ac_animes_t').css({'opacity':0,'display':'block'}).animate({opacity:1}, 500, function() {
|
|
setTimeout(function() {
|
|
$('#ac_animes_t').stop().animate({opacity:0}, 500, function() {
|
|
$('#ac_animes_t').css({'display':'none'})
|
|
});
|
|
}, 1000);
|
|
});
|
|
}
|
|
else {
|
|
$('input[value="'+input_ID+'"]').parents().eq(1).trigger('click');
|
|
}
|
|
$(this).val('');
|
|
return false;
|
|
}
|
|
}).data( 'customCatcomplete' )._renderItem = function( ul, item ) {
|
|
var descr = item.type != '' ? ' <i>(' + item.type + ')</i>' : '';
|
|
return $( '<li>' )
|
|
.append( '<a>' + item.label + descr + '</a>' )
|
|
.appendTo( ul );
|
|
};
|
|
});
|
|
};
|
|
rebuildTopicsAC();
|
|
/*
|
|
$('input[type="text"].autocomplete').each(function () {
|
|
var $input = $(this);
|
|
var $iWrap = $input.closest('.sf-field-wrap');
|
|
var $acWrap = $('<div class="sf-autocomplete"><div class="sfa-wrap"></div></div>');
|
|
var $acSect = $acWrap.find('.sfa-wrap');
|
|
|
|
$acWrap.appendTo($iWrap);
|
|
|
|
$input.catcomplete({
|
|
appendTo: $acSect,
|
|
delay: 0,
|
|
source: data,
|
|
open: function () {
|
|
$acSect.addClass('show');
|
|
},
|
|
close: function () {
|
|
$acSect.removeClass('show');
|
|
},
|
|
select: function( event, ui ) {
|
|
var type = ui.item.type != '' ? ' (' + ui.item.type + ')' : '';
|
|
ui.item.value = ui.item.label + type;
|
|
}
|
|
}).data( 'customCatcomplete' )._renderItem = function( ul, item ) {
|
|
var descr = item.type != '' ? ' <i>(' + item.type + ')</i>' : '';
|
|
return $( '<li>' )
|
|
.append( '<a>' + item.label + descr + '</a>' )
|
|
.appendTo( ul );
|
|
};
|
|
});
|
|
*/
|
|
/* Галереи-слайдеры на главной
|
|
* использован плагин Swiper
|
|
* http://www.idangero.us/sliders/swiper/api.php
|
|
* */
|
|
$('#mp-recent-expo').each(function () {
|
|
var $reContainer = $(this);
|
|
var $reSwipeWrap = $reContainer.children('ul');
|
|
var $reSwipeItems = $reSwipeWrap.children('li');
|
|
var $reControls = $reContainer.children('div.re-controls');
|
|
var $recPrev = $reControls.children('a.prev');
|
|
var $recNext = $reControls.children('a.next');
|
|
|
|
if ($reSwipeItems.length > 1) {
|
|
$reControls.addClass('enabled');
|
|
$reSwipeItems.css({
|
|
display: 'block'
|
|
});
|
|
$reContainer.height($reSwipeItems.eq(0).height());
|
|
var $reSwiper = $reContainer.swiper({
|
|
speed: 500,
|
|
mode:'horizontal',
|
|
loop: false,
|
|
simulateTouch: false,
|
|
onInit: function () {
|
|
$recPrev.addClass('disabled');
|
|
},
|
|
onSlideChangeStart: function (swiper) {
|
|
$reContainer.animate({
|
|
height: $reSwipeItems.eq(swiper.activeIndex).children('div.re-body').height()
|
|
}, 300);
|
|
if (swiper.activeIndex == 0) {
|
|
if (!$recPrev.hasClass('disabled')) {
|
|
$recPrev.addClass('disabled');
|
|
}
|
|
if ($recNext.hasClass('disabled')) {
|
|
$recNext.removeClass('disabled');
|
|
}
|
|
} else if (swiper.activeIndex == swiper.slides.length-1) {
|
|
if (!$recNext.hasClass('disabled')) {
|
|
$recNext.addClass('disabled');
|
|
}
|
|
if ($recPrev.hasClass('disabled')) {
|
|
$recPrev.removeClass('disabled');
|
|
}
|
|
} else {
|
|
if ($recPrev.hasClass('disabled')) {
|
|
$recPrev.removeClass('disabled');
|
|
}
|
|
if ($recNext.hasClass('disabled')) {
|
|
$recNext.removeClass('disabled');
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
$recPrev.on('click', function () {
|
|
if (!$(this).hasClass('disabled')) {
|
|
$reSwiper.swipePrev();
|
|
}
|
|
return false;
|
|
});
|
|
$recNext.on('click', function () {
|
|
if (!$(this).hasClass('disabled')) {
|
|
$reSwiper.swipeNext();
|
|
}
|
|
return false;
|
|
});
|
|
}
|
|
|
|
});
|
|
|
|
$('#mp-photo-gallery').each(function () {
|
|
var $reContainer = $(this);
|
|
var $reSwipeWrap = $reContainer.children('ul');
|
|
var $reSwipeItems = $reSwipeWrap.children('li');
|
|
var $reControls = $reContainer.children('div.re-controls');
|
|
var $recPrev = $reControls.children('a.prev');
|
|
var $recNext = $reControls.children('a.next');
|
|
|
|
if ($reSwipeItems.length > 1) {
|
|
$reControls.addClass('enabled');
|
|
var $reSwiper = $reContainer.swiper({
|
|
speed: 500,
|
|
mode:'horizontal',
|
|
loop: false,
|
|
simulateTouch: false,
|
|
onInit: function (swiper) {
|
|
$recPrev.addClass('disabled');
|
|
},
|
|
onSlideChangeStart: function (swiper) {
|
|
var $descrs = $reSwipeItems.find('div.pgi-descr');
|
|
$descrs.animate({
|
|
height: 'hide',
|
|
opacity: 'hide'
|
|
}, 500);
|
|
if (swiper.activeIndex == 0) {
|
|
if (!$recPrev.hasClass('disabled')) {
|
|
$recPrev.addClass('disabled');
|
|
}
|
|
if ($recNext.hasClass('disabled')) {
|
|
$recNext.removeClass('disabled');
|
|
}
|
|
} else if (swiper.activeIndex == swiper.slides.length-1) {
|
|
if (!$recNext.hasClass('disabled')) {
|
|
$recNext.addClass('disabled');
|
|
}
|
|
if ($recPrev.hasClass('disabled')) {
|
|
$recPrev.removeClass('disabled');
|
|
}
|
|
} else {
|
|
if ($recPrev.hasClass('disabled')) {
|
|
$recPrev.removeClass('disabled');
|
|
}
|
|
if ($recNext.hasClass('disabled')) {
|
|
$recNext.removeClass('disabled');
|
|
}
|
|
}
|
|
},
|
|
onSlideChangeEnd: function (swiper) {
|
|
var $descrs = $reSwipeItems.find('div.pgi-descr');
|
|
$descrs.eq(swiper.activeIndex).slideDown(250);
|
|
}
|
|
});
|
|
|
|
$recPrev.on('click', function () {
|
|
if (!$(this).hasClass('disabled')) {
|
|
$reSwiper.swipePrev();
|
|
}
|
|
return false;
|
|
});
|
|
$recNext.on('click', function () {
|
|
if (!$(this).hasClass('disabled')) {
|
|
$reSwiper.swipeNext();
|
|
}
|
|
return false;
|
|
});
|
|
}
|
|
});
|
|
|
|
$('#ps-photo-gallery').each(function () {
|
|
var $reContainer = $(this);
|
|
var $reSwipeWrap = $reContainer.children('ul');
|
|
var $reSwipeItems = $reSwipeWrap.children('li');
|
|
var $reControls = $reContainer.children('div.re-controls');
|
|
var $recPrev = $reControls.children('a.prev');
|
|
var $recNext = $reControls.children('a.next');
|
|
|
|
if ($reSwipeItems.length > 1) {
|
|
$reControls.addClass('enabled');
|
|
$reSwipeItems.css({
|
|
display: 'block'
|
|
});
|
|
var $reSwiper = $reContainer.swiper({
|
|
speed: 500,
|
|
mode:'horizontal',
|
|
calculateHeight: true,
|
|
loop: false,
|
|
simulateTouch: false,
|
|
onInit: function (swiper) {
|
|
$recPrev.addClass('disabled');
|
|
},
|
|
onSlideChangeStart: function (swiper) {
|
|
if (swiper.activeIndex == 0) {
|
|
if (!$recPrev.hasClass('disabled')) {
|
|
$recPrev.addClass('disabled');
|
|
}
|
|
if ($recNext.hasClass('disabled')) {
|
|
$recNext.removeClass('disabled');
|
|
}
|
|
} else if (swiper.activeIndex == swiper.slides.length-1) {
|
|
if (!$recNext.hasClass('disabled')) {
|
|
$recNext.addClass('disabled');
|
|
}
|
|
if ($recPrev.hasClass('disabled')) {
|
|
$recPrev.removeClass('disabled');
|
|
}
|
|
} else {
|
|
if ($recPrev.hasClass('disabled')) {
|
|
$recPrev.removeClass('disabled');
|
|
}
|
|
if ($recNext.hasClass('disabled')) {
|
|
$recNext.removeClass('disabled');
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
$recPrev.on('click', function () {
|
|
if (!$(this).hasClass('disabled')) {
|
|
$reSwiper.swipePrev();
|
|
}
|
|
return false;
|
|
});
|
|
$recNext.on('click', function () {
|
|
if (!$(this).hasClass('disabled')) {
|
|
$reSwiper.swipeNext();
|
|
}
|
|
return false;
|
|
});
|
|
}
|
|
|
|
});
|
|
|
|
$('#s-slide-gallery').each(function () {
|
|
var $reContainer = $(this);
|
|
var $reSwipeWrap = $reContainer.children('ul');
|
|
var $reSwipeItems = $reSwipeWrap.children('li');
|
|
var $reControls = $reContainer.children('div.re-controls');
|
|
var $recPrev = $reControls.children('a.prev');
|
|
var $recNext = $reControls.children('a.next');
|
|
|
|
if ($reSwipeItems.length > 4) {
|
|
$reControls.addClass('enabled');
|
|
$reSwipeItems.css({
|
|
display: 'block'
|
|
});
|
|
|
|
$win.on('resize', function () {
|
|
$reContainer.height($reSwipeItems.eq(0).height());
|
|
}).trigger('resize');
|
|
|
|
var $reSwiper = $reContainer.swiper({
|
|
slidesPerView: 4,
|
|
slidesPerGroup: 4,
|
|
speed: 500,
|
|
mode:'horizontal',
|
|
calculateHeight: true,
|
|
loop: false,
|
|
simulateTouch: false,
|
|
onInit: function (swiper) {
|
|
$recPrev.addClass('disabled');
|
|
},
|
|
onSlideChangeStart: function (swiper) {
|
|
if (swiper.activeIndex == 0) {
|
|
if (!$recPrev.hasClass('disabled')) {
|
|
$recPrev.addClass('disabled');
|
|
}
|
|
if ($recNext.hasClass('disabled')) {
|
|
$recNext.removeClass('disabled');
|
|
}
|
|
} else if (swiper.activeIndex == swiper.slides.length-4) {
|
|
if (!$recNext.hasClass('disabled')) {
|
|
$recNext.addClass('disabled');
|
|
}
|
|
if ($recPrev.hasClass('disabled')) {
|
|
$recPrev.removeClass('disabled');
|
|
}
|
|
} else {
|
|
if ($recPrev.hasClass('disabled')) {
|
|
$recPrev.removeClass('disabled');
|
|
}
|
|
if ($recNext.hasClass('disabled')) {
|
|
$recNext.removeClass('disabled');
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
$recPrev.on('click', function () {
|
|
if (!$(this).hasClass('disabled')) {
|
|
$reSwiper.swipePrev();
|
|
}
|
|
return false;
|
|
});
|
|
$recNext.on('click', function () {
|
|
if (!$(this).hasClass('disabled')) {
|
|
$reSwiper.swipeNext();
|
|
}
|
|
return false;
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
$('.sli-slides').each(function () {
|
|
var $reContainer = $(this);
|
|
var $reSwipeWrap = $reContainer.children('ul');
|
|
var $reSwipeItems = $reSwipeWrap.children('li');
|
|
var $reControls = $reContainer.children('div.re-controls');
|
|
var $recPrev = $reControls.children('a.prev');
|
|
var $recNext = $reControls.children('a.next');
|
|
|
|
if ($reSwipeItems.length > 4) {
|
|
$reControls.addClass('enabled');
|
|
$reSwipeItems.css({
|
|
display: 'block'
|
|
});
|
|
|
|
$win.on('resize', function () {
|
|
$reContainer.css({
|
|
height: $reSwipeItems.eq(0).height()
|
|
});
|
|
}).trigger('resize');
|
|
|
|
var $reSwiper = $reContainer.swiper({
|
|
slidesPerView: 4,
|
|
slidesPerGroup: 4,
|
|
calculateHeight: true,
|
|
speed: 500,
|
|
mode:'horizontal',
|
|
loop: false,
|
|
simulateTouch: false,
|
|
onInit: function (swiper) {
|
|
$recPrev.addClass('disabled');
|
|
},
|
|
onSlideChangeStart: function (swiper) {
|
|
if (swiper.activeIndex == 0) {
|
|
if (!$recPrev.hasClass('disabled')) {
|
|
$recPrev.addClass('disabled');
|
|
}
|
|
if ($recNext.hasClass('disabled')) {
|
|
$recNext.removeClass('disabled');
|
|
}
|
|
} else if (swiper.activeIndex == swiper.slides.length-4) {
|
|
if (!$recNext.hasClass('disabled')) {
|
|
$recNext.addClass('disabled');
|
|
}
|
|
if ($recPrev.hasClass('disabled')) {
|
|
$recPrev.removeClass('disabled');
|
|
}
|
|
} else {
|
|
if ($recPrev.hasClass('disabled')) {
|
|
$recPrev.removeClass('disabled');
|
|
}
|
|
if ($recNext.hasClass('disabled')) {
|
|
$recNext.removeClass('disabled');
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
$recPrev.on('click', function () {
|
|
if (!$(this).hasClass('disabled')) {
|
|
$reSwiper.swipePrev();
|
|
}
|
|
return false;
|
|
});
|
|
$recNext.on('click', function () {
|
|
if (!$(this).hasClass('disabled')) {
|
|
$reSwiper.swipeNext();
|
|
}
|
|
return false;
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
/* Открытие popup диалогов */
|
|
var fbPopupOptions = {
|
|
padding: 0,
|
|
fitToView: false
|
|
};
|
|
|
|
$('a.pw-open').fancybox(fbPopupOptions);
|
|
|
|
/* Обработка placeholder для старых браузеров */
|
|
$('input[placeholder], textarea[placeholder]').placeholder();
|
|
|
|
/* показ сообщений помощи в полях диалогов*/
|
|
$doc.on('focus', 'form.pw-form input[type="text"], form.pw-form input[type="password"]', function (event) {
|
|
var $input = $(this);
|
|
var $fLine = $input.closest(".pwf-line");
|
|
var $help = $fLine.find('div.msg-help');
|
|
var $error = $fLine.find('div.msg-error');
|
|
var $error2 = $(this).parent().parent().parent().find('.mf-error');
|
|
$error.parent().remove();
|
|
$error2.parent().remove();
|
|
|
|
if ($help.is(':hidden')) {
|
|
$help.fadeIn(300);
|
|
}
|
|
});
|
|
|
|
$doc.on('blur', 'form.pw-form input[type="text"], form.pw-form input[type="password"]', function (event) {
|
|
var $input = $(this);
|
|
var $fLine = $input.closest(".pwf-line");
|
|
var $help = $fLine.find('div.msg-help');
|
|
if ($help.is(':visible')) {
|
|
$help.fadeOut(300);
|
|
}
|
|
});
|
|
|
|
/* jQueri UI Datepicker */
|
|
$.datepicker.setDefaults($.datepicker.regional["ru"]);
|
|
|
|
$( "#dateFrom" ).datepicker({
|
|
dateFormat: 'dd.mm.yy',
|
|
showOn: 'button',
|
|
showOtherMonths: true,
|
|
constrainInput: true,
|
|
onClose: function( selectedDate ) {
|
|
$( "#dateTo" ).datepicker( "option", "minDate", selectedDate );
|
|
}
|
|
});
|
|
$( "#dateTo" ).datepicker({
|
|
dateFormat: 'dd.mm.yy',
|
|
showOn: 'button',
|
|
showOtherMonths: true,
|
|
constrainInput: true,
|
|
onClose: function( selectedDate ) {
|
|
$( "#dateFrom" ).datepicker( "option", "maxDate", selectedDate );
|
|
}
|
|
});
|
|
|
|
/* Custom scroll
|
|
* использован плагин malihu-custom-scrollbar-plugin
|
|
* http://manos.malihu.gr/jquery-custom-content-scroller/
|
|
* */
|
|
$('div.scroll-container').each(function () {
|
|
var $scrollContainer = $(this);
|
|
$scrollContainer.mCustomScrollbar({
|
|
scrollInertia: 200,
|
|
contentTouchScroll: true,
|
|
scrollButtons: {
|
|
enable: false
|
|
},
|
|
advanced:{
|
|
updateOnContentResize: true,
|
|
autoScrollOnFocus: false
|
|
}
|
|
});
|
|
});
|
|
|
|
/* Открыть диалог подписки на нужной вкладке */
|
|
$('#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);
|
|
var $parentUl = $curTab.closest('ul');
|
|
var index = $parentUl.children('li').index(this);
|
|
var $contentUl = $parentUl.siblings('.tabs-content');
|
|
var $link = $curTab.find("a");
|
|
var $popupSubscr = $curTab.closest('#pw-subscribe');
|
|
|
|
if (!$curTab.hasClass('active')) {
|
|
if ($popupSubscr.length) {
|
|
$contentUl = $popupSubscr.find('.tabs-content');
|
|
}
|
|
var $activeTab = $parentUl.children('li.active');
|
|
var $activeTContent = $contentUl.find('li.active');
|
|
var $currentTContent = $contentUl.children('li').eq(index);
|
|
|
|
$activeTab.removeClass("active");
|
|
$activeTContent.removeClass("active");
|
|
$curTab.addClass("active");
|
|
$currentTContent.addClass("active");
|
|
}
|
|
|
|
$link.blur();
|
|
closeSelectBox();
|
|
return false;
|
|
});
|
|
|
|
/* Показ подписей картинок в деталях фото галерей */
|
|
$('#cli-pg').each(function () {
|
|
var $wrap = $(this);
|
|
var $link = $wrap.find('a');
|
|
$link.on({
|
|
mouseenter: function () {
|
|
var $el = $(this);
|
|
var $title = $el.find('.pg-title');
|
|
|
|
$title
|
|
.stop(true, true)
|
|
.slideDown(300, function () {
|
|
$title.css({
|
|
display: 'block'
|
|
});
|
|
});
|
|
},
|
|
mouseleave: function () {
|
|
var $el = $(this);
|
|
var $title = $el.find('.pg-title');
|
|
|
|
$title
|
|
.stop(true, true)
|
|
.slideUp(300);
|
|
}
|
|
});
|
|
});
|
|
|
|
$('#map-canvas').each(function () {
|
|
var $mapCanvas = $(this);
|
|
if(!$mapCanvas.is(':hidden')) {
|
|
google.maps.event.addDomListener(window, 'load', mapInit);
|
|
$mapCanvas.data('init', true);
|
|
}
|
|
});
|
|
|
|
$('a.toggle-map').on({
|
|
click: function () {
|
|
var $tLink = $(this);
|
|
var $tContainer = $tLink.closest('.i-address');
|
|
var $mapWrap = $tContainer.children('.i-map');
|
|
var $mapCanvas = $('#map-canvas');
|
|
var $hlink = $tContainer.find('header a.toggle-map');
|
|
|
|
if ($mapWrap.is(':hidden')) {
|
|
$mapWrap
|
|
.stop(true, true)
|
|
.animate({
|
|
opacity: 'show',
|
|
height: 'show'
|
|
}, 300, function () {
|
|
if(!$mapCanvas.data('init')) {
|
|
mapInit();
|
|
$mapCanvas.data('init', true);
|
|
}
|
|
$tContainer.addClass('map-opened');
|
|
});
|
|
} else {
|
|
$mapWrap
|
|
.stop(true, true)
|
|
.animate({
|
|
opacity: 'hide',
|
|
height: 'hide'
|
|
}, 300, function () {
|
|
$tContainer.removeClass('map-opened');
|
|
});
|
|
}
|
|
return false;
|
|
}
|
|
});
|
|
|
|
$('ul.messages-list').each(function () {
|
|
var $mList = $(this);
|
|
var $mItems = $mList.children('li');
|
|
|
|
$mItems.on({
|
|
mouseenter: function () {
|
|
var $item = $(this);
|
|
var $mButtons = $item.find('div.mi-buttons');
|
|
|
|
$mButtons
|
|
.stop(true, true)
|
|
.animate({
|
|
opacity: 'show',
|
|
height: 'show'
|
|
}, 250);
|
|
},
|
|
mouseleave: function () {
|
|
var $item = $(this);
|
|
var $mButtons = $item.find('div.mi-buttons');
|
|
|
|
$mButtons
|
|
.stop(true, true)
|
|
.animate({
|
|
opacity: 'hide',
|
|
height: 'hide'
|
|
}, 250);
|
|
}
|
|
});
|
|
});
|
|
|
|
$('.set-sect > header').on('click', function () {
|
|
var $trigger = $(this);
|
|
var $container = $trigger.closest('.set-sect');
|
|
var $fBody = $container.children('div.set-sect-body');
|
|
|
|
if ($fBody.is(':visible')) {
|
|
$fBody
|
|
.stop(true, true)
|
|
.animate({
|
|
height: 'hide',
|
|
opacity: 'hide'
|
|
}, 300, function () {
|
|
$container.addClass('closed')
|
|
});
|
|
} else {
|
|
$fBody
|
|
.stop(true, true)
|
|
.animate({
|
|
height: 'show',
|
|
opacity: 'show'
|
|
}, 300, function () {
|
|
$container.removeClass('closed')
|
|
});
|
|
}
|
|
});
|
|
|
|
$('input.topicChecks').change(function() {
|
|
|
|
if ($(this).prop('checked')==false) {
|
|
|
|
$('li.level1.'+$(this).val()+'').each(function() {
|
|
var s_ID='s'+$(this).find('>label span input').attr('value');
|
|
$('.csb-selected.show div#'+s_ID).parent().removeClass('show');
|
|
$(this).find('>label.active').first().trigger('click');
|
|
$(this).find('ul li label.active').trigger('click');
|
|
$(this).hide().addClass('noAC').find('li').each(function() {
|
|
$(this).addClass('noAC');
|
|
});
|
|
rebuildTopicsAC();
|
|
})
|
|
}
|
|
else {
|
|
$('li.level1.'+$(this).val()+'').each(function() {
|
|
$(this).fadeIn();
|
|
$(this).removeClass('noAC').find('.noAC').each(function() {
|
|
$(this).removeClass('noAC');
|
|
});
|
|
|
|
});
|
|
rebuildTopicsAC();
|
|
};
|
|
|
|
});
|
|
|
|
$('div.c-select-box').each(function () {
|
|
var $sb = $(this);
|
|
var $showContainer = $sb.children('div.csb-selected-items');
|
|
var $selected = $('<div class="csb-selected"><div class="csbs-text"></div><a class="csbs-del" href="#">x</a></div>');
|
|
var $checks = $sb.find('input[type="checkbox"]');
|
|
var $qSelClear = $sb.find('div.q-sel > a.clear');
|
|
var $smSwitchers = $sb.find('.places-list li > a, .places-list ul li ul li label a, .topics-list li > a, .topics-list ul li ul li label a');
|
|
|
|
if (!$sb.hasClass('disabled')) {
|
|
$checks
|
|
.each(function () {
|
|
var $el = $(this);
|
|
var index = $checks.index(this);
|
|
var $label = $el.closest('label');
|
|
var labelText = $label.text();
|
|
var $elShow = $selected.clone();
|
|
var $elText = $elShow.find('div.csbs-text');
|
|
var $clear = $elShow.find('a.csbs-del');
|
|
|
|
$elText.text(labelText);
|
|
$elShow.find('>div').prop('id','s'+$label.find('input').prop('value'));
|
|
$clear.on('click', function () {
|
|
|
|
$elShow.removeClass('show');
|
|
if ($showContainer.children('.show').length < 1 ) {
|
|
$showContainer.removeClass('show');
|
|
}
|
|
var li_ID=$(this).parent().find('div').attr('id').substring(1);
|
|
$('.places-list, .topics-list').find('label:contains("'+$(this).parent().find('.csbs-text').text()+'")').each(function() {
|
|
if ($(this).find('input').attr('value')==li_ID) {
|
|
$(this).trigger('click');
|
|
}
|
|
});
|
|
|
|
return false;
|
|
});
|
|
$showContainer.append($elShow);
|
|
if ($el.is(':checked')) {
|
|
$label.addClass('active');
|
|
|
|
}
|
|
if (!$showContainer.hasClass('show') && $showContainer.children('.show').length > 0) {
|
|
$showContainer.addClass('show');
|
|
}
|
|
})
|
|
.on('change', function () {
|
|
var $el = $(this);
|
|
var $label = $el.closest('label');
|
|
var $showEls = $showContainer.children();
|
|
|
|
console.log('#s'+$label.find('span input').attr('value'));
|
|
var index = $checks.index(this);
|
|
$el.trigger('blur');
|
|
|
|
|
|
if ($el.is(':checked')) {
|
|
$label.addClass('active');
|
|
$showEls.eq(index).addClass('show');
|
|
|
|
} else {
|
|
$label.removeClass('active');
|
|
$el.prop('checked', false);
|
|
|
|
$showEls.eq(index).removeClass('show');
|
|
}
|
|
if ($showContainer.children('.show').length > 0) {
|
|
|
|
$showContainer.addClass('show');
|
|
} else {
|
|
$showContainer.removeClass('show');
|
|
}
|
|
// Если сменился чекбокс области
|
|
if ($el.parents().eq(2).is('.level2')) {
|
|
// Выделяем все города
|
|
if ($el.is(':checked')) {
|
|
$el.parents().eq(2).addClass('full');
|
|
$el.parents().eq(2).find('ul li label').each(
|
|
function() {
|
|
$(this).addClass('active');
|
|
$(this).find('input[type="checkbox"]').prop('checked', true);
|
|
var s_ID='s'+$(this).find('span input').first().attr('value');
|
|
$showContainer.find('#'+s_ID).parent().removeClass('show');
|
|
}
|
|
);
|
|
} else {
|
|
// Если сняли метку с области - снимаем метки с городов области
|
|
|
|
$el.parents().eq(2).removeClass('full');
|
|
$el.parents().eq(4).find('input[type="checkbox"]').first().prop('checked', false);
|
|
$el.parents().eq(4).find('.custom-radio-check').first().removeClass('active');
|
|
|
|
$el.parents().eq(3).find('li.level2.full').each(function () {
|
|
var s_ID='s'+$(this).find('label span input').first().attr('value');
|
|
$showContainer.find('#'+s_ID).parent().addClass('show');
|
|
}
|
|
);
|
|
var s_ID='s'+$el.parents().eq(4).find('label span input').first().attr('value');
|
|
$showContainer.find('#'+s_ID).parent().removeClass('show');
|
|
console.log('n222');
|
|
$el.parents().eq(4).find('label').first().removeClass('active');
|
|
$el.parents().eq(4).find('label span input[type="checkbox"]').first().prop('checked', false);
|
|
$el.parents().eq(2).find('ul li label.active').each(
|
|
function() {
|
|
$(this).removeClass('active');
|
|
$(this).find('input[type="checkbox"]').prop('checked', false);
|
|
}
|
|
);
|
|
}
|
|
}
|
|
else {
|
|
// Если сменился чекбокс страны
|
|
if ($el.parents().eq(2).is('.level1')) {
|
|
// Поставили метку - отмечаем все обласи
|
|
if ($el.is(':checked')) {
|
|
if ((($label.parents().eq(1).find('li .custom-radio-check.active').length)>=($label.parents().eq(1).find('li .custom-radio-check').length))) {
|
|
$label.parents().eq(2).find('label').addClass('active');
|
|
$label.parents().eq(2).find('label span input[type="checkbox"]').prop('checked', true);
|
|
} else {};
|
|
// И все города в областях
|
|
$el.parents().eq(2).find('ul li.level2').addClass('full');
|
|
if ($el.parents().eq(2).find('ul li.level2').length>0) {
|
|
$el.parents().eq(2).find('ul li.level2 label').each(
|
|
function() {
|
|
$(this).addClass('active');
|
|
$(this).find('input[type="checkbox"]').prop('checked', true);
|
|
var s_ID='s'+$(this).find('span input').first().attr('value');
|
|
$showContainer.find('#'+s_ID).parent().removeClass('show');
|
|
}
|
|
);
|
|
} else {
|
|
$el.parents().eq(2).find('li label').each(
|
|
function() {
|
|
$(this).addClass('active');
|
|
$(this).find('input[type="checkbox"]').prop('checked', true);
|
|
var s_ID='s'+$(this).find('span input').first().attr('value');
|
|
$showContainer.find('#'+s_ID).parent().removeClass('show');
|
|
|
|
}
|
|
);
|
|
}
|
|
} else {
|
|
// Сняли метку - снимаем метки дочерних элементов
|
|
$el.parents().eq(2).find('ul li.level2').removeClass('full');
|
|
if ((($label.parents().eq(1).find('li .custom-radio-check.active').length)<($label.parents().eq(1).find('li .custom-radio-check').length))) {
|
|
$label.removeClass('active');
|
|
$label.find('span input[type="checkbox"]').prop('checked', false);
|
|
} else {};
|
|
if ($el.parents().eq(2).find('ul li.level2').length>0) {
|
|
$el.parents().eq(2).find('ul li.level2 label.active').each(
|
|
function() {
|
|
$(this).removeClass('active');
|
|
$(this).find('input[type="checkbox"]').prop('checked', false);
|
|
}
|
|
); } else {
|
|
$el.parents().eq(2).find('li label.active').each(
|
|
function() {
|
|
$(this).removeClass('active');
|
|
$(this).find('input[type="checkbox"]').prop('checked', false);
|
|
}
|
|
);
|
|
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
// Если сменился чекбокс последнего города и область не отмечена - выделить всю область
|
|
if ((($label.parents().eq(1).find('li .custom-radio-check.active').length)>=($label.parents().eq(1).find('li .custom-radio-check').length))&&($el.not(':checked'))) {
|
|
$label.parents().eq(2).find('input[type="checkbox"]').first().parents().eq(1).addClass('active');
|
|
$label.parents().eq(2).find('input[type="checkbox"]').first().parents().eq(2).addClass('full');
|
|
$label.parents().eq(2).find('input[type="checkbox"]').first().prop('checked', true);
|
|
var s_ID='s'+$label.parents().eq(2).find('input[type="checkbox"]').first().attr('value');
|
|
$showContainer.find('#'+s_ID).parent().addClass('show');
|
|
|
|
$label.parents().eq(1).find('.custom-radio-check').each(function () {
|
|
$(this).addClass('active');
|
|
var s_ID='s'+$(this).find('span input').first().attr('value');
|
|
console.log('ttt');
|
|
$showContainer.find('#'+s_ID).parent().removeClass('show');
|
|
});
|
|
|
|
} else {
|
|
// Область была отмечена, сняли метку города - снимаем метку области
|
|
$label.parents().eq(2).find('label').first().removeClass('active');
|
|
if ($label.parents().eq(2).hasClass('level2')) {
|
|
$el.parents().eq(6).find('input[type="checkbox"]').first().prop('checked', false);
|
|
$el.parents().eq(6).find('.custom-radio-check').first().removeClass('active');
|
|
} else {};
|
|
|
|
$label.parents().eq(2).find('input[type="checkbox"]').first().parents().eq(2).removeClass('full');
|
|
$label.parents().eq(2).find('input[type="checkbox"]').first().prop('checked', false);
|
|
var s_ID='s'+$label.parents().eq(2).find('input[type="checkbox"]').first().attr('value');
|
|
$showContainer.find('#'+s_ID).parent().removeClass('show');
|
|
|
|
|
|
|
|
$label.parents().eq(1).find('.custom-radio-check.active').each(function () {
|
|
var s_ID='s'+$(this).find('span input').attr('value');
|
|
$showContainer.find('#'+s_ID).parent().addClass('show');
|
|
|
|
console.log('1');
|
|
});
|
|
if ($label.parents().eq(4).hasClass('level1')) {
|
|
$label.parents().eq(3).find('li.level2.full').each(function () {
|
|
var s_ID='s'+$(this).find('label span input').first().attr('value');
|
|
$showContainer.find('#'+s_ID).parent().addClass('show');
|
|
console.log('2');
|
|
});
|
|
var s_ID='s'+$label.parents().eq(4).find('label span input').first().attr('value');
|
|
$showContainer.find('#'+s_ID).parent().removeClass('show');
|
|
} else {};
|
|
|
|
};
|
|
};
|
|
};
|
|
if ($label.parents().eq(2).hasClass('level1')) {
|
|
// Для областей/городов, чей родитель - страна
|
|
$label.parents().eq(2).find('>ul').each(function () {
|
|
// Если есть области и они все уже выделены - сокращаем список тегов областей до тега страны
|
|
if ((($(this).find('li.level2.full').length)>=($(this).find('li.level2').length))&&($(this).find('li.level2').length>0)) {
|
|
$el.parents().eq(4).find('input[type="checkbox"]').first().prop('checked', true);
|
|
$el.parents().eq(4).find('.custom-radio-check').first().addClass('active');
|
|
$(this).find('li.level2.full').each(function () {
|
|
var s_ID='s'+$(this).find('label span input').first().attr('value');
|
|
$showContainer.find('#'+s_ID).parent().removeClass('show');
|
|
console.log('3');
|
|
}
|
|
);
|
|
var s_ID='s'+$label.parents().eq(3).find('li.level1 label span input').first().attr('value');
|
|
$showContainer.find('#'+s_ID).parent().addClass('show');
|
|
console.log('4');
|
|
|
|
} else {};
|
|
});
|
|
} else {
|
|
// То же самое только для городов, чей родитель область, а затем страна
|
|
if ($label.parents().eq(4).hasClass('level1')) {
|
|
$label.parents().eq(4).find('>ul').each(function() {
|
|
if ((($(this).find('li.level2.full').length)>=($(this).find('li.level2').length))&&($(this).find('li.level2').length>0)) {
|
|
$el.parents().eq(6).find('input[type="checkbox"]').first().prop('checked', true);
|
|
$el.parents().eq(6).find('.custom-radio-check').first().addClass('active');
|
|
$(this).find('li.level2.full').each(function () {
|
|
var s_ID='s'+$(this).find('label span input').first().attr('value');
|
|
$showContainer.find('#'+s_ID).parent().removeClass('show');
|
|
}
|
|
);
|
|
var s_ID='s'+$label.parents().eq(5).find('li.level1 label span input').first().attr('value');
|
|
$showContainer.find('#'+s_ID).parent().addClass('show');
|
|
console.log('5');
|
|
} else {};
|
|
});
|
|
} else {};
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
}
|
|
|
|
$qSelClear.on('click', function () {
|
|
$checks.prop('checked', false).trigger('change');
|
|
return false;
|
|
});
|
|
|
|
$smSwitchers.on('click', function () {
|
|
var $switcher = $(this);
|
|
var $pContainer = $switcher.closest('li');
|
|
var $submenu = $pContainer.children('ul');
|
|
|
|
if ($pContainer.hasClass('active')) {
|
|
$submenu
|
|
.stop(true, true)
|
|
.animate({
|
|
opacity: 'hide',
|
|
height: 'hide'
|
|
}, 300, function () {
|
|
$pContainer.removeClass('active');
|
|
});
|
|
} else {
|
|
$submenu
|
|
.stop(true, true)
|
|
.animate({
|
|
opacity: 'show',
|
|
height: 'show'
|
|
}, 300, function () {
|
|
$pContainer.addClass('active');
|
|
});
|
|
}
|
|
|
|
return false;
|
|
})
|
|
});
|
|
|
|
$('div.c-select-box.select div.csb-selected-items').on('click', function () {
|
|
var $el = $(this);
|
|
var $cont = $el.closest('.c-select-box');
|
|
var $menuWrap = $cont.children('.csb-menu-wrap');
|
|
var $sbMenus = $('div.c-select-box').children('.csb-menu-wrap');
|
|
|
|
|
|
$sbMenus.each(function () {
|
|
var $sbMenu = $(this);
|
|
if ($sbMenu.is(':visible')) {
|
|
$sbMenu
|
|
.stop(true, true)
|
|
.animate({
|
|
height: 'hide',
|
|
opacity: 'hide'
|
|
}, 300);
|
|
}
|
|
});
|
|
|
|
if ($menuWrap.is(':hidden') && !$cont.hasClass('disabled')) {
|
|
$menuWrap
|
|
.stop(true, true)
|
|
.animate({
|
|
height: 'show',
|
|
opacity: 'show'
|
|
}, 300);
|
|
}
|
|
});
|
|
|
|
function closeSelectBox() {
|
|
var selBoxMenu = $('div.c-select-box.select div.csb-menu-wrap');
|
|
selBoxMenu.stop(true, true)
|
|
.animate({
|
|
height: 'hide',
|
|
opacity: 'hide'
|
|
}, 300);
|
|
}
|
|
|
|
$doc.on('click', function (event) {
|
|
var targetObj = $(event.target);
|
|
if (targetObj.parents().filter('.c-select-box.select').length < 1) {
|
|
closeSelectBox();
|
|
}
|
|
});
|
|
|
|
$('input[type="checkbox"].annoncesFlag').each(function () {
|
|
var $check = $(this);
|
|
|
|
$check.on('change', function () {
|
|
var $aInputsWrap = $check.closest('div.mf-announces').children('div.mf-announces-body');
|
|
var $inputs = $aInputsWrap.find('input, select, textarea');
|
|
var $selectBox = $aInputsWrap.find('div.c-select-box');
|
|
|
|
if ($check.prop('checked')) {
|
|
$aInputsWrap.removeClass('disabled');
|
|
$selectBox.removeClass('disabled');
|
|
$inputs.prop('disabled', false);
|
|
} else {
|
|
$aInputsWrap.addClass('disabled');
|
|
$selectBox.addClass('disabled');
|
|
$inputs.prop('disabled', true);
|
|
}
|
|
}).trigger('change');
|
|
});
|
|
|
|
/* Открыть увеличенную фотографию
|
|
* загружать текущую и картинки по нажатию стрелок наверное при помощи ajax
|
|
* */
|
|
$('a.open-photo').on('click', function () {
|
|
var $popupGallery = $('#pw-gallery');
|
|
// configure image
|
|
var $img = $(this).find('img').clone();
|
|
$img.addClass('photoTag');
|
|
//$img.attr('width', '730');
|
|
//$img.attr('height', '533');
|
|
|
|
$img_block = $popupGallery.find('.pg-photos');
|
|
$img_block.html($img);
|
|
|
|
// add id for image description
|
|
var id = 'imgid'+$img.attr('data-image-id')
|
|
$popupGallery.find('.pg-photo-descr').attr('id', id);
|
|
$popupGallery.find('.pg-photo-descr ul').remove();
|
|
|
|
$popupGallery.find('.pg-photo-title').html($img.attr('data-image-name'))
|
|
$popupGallery.find('.pg-photo-text').html($img.attr('data-image-description'))
|
|
|
|
// Список людей для автокомплита:
|
|
|
|
$.getJSON('/accounts/get-tag-users/',function(json){
|
|
window.photoTagData = json;
|
|
});
|
|
|
|
|
|
|
|
// отметки
|
|
$('.photoTag').photoTag({
|
|
externalAddTagLinks: {
|
|
bind: true,
|
|
selector: ".addTag"
|
|
},
|
|
requestTagsUrl: '/photo/existing-tags/',
|
|
deleteTagsUrl: '/photo/delete-tag/',
|
|
addTagUrl: '/photo/add-tag/',
|
|
parametersForNewTag: {
|
|
name: {
|
|
parameterKey: 'name',
|
|
isAutocomplete: true,
|
|
label: 'Введите имя:'
|
|
}
|
|
}
|
|
});
|
|
// ---------------------------------------
|
|
|
|
var $popupOuter = $('div.popup-gallery-outer', $popupGallery);
|
|
var $closePopup = $('a.pg-close', $popupGallery);
|
|
var $prevSlide = $('a.pgpc-prev', $popupGallery);
|
|
var $nextSlide = $('a.pgpc-next', $popupGallery);
|
|
|
|
|
|
function closeGallery() {
|
|
$popupGallery.fadeOut(300, function () {
|
|
$body.removeClass('no-scroll');
|
|
});
|
|
return false;
|
|
}
|
|
|
|
$closePopup.on('click', closeGallery);
|
|
$popupOuter.on('click', function (event) {
|
|
var targetObj = $(event.target);
|
|
if (targetObj.parents().filter('.popup-gallery').length < 1) {
|
|
closeGallery()
|
|
}
|
|
});
|
|
|
|
$prevSlide.on('click', function () {
|
|
return false;
|
|
});
|
|
|
|
$nextSlide.on('click', function () {
|
|
return false;
|
|
});
|
|
|
|
$body.addClass('no-scroll');
|
|
$popupGallery.fadeIn(300);
|
|
|
|
return false;
|
|
});
|
|
|
|
$('a.icb-edit-profile').on('click', function () {
|
|
var $editBtn = $(this);
|
|
var $exitBtn = $editBtn.next('a.icb-exit-edit');
|
|
var $editable = $('div.p-editable');
|
|
|
|
$editBtn.css({
|
|
display: 'none'
|
|
});
|
|
$exitBtn.css({
|
|
display: 'inline-block'
|
|
});
|
|
$editable.addClass('pe-active');
|
|
|
|
return false;
|
|
});
|
|
|
|
$('a.icb-exit-edit').on('click', function () {
|
|
var $exitBtn = $(this);
|
|
var $editBtn = $exitBtn.prev('a.icb-edit-profile');
|
|
var $editable = $('div.p-editable');
|
|
|
|
$editBtn.css({
|
|
display: 'inline-block'
|
|
});
|
|
$exitBtn.css({
|
|
display: 'none'
|
|
});
|
|
$editable.removeClass('pe-active');
|
|
|
|
return false;
|
|
});
|
|
|
|
$('a.e-btn').on('click', function () {
|
|
var $switch = $(this);
|
|
var $wrapper = $switch.closest('.edit-wrap');
|
|
var $container = $switch.closest('.p-editable');
|
|
var $pForm = $wrapper.children('.e-form');
|
|
var $closeBtn = $pForm.find('a.ef-close');
|
|
var $eContainers = $('.p-editable.pe-current').not($container);
|
|
|
|
$eContainers.each(function() {
|
|
$(this).removeClass('pe-current');
|
|
});
|
|
$container.toggleClass('pe-current');
|
|
|
|
$closeBtn.one('click', function() {
|
|
$container.removeClass('pe-current');
|
|
return false;
|
|
});
|
|
|
|
$(document).one('click', function(event) {
|
|
var targetObj = $(event.target);
|
|
if (targetObj.parents().filter('.e-form').length < 1) {
|
|
$container.removeClass('pe-current');
|
|
}
|
|
});
|
|
|
|
return false;
|
|
});
|
|
|
|
$('a.eps-open').on('click', function () {
|
|
var $switch = $(this);
|
|
var $sect = $switch.closest('.ep-sect');
|
|
var $sectBody = $sect.children('div.ep-sect-body');
|
|
|
|
if ($sect.hasClass('eps-opened')) {
|
|
$sectBody
|
|
.stop()
|
|
.animate({
|
|
height: 'hide',
|
|
opacity: 'hide'
|
|
}, 300, function () {
|
|
$sect.removeClass('eps-opened');
|
|
});
|
|
} else {
|
|
$sectBody
|
|
.stop()
|
|
.animate({
|
|
height: 'show',
|
|
opacity: 'show'
|
|
}, 300, function () {
|
|
$sect.addClass('eps-opened');
|
|
});
|
|
}
|
|
|
|
return false;
|
|
});
|
|
|
|
$('div.calendar-container').each(function () {
|
|
var $scrollContainer = $(this);
|
|
$scrollContainer.mCustomScrollbar({
|
|
scrollInertia: 200,
|
|
contentTouchScroll: true,
|
|
horizontalScroll: true,
|
|
scrollButtons: {
|
|
enable: false
|
|
},
|
|
advanced:{
|
|
updateOnContentResize: true
|
|
}
|
|
});
|
|
});
|
|
|
|
$('div.e-form input[type="file"]').each(function () {
|
|
var $iFile = $(this);
|
|
var $ifContainer = $iFile.closest('.input-file');
|
|
var $inpText = $ifContainer.children('.file-text');
|
|
|
|
if ($iFile.val() != "") {
|
|
$inpText.text($iFile.val());
|
|
}
|
|
|
|
$iFile.on({
|
|
change: function () {
|
|
$inpText.text($iFile.val());
|
|
}
|
|
});
|
|
|
|
var parent = $(this).parents(".field.file");
|
|
if (parent.length > 0) {
|
|
var inpText = $(".input-text", parent);
|
|
if ($(this).val() != "") {
|
|
inpText.text($(this).val());
|
|
}
|
|
}
|
|
});
|
|
|
|
//--------------------------------------------
|
|
$('a.reply-msg').on('click', function () {
|
|
var sender = $(this).attr('data-sender');
|
|
var reply_message = $(this).attr('data-reply-message');
|
|
var $reply = $('#pw-reply');
|
|
$reply.find('#id_recipient').val(sender)
|
|
$reply.find('#reply_message').val(reply_message)
|
|
});
|
|
//--------------------------------------------
|
|
|
|
});
|
|
|
|
}(jQuery);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|