diff options
Diffstat (limited to 'js/lib/ui.js')
-rw-r--r-- | js/lib/ui.js | 45 |
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 |