'
};
// открываем список тегов в теме
$themes_modal.on('click', '.trigger', function (e) {
e.preventDefault();
var $link = $(this),
$sub_list = $link.next('.sub');
// если теги подгружены, то открываем(закрываем) список
// если нет, то подгружаем аяксом теги
if ($sub_list.hasClass('has_items')){
$sub_list.slideToggle(100);
} else {
renderSublist($link.attr('href'), $sub_list);
}
});
$themes_modal.on('change', 'input[type="checkbox"]', function (e) {
e.preventDefault();
var $checkbox = $(this);
// записываем(удаляем) в объект user_choice отмеченные темы(теги)
if($checkbox.is(':checked')){
user_choice[$checkbox.attr('name')][$checkbox.val()] = $checkbox.parent().find('.label').text();
} else {
delete user_choice[$checkbox.attr('name')][$checkbox.val()];
}
});
// Подтверждение выбранных тем
$themes_modal.on('click', '.modal-approve', function (e) {
e.preventDefault();
var $selected_themes = $('#selected_themes'),
$selected_tags = $('#selected_tags');
$selected_themes.html('');
for (var theme_id in user_choice['th']) {
var $theme = $(renderSelectedThemes(theme_id, 'th', user_choice['th'][theme_id]));
$selected_themes.append($theme);
}
for (var tag_id in user_choice['tg']) {
var $tag = $(renderSelectedThemes(tag_id, 'tg', user_choice['tg'][tag_id]));
$selected_tags.append($tag);
}
$.fancybox.close();
})
})();
// Выбор городов
$(function () {
$('.back_to_site').on('click', function (event) {
event.preventDefault();
window.history.back();
});
$('.themes_trigger').on('click', function (event) {
event.preventDefault();
$.fancybox.open({
href: '#search-modal',
padding: 0
});
});
$('.scroll-container').mCustomScrollbar();
});