]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #4022 made JS lib a little more consistent
authorcash <cash.costello@gmail.com>
Wed, 2 Nov 2011 00:24:54 +0000 (20:24 -0400)
committercash <cash.costello@gmail.com>
Wed, 2 Nov 2011 00:24:54 +0000 (20:24 -0400)
js/lib/ui.js

index 16ef2dc9630f5fd5a63c8b698b77a41f94f65c3e..c26cbe389ad3bc6a33359ba858a8ceab65451079 100644 (file)
@@ -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