colonymech / docs / www / colonyscout / internal / jeditable / jquery.jeditable.autogrow.js @ f59acf11
History | View | Annotate | Download (1003 Bytes)
1 |
/*
|
---|---|
2 |
* Autogrow textarea for Jeditable
|
3 |
*
|
4 |
* Copyright (c) 2008 Mika Tuupola
|
5 |
*
|
6 |
* Licensed under the MIT license:
|
7 |
* http://www.opensource.org/licenses/mit-license.php
|
8 |
*
|
9 |
* Depends on Autogrow jQuery plugin by Chrys Bader:
|
10 |
* http://www.aclevercookie.com/facebook-like-auto-growing-textarea/
|
11 |
*
|
12 |
* Project home:
|
13 |
* http://www.appelsiini.net/projects/jeditable
|
14 |
*
|
15 |
* Revision: $Id$
|
16 |
*
|
17 |
*/
|
18 |
|
19 |
$.editable.addInputType('autogrow', { |
20 |
element : function(settings, original) { |
21 |
var textarea = $('<textarea />'); |
22 |
if (settings.rows) {
|
23 |
textarea.attr('rows', settings.rows);
|
24 |
} else {
|
25 |
textarea.height(settings.height); |
26 |
} |
27 |
if (settings.cols) {
|
28 |
textarea.attr('cols', settings.cols);
|
29 |
} else {
|
30 |
textarea.width(settings.width); |
31 |
} |
32 |
$(this).append(textarea); |
33 |
return(textarea);
|
34 |
}, |
35 |
plugin : function(settings, original) { |
36 |
$('textarea', this).autogrow(settings.autogrow); |
37 |
} |
38 |
}); |