elgg.provide('elgg.tidypics');
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";
},
title: function() {
return '
'+ $(this).find('img').attr('title') +'
- '+ elgg.echo('comments') +'';
}
});
}
$("#tidypics-sort").sortable({
opacity: 0.7,
revert: true,
scroll: true
});
$('.elgg-form-photos-album-sort').submit(function() {
var tidypics_guids = [];
$("#tidypics-sort li").each(function(index) {
tidypics_guids.push($(this).attr('id'));
});
$('input[name="guids"]').val(tidypics_guids.toString());
});
};
elgg.register_hook_handler('init', 'system', elgg.tidypics.init);