auth: store global user metadata in User object
[minimedit.git] / foto / album.inc.php
index 5e1a14845fe6a3a0a62d54bb3f6012aca9674c5f..6d706ca99769bd5c37a3dfc7c46d20c2f55f1cb4 100644 (file)
@@ -24,9 +24,9 @@ function openphotoswipe(index) {
                closeElClasses: [], 
                shareButtons: [
 <?php
-if (!empty($User['admin'])) {
+if ($User and $User->admin) {
        printf("\t\t\t{id:'%s', label:'%s', url:'%s'},\n",
-               'cover', 'Cover instellen', "/edit/fotocover$Args?img={{image_url}}"
+               'cover', 'Cover instellen', "/edit/foto/cover$Args?img={{image_url}}"
        );
 }
 ?>
@@ -74,6 +74,7 @@ function imgjustify() {
                targetRowHeight: 200,
        };
        var layout = require('justified-layout')(ratios, config);
+       var thumbreplace = !/[?&]blur\b/.test(window.location.search);
 
        gallery.style.position = 'relative';
        gallery.style.height = layout.containerHeight + 'px';
@@ -86,21 +87,28 @@ function imgjustify() {
                        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 (thumbreplace) {
+                               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();