// $Id: textarea.js,v 1.22 2008/01/17 19:31:56 goba Exp $ Drupal.behaviors.textarea = function(context) { $('textarea.resizable:not(.textarea-processed)', context).each(function() { // Avoid non-processed teasers. if ($(this).is(('textarea.teaser:not(.teaser-processed)'))) { return false; } var textarea = $(this).addClass('textarea-processed'), staticOffset = null; // When wrapping the text area, work around an IE margin bug. See: // http://jaspan.com/ie-inherited-margin-bug-form-elements-and-haslayout $(this).wrap('
') .parent().append($('
').mousedown(startDrag)); var grippie = $('div.grippie', $(this).parent())[0]; grippie.style.marginRight = (grippie.offsetWidth - $(this)[0].offsetWidth) +'px'; function startDrag(e) { staticOffset = textarea.height() - e.pageY; textarea.css('opacity', 0.25); $(document).mousemove(performDrag).mouseup(endDrag); return false; } function performDrag(e) { textarea.height(Math.max(32, staticOffset + e.pageY) + 'px'); return false; } function endDrag(e) { $(document).unbind("mousemove", performDrag).unbind("mouseup", endDrag); textarea.css('opacity', 1); } }); $('textarea.resizable2:not(.textarea-processed)', context).each(function() { // Avoid non-processed teasers. if ($(this).is(('textarea.teaser:not(.teaser-processed)'))) { return false; } var textarea = $(this).addClass('textarea-processed'), staticOffset = null; // When wrapping the text area, work around an IE margin bug. See: // http://jaspan.com/ie-inherited-margin-bug-form-elements-and-haslayout $(this).wrap('
') $('.comgripple').append($('
').mousedown(startDrag)); var grippie = $('div.grippie', $('.comgripple'))[0]; function startDrag(e) { staticOffset = textarea.height() - e.pageY; textarea.css('opacity', 0.25); $('.comment-send').css('opacity', 0.25); $(document).mousemove(performDrag).mouseup(endDrag); return false; } function performDrag(e) { textarea.height(Math.max(48, staticOffset + e.pageY) + 'px'); $('.comment-send').height(Math.max(48, staticOffset + e.pageY) + 'px'); return false; } function endDrag(e) { $(document).unbind("mousemove", performDrag).unbind("mouseup", endDrag); textarea.css('opacity', 1); $('.comment-send').css('opacity', 1); } }); }; /* playback timings (ms): LoadShardBlock: 35.069 (3) esindex: 0.009 captures_list: 53.769 CDXLines.iter: 13.262 (3) PetaboxLoader3.datanode: 52.65 (4) exclusion.robots: 0.255 exclusion.robots.policy: 0.245 RedisCDXSource: 1.839 PetaboxLoader3.resolve: 24.099 load_resource: 103.509 */