aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarijus <mario@mariovavti.com>2014-09-11 10:41:11 +0200
committermarijus <mario@mariovavti.com>2014-09-11 10:41:11 +0200
commit3caee72aee3d5008f954e3ccf1dc2b61fedf23d8 (patch)
tree311afb757625dcdb813bda529fb4eb86791e1701
parent8835f646aeb6276987f11cc4799c3810802c3f1f (diff)
downloadvolse-hubzilla-3caee72aee3d5008f954e3ccf1dc2b61fedf23d8.tar.gz
volse-hubzilla-3caee72aee3d5008f954e3ccf1dc2b61fedf23d8.tar.bz2
volse-hubzilla-3caee72aee3d5008f954e3ccf1dc2b61fedf23d8.zip
another day another concept - hope this works better
-rw-r--r--mod/photos.php20
-rw-r--r--view/css/mod_photos.css4
-rw-r--r--view/js/main.js36
-rwxr-xr-xview/tpl/photos_recent.tpl6
-rwxr-xr-xview/tpl/photosajax.tpl3
5 files changed, 40 insertions, 29 deletions
diff --git a/mod/photos.php b/mod/photos.php
index b1d105986..866d8c275 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -635,7 +635,7 @@ function photos_content(&$a) {
);
if(count($r)) {
$a->set_pager_total(count($r));
- $a->set_pager_itemspage(60);
+ $a->set_pager_itemspage(30);
}
if($_GET['order'] === 'posted')
@@ -703,7 +703,7 @@ function photos_content(&$a) {
if(count($r)) {
$twist = 'rotright';
$o .= "<script> var page_query = '" . $_GET['q'] . "'; var extra_args = '" . extra_query_args() . "' ; </script>";
- $o .= '<div id="photo-album-contents">';
+ $o .= '<div id="photo-album-contents-' . $a->pager['page'] . '">';
foreach($r as $rr) {
@@ -755,12 +755,18 @@ function photos_content(&$a) {
if($_REQUEST['aj']) {
if(! $r)
$ajaxout .= '<div id="content-complete"></div>';
+
+ echo '<div id="photo-album-contents-' . $a->pager['page'] . '">';
echo $ajaxout;
+ echo '<div>';
+ echo '<script>justifyPhotos(' . $a->pager['page'] . ');</script>';
killme();
}
- $o .= '<div id="page-end"></div>';
+
$o .= '</div>'; // photo-album-contents
+ $o .= '<script>justifyPhotos(' . $a->pager['page'] . ');</script>';
+ $o .= '<div id="page-end"></div>';
$o .= '<div id="photo-album-end"></div>';
$o .= '<script>$(document).ready(function() { loadingPage = false;});</script>';
$o .= '<div id="page-spinner"></div>';
@@ -1159,7 +1165,7 @@ function photos_content(&$a) {
);
if(count($r)) {
$a->set_pager_total(count($r));
- $a->set_pager_itemspage(60);
+ $a->set_pager_itemspage(30);
}
$r = q("SELECT `resource_id`, `id`, `filename`, type, `album`, max(`scale`) AS `scale` FROM `photo`
@@ -1216,7 +1222,8 @@ function photos_content(&$a) {
if($_REQUEST['aj']) {
if($photos) {
$o = replace_macros(get_markup_template('photosajax.tpl'),array(
- '$photos' => $photos
+ '$photos' => $photos,
+ '$page' => $a->pager['page']
));
}
else {
@@ -1233,6 +1240,7 @@ function photos_content(&$a) {
'$can_post' => $can_post,
'$upload' => array(t('Upload New Photos'), $a->get_baseurl().'/photos/'.$a->data['channel']['channel_address'].'/upload'),
'$photos' => $photos,
+ '$page' => $a->pager['page']
));
}
@@ -1243,7 +1251,7 @@ function photos_content(&$a) {
killme();
}
-// $o .= paginate($a);
+// paginate($a);
return $o;
}
diff --git a/view/css/mod_photos.css b/view/css/mod_photos.css
index fa3b5b35a..b81145cd5 100644
--- a/view/css/mod_photos.css
+++ b/view/css/mod_photos.css
@@ -182,3 +182,7 @@
margin-left: 200px;
}
+div[id^='photo-album-contents-'] {
+ margin-bottom: 3px;
+}
+
diff --git a/view/js/main.js b/view/js/main.js
index ae90bb272..e263fd116 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -700,29 +700,25 @@ function updateConvItems(mode,data) {
updatePageItems(update_mode,data);
$("#page-spinner").spin(false);
in_progress = false;
- justifyPhotos();
});
}
- function justifyPhotos() {
- if($('#photo-album-contents').length > 0) {
- loadingPage = true;
- $('#photo-album-contents').justifiedGallery({
- lastRow : 'nojustify',
- captions: true,
- margins: 3,
- rowHeight : 150,
- sizeRangeSuffixes : {
- 'lt100': '',
- 'lt240': '',
- 'lt320': '',
- 'lt500': '',
- 'lt640': '',
- 'lt1024': ''
- }
- }).on('jg.complete', function(e){ loadingPage = false; });
- }
+ function justifyPhotos(bParam_page) {
+ $('#photo-album-contents-' + bParam_page).justifiedGallery({
+ lastRow : 'nojustify',
+ captions: true,
+ margins: 3,
+ rowHeight : 150,
+ sizeRangeSuffixes : {
+ 'lt100': '',
+ 'lt240': '',
+ 'lt320': '',
+ 'lt500': '',
+ 'lt640': '',
+ 'lt1024': ''
+ }
+ });
}
function notify_popup_loader(notifyType) {
@@ -1093,8 +1089,6 @@ $(document).ready(function() {
$(".autotime").timeago();
- justifyPhotos();
-
});
function zFormError(elm,x) {
diff --git a/view/tpl/photos_recent.tpl b/view/tpl/photos_recent.tpl
index 8eaa208b1..0f86a635d 100755
--- a/view/tpl/photos_recent.tpl
+++ b/view/tpl/photos_recent.tpl
@@ -3,12 +3,14 @@
<a id="photo-top-upload-link" href="{{$upload.1}}">{{$upload.0}}</a>
{{/if}}
-<div id="photo-album-contents">
+<div id="photo-album-contents-{{$page}}">
{{foreach $photos as $photo}}
{{include file="photo_top.tpl"}}
{{/foreach}}
-<div id="page-end"></div>
+
</div>
+<script>justifyPhotos({{$page}});</script>
+<div id="page-end"></div>
<div class="photos-end"></div>
<script>$(document).ready(function() { loadingPage = false;});</script>
<div id="page-spinner"></div>
diff --git a/view/tpl/photosajax.tpl b/view/tpl/photosajax.tpl
index a88682e8b..a9a9605d0 100755
--- a/view/tpl/photosajax.tpl
+++ b/view/tpl/photosajax.tpl
@@ -1,4 +1,7 @@
<!-- -->
+<div id="photo-album-contents-{{$page}}">
{{foreach $photos as $photo}}
{{include file="photo_top.tpl"}}
{{/foreach}}
+</div>
+<script>justifyPhotos({{$page}});</script>