Elgg  Version 5.1
default.js
Go to the documentation of this file.
1 
4 define(['jquery'], function ($) {
5 
12  function loadMenu(mac, callback) {
13  var $all_placeholders = $(".elgg-menu-hover[data-menu-id='" + mac + "']");
14 
15  if (!$all_placeholders.length) {
16  return;
17  }
18 
19  require(['elgg/Ajax'], function(Ajax) {
20  var ajax = new Ajax();
21  ajax.view('navigation/menu/user_hover/contents', {
22  data: $all_placeholders.eq(0).data('elggMenuData'),
23  success: function(data) {
24  if (data) {
25  // replace all existing placeholders with new menu
26  $all_placeholders.html($(data));
27  }
28 
29  if (typeof callback === 'function') {
30  callback();
31  }
32  },
33  complete: function() {
34  $all_placeholders.removeAttr('data-menu-id data-elgg-menu-data');
35  }
36  });
37  });
38  };
39 
45  function showPopup($icon) {
46  // check if we've attached the menu to this element already
47  var $hovermenu = $icon.data('hovermenu') || null;
48 
49  if (!$hovermenu) {
50  $hovermenu = $icon.parent().find('.elgg-menu-hover');
51  $icon.data('hovermenu', $hovermenu);
52  }
53 
54  $hovermenu.on('open', function() {
55  $hovermenu.find('a:first').focus();
56  });
57 
58  require(['elgg/popup'], function(popup) {
59  if ($hovermenu.is(':visible')) {
60  // close hovermenu if arrow is clicked & menu already open
61  popup.close($hovermenu);
62  } else {
63  popup.open($icon, $hovermenu, {
64  'my': 'left top',
65  'at': 'left top',
66  'of': $icon.closest('.elgg-avatar'),
67  'collision': 'fit fit'
68  });
69  }
70  });
71  };
72 
73  // avatar contextual menu
74  $(document).on('click', '.elgg-avatar-menu > a', function(e) {
75  e.preventDefault();
76 
77  var $icon = $(this);
78 
79  var $placeholder = $icon.parent().find('.elgg-menu-hover[data-menu-id]');
80 
81  if ($placeholder.length) {
82  loadMenu($placeholder.attr('data-menu-id'), function() {
83  showPopup($icon);
84  });
85  } else {
86  showPopup($icon);
87  }
88  });
89 });
define(['jquery'], function($){function loadMenu(mac, callback){var $all_placeholders=$(".elgg-menu-hover[data-menu-id='"+mac+"']");if(!$all_placeholders.length){return;}require(['elgg/Ajax'], function(Ajax){var ajax=new Ajax();ajax.view('navigation/menu/user_hover/contents',{data:$all_placeholders.eq(0).data('elggMenuData'), success:function(data){if(data){$all_placeholders.html($(data));}if(typeof callback=== 'function'){callback();}}, complete:function(){$all_placeholders.removeAttr('data-menu-id data-elgg-menu-data');}});});};function showPopup($icon){var $hovermenu=$icon.data('hovermenu')||null;if(!$hovermenu){$hovermenu=$icon.parent().find('.elgg-menu-hover');$icon.data('hovermenu', $hovermenu);}$hovermenu.on('open', function(){$hovermenu.find('a:first').focus();});require(['elgg/popup'], function(popup){if($hovermenu.is(':visible')){popup.close($hovermenu);}else{popup.open($icon, $hovermenu,{'my': 'left top','at': 'left top','of':$icon.closest('.elgg-avatar'),'collision': 'fit fit'});}});};$(document).on('click', '.elgg-avatar-menu > a', function(e){e.preventDefault();var $icon=$(this);var $placeholder=$icon.parent().find('.elgg-menu-hover[data-menu-id]');if($placeholder.length){loadMenu($placeholder.attr('data-menu-id'), function(){showPopup($icon);});}else{showPopup($icon);}});})
Handles user hover menu.
if(function_exists('apache_get_version')) $icon
Definition: generic.php:49
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