Elgg  Version 5.1
elgg.js.php
Go to the documentation of this file.
1 <?php
6 echo elgg_view('core/js/elgglib.js');
7 
8 foreach (_elgg_get_js_site_data() as $expression => $value) {
9  $value = json_encode($value);
10  echo "{$expression} = {$value};" . PHP_EOL;
11 }
12 ?>
13 
14 // page data overrides site data
15 elgg.data = $.extend(true, {}, elgg.data, elgg._data);
16 delete elgg._data;
17 
18 // jQuery and UI must be loaded sync in 2.x but modules should depend on these AMD modules
19 define('jquery', function () {
20  return jQuery;
21 });
22 
23 define('elgg', ['jquery'], function($) {
24 
25  // @todo we need better documentation for this hack
26  // iOS Hover Event Class Fix
27  $('.elgg-page').attr('onclick', 'return true');
28 
35  function requiresConfirmation(e) {
36  var confirmText = $(this).data('confirm');
37  if (!confirm(confirmText)) {
38  e.preventDefault();
39  e.stopPropagation();
40  e.stopImmediatePropagation();
41  return false;
42  }
43  };
44 
45  $(document).on('click', '*[data-confirm]', requiresConfirmation);
46 
47  document.addEventListener('scroll', function() {
48  if ($(document).scrollTop() > 1000) {
49  $('#elgg-scroll-to-top').show();
50  } else {
51  $('#elgg-scroll-to-top').hide();
52  }
53  }, { passive: true });
54 
55  return elgg;
56 });
57 
58 require(['elgg']); // Forces the define() function to always run
59 
60 // Process queue. We have to wait until now because many modules depend on 'elgg' and we can't load
61 // it asynchronously.
62 if (!window._require_queue) {
63  if (window.console) {
64  console.log('Elgg\'s require() shim is not defined. Do not override the view "page/elements/head".');
65  }
66 } else {
67  while (_require_queue.length) {
68  require.apply(null, _require_queue.shift());
69  }
70  delete window._require_queue;
71 }
72 
73 require(['elgg/lightbox', 'elgg/security']);
_elgg_get_js_site_data()
Get the site data to be merged into "elgg" in elgg.js.
Definition: views.php:1379
_require_queue
Definition: head.php:78
$value
Definition: generic.php:51
elgg_view(string $view, array $vars=[], string $viewtype= '')
Return a parsed view.
Definition: views.php:177
define(['jquery', 'elgg/spinner', 'elgg/Ajax', 'elgg/system_messages', 'elgg/security', 'elgg/i18n', 'jquery-ui/widgets/sortable'], function($, spinner, Ajax, system_messages, security, i18n){function freezePlugins(){$('#elgg-plugin-list-cover').css('display', 'block');};function unfreezePlugins(){$('#elgg-plugin-list-cover').css('display', 'none');};function initPluginReordering(){$('#elgg-plugin-list >.elgg-list-container > ul').sortable({items: 'li:has(>.elgg-state-draggable)', handle: '.elgg-body', forcePlaceholderSize:true, placeholder: 'elgg-plugin-placeholder', opacity:0.8, revert:500, stop:movePlugin});};function toggleSinglePlugin(){spinner.start();freezePlugins();};function toggleAllPlugins(event){event.preventDefault();if(!confirm(i18n.echo('question:areyousure'))){return;}freezePlugins();var guids=[], state=$(this).data('desiredState'), find_state=state== 'active'? 'inactive': 'active';$('.elgg-plugin.elgg-state-'+find_state+ ':visible').each(function(){var guid=$(this).data('guid');if(guid){guids.push(guid);}});if(!guids.length){system_messages.error(i18n.echo('admin:plugins:already:'+state));unfreezePlugins();return;}spinner.start();var $form=$('< form method="post"/>');$form.prop('action', security.addToken(this.href));$form.append('< input type="hidden"name="guids"value="' + guids.join(',') + '"/>');$form.appendTo("body").submit();};function movePlugin(e, ui){freezePlugins();var pluginGuid=ui.item.attr('id');pluginGuid=pluginGuid.replace('elgg-object-', '');var ajax=new Ajax();ajax.action('admin/plugins/set_priority',{data:{plugin_guid:pluginGuid, priority:ui.item.index()+1}, success:function(){unfreezePlugins();}});};function filterPluginCategory(event){event.preventDefault();$(".elgg-admin-plugins-categories > li").removeClass("elgg-state-selected");$(".elgg-plugin").hide();$(".elgg-plugin-category-"+$(this).attr("rel")).show();$(this).closest('li').addClass("elgg-state-selected");};initPluginReordering();$(document).on('click', '.elgg-admin-plugins-categories a', filterPluginCategory);$(document).on('click', '.elgg-plugins-toggle', toggleAllPlugins);$(document).on('click', '.elgg-plugin-state-change', toggleSinglePlugin);})
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
var elgg
Definition: elgglib.js:4