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 li',
function(e) {
13 if (!$(e.target).is(
'a')) {
14 $(
this).stop().fadeOut(
'fast');
18 $(
'.elgg-system-messages li').animate({opacity: 0.9}, 6000);
19 $(
'.elgg-system-messages li.elgg-state-success').fadeOut(
'slow');
24 popup.bind($(
'[rel="popup"]'));
27 $(
document).
on(
'click',
'.elgg-menu-page .elgg-menu-parent',
elgg.ui.toggleMenu);
29 $(
document).
on(
'click',
'*[data-confirm], .elgg-requires-confirmation',
elgg.ui.requiresConfirmation);
30 if ($(
'.elgg-requires-confirmation').length > 0) {
31 elgg.deprecated_notice(
'Use of .elgg-requires-confirmation is deprecated by data-confirm',
'1.10');
34 $(
'.elgg-autofocus').focus();
35 if ($(
'.elgg-autofocus').length > 0) {
36 elgg.deprecated_notice(
'Use of .elgg-autofocus is deprecated by html5 autofocus', 1.9);
39 elgg.ui.initAccessInputs();
42 var elementId =
elgg.getSelectorFromUrlFragment(
document.URL);
43 $(elementId).addClass(
'elgg-state-highlight');
45 elgg.ui.initDatePicker();
47 elgg.ui.registerTogglableMenuItems(
'add-friend',
'remove-friend');
63 elgg.ui.toggles =
function(event) {
64 event.preventDefault();
66 selector = $this.data().toggleSelector;
71 selector = $this.attr(
'href');
74 var $elements = $(selector);
76 $this.toggleClass(
'elgg-state-active');
78 $elements.each(
function(
index, elem) {
80 if ($elem.data().toggleSlide !=
false) {
81 $elem.slideToggle(
'medium');
87 $this.trigger(
'elgg_ui_toggle', [{
88 $toggled_elements: $elements
110 elgg.ui.popupOpen =
function(event) {
112 elgg.deprecated_notice(
'elgg.ui.popupOpen() has been deprecated and should not be called directly. Use elgg/popup AMD module instead',
'2.2');
114 event.preventDefault();
115 event.stopPropagation();
127 elgg.ui.popupClose =
function(event) {
129 elgg.deprecated_notice(
'elgg.ui.popupClose() has been deprecated and should not be called directly. Use elgg/popup AMD module instead',
'2.2');
142 elgg.ui.toggleMenu =
function(event) {
143 $(
this).siblings().slideToggle(
'medium');
144 $(
this).toggleClass(
'elgg-menu-closed elgg-menu-opened');
145 event.preventDefault();
154 elgg.ui.initHoverMenu =
function(parent) {
161 function loadMenu(mac) {
162 var $all_placeholders = $(
".elgg-menu-hover[rel='" + mac +
"']");
165 var $ul = $all_placeholders.filter(
'[data-elgg-menu-data]');
171 elgg.get(
'ajax/view/navigation/menu/user_hover/contents', {
172 data: $ul.data(
'elggMenuData'),
176 $all_placeholders.removeClass(
'elgg-ajax-loader')
177 .html($(data).children());
188 $(parent).
on(
'mouseover',
".elgg-avatar",
function() {
189 $(
this).children(
".elgg-icon-hover-menu").show();
191 .
on(
'mouseout',
'.elgg-avatar',
function() {
192 $(
this).children(
".elgg-icon-hover-menu").hide();
197 $(
document).
on(
'click',
".elgg-avatar > .elgg-icon-hover-menu",
function(e) {
201 var $placeholder = $icon.parent().find(
".elgg-menu-hover.elgg-ajax-loader");
203 if ($placeholder.length) {
204 loadMenu($placeholder.attr(
"rel"));
208 var $hovermenu = $icon.data(
'hovermenu') || null;
211 $hovermenu = $icon.parent().find(
".elgg-menu-hover");
212 $icon.data(
'hovermenu', $hovermenu);
216 if ($hovermenu.is(
':visible')) {
218 popup.close($hovermenu);
220 popup.open($icon, $hovermenu, {
222 'at':
'right-15px bottom',
223 'of': $icon.closest(
".elgg-avatar"),
224 'collision':
'fit fit' 238 elgg.ui.requiresConfirmation =
function(e) {
239 var confirmText = $(
this).data(
'confirm') ||
elgg.echo(
'question:areyousure');
240 if (!confirm(confirmText)) {
255 elgg.ui.loginHandler =
function(hook,
type, params, options) {
256 if (params.target.attr(
'id') ==
'login-dropdown-box') {
257 options.my =
'right top';
258 options.at =
'right bottom';
276 elgg.ui.initDatePicker =
function () {
277 var selector =
'.elgg-input-date:not([data-datepicker-opts])';
278 if (!$(selector).length) {
281 elgg.deprecated_notice(
'elgg.ui.initDatePicker() has been deprecated. Use input/date AMD module instead',
'2.1');
294 elgg.ui.registerTogglableMenuItems =
function(menuItemNameA, menuItemNameB) {
297 $(
document).off(
'click.togglable',
'.elgg-menu-item-' + menuItemNameA +
' a')
298 .on(
'click.togglable',
'.elgg-menu-item-' + menuItemNameA +
' a',
function() {
299 var
$menu = $(
this).closest(
'.elgg-menu');
302 elgg.ui.toggleMenuItems($menu, menuItemNameB, menuItemNameA);
305 elgg.action($(
this).attr(
'href'), {
307 if (json.system_messages.error.length) {
309 elgg.ui.toggleMenuItems($menu, menuItemNameA, menuItemNameB);
314 elgg.ui.toggleMenuItems($menu, menuItemNameA, menuItemNameB);
323 $(
document).off(
'click.togglable',
'.elgg-menu-item-' + menuItemNameB +
' a')
324 .on(
'click.togglable',
'.elgg-menu-item-' + menuItemNameB +
' a',
function() {
325 var
$menu = $(
this).closest(
'.elgg-menu');
328 elgg.ui.toggleMenuItems($menu, menuItemNameA, menuItemNameB);
331 elgg.action($(
this).attr(
'href'), {
333 if (json.system_messages.error.length) {
335 elgg.ui.toggleMenuItems($menu, menuItemNameB, menuItemNameA);
340 elgg.ui.toggleMenuItems($menu, menuItemNameB, menuItemNameA);
349 elgg.ui.toggleMenuItems =
function(
$menu, nameOfItemToShow, nameOfItemToHide) {
350 $menu.find(
'.elgg-menu-item-' + nameOfItemToShow).removeClass(
'hidden').find(
'a').focus();
351 $menu.find(
'.elgg-menu-item-' + nameOfItemToHide).addClass(
'hidden');
363 elgg.ui.initAccessInputs =
function () {
364 $(
'.elgg-input-access').each(
function () {
365 function updateMembersonlyNote() {
367 if (val != acl && val !== 0) {
369 $note.css(
'visibility',
'visible');
371 $note.css(
'visibility',
'hidden');
375 acl = $select.data(
'group-acl'),
376 $note = $(
'.elgg-input-access-membersonly', this.parentNode),
377 commentCount = $select.data(
'comment-count'),
378 originalValue = $select.data(
'original-value');
380 updateMembersonlyNote();
381 $select.change(updateMembersonlyNote);
385 $select.change(
function(e) {
386 if ($(
this).val() != originalValue) {
387 if (!confirm(
elgg.echo(
'access:comments:change', [commentCount]))) {
388 $(
this).val(originalValue);
396 elgg.register_hook_handler(
'init',
'system',
elgg.ui.init);
397 elgg.register_hook_handler(
'getOptions',
'ui.popup',
elgg.ui.loginHandler);
elgg message elgg state error
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
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
elgg message elgg state success