1 elgg.provide(
'elgg.ui');
3 elgg.ui.init =
function () {
6 $(
'.elgg-page').attr(
"onclick",
"return true");
9 elgg.ui.initHoverMenu();
12 $(document).
on(
'click',
'.elgg-system-messages .elgg-message',
function(e) {
13 if (!$(e.target).is(
'a')) {
17 $this.clearQueue().slideUp(100,
function () {
23 $(
'.elgg-page-default .elgg-system-messages .elgg-message').parent().animate({opacity: 0.9}, 6000);
24 $(
'.elgg-page-default .elgg-system-messages .elgg-message-success').parent().fadeOut(
'slow');
26 $(document).
on(
'click',
'[rel=toggle]',
elgg.ui.toggles);
28 require([
'elgg/popup'],
function(popup) {
29 popup.bind($(
'[rel="popup"]'));
32 $(document).
on(
'click',
'*[data-confirm]',
elgg.ui.requiresConfirmation);
35 var elementId =
elgg.getSelectorFromUrlFragment(document.URL);
36 $(elementId).addClass(
'elgg-state-highlight');
52 elgg.ui.toggles =
function(event) {
53 event.preventDefault();
55 selector = $this.data().toggleSelector;
60 selector = $this.attr(
'href');
63 var $elements = $(selector);
65 $this.toggleClass(
'elgg-state-active');
67 $elements.each(
function(index, elem) {
69 if ($elem.data().toggleSlide !=
false) {
70 $elem.slideToggle(
'medium');
76 $this.trigger(
'elgg_ui_toggle', [{
77 $toggled_elements: $elements
87 elgg.ui.initHoverMenu =
function(parent) {
95 function loadMenu(mac, callback) {
96 var $all_placeholders = $(
".elgg-menu-hover[rel='" + mac +
"']");
99 var $ul = $all_placeholders.filter(
'[data-elgg-menu-data]');
105 require([
'elgg/Ajax'],
function(Ajax) {
106 var
ajax =
new Ajax();
107 ajax.view(
'navigation/menu/user_hover/contents', {
108 data: $ul.data(
'elggMenuData'),
109 success:
function(data) {
112 $all_placeholders.html($(data));
115 if (typeof callback ===
'function') {
119 complete:
function() {
120 $all_placeholders.removeAttr(
'data-menu-placeholder');
131 function showPopup(
$icon) {
133 var $hovermenu =
$icon.data(
'hovermenu') || null;
136 $hovermenu =
$icon.parent().find(
".elgg-menu-hover");
137 $icon.data(
'hovermenu', $hovermenu);
140 require([
'elgg/popup'],
function(popup) {
141 if ($hovermenu.is(
':visible')) {
143 popup.close($hovermenu);
145 popup.open(
$icon, $hovermenu, {
148 'of':
$icon.closest(
".elgg-avatar"),
149 'collision':
'fit fit' 160 $(document).
on(
'click',
".elgg-avatar-menu > a",
function(e) {
165 var $placeholder = $icon.parent().find(
".elgg-menu-hover[data-menu-placeholder]");
167 if ($placeholder.length) {
168 loadMenu($placeholder.attr(
"rel"),
function() {
184 elgg.ui.requiresConfirmation =
function(e) {
185 var confirmText = $(
this).data(
'confirm') ||
elgg.echo(
'question:areyousure');
186 if (!confirm(confirmText)) {
189 e.stopImmediatePropagation();
201 elgg.ui.registerTogglableMenuItems =
function(menuItemNameA, menuItemNameB) {
202 require([
'navigation/menu/elements/item_toggle'],
function() {
203 menuItemNameA = menuItemNameA.replace(
'_',
'-');
204 menuItemNameB = menuItemNameB.replace(
'_',
'-');
206 $(
'.elgg-menu-item-' + menuItemNameA +
' a').not(
'[data-toggle]').attr(
'data-toggle', menuItemNameB);
207 $(
'.elgg-menu-item-' + menuItemNameB +
' a').not(
'[data-toggle]').attr(
'data-toggle', menuItemNameA);
211 elgg.register_hook_handler(
'init',
'system',
elgg.ui.init);
elgg ajax
Wrapper function for jQuery.ajax which ensures that the url being called is relative to the elgg site...
elgg require
Throw an error if the required package isn't present.
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