1
0

Add switch for category overlay view + JS code for it.

References #254
This commit is contained in:
Matthias Mees
2014-12-31 15:18:52 +01:00
parent b141f4a410
commit 8cb627cb31
2 changed files with 19 additions and 2 deletions

View File

@ -124,6 +124,7 @@
<label for="categoryfilter" class="visuallyhidden">{$CONST.FILTERS}</label>
<input id="categoryfilter" type="text" placeholder="{$CONST.FILTERS}: {$CONST.CATEGORIES}">
<button class="reset_livefilter icon_link" type="button" data-target="categoryfilter" title="{$CONST.RESET_FILTERS}"><span class="icon-cancel"></span><span class="visuallyhidden">{$CONST.RESET_FILTERS}</span></button>
<button id="toggle_cat_view" class="icon_link" type="button" title="Switch category view"><span class="icon-toggle-off"></span><span class="visuallyhidden">Switch category view</span></button> {* i18n *}
</div>
{foreach from=$entry_vars.category_options item="entry_cat"}

View File

@ -988,6 +988,22 @@ $(function() {
}
{/if}
// Switch category view
if($('#serendipityEntry').length > 0) {
$('#toggle_cat_view').click(function() {
var $el = $(this);
var $target = $('.mfp-content');
if($target.hasClass('compact_categories')) {
$target.removeClass('compact_categories');
$el.find('.icon-toggle-on').removeClass('icon-toggle-on').addClass('icon-toggle-off');
} else {
$target.addClass('compact_categories');
$el.find('.icon-toggle-off').removeClass('icon-toggle-off').addClass('icon-toggle-on');
}
});
};
// Show tag selector
{if $use_backendpopups}
if($('#serendipityEntry').length > 0) {
@ -1346,7 +1362,7 @@ $(function() {
max_height = {if {serendipity_getConfigVar key='maxImgHeight'}}{serendipity_getConfigVar key='maxImgHeight'}{else}0{/if},
width = image.width,
height = image.height;
if (max_width > 0 && width > max_width) {
height *= max_width / width;
width = max_width;
@ -1355,7 +1371,7 @@ $(function() {
width *= max_height / height;
height = max_height;
}
canvas.width = width;
canvas.height = height;
canvas.getContext('2d').drawImage(image, 0, 0, width, height);