/** * Lightbox initialization */ elgg.provide('elgg.ui.lightbox'); elgg.ui.lightbox.init = function() { $.extend($.colorbox.settings, { current: elgg.echo('js:lightbox:current', ['{current}', '{total}']), previous: elgg.echo('previous'), next: elgg.echo('next'), close: elgg.echo('close'), xhrError: elgg.echo('error:default'), imgError: elgg.echo('error:default'), }); $(".elgg-lightbox").colorbox(); $(".elgg-lightbox-photo").colorbox({photo: true}); var n = 0; $(".elgg-lightbox-gallery").each(function() { $(this).find(".elgg-lightbox, .elgg-lightbox-photo") .addClass("elgg-lightbox-" + n) .colorbox({ rel: "elgg-lightbox-" + n++, }); }); } elgg.ui.lightbox.close = function() { $.colorbox.close(); } elgg.register_hook_handler('init', 'system', elgg.ui.lightbox.init);