2006-03-09 23:20:24 +00:00
|
|
|
// $Id$
|
|
|
|
|
2006-08-31 23:31:25 +00:00
|
|
|
Drupal.textareaAttach = function() {
|
|
|
|
$('textarea.resizable:not(.processed)').each(function() {
|
|
|
|
var textarea = $(this).addClass('processed'), staticOffset = null;
|
2006-09-07 08:05:31 +00:00
|
|
|
|
2006-08-31 23:31:25 +00:00
|
|
|
$(this).wrap('<div class="resizable-textarea"></div>')
|
|
|
|
.parent().append($('<div class="grippie"></div>').mousedown(startDrag));
|
|
|
|
|
|
|
|
var grippie = $('div.grippie', $(this).parent())[0];
|
|
|
|
grippie.style.marginRight = (grippie.offsetWidth - $(this)[0].offsetWidth) +'px';
|
|
|
|
|
|
|
|
function startDrag(e) {
|
|
|
|
staticOffset = textarea.height() - Drupal.mousePosition(e).y;
|
|
|
|
textarea.css('opacity', 0.25);
|
|
|
|
$(document).mousemove(performDrag).mouseup(endDrag);
|
|
|
|
return false;
|
2005-12-29 03:59:30 +00:00
|
|
|
}
|
|
|
|
|
2006-08-31 23:31:25 +00:00
|
|
|
function performDrag(e) {
|
|
|
|
textarea.height(Math.max(32, staticOffset + Drupal.mousePosition(e).y) + 'px');
|
|
|
|
return false;
|
|
|
|
}
|
2005-12-29 03:59:30 +00:00
|
|
|
|
2006-08-31 23:31:25 +00:00
|
|
|
function endDrag(e) {
|
|
|
|
$(document).unmousemove(performDrag).unmouseup(endDrag);
|
|
|
|
textarea.css('opacity', 1);
|
|
|
|
}
|
|
|
|
});
|
2005-12-29 03:59:30 +00:00
|
|
|
}
|
|
|
|
|
2006-08-31 23:31:25 +00:00
|
|
|
if (Drupal.jsEnabled) {
|
|
|
|
$(document).ready(Drupal.textareaAttach);
|
2005-12-29 03:59:30 +00:00
|
|
|
}
|