123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122 |
- <?php
- ?>
- elgg.provide('elgg.ui.lightbox');
- <?php echo elgg_view('js/lightbox/settings'); ?>
- elgg.ui.lightbox.init = function() {
- function registerDeprecationError() {
- elgg.register_error("fancybox lightbox has been replaced by colorbox", 9999999999999);
- }
- elgg.ui.lightbox.bind(".elgg-lightbox");
- elgg.ui.lightbox.bind(".elgg-lightbox-photo", {photo: true});
- if (typeof $.fancybox === 'undefined') {
- $.fancybox = {
-
- __noSuchMethod__ : registerDeprecationError,
- close: function () {
- registerDeprecationError();
- $.colorbox.close();
- }
- };
-
- $.fn.fancybox = function (arg) {
- registerDeprecationError();
- if (arg.type === 'image') {
- arg.photo = true;
- }
- this.colorbox(arg);
- return this;
- };
- }
- };
- elgg.ui.lightbox.bind = function (selector, opts) {
- if (!$.isPlainObject(opts)) {
- opts = {};
- }
-
- opts = $.extend({}, elgg.ui.lightbox.getSettings(), opts);
- $(document).on('click', selector, function (e) {
- var $this = $(this),
- href = $this.prop('href') || $this.prop('src'),
- dataOpts = $this.data('colorboxOpts');
-
- if (!$.isPlainObject(dataOpts)) {
- dataOpts = {};
- }
- if (!dataOpts.href && href) {
- dataOpts.href = href;
- }
-
- $.colorbox($.extend({}, opts, dataOpts));
- e.preventDefault();
- });
- };
- elgg.ui.lightbox.close = function() {
- $.colorbox.close();
- };
- elgg.register_hook_handler('init', 'system', elgg.ui.lightbox.init);
- <?php
- $js_path = elgg_get_config('path');
- $js_path = "{$js_path}vendors/jquery/colorbox/jquery.colorbox-min.js";
- readfile($js_path);
|