Removed hidden size element, fix for folder previews
authorBaptiste CLÉMENT <batoche@free.fr>
Mon, 19 Aug 2013 19:28:53 +0000 (21:28 +0200)
committerMarc MAURICE <marc-bizou@pub.positon.org>
Mon, 19 Aug 2013 19:28:53 +0000 (21:28 +0200)
plugins/_disabled/balanced/before_content.php [deleted file]
plugins/_disabled/balanced/head.php
plugins/_disabled/balanced/scripts.js

diff --git a/plugins/_disabled/balanced/before_content.php b/plugins/_disabled/balanced/before_content.php
deleted file mode 100644 (file)
index 2abced6..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<div id="thumbsize" style="visibility:hidden"><?= THUMB_SIZE ?></div>
index 44cca72..f2c2bb9 100644 (file)
@@ -1,9 +1,10 @@
 <script language="javascript" src="../plugins/balanced/scripts.js"></script> 
 <script language="javascript">
-        window.onload = function(event) {
-                applyOptimalImagesSize();
+        var thumbsize = <?php echo THUMB_SIZE ?>;
+       window.onload = function(event) {
+                applyOptimalImagesSize(thumbsize);
         }
         window.onresize = function(event) {
-                applyOptimalImagesSize();
+                applyOptimalImagesSize(thumbsize);
         }
 </script>
index 51eb4c6..65ef586 100644 (file)
@@ -1,12 +1,27 @@
-function applyOptimalImagesSize()\r
+/*Copyright (C) 2013  Baptiste Clement\r
+\r
+This program is free software: you can redistribute it and/or modify\r
+it under the terms of the GNU General Public License as published by\r
+the Free Software Foundation, either version 3 of the License, or\r
+(at your option) any later version.\r
+\r
+This program is distributed in the hope that it will be useful,\r
+but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+GNU General Public License for more details.\r
+\r
+You should have received a copy of the GNU General Public License\r
+along with this program.  If not, see <http://www.gnu.org/licenses/>.\r
+*/\r
+\r
+function applyOptimalImagesSize(bestHeight)\r
 {\r
-       var divimages = document.getElementsByClassName("image");\r
+       var divimages = document.getElementsByClassName("image imagepreview");\r
        var images = new Array();\r
        for(var i = 0 ; i < divimages.length ; ++i)\r
        {\r
                images.push(divimages[i].children[0].children[0]);\r
        }\r
-       var bestHeight = parseInt(document.getElementById("thumbsize").textContent);\r
        var newHList = getOptimalHeights(images, bestHeight);\r
        for( var i = 0 ; i < images.length ; ++i)\r
        {\r
@@ -96,9 +111,6 @@ function getAllImageSizesForHeight(images, height)
        return sizes;\r
 }\r
 \r
-\r
-\r
-\r
 //Renvoi un tableau de tableau, correspondant au découpage du tableau d'entrée découpé par tranche de MAX\r
 function splitTab(tab, max)\r
 {\r