restore category_toggle
This commit is contained in:
@ -413,27 +413,34 @@ function showConfigAll(count) {
|
||||
}
|
||||
|
||||
// Collapses/expands the category selector
|
||||
function showItem(id) {
|
||||
if (id == undefined) {
|
||||
// this function got called by addLoadEvent, used pre s9y 2.0
|
||||
id = 'categoryselector';
|
||||
function toggleCategorySelector(id) {
|
||||
if ($('#toggle_' + id).length == 0) {
|
||||
// this function got called on load of the editor
|
||||
var toggleButton = document.createElement('img');
|
||||
toggleButton.id = ('toggle_' + id);
|
||||
$(toggleButton).click(function() {
|
||||
toggleCategorySelector(id);
|
||||
});
|
||||
$('#'+id).before(toggleButton);
|
||||
|
||||
if ($('#'+id).children('*[selected="selected"]').length > 1) {
|
||||
// when loading the page new for the preview and more than one category was
|
||||
// selected, collapsing the category-selector would lose those categories
|
||||
$('#'+id).attr("size", $('#'+id).children().size);
|
||||
$('#option_' + id).attr("src", minus_img);
|
||||
$('#toggle_' + id).attr("src", img_minus);
|
||||
return
|
||||
}
|
||||
|
||||
}
|
||||
if ($('#'+id).attr("multiple")) {
|
||||
$('#'+id).removeAttr("multiple");
|
||||
$('#'+id).removeAttr("size");
|
||||
$('#option_' + id).attr("src", plus_img);
|
||||
$('#toggle_' + id).attr("src", img_plus);
|
||||
|
||||
} else {
|
||||
$('#'+id).attr("multiple", "");
|
||||
$('#'+id).attr("size", $('#'+id).children().size);
|
||||
$('#option_' + id).attr("src", minus_img);
|
||||
$('#toggle_' + id).attr("src", img_minus);
|
||||
}
|
||||
}
|
||||
|
||||
@ -742,5 +749,8 @@ function highlightComment(id, checkvalue) {
|
||||
$('input[name="serendipity[filter][fileCategory]"]').on('change', function() {
|
||||
$('#media_library_control').submit();
|
||||
});
|
||||
|
||||
// Category selector
|
||||
toggleCategorySelector('categoryselector');
|
||||
|
||||
})(jQuery);
|
||||
|
Reference in New Issue
Block a user