~spreadubuntu/spreadubuntu/devel-drupal6

« back to all changes in this revision

Viewing changes to misc/textarea.js

  • Committer: ruben
  • Date: 2009-06-08 09:38:49 UTC
  • Revision ID: ruben@captive-20090608093849-s1qtsyctv2vwp1x1
SpreadUbuntu moving to Drupal6. Based on ubuntu-drupal theme and adding our modules

Show diffs side-by-side

added added

removed removed

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