From 6ef62a444fbcebea25cf475613d5cab0c43b58c8 Mon Sep 17 00:00:00 2001 From: Sem Date: Wed, 1 Aug 2012 18:45:25 +0200 Subject: Added support for colorbox. --- views/default/js/photos/tidypics.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'views/default/js/photos') diff --git a/views/default/js/photos/tidypics.php b/views/default/js/photos/tidypics.php index c97a1eadb..20dcc403e 100644 --- a/views/default/js/photos/tidypics.php +++ b/views/default/js/photos/tidypics.php @@ -9,8 +9,14 @@ elgg.provide('elgg.tidypics'); elgg.tidypics.init = function() { - if ($(".tidypics-lightbox").length) { - $(".tidypics-lightbox").fancybox({'type': 'image'}); + if ($.colorbox) { + $(".elgg-gallery .tidypics-lightbox").colorbox({ + onComplete: function() { + $('#cboxLoadedContent .elgg-page-topbar, #cboxLoadedContent .elgg-page-header, ' + + '#cboxLoadedContent .elgg-page-footer, #cboxLoadedContent .elgg-sidebar').css('display', 'none'); + $('#cboxLoadedContent .elgg-layout').css('background-image', 'none'); + } + }); } $("#tidypics-sort").sortable({ -- cgit v1.2.3 From 77a70ff27576649f455358b6ff18c2ad1c786f6c Mon Sep 17 00:00:00 2001 From: Sem Date: Wed, 1 Aug 2012 20:32:15 +0200 Subject: Ajax views was messy and wasn't resizing well, moved to only images. --- start.php | 2 +- views/default/js/photos/tidypics.php | 14 ++++++++------ views/default/object/image/summary.php | 2 +- views/default/river/object/album/create.php | 2 +- views/default/river/object/image/create.php | 2 +- views/default/river/object/tidypics_batch/create.php | 2 +- 6 files changed, 13 insertions(+), 11 deletions(-) (limited to 'views/default/js/photos') diff --git a/start.php b/start.php index 7de36b29f..b47b71d81 100644 --- a/start.php +++ b/start.php @@ -44,7 +44,7 @@ function tidypics_init() { $js = elgg_get_simplecache_url('js', 'photos/uploading'); elgg_register_simplecache_view('js/photos/uploading'); elgg_register_js('tidypics:uploading', $js, 'footer'); - + elgg_register_js('swfobject', 'mod/tidypics/vendors/uploadify/swfobject.js', 'footer'); elgg_register_js('jquery.uploadify-tp', 'mod/tidypics/vendors/uploadify/jquery.uploadify.v2.1.1.min.js', 'footer'); diff --git a/views/default/js/photos/tidypics.php b/views/default/js/photos/tidypics.php index 20dcc403e..869089850 100644 --- a/views/default/js/photos/tidypics.php +++ b/views/default/js/photos/tidypics.php @@ -9,12 +9,14 @@ elgg.provide('elgg.tidypics'); elgg.tidypics.init = function() { - if ($.colorbox) { - $(".elgg-gallery .tidypics-lightbox").colorbox({ - onComplete: function() { - $('#cboxLoadedContent .elgg-page-topbar, #cboxLoadedContent .elgg-page-header, ' + - '#cboxLoadedContent .elgg-page-footer, #cboxLoadedContent .elgg-sidebar').css('display', 'none'); - $('#cboxLoadedContent .elgg-layout').css('background-image', 'none'); + if (elgg.ui.lightbox) { + $('.elgg-lightbox, .elgg-lightbox-photo').colorbox({ + href: function() { + var guid = (new RegExp("photos/image/[0-9]+", 'i')).exec($(this).attr('href')).toString().substr("photos/image/".length); + return elgg.config.wwwroot + "photos/thumbnail/" + guid + "/large"; + }, + title: function() { + return '

'+ $(this).find('img').attr('title') +'

- '+ elgg.echo('comments') +''; } }); } diff --git a/views/default/object/image/summary.php b/views/default/object/image/summary.php index 34a726353..0fa03cbe8 100644 --- a/views/default/object/image/summary.php +++ b/views/default/object/image/summary.php @@ -23,7 +23,7 @@ $body = elgg_view_entity_icon($image, 'small', array( 'img_class' => 'tidypics-photo', 'encode_text' => false, 'is_trusted' => true, - 'link_class' => 'tidypics-lightbox elgg-lightbox', + 'link_class' => 'tidypics-lightbox elgg-lightbox-photo', )); /* diff --git a/views/default/river/object/album/create.php b/views/default/river/object/album/create.php index 2269b2eb6..29620041f 100644 --- a/views/default/river/object/album/create.php +++ b/views/default/river/object/album/create.php @@ -26,7 +26,7 @@ if ($album_river_view == "cover") { foreach($images as $image) { $attachments .= '
  • '; $attachments .= elgg_view_entity_icon($image, 'tiny', array( - 'link_class' => 'tidypics-lightbox elgg-lightbox', + 'link_class' => 'tidypics-lightbox elgg-lightbox-photo', )); $attachments .= '
  • '; } diff --git a/views/default/river/object/image/create.php b/views/default/river/object/image/create.php index c34e6b309..6b68b4d68 100644 --- a/views/default/river/object/image/create.php +++ b/views/default/river/object/image/create.php @@ -25,7 +25,7 @@ $image_link = elgg_view('output/url', array( 'href' => $image->getURL(), 'text' => $image->getTitle(), 'is_trusted' => true, - 'class' => 'elgg-lightbox', + 'class' => 'elgg-lightbox-photo', )); $album_link = elgg_view('output/url', array( diff --git a/views/default/river/object/tidypics_batch/create.php b/views/default/river/object/tidypics_batch/create.php index 3908f824d..b97c853a3 100644 --- a/views/default/river/object/tidypics_batch/create.php +++ b/views/default/river/object/tidypics_batch/create.php @@ -46,7 +46,7 @@ if (count($images)) { foreach($images as $image) { $attachments .= '
  • '; $attachments .= elgg_view_entity_icon($image, 'tiny', array( - 'link_class' => 'tidypics-lightbox elgg-lightbox', + 'link_class' => 'tidypics-lightbox elgg-lightbox-photo', )); $attachments .= '
  • '; } -- cgit v1.2.3 From 3ef058394574c630726c955ba2a54a63df453d08 Mon Sep 17 00:00:00 2001 From: Sem Date: Wed, 1 Aug 2012 21:13:28 +0200 Subject: Fixed image full view lightbox. --- views/default/js/photos/tidypics.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'views/default/js/photos') diff --git a/views/default/js/photos/tidypics.php b/views/default/js/photos/tidypics.php index 869089850..1ff7b2c40 100644 --- a/views/default/js/photos/tidypics.php +++ b/views/default/js/photos/tidypics.php @@ -12,8 +12,12 @@ elgg.tidypics.init = function() { if (elgg.ui.lightbox) { $('.elgg-lightbox, .elgg-lightbox-photo').colorbox({ href: function() { - var guid = (new RegExp("photos/image/[0-9]+", 'i')).exec($(this).attr('href')).toString().substr("photos/image/".length); - return elgg.config.wwwroot + "photos/thumbnail/" + guid + "/large"; + if ((new RegExp("photos/image/[0-9]+", 'i')).test($(this).attr('href'))) { + var guid = (new RegExp("photos/image/[0-9]+", 'i')).exec($(this).attr('href')).toString().substr("photos/image/".length); + return elgg.config.wwwroot + "photos/thumbnail/" + guid + "/large"; + } else { + return $(this).attr('href'); + } }, title: function() { return '

    '+ $(this).find('img').attr('title') +'

    - '+ elgg.echo('comments') +''; -- cgit v1.2.3