From c1c2214b477223e87547f06f1dc1c0c9e7fe47d4 Mon Sep 17 00:00:00 2001 From: marijus Date: Wed, 10 Sep 2014 17:10:39 +0200 Subject: photo justification --- view/js/main.js | 29 ++++++++++++++++++++++++----- view/php/theme_init.php | 3 +++ view/tpl/photo_album.tpl | 10 +++------- view/tpl/photo_top.tpl | 9 +++------ view/tpl/photos_recent.tpl | 2 +- 5 files changed, 34 insertions(+), 19 deletions(-) (limited to 'view') diff --git a/view/js/main.js b/view/js/main.js index 8c4fcdc13..1599c3a2e 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -700,10 +700,28 @@ function updateConvItems(mode,data) { updatePageItems(update_mode,data); $("#page-spinner").spin(false); in_progress = false; + justifyPhotos(); }); } + function justifyPhotos() { + 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 notify_popup_loader(notifyType) { @@ -1050,7 +1068,6 @@ function previewTheme(elm) { } $(document).ready(function() { - jQuery.timeago.settings.strings = { prefixAgo : aStr['t01'], prefixFromNow : aStr['t02'], @@ -1074,6 +1091,8 @@ $(document).ready(function() { $(".autotime").timeago(); + justifyPhotos(); + }); function zFormError(elm,x) { @@ -1089,7 +1108,7 @@ $(document).ready(function() { -$(window).scroll(function () { +$(window).scroll(function () { if(typeof buildCmd == 'function') { // This is a content page with items and/or conversations $('#more').hide(); @@ -1099,8 +1118,8 @@ $(window).scroll(function () { $('#more').css("top","400"); $('#more').show(); } - - if($(window).scrollTop() + $(window).height() > $(document).height() - 100) { + + if($(window).scrollTop() + $(window).height() == $(document).height()) { if((pageHasMoreContent) && (! loadingPage)) { $('#more').hide(); $('#no-more').hide(); @@ -1120,7 +1139,7 @@ $(window).scroll(function () { $('#more').show(); } - if($(window).scrollTop() + $(window).height() > $(document).height() - 100) { + if($(window).scrollTop() + $(window).height() == $(document).height()) { if((pageHasMoreContent) && (! loadingPage)) { $('#more').hide(); $('#no-more').hide(); diff --git a/view/php/theme_init.php b/view/php/theme_init.php index 45eb2fc1d..36504ec54 100644 --- a/view/php/theme_init.php +++ b/view/php/theme_init.php @@ -10,10 +10,13 @@ head_add_css('library/colorbox/colorbox.css'); head_add_css('view/css/conversation.css'); head_add_css('view/css/widgets.css'); +head_add_css('library/justifiedGallery/dist/css/justifiedGallery.css'); head_add_js('jquery.js'); head_add_js('jquery-migrate-1.1.1.js'); +head_add_js('library/justifiedGallery/dist/js/jquery.justifiedGallery.js'); + //head_add_js('jquery-compat.js'); head_add_js('spin.js'); head_add_js('jquery.spin.js'); diff --git a/view/tpl/photo_album.tpl b/view/tpl/photo_album.tpl index a63bff78c..b5ea14c14 100755 --- a/view/tpl/photo_album.tpl +++ b/view/tpl/photo_album.tpl @@ -1,7 +1,3 @@ -
- - {{$imgalt}} -

{{$desc}}

-
-
-
+ + {{if $desc}}{{$desc}}{{else}}{{$imgalt}}{{/if}} + diff --git a/view/tpl/photo_top.tpl b/view/tpl/photo_top.tpl index 944928f85..4a106c30d 100755 --- a/view/tpl/photo_top.tpl +++ b/view/tpl/photo_top.tpl @@ -1,7 +1,4 @@ -
- - {{$photo.alt}} - - -
+ + {{$photo.album.name}} + diff --git a/view/tpl/photos_recent.tpl b/view/tpl/photos_recent.tpl index 386979de5..8eaa208b1 100755 --- a/view/tpl/photos_recent.tpl +++ b/view/tpl/photos_recent.tpl @@ -3,7 +3,7 @@ {{$upload.0}} {{/if}} -
+
{{foreach $photos as $photo}} {{include file="photo_top.tpl"}} {{/foreach}} -- cgit v1.2.3 From d825adf4230ac20d39829150e2e7b03942d9f9c6 Mon Sep 17 00:00:00 2001 From: marijus Date: Wed, 10 Sep 2014 17:40:50 +0200 Subject: without this check we kill the directory autoload --- view/js/main.js | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'view') diff --git a/view/js/main.js b/view/js/main.js index 1599c3a2e..ae90bb272 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -706,21 +706,23 @@ function updateConvItems(mode,data) { } function justifyPhotos() { - 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; }); + 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 notify_popup_loader(notifyType) { -- cgit v1.2.3