Removed hidden size element, fix for folder previews

This commit is contained in:
Baptiste CLÉMENT 2013-08-19 21:28:53 +02:00 committed by Marc MAURICE
parent 1a6d3e0609
commit 90f5657437
3 changed files with 22 additions and 10 deletions

View file

@ -1 +0,0 @@
<div id="thumbsize" style="visibility:hidden"><?= THUMB_SIZE ?></div>

View file

@ -1,9 +1,10 @@
<script language="javascript" src="../plugins/balanced/scripts.js"></script>
<script language="javascript">
var thumbsize = <?php echo THUMB_SIZE ?>;
window.onload = function(event) {
applyOptimalImagesSize();
applyOptimalImagesSize(thumbsize);
}
window.onresize = function(event) {
applyOptimalImagesSize();
applyOptimalImagesSize(thumbsize);
}
</script>

View file

@ -1,12 +1,27 @@
function applyOptimalImagesSize()
/*Copyright (C) 2013 Baptiste Clement
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
function applyOptimalImagesSize(bestHeight)
{
var divimages = document.getElementsByClassName("image");
var divimages = document.getElementsByClassName("image imagepreview");
var images = new Array();
for(var i = 0 ; i < divimages.length ; ++i)
{
images.push(divimages[i].children[0].children[0]);
}
var bestHeight = parseInt(document.getElementById("thumbsize").textContent);
var newHList = getOptimalHeights(images, bestHeight);
for( var i = 0 ; i < images.length ; ++i)
{
@ -96,9 +111,6 @@ function getAllImageSizesForHeight(images, height)
return sizes;
}
//Renvoi un tableau de tableau, correspondant au découpage du tableau d'entrée découpé par tranche de MAX
function splitTab(tab, max)
{