login/pass: error messages below page title
[minimedit.git] / foto / album.inc.php
index 597e9a4e343842974b4ced481ff8878c4565f23a..692aafa4efa21debc8ec58e458da4d3c2d023b4d 100644 (file)
@@ -23,6 +23,13 @@ function openphotoswipe(index) {
                clickToCloseNonZoomable: false,
                closeElClasses: [], 
                shareButtons: [
+<?php
+if ($User->admin('foto')) {
+       printf("\t\t\t{id:'%s', label:'%s', url:'%s'},\n",
+               'cover', 'Cover instellen', "/edit/foto/cover{$Page->path}?img={{image_url}}"
+       );
+}
+?>
                        {id:'download', label:'Origineel downloaden', url:'{{raw_image_url}}', download:true}
                ],
        };
@@ -78,22 +85,15 @@ function imgjustify() {
                        imgel.style.position = 'absolute';
                        imgel.style.top = layout.boxes[i].top + 'px';
                        imgel.style.left = layout.boxes[i].left + 'px';
-
-                       var thumbtarget = imgel.src.replace(/(\/thumb\/)\d+/, '$1'+layout.boxes[i].height)
-                       if (imgel.complete) {
-                               imgel.src = thumbtarget;
-                       }
-                       else if (thumbtarget != imgel.src) {
-                               var loadthumb = new Image();
-                               loadthumb.src = thumbtarget;
-                               loadthumb.onload = function() {
-                                       imgel.src = this.src;
-                               };
-                       }
                })();
        }
 };
 
+if (request = window.location.hash.match(/pid=(.*)/)) {
+       index = images.findIndex(row => row.src == request[1]);
+       openphotoswipe(index);
+}
+
 window.addEventListener('resize', imgjustify, false);
 imgjustify();