23 getOptions:
function (opts) {
30 current: elgg.echo(
'js:lightbox:current', [
'{current}',
'{total}']),
31 previous: elgg.echo(
'previous'),
32 next: elgg.echo(
'next'),
33 close: elgg.echo(
'close'),
34 xhrError: elgg.echo(
'error:default'),
35 imgError: elgg.echo(
'error:default'),
39 reposition: $(window).
height() > 600
42 elgg.provide(
'elgg.ui.lightbox');
45 $.extend(settings, elgg.ui.lightbox.deprecated_settings, opts);
47 $.extend(settings, opts);
50 return elgg.trigger_hook(
'getOptions',
'ui.lightbox', null, settings);
61 bind:
function (selector, opts, use_element_data) {
67 if (use_element_data ===
false) {
68 $(selector).colorbox(lightbox.getOptions(opts));
73 .off(
'click.lightbox', selector)
74 .on(
'click.lightbox', selector,
function (e) {
77 href = $this.prop(
'href') || $this.prop(
'src'),
79 dataOpts = $this.data(
'colorboxOpts'),
86 if (!dataOpts.href && href) {
91 $.extend(currentOpts, opts, dataOpts);
92 if (currentOpts.inline && currentOpts.href) {
93 currentOpts.href = elgg.getSelectorFromUrlFragment(currentOpts.href);
96 lightbox.open(currentOpts);
106 open:
function (opts) {
107 $.colorbox(lightbox.getOptions(opts));
114 close: $.colorbox.close,
120 resize: $.colorbox.resize
123 lightbox.bind(
".elgg-lightbox");
124 lightbox.bind(
".elgg-lightbox-photo", {photo:
true});
125 lightbox.bind(
".elgg-lightbox-inline", {
inline:
true});
126 lightbox.bind(
".elgg-lightbox-iframe", {iframe:
true});
elgg isPlainObject
Check if the value is a "plain" object (i.e., created by {} or new Object())
friends picker navigation li a current
elgg require
Throw an error if the required package isn't present.
GNU GENERAL PUBLIC LICENSE June Free Software Inc Franklin Fifth MA USA Everyone is permitted to copy and distribute verbatim copies of this license document
define('elgg/lightbox', function(require){var elgg=require('elgg');var $=require('jquery');require('elgg/init');require('jquery.colorbox');var lightbox={getOptions:function(opts){if(!$.isPlainObject(opts)){opts={};}var 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'), opacity:0.5, maxWidth: '100%', reposition:$(window).height() > 600};elgg.provide('elgg.ui.lightbox');if($.isPlainObject(elgg.ui.lightbox.deprecated_settings)){$.extend(settings, elgg.ui.lightbox.deprecated_settings, opts);}else{$.extend(settings, opts);}return elgg.trigger_hook('getOptions', 'ui.lightbox', null, settings);}, bind:function(selector, opts, use_element_data){if(!$.isPlainObject(opts)){opts={};}if(use_element_data===false){$(selector).colorbox(lightbox.getOptions(opts));return;}$(document).off('click.lightbox', selector).on('click.lightbox', selector, function(e){e.preventDefault();var $this=$(this), href=$this.prop('href')||$this.prop('src'), dataOpts=$this.data('colorboxOpts'), currentOpts={};if(!$.isPlainObject(dataOpts)){dataOpts={};}if(!dataOpts.href &&href){dataOpts.href=href;}$.extend(currentOpts, opts, dataOpts);if(currentOpts.inline &¤tOpts.href){currentOpts.href=elgg.getSelectorFromUrlFragment(currentOpts.href);}lightbox.open(currentOpts);});}, open:function(opts){$.colorbox(lightbox.getOptions(opts));}, close:$.colorbox.close, resize:$.colorbox.resize};lightbox.bind(".elgg-lightbox");lightbox.bind(".elgg-lightbox-photo",{photo:true});lightbox.bind(".elgg-lightbox-inline",{inline:true});lightbox.bind(".elgg-lightbox-iframe",{iframe:true});return lightbox;})
Lightbox module We use a named module and inline it in elgg.js.
ui datepicker ui datepicker next