Cool js photo resizing effect
This commit is contained in:
parent
c73398fb25
commit
90521450a0
@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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');
|
||||
|
15
plugins/GNUsocialPhotos/res/gnusocialphotos.js
Normal file
15
plugins/GNUsocialPhotos/res/gnusocialphotos.js
Normal file
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user