]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Cool js photo resizing effect
authorMax Shinn <trombonechamp@gmail.com>
Tue, 28 Dec 2010 15:38:50 +0000 (09:38 -0600)
committerMax Shinn <trombonechamp@gmail.com>
Tue, 28 Dec 2010 15:38:50 +0000 (09:38 -0600)
plugins/GNUsocialPhotos/GNUsocialPhotosPlugin.php
plugins/GNUsocialPhotos/actions/photos.php
plugins/GNUsocialPhotos/res/gnusocialphotos.js [new file with mode: 0644]

index 7be8b0a962305863c4285ed6ae113109a978dde6..a3aed95c0cefd2ac1511a2758f6ed22b5e8749b5 100644 (file)
@@ -199,5 +199,10 @@ class GNUsocialPhotosPlugin extends Plugin
     {
         $action->cssLink('/plugins/GNUsocialPhotos/res/style.css');
     }
+
+    function onEndShowScripts($action)
+    {
+        $action->script('plugins/GNUsocialPhotos/res/gnusocialphotos.js');
+    }
 }
 
index bfa77b9c35176cfa07cde1a118ceafee32852fef..d1136008506ea70fdd344004eb0f87f95e0ffea5 100644 (file)
@@ -83,10 +83,20 @@ class PhotosAction extends Action
         if (!$album->find()) {
             GNUsocialPhotoAlbum::newAlbum($cur->id, 'Default');
         }
+
+        $this->elementStart('div', array('class' => 'galleryheader'));
+        $this->element('a', array('href' => '#',
+                                  'onclick' => 'increasePhotoSize()'), '+');
+        $this->raw(' | ');
+        $this->element('a', array('href' => '#',
+                                  'onclick' => 'decreasePhotoSize()'), '-');
+        $this->elementEnd('div');
+
         while ($album->fetch()) {
             $this->elementStart('div', array('class' => 'photocontainer'));
             $this->elementStart('a', array('href' => $album->getPageLink()));
-            $this->element('img', array('src' => $album->getThumbUri()));
+            $this->element('img', array('src' => $album->getThumbUri(),
+                                        'class' => 'albumingallery'));
             $this->elementEnd('a');
             $this->element('h3', array(), $album->album_name);
             $this->elementEnd('div');
@@ -107,17 +117,28 @@ class PhotosAction extends Action
         }
 
         $photos = GNUsocialPhoto::getGalleryPage($page, $album->album_id, 9);
+        $this->elementStart('div', array('class' => 'galleryheader'));
         if ($page > 1) { 
             $this->element('a', array('href' => $album->getPageLink() . '?pageid=' . ($page-1)), 'Previous page');
+            $this->raw(' | ');
         }
         if (GNUsocialPhoto::getGalleryPage($page+1, $album->album_id, 9)) {
             $this->element('a', array('href' => $album->getPageLink() . '?pageid=' . ($page+1) ), 'Next page');
+            $this->raw(' | ');
         }
+        $this->element('a', array('href' => '#',
+                                  'onclick' => 'increasePhotoSize()'), '+');
+        $this->raw(' | ');
+        $this->element('a', array('href' => '#',
+                                  'onclick' => 'decreasePhotoSize()'), '-');
+        $this->elementEnd('div');
+        
 
         foreach ($photos as $photo) {
             $this->elementStart('a', array('href' => $photo->getPageLink()));
             $this->elementStart('div', array('class' => 'photocontainer'));
-            $this->element('img', array('src' => $photo->thumb_uri));
+            $this->element('img', array('src' => $photo->thumb_uri,
+                                        'class' => 'photoingallery'));
             $this->element('div', array('class' => 'phototitle'), $photo->title);
             $this->elementEnd('div');
             $this->elementEnd('a');
diff --git a/plugins/GNUsocialPhotos/res/gnusocialphotos.js b/plugins/GNUsocialPhotos/res/gnusocialphotos.js
new file mode 100644 (file)
index 0000000..3a959a5
--- /dev/null
@@ -0,0 +1,15 @@
+function increasePhotoSize() {
+    $('.photoingallery, .albumingallery').each(function(index) {
+            this.height *= 1.1;
+            this.width *= 1.1;
+        });
+    return false;
+}
+
+function decreasePhotoSize() {
+    $('.photoingallery, .albumingallery').each(function(index) {
+            this.height /= 1.1;
+            this.width /= 1.1;
+        });
+    return false;
+}