[ Index ]

PHP Cross Reference of Drupal 6 (gatewave)

title

Body

[close]

/sites/all/modules/project/ -> project.js (source)

   1  /* $Id: project.js,v 1.3 2009/01/12 20:07:19 dww Exp $ */
   2  
   3  Drupal.behaviors.projectAuto = function (context) {
   4    // The initially selected term, if any.
   5    var tid;
   6    $('div.project-taxonomy-element input:not(.projectAuto-processed)', context).addClass('projectAuto-processed').each(function () {
   7        if (this.checked) {
   8          tid = this.value;
   9        }
  10      })
  11      .click(function () {
  12        Drupal.projectSetTaxonomy(this.value);
  13      });
  14    Drupal.projectSetTaxonomy(tid);
  15  }
  16  
  17  Drupal.projectSetTaxonomy = function (tid) {
  18    $('div.project-taxonomy-element select').each(function () {
  19      // If this is the selector for the currently selected
  20      // term, show it (in case it was previously hidden).
  21      if (this.id == 'edit-tid-' + tid) {
  22        // Hide not the select but its containing div (which also contains
  23        // the label).
  24        $(this).parents('div.form-item').show();
  25      }
  26      // Otherwise, empty it and hide it.
  27      else {
  28        // In case terms were previously selected, unselect them.
  29        // They are no longer valid.
  30        this.selectedIndex = -1;
  31        $(this).parents('div.form-item').hide();
  32      }
  33    });
  34  }


Generated: Thu Mar 24 11:18:33 2011 Cross-referenced by PHPXref 0.7