aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2011-11-01 20:24:54 -0400
committercash <cash.costello@gmail.com>2011-11-01 20:24:54 -0400
commitc501b5b60051007f8db088c987a66a03e9934c0b (patch)
treeef9dbfe8b22629b5cf92e921eb65a0de7c4d5031 /js
parent5c0bd8a19a294f178ddd6607dd3f624ca34fa5b7 (diff)
downloadelgg-c501b5b60051007f8db088c987a66a03e9934c0b.tar.gz
elgg-c501b5b60051007f8db088c987a66a03e9934c0b.tar.bz2
Fixes #4022 made JS lib a little more consistent
Diffstat (limited to 'js')
-rw-r--r--js/lib/ui.js45
1 files changed, 22 insertions, 23 deletions
diff --git a/js/lib/ui.js b/js/lib/ui.js
index 16ef2dc96..c26cbe389 100644
--- a/js/lib/ui.js
+++ b/js/lib/ui.js
@@ -14,17 +14,13 @@ elgg.ui.init = function () {
$('[rel=toggle]').live('click', elgg.ui.toggles);
- $('[rel=popup]').live('click', elgg.ui.popsUp);
+ $('[rel=popup]').live('click', elgg.ui.popupOpen);
$('.elgg-menu-page .elgg-menu-parent').live('click', elgg.ui.toggleMenu);
$('.elgg-requires-confirmation').live('click', elgg.ui.requiresConfirmation);
$('.elgg-autofocus').focus();
-
- if ($('.elgg-input-date').length) {
- elgg.ui.initDatePicker();
- }
};
/**
@@ -63,7 +59,7 @@ elgg.ui.toggles = function(event) {
* @param {Object} event
* @return void
*/
-elgg.ui.popsUp = function(event) {
+elgg.ui.popupOpen = function(event) {
event.preventDefault();
event.stopPropagation();
@@ -183,7 +179,7 @@ elgg.ui.initHoverMenu = function(parent) {
var $hovermenu = $(this).data('hovermenu') || null;
if (!$hovermenu) {
- var $hovermenu = $(this).parent().find(".elgg-menu-hover");
+ $hovermenu = $(this).parent().find(".elgg-menu-hover");
$(this).data('hovermenu', $hovermenu);
}
@@ -240,7 +236,7 @@ elgg.ui.requiresConfirmation = function(e) {
*
* @return {Object}
*/
-elgg.ui.LoginHandler = function(hook, type, params, options) {
+elgg.ui.loginHandler = function(hook, type, params, options) {
if (params.target.attr('id') == 'login-dropdown-box') {
options.my = 'right top';
options.at = 'right bottom';
@@ -261,22 +257,25 @@ elgg.ui.LoginHandler = function(hook, type, params, options) {
* @return void
*/
elgg.ui.initDatePicker = function() {
- $('.elgg-input-date').datepicker({
- // ISO-8601
- dateFormat: 'yy-mm-dd',
- onSelect: function(dateText) {
- if ($(this).is('.elgg-input-timestamp')) {
- // convert to unix timestamp
- var dateParts = dateText.split("-");
- var timestamp = Date.UTC(dateParts[0], dateParts[1] - 1, dateParts[2]);
- timestamp = timestamp / 1000;
-
- var id = $(this).attr('id');
- $('input[name="' + id + '"]').val(timestamp);
+ if ($('.elgg-input-date').length) {
+ $('.elgg-input-date').datepicker({
+ // ISO-8601
+ dateFormat: 'yy-mm-dd',
+ onSelect: function(dateText) {
+ if ($(this).is('.elgg-input-timestamp')) {
+ // convert to unix timestamp
+ var dateParts = dateText.split("-");
+ var timestamp = Date.UTC(dateParts[0], dateParts[1] - 1, dateParts[2]);
+ timestamp = timestamp / 1000;
+
+ var id = $(this).attr('id');
+ $('input[name="' + id + '"]').val(timestamp);
+ }
}
- }
- });
+ });
+ }
};
elgg.register_hook_handler('init', 'system', elgg.ui.init);
-elgg.register_hook_handler('getOptions', 'ui.popup', elgg.ui.LoginHandler); \ No newline at end of file
+elgg.register_hook_handler('init', 'system', elgg.ui.initDatePicker);
+elgg.register_hook_handler('getOptions', 'ui.popup', elgg.ui.loginHandler); \ No newline at end of file