[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/sites/all/modules/module_builder/theme/ -> module_builder.js (source)

   1  
   2  /**
   3   * For a given hook grouping, selects/deselects all hooks associated with it.
   4   *
   5   * The bulk of this function (except the crappy hard-coded stuff ;)) was
   6   * courtesy of David Carrington (Thox), with enhancements
   7   * made by Steven Wittens (Unconed). Thanks a lot, guys!! :D
   8   */
   9  function check_hooks(grouping, hooks) {
  10    // Loop through the hooks
  11    for (i = 0; hook = hooks[i]; i++) {
  12      // Find the relevant checkbox
  13      hook_groups = Array('authentication', 'core', 'node');
  14      for (j = 0; group = hook_groups[j]; j++) {
  15        id = 'edit-hooks-' + group + '-' + hook.replace(/_/g, '-');
  16        if (document.getElementById(id)) {
  17          checkbox = document.getElementById(id);
  18          break;
  19        }
  20      }
  21  
  22      // Set the checkbox status to the status of the clicked one
  23      if (typeof checkbox.checkCount == 'undefined') {
  24        checkbox.checkCount = 0;
  25      }
  26      checkbox.checkCount += grouping.checked ? 1 : -1;
  27      checkbox.checked = checkbox.checkCount > 0;
  28    }
  29  }
  30  
  31  /**
  32   * Clears the default texts on click.
  33   * Only happens on a fresh form (ie not when the user clicks our back button).
  34   */
  35  $(document).ready(function() {
  36    $('.fresh .form-text.required').click(function () {
  37      $(this).attr('value', '');
  38      $(this).unbind('click');
  39    });
  40    // If the user gets here with a tab and types, lose the click clearing.
  41    $('.fresh .form-text.required').keypress(function () {
  42      $(this).unbind('click'); 
  43    });  
  44  });
  45    
  46  


Generated: Mon Jul 9 18:01:44 2012 Cross-referenced by PHPXref 0.7