Elgg  Version 4.3
ajax-append.js
Go to the documentation of this file.
1 
4 define(['jquery', 'elgg/Ajax', 'elgg/system_messages'], function ($, Ajax, system_messages) {
5  // register click event
6  $(document).on('click', '.elgg-list-container-ajax-append .elgg-pagination a', function (event) {
7  event.preventDefault();
8 
9  var $link = $(this);
10 
11  var href = $link.attr('href');
12  var position = $link.closest('li').hasClass('elgg-pagination-previous') ? 'before' : 'after';
13  var $target = $link.closest('.elgg-list-container');
14  var $pagination = $link.closest('.elgg-pagination');
15 
16  $pagination.html('<div class="elgg-ajax-loader"></div>');
17 
18  var ajax = new Ajax(false);
19 
20  ajax.path(href, {
21  data: {
22  _elgg_ajax_list: 1, // ask for quick return from elgg_view_page()
23  },
24  success: function(result) {
25  var id_selector = '#' + $target.attr('id');
26 
27  $new_html = $(result).find(id_selector).addBack(id_selector);
28  if ($new_html.length) {
29  var list_items = $new_html.find('> .elgg-list').html();
30  var $target_list = $target.find('> .elgg-list');
31 
32  $pagination.replaceWith($new_html.find('> .elgg-pagination-' + position))
33  if (position === 'before') {
34  $target_list.prepend(list_items);
35  } else {
36  $target_list.append(list_items);
37  }
38 
39  $target_list.trigger('change');
40  } else {
41  require(['elgg/i18n'], function(i18n) {
42  system_messages.error(i18n.echo('ajax:pagination:no_data'));
43  });
44  }
45  },
46  });
47  });
48 });
if(!$comment instanceof\ElggComment||!$comment->canEdit()) $target
Definition: edit.php:13
$pagination
Definition: gallery.php:20
if(!$item instanceof ElggEntity) $link
Definition: container.php:16
elgg require
Throw an error if the required package isn&#39;t present.
Definition: deprecated.js:176
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(event){freezePlugins();event.preventDefault();var ajax=new Ajax();ajax.action(this.href).done(function(){ajax.path('admin_plugins_refresh').done(function(output){$('#elgg-plugin-list').html(output.list);$('.elgg-sidebar').html(output.sidebar);$(".elgg-admin-plugins-categories > li.elgg-state-selected > a").trigger('click');initPluginReordering();unfreezePlugins();});}).fail(function(){location.reload();});};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