[ Index ]

PHP Cross Reference of Drupal 6 (yi-drupal)

title

Body

[close]

/misc/ -> textarea.js (source)

   1  
   2  Drupal.behaviors.textarea = function(context) {
   3    $('textarea.resizable:not(.textarea-processed)', context).each(function() {
   4      // Avoid non-processed teasers.
   5      if ($(this).is(('textarea.teaser:not(.teaser-processed)'))) {
   6        return false;  
   7      }
   8      var textarea = $(this).addClass('textarea-processed'), staticOffset = null;
   9  
  10      // When wrapping the text area, work around an IE margin bug.  See:
  11      // http://jaspan.com/ie-inherited-margin-bug-form-elements-and-haslayout
  12      $(this).wrap('<div class="resizable-textarea"><span></span></div>')
  13        .parent().append($('<div class="grippie"></div>').mousedown(startDrag));
  14  
  15      var grippie = $('div.grippie', $(this).parent())[0];
  16      grippie.style.marginRight = (grippie.offsetWidth - $(this)[0].offsetWidth) +'px';
  17  
  18      function startDrag(e) {
  19        staticOffset = textarea.height() - e.pageY;
  20        textarea.css('opacity', 0.25);
  21        $(document).mousemove(performDrag).mouseup(endDrag);
  22        return false;
  23      }
  24  
  25      function performDrag(e) {
  26        textarea.height(Math.max(32, staticOffset + e.pageY) + 'px');
  27        return false;
  28      }
  29  
  30      function endDrag(e) {
  31        $(document).unbind("mousemove", performDrag).unbind("mouseup", endDrag);
  32        textarea.css('opacity', 1);
  33      }
  34    });
  35  };


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