Skip to content
Snippets Groups Projects
Commit f0aec085 authored by Adrian Lang's avatar Adrian Lang
Browse files

Only resize to fullscreen if screen is big enough

parent c6bab407
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,9 @@ var dw_mediamanager = {
view: false,
layout_width: 0,
layout_height: 0,
// The minimum height of the full-screen mediamanager in px
minHeights: {thumbs: 200, rows: 100},
init: function () {
var $content, $tree;
......@@ -71,7 +73,6 @@ var dw_mediamanager = {
dw_mediamanager.image_diff();
dw_mediamanager.init_ajax_uploader();
console.log(jQuery('#mediamanager__page div.filelist').find('div.panelContent a'));
// changing opened tab in the file list panel
jQuery('#mediamanager__page div.filelist').delegate('ul.tabs a', 'click', dw_mediamanager.list)
// loading file details
......@@ -367,6 +368,8 @@ var dw_mediamanager = {
DokuCookie.setValue('view', type);
}
dw_mediamanager.view = type;
dw_mediamanager.resize();
},
/**
......@@ -476,13 +479,7 @@ var dw_mediamanager = {
jQuery(this).width(w);
});
var windowHeight = jQuery(window).height();
var height = windowHeight - 300;
if (layout_height < height) {
layout_height = height;
jQuery('#mediamanager__page div.panelContent').height(height);
dw_mediamanager.$resizables().height(height+100);
}
dw_mediamanager.resize();
dw_mediamanager.opacity_slider();
dw_mediamanager.portions_slider();
......@@ -532,11 +529,27 @@ var dw_mediamanager = {
}
});
var windowHeight = jQuery(window).height();
var height = windowHeight - 300;
layout_height = height;
jQuery('#mediamanager__page .panelContent').height(height);
$resizables.height(height+100);
dw_mediamanager.resize();
},
resize: function () {
var $contents = jQuery('#mediamanager__page div.panelContent'),
height = jQuery(window).height() - jQuery(document).height() +
Math.max.apply(null, jQuery.map($contents, function (v) {
return jQuery(v).height();
}));
// If the screen is too small, don’t try to resize
if (height < dw_mediamanager.minHeights[dw_mediamanager.view]) {
$contents.add(dw_mediamanager.$resizables()).height('auto');
} else {
$contents.height(height);
dw_mediamanager.$resizables().each(function () {
var $this = jQuery(this);
$this.height(height + $this.find('div.panelContent').offset().top -
$this.offset().top);
});
}
},
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment