Textarea Drag Resize

By Morac Last update Nov 23, 2010 — Installed 5,758 times.

Archived Comments (locked)

in
Subscribe to Archived Comments 15 posts, 9 voices



Jesse Andrews Admin

The following is an archive of comments made before threaded discussions was implemented (November 16th, 2008)

 
Glenn Carr Scriptwright

Made changes to allow resizing lists:

var them = document.getElementsByTagName("textarea");
var lists = document.getElementsByTagName("select"); // new line

...and...

trace(5, them.length.toString() + " textareas.");
// Start of new code:
for(var i = lists.length - 1; i >= 0; i--) {
var listSize = lists[i].getAttribute("size");
if ( listSize != null && parseInt( listSize, 10 ) > 1 )
tweak_textarea(lists[i]);
}
trace(5, lists.length.toString() + " textareas.");
// End new code

...and...

button.title = "Click and drag to change the size"; // changed text from "Click and drag me to change the textarea's size"

 
Glenn Carr Scriptwright

Thanks for the great script. Here's a minor change I made to your script to change the cursor when hovering over the resize image:

button.setAttribute('class', 'text_area_grabber_button');
GM_addStyle( '.text_area_grabber_button { cursor:se-resize }' );

 
Morac Script's Author

Just another update. It makes it so that the little grabber button only displays when the textarea it is attached to is displayed. This prevents a bunch of buttons from showing underneath textareas which are selected via "tabs".

Every now and then there is a page where the button shows underneath the textarea instead of next to it, but there's no way to fix that without breaking forms. The button still works, but doesn't move.

 
Morac Script's Author

Okay the update I made yesterday broke sites that use WYSISWYG editing. I undid the changes I made yesterday and went with a more simplistic approach. The new version won't break any sites and won't mess with the formatting of the page. Also the resize button won't be displayed if the text area is actually hidden like it is on many WYSISWYG editting forums.

 
Morac Script's Author

I updated to prevent it from screwing up with white space wrapping on page, i.e. pages ended up being wider than the browser window.

Unfortunately putting the textarea in a div container doesn't work because for some reason Firefox occasionally won't submit textareas that have been moved, so instead I cloned the textarea and hid the original. The clone is linked to the original such that any update to the text in the clone changes the original's text. This works well.

 
Alvin User

FAIL.

 
Chris4 Scriptwright

This screws up the contact form on my website, so unfortunately I can no long use the script.

I thought I had broken Firefox at first, somehow.

 
Chris4 Scriptwright

Thanks, trying now.

http://www.pcworld.com/article/id,147266-page,4...

 
lootpacker User

This is pretty handy

 
Josh Gunderson User

Works as advertised. I find it especially useful for the MySpace Mail Center.

 
Schlick User

I eagerly changed to use this script instead however on the first site I tested it on (http://esirotab.starclass.com.au/) it stuffed up the visual display of the textarea and surrounding elements.

 
Silly Walrus Scriptwright

Very useful userscript, thanks.

 
Morac Script's Author

Fixed a minor issue where sometimes the text area would go off the right side of the window.

 
Morac Script's Author

This is a modified version of Sean M. Burke's textarea resize script. http://userscripts.org/scripts/show/5073

I fixed the problem where sometimes the text in the textarea wouldn't be submitted (basically the text got lost).

This script does not have that problem.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel