blob: 9a2a1658dcd47c2f9783233c682e7e217c113cb2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
// $Id$
Drupal.textareaAttach = function() {
$('textarea.resizable:not(.processed)').each(function() {
var textarea = $(this).addClass('processed'), staticOffset = null;
$(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;
}
function performDrag(e) {
textarea.height(Math.max(32, staticOffset + Drupal.mousePosition(e).y) + 'px');
return false;
}
function endDrag(e) {
$(document).unmousemove(performDrag).unmouseup(endDrag);
textarea.css('opacity', 1);
}
});
}
if (Drupal.jsEnabled) {
$(document).ready(Drupal.textareaAttach);
}
|