Elgg  Version 2.3
Functions | Variables
ui.js File Reference

Go to the source code of this file.

Functions

elgg provide ('elgg.ui')
 
elgg register_hook_handler ('init', 'system', elgg.ui.init)
 

Variables

elgg ui init
 
elgg ui toggles
 Toggles an element based on clicking a separate element. More...
 
elgg ui popupOpen
 Pops up an element based on clicking a separate element. More...
 
elgg ui popupClose
 Catches clicks that aren't in a popup and closes all popups. More...
 
elgg ui toggleMenu
 Toggles a child menu when the parent is clicked. More...
 
elgg ui initHoverMenu
 Initialize the hover menu. More...
 
elgg ui requiresConfirmation
 Calls a confirm() and returns false if denied. More...
 
elgg ui loginHandler
 Repositions the login popup. More...
 
elgg ui initDatePicker
 Initialize the date picker. More...
 
elgg ui registerTogglableMenuItems
 This function registers two menu items that are actions that are the opposite of each other and ajaxifies them. More...
 
elgg ui toggleMenuItems
 
elgg ui initAccessInputs
 Initialize input/access for dynamic display of members only warning. More...
 

Function Documentation

elgg provide ( 'elgg.ui'  )
elgg register_hook_handler ( 'init ,
'system ,
elgg.ui.  init 
)

Variable Documentation

elgg ui init

Definition at line 3 of file ui.js.

elgg ui initAccessInputs

Initialize input/access for dynamic display of members only warning.

If a select.elgg-input-access is accompanied by a note (.elgg-input-access-membersonly), then hide the note when the select value is PRIVATE or group members.

Returns
void
Since
1.9.0

Definition at line 363 of file ui.js.

elgg ui initDatePicker
Initial value:
= function () {
var selector = '.elgg-input-date:not([data-datepicker-opts])';
if (!$(selector).length) {
return;
}
elgg.deprecated_notice('elgg.ui.initDatePicker() has been deprecated. Use input/date AMD module instead', '2.1');
require(['input/date'], function (datepicker) {
datepicker.init(selector);
});
}
elgg
Definition: install.js:23
ui datepicker
Definition: admin.css.php:639
elgg require
Throw an error if the required package isn't present.
Definition: elgglib.js:164

Initialize the date picker.

Uses the class .elgg-input-date as the selector.

If the class .elgg-input-timestamp is set on the input element, the onSelect method converts the date text to a unix timestamp in seconds. That value is stored in a hidden element indicated by the id on the input field.

Returns
void jqueryui.datepicker

Definition at line 276 of file ui.js.

elgg ui initHoverMenu

Initialize the hover menu.

Parameters
{Object}parent
Returns
void

Definition at line 154 of file ui.js.

elgg ui loginHandler
Initial value:
= function(hook, type, params, options) {
if (params.target.attr('id') == 'login-dropdown-box') {
options.my = 'right top';
options.at = 'right bottom';
return options;
}
return null;
}
list style type
Definition: admin.css.php:808

Repositions the login popup.

Parameters
{String}hook 'getOptions'
{String}type 'ui.popup'
{Object}params An array of info about the target and source.
{Object}options Options to pass to
Returns
{Object}

Definition at line 255 of file ui.js.

elgg ui popupClose
Initial value:
= function(event) {
elgg.deprecated_notice('elgg.ui.popupClose() has been deprecated and should not be called directly. Use elgg/popup AMD module instead', '2.2');
require(['elgg/popup'], function(popup) {
popup.close();
});
}
elgg
Definition: install.js:23
elgg module popup
Definition: admin.css.php:355
elgg require
Throw an error if the required package isn't present.
Definition: elgglib.js:164

Catches clicks that aren't in a popup and closes all popups.

Definition at line 127 of file ui.js.

elgg ui popupOpen
Initial value:
= function(event) {
elgg.deprecated_notice('elgg.ui.popupOpen() has been deprecated and should not be called directly. Use elgg/popup AMD module instead', '2.2');
event.preventDefault();
event.stopPropagation();
var $elem = $(this);
require(['elgg/popup'], function(popup) {
popup.open($elem);
});
}
elgg
Definition: install.js:23
elgg module popup
Definition: admin.css.php:355
elgg require
Throw an error if the required package isn't present.
Definition: elgglib.js:164

Pops up an element based on clicking a separate element.

Set the rel="popup" on the popper and set the href to target the item you want to toggle () This function emits the getOptions, ui.popup hook that plugins can register for to provide custom positioning for elements. The handler is passed the following params: targetSelector: The selector used to find the popup target: The popup jQuery element as found by the selector source: The jquery element whose click event initiated a popup. The return value of the function is used as the options object to .position(). Handles can also return false to abort the default behvior and override it with their own. {Object} event void

Definition at line 110 of file ui.js.

elgg ui registerTogglableMenuItems

This function registers two menu items that are actions that are the opposite of each other and ajaxifies them.

E.g. like/unlike, friend/unfriend, ban/unban, etc.

Note the menu item names must be given in their normalized form. So if the name is remove_friend, you should call this function with "remove-friend" instead.

Definition at line 294 of file ui.js.

elgg ui requiresConfirmation
Initial value:
= function(e) {
var confirmText = $(this).data('confirm') || elgg.echo('question:areyousure');
if (!confirm(confirmText)) {
return false;
}
}
elgg
Definition: install.js:23

Calls a confirm() and returns false if denied.

Parameters
{Object}e
Returns
void

Definition at line 238 of file ui.js.

elgg ui toggleMenu
Initial value:
= function(event) {
$(this).siblings().slideToggle('medium');
$(this).toggleClass('elgg-menu-closed elgg-menu-opened');
event.preventDefault();
}

Toggles a child menu when the parent is clicked.

Parameters
{Object}event
Returns
void

Definition at line 142 of file ui.js.

elgg ui toggleMenuItems
Initial value:
= function($menu, nameOfItemToShow, nameOfItemToHide) {
$menu.find('.elgg-menu-item-' + nameOfItemToShow).removeClass('hidden').find('a').focus();
$menu.find('.elgg-menu-item-' + nameOfItemToHide).addClass('hidden');
}
$menu
Definition: default.php:19

Definition at line 349 of file ui.js.

elgg ui toggles
Initial value:
= function(event) {
event.preventDefault();
var $this = $(this),
selector = $this.data().toggleSelector;
if (!selector) {
selector = $this.attr('href');
}
var $elements = $(selector);
$this.toggleClass('elgg-state-active');
$elements.each(function(index, elem) {
var $elem = $(elem);
if ($elem.data().toggleSlide != false) {
$elem.slideToggle('medium');
} else {
$elem.toggle();
}
});
$this.trigger('elgg_ui_toggle', [{
$toggled_elements: $elements
}]);
}
z index
Definition: admin.css.php:358

Toggles an element based on clicking a separate element.

Use rel="toggle" on the toggler element Set the href to target the item you want to toggle () or use data-toggle-selector="your_jquery_selector" to have an advanced selection method By default elements perform a slideToggle. If you want a normal toggle (hide/show) you can add data-toggle-slide="0" on the elements to prevent a slide. {Object} event void

Definition at line 63 of file ui.js.