Elgg  Version 1.9
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  // Q: why not use "colorbox"? A: https://github.com/jackmoore/colorbox/issues/435
92 
93  if (!$.isPlainObject(dataOpts)) {
94  dataOpts = {};
95  }
96 
97  // merge data- options into opts
98  $.colorbox($.extend({href: href}, opts, dataOpts));
99  e.preventDefault();
100  });
101 };
102 
107 elgg.ui.lightbox.close = function() {
108  $.colorbox.close();
109 };
110 
111 elgg.register_hook_handler('init', 'system', elgg.ui.lightbox.init);
112 
113 <?php
114 
116 $js_path = "{$js_path}vendors/jquery/colorbox/jquery.colorbox-min.js";
117 readfile($js_path);
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:43
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 photo
Definition: components.php:249
GNU GENERAL PUBLIC LICENSE June Free Software Franklin Fifth MA USA Everyone is permitted to copy and distribute verbatim copies of this license document
Definition: LICENSE.txt:4
elgg echo
Translates a string.
Definition: languages.js:43
elgg_view($view, $vars=array(), $bypass=false, $ignored=false, $viewtype= '')
Return a parsed view.
Definition: views.php:354