2006-03-09 23:20:24 +00:00
|
|
|
// $Id$
|
2009-04-27 20:19:38 +00:00
|
|
|
(function ($) {
|
2006-03-09 23:20:24 +00:00
|
|
|
|
2008-10-29 10:01:28 +00:00
|
|
|
Drupal.behaviors.textarea = {
|
2009-04-27 20:19:38 +00:00
|
|
|
attach: function (context, settings) {
|
2010-03-09 11:45:37 +00:00
|
|
|
$('.form-textarea-wrapper.resizable', context).once('textarea', function () {
|
2009-08-31 05:51:08 +00:00
|
|
|
var staticOffset = null;
|
2010-03-09 11:45:37 +00:00
|
|
|
var textarea = $(this).addClass('resizable-textarea').find('textarea');
|
2009-08-31 05:51:08 +00:00
|
|
|
var grippie = $('<div class="grippie"></div>').mousedown(startDrag);
|
2006-08-31 23:31:25 +00:00
|
|
|
|
2010-03-09 11:45:37 +00:00
|
|
|
grippie.insertAfter(textarea);
|
2006-08-31 23:31:25 +00:00
|
|
|
|
2008-10-29 10:01:28 +00:00
|
|
|
function startDrag(e) {
|
|
|
|
staticOffset = textarea.height() - e.pageY;
|
|
|
|
textarea.css('opacity', 0.25);
|
|
|
|
$(document).mousemove(performDrag).mouseup(endDrag);
|
|
|
|
return false;
|
|
|
|
}
|
2005-12-29 03:59:30 +00:00
|
|
|
|
2008-10-29 10:01:28 +00:00
|
|
|
function performDrag(e) {
|
|
|
|
textarea.height(Math.max(32, staticOffset + e.pageY) + 'px');
|
|
|
|
return false;
|
|
|
|
}
|
2005-12-29 03:59:30 +00:00
|
|
|
|
2008-10-29 10:01:28 +00:00
|
|
|
function endDrag(e) {
|
2009-04-26 19:18:46 +00:00
|
|
|
$(document).unbind('mousemove', performDrag).unbind('mouseup', endDrag);
|
2008-10-29 10:01:28 +00:00
|
|
|
textarea.css('opacity', 1);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2007-06-01 09:05:45 +00:00
|
|
|
};
|
2009-02-18 13:46:55 +00:00
|
|
|
|
|
|
|
})(jQuery);
|