Elgg  Version 1.12
lightbox.php
Go to the documentation of this file.
1 <?php
34 ?>
35 //<script>
36 
37 elgg.provide('elgg.ui.lightbox');
38 
39 <?php echo elgg_view('js/lightbox/settings'); ?>
40 
44 elgg.ui.lightbox.init = function() {
45  function registerDeprecationError() {
46  elgg.register_error("fancybox lightbox has been replaced by colorbox", 9999999999999);
47  }
48 
49  elgg.ui.lightbox.bind(".elgg-lightbox");
50  elgg.ui.lightbox.bind(".elgg-lightbox-photo", {photo: true});
51 
52  if (typeof $.fancybox === 'undefined') {
53  $.fancybox = {
54  // error message for firefox users
55  __noSuchMethod__ : registerDeprecationError,
56  close: function () {
57  registerDeprecationError();
58  $.colorbox.close();
59  }
60  };
61  // support $().fancybox({type:'image'})
62  $.fn.fancybox = function (arg) {
63  registerDeprecationError();
64  if (arg.type === 'image') {
65  arg.photo = true;
66  }
67  this.colorbox(arg);
68  return this;
69  };
70  }
71 };
72 
79 elgg.ui.lightbox.bind = function (selector, opts) {
80  if (!$.isPlainObject(opts)) {
81  opts = {};
82  }
83 
84  // merge opts into defaults
85  opts = $.extend({}, elgg.ui.lightbox.getSettings(), opts);
86 
87  $(document).on('click', selector, function (e) {
88  var $this = $(this),
89  href = $this.prop('href') || $this.prop('src'),
90  dataOpts = $this.data('colorboxOpts');
91  // Note: data-colorbox was reserved https://github.com/jackmoore/colorbox/issues/435
92 
93  if (!$.isPlainObject(dataOpts)) {
94  dataOpts = {};
95  }
96 
97  if (!dataOpts.href && href) {
98  dataOpts.href = href;
99  }
100 
101  // merge data- options into opts
102  $.colorbox($.extend({}, opts, dataOpts));
103  e.preventDefault();
104  });
105 };
106 
111 elgg.ui.lightbox.close = function() {
112  $.colorbox.close();
113 };
114 
115 elgg.register_hook_handler('init', 'system', elgg.ui.lightbox.init);
116 
117 <?php
118 
120 $js_path = "{$js_path}vendors/jquery/colorbox/jquery.colorbox-min.js";
121 readfile($js_path);
elgg
Definition: install.js:23
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
elgg extend
Merges two or more objects together and returns the result.
Definition: elgglib.js:42
elgg isPlainObject
Check if the value is a "plain" object (i.e., created by {} or new Object())
Definition: elgglib.js:75
elgg echo
Translates a string.
Definition: languages.js:48
elgg_view($view, $vars=array(), $bypass=false, $ignored=false, $viewtype= '')
Return a parsed view.
Definition: views.php:340
Bundled plugins(the contents of the"/mod"directory) are available only under the GPLv2 license.The remainder of the project is available under either MIT or GPLv2.Both licenses can be found below.More info and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed on
Definition: LICENSE.txt:96