|
|
|
@ -58,6 +58,7 @@ function sendForm (show_modal) { |
|
|
|
$autocomplete = $('#autocomplete_themes', $themes_modal), |
|
|
|
$autocomplete = $('#autocomplete_themes', $themes_modal), |
|
|
|
$autocomplete_results = $('#autocomplete_themes_results', $themes_modal), |
|
|
|
$autocomplete_results = $('#autocomplete_themes_results', $themes_modal), |
|
|
|
$selected_themes = $('.selected_themes', $themes_modal), |
|
|
|
$selected_themes = $('.selected_themes', $themes_modal), |
|
|
|
|
|
|
|
$popular_themes = $('#popular_themes'), |
|
|
|
timer, |
|
|
|
timer, |
|
|
|
themes_data = {}, |
|
|
|
themes_data = {}, |
|
|
|
// template for mustache.js
|
|
|
|
// template for mustache.js
|
|
|
|
@ -218,6 +219,16 @@ function sendForm (show_modal) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$popular_themes.on('change', 'input[type="checkbox"]', function () { |
|
|
|
|
|
|
|
var theme_id = this.value; |
|
|
|
|
|
|
|
changeThemeData(theme_id, !themes_data[theme_id].checked, true); |
|
|
|
|
|
|
|
$themes_modal |
|
|
|
|
|
|
|
.find('#id_th_' + theme_id) |
|
|
|
|
|
|
|
.prop('checked', themes_data[theme_id].checked) |
|
|
|
|
|
|
|
.trigger('change'); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$themes_modal.on('change', 'input[type="checkbox"]', function (e) { |
|
|
|
$themes_modal.on('change', 'input[type="checkbox"]', function (e) { |
|
|
|
e.preventDefault(); |
|
|
|
e.preventDefault(); |
|
|
|
// sendForm();
|
|
|
|
// sendForm();
|
|
|
|
@ -232,6 +243,7 @@ function sendForm (show_modal) { |
|
|
|
if ($checkbox.is(':checked')) { |
|
|
|
if ($checkbox.is(':checked')) { |
|
|
|
changeThemeData($checkbox.val(), true, true); |
|
|
|
changeThemeData($checkbox.val(), true, true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Отмечаем выбранными все теги у темы
|
|
|
|
$sub_list.find('input[name="tg"]').each(function (i, checkbox) { |
|
|
|
$sub_list.find('input[name="tg"]').each(function (i, checkbox) { |
|
|
|
$(checkbox).prop('checked', true); |
|
|
|
$(checkbox).prop('checked', true); |
|
|
|
}); |
|
|
|
}); |
|
|
|
@ -243,6 +255,14 @@ function sendForm (show_modal) { |
|
|
|
var rendered_theme = renderTheme($checkbox.val()); |
|
|
|
var rendered_theme = renderTheme($checkbox.val()); |
|
|
|
$selected_themes.append(rendered_theme); |
|
|
|
$selected_themes.append(rendered_theme); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.log($popular_themes.find('#id_popular_theme_' + $checkbox.val())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Ставим чекбокс на популярных темах
|
|
|
|
|
|
|
|
$popular_themes |
|
|
|
|
|
|
|
.find('#id_popular_theme_' + $checkbox.val()) |
|
|
|
|
|
|
|
.prop('checked', true); |
|
|
|
|
|
|
|
|
|
|
|
// Сняли чекбокс темы
|
|
|
|
// Сняли чекбокс темы
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
changeThemeData($checkbox.val(), false, true); |
|
|
|
changeThemeData($checkbox.val(), false, true); |
|
|
|
@ -252,6 +272,10 @@ function sendForm (show_modal) { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
removeSelectedItem($checkbox.attr('name'), $checkbox.val()); |
|
|
|
removeSelectedItem($checkbox.attr('name'), $checkbox.val()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$popular_themes |
|
|
|
|
|
|
|
.find('#id_popular_theme_' + $checkbox.val()) |
|
|
|
|
|
|
|
.prop('checked', false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Изменили чекбокс тега
|
|
|
|
// Изменили чекбокс тега
|
|
|
|
@ -381,6 +405,10 @@ function sendForm (show_modal) { |
|
|
|
$this.parents('li').remove(); |
|
|
|
$this.parents('li').remove(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!$('#selected_themes').find('li').length) { |
|
|
|
|
|
|
|
$popular_themes.show(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
checkSelected(); |
|
|
|
checkSelected(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -409,6 +437,8 @@ function sendForm (show_modal) { |
|
|
|
$('#selected_themes').html($selected); |
|
|
|
$('#selected_themes').html($selected); |
|
|
|
sendForm(); |
|
|
|
sendForm(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$selected.length ? $popular_themes.hide() : $popular_themes.show(); |
|
|
|
|
|
|
|
|
|
|
|
$.fancybox.close(); |
|
|
|
$.fancybox.close(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
@ -675,4 +705,8 @@ $(function () { |
|
|
|
|
|
|
|
|
|
|
|
if ($('#unsibscribed').length) |
|
|
|
if ($('#unsibscribed').length) |
|
|
|
$.fancybox.open({href: '#unsibscribed'}); |
|
|
|
$.fancybox.open({href: '#unsibscribed'}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$('.smooth_scroll').on('click', function (event) { |
|
|
|
|
|
|
|
var target = $() |
|
|
|
|
|
|
|
}) |
|
|
|
}); |
|
|
|
}); |
|
|
|
|