diff options
author | Sem <sembrestels@riseup.net> | 2013-11-09 16:23:42 +0100 |
---|---|---|
committer | Sem <sembrestels@riseup.net> | 2013-11-09 16:23:42 +0100 |
commit | 1f40407cb2d2f0edfc4cc5346f332f5c6adab022 (patch) | |
tree | 2f1e4a4cab88102e372351c0dc4cbfade526db90 /mod/colorbox/views/default/js/lightbox.php | |
parent | f448cd91f9ecebea37daf40aada2fa1a20200817 (diff) | |
parent | fb61398a422ef6bd25028f6f47c008738e8fea8c (diff) | |
download | elgg-1f40407cb2d2f0edfc4cc5346f332f5c6adab022.tar.gz elgg-1f40407cb2d2f0edfc4cc5346f332f5c6adab022.tar.bz2 |
Add 'mod/colorbox/' from commit 'fb61398a422ef6bd25028f6f47c008738e8fea8c'
git-subtree-dir: mod/colorbox
git-subtree-mainline: f448cd91f9ecebea37daf40aada2fa1a20200817
git-subtree-split: fb61398a422ef6bd25028f6f47c008738e8fea8c
Diffstat (limited to 'mod/colorbox/views/default/js/lightbox.php')
-rw-r--r-- | mod/colorbox/views/default/js/lightbox.php | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/mod/colorbox/views/default/js/lightbox.php b/mod/colorbox/views/default/js/lightbox.php new file mode 100644 index 000000000..732092e2b --- /dev/null +++ b/mod/colorbox/views/default/js/lightbox.php @@ -0,0 +1,81 @@ +<?php +/** + * Colorbox -- Stylesheet + * + * Used as a view because we need to pass a full URL to AlphaImageLoader. + * + * @package Lorea + * @subpackage Colorbox + * + * Copyright 2011-2012 Lorea Faeries <federation@lorea.org> + * + * This program is free software: you can redistribute it and/or + * modify it under the terms of the GNU Affero General Public License + * as published by the Free Software Foundation, either version 3 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public + * License along with this program. If not, see + * <http://www.gnu.org/licenses/>. + * + * Usage + * Apply the class elgg-lightbox to links. + * + * Advanced Usage + * Elgg is distributed with the Colorbox jQuery library. Please go to + * http://www.jacklmoore.com/colorbox for more information on the options of this lightbox. + * + * Overriding + * In a plugin, override this view and override the registration for the + * lightbox JavaScript and CSS (@see elgg_views_boot()). + * + * @todo add support for passing options: $('#myplugin-lightbox').elgg.ui.lightbox(options); + */ + +?> + +/** + * 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); + +<?php + +$js_path = elgg_get_plugins_path(); +$js_path = "{$js_path}colorbox/vendors/jquery/colorbox/colorbox/jquery.colorbox-min.js"; +include $js_path; |