Curiosity is bliss    Archive    Feed    About    Search

Julien Couvreur's programming blog and more

Textarea resize user script

 

Typing a lot of text, such as blogging or commenting, into small text boxes on a web page is uncomfortable. The following script makes it more comfortable. After you install it, you can enlarge any text box by typing Ctrl-Enter.

TextareaResize is my latest Greasemonkey user script.
It allows you to grow the size of textareas on most websites using the keyboard: while typing in a textarea, press Ctrl-Enter to expand the textarea vertically and Ctrl-Space to make it wider.

Update (2005/05/10): Updated to maximize how much of the textarea can be seen: the textarea is brought at the top of the window and won't be resized any larger than the viewport.

Update (2005/05/19): Updated the script with the code Matt Sherwood suggested in a comment: Shift-Ctrl-Enter and Shift-Ctrl-Space to shrink the size. I also improved the way the textarea gets centered, using ScrollIntoView.

______________________________________

Checkout Textarea extension:

http://www.extensionsmirror.nl/index.php?showtopic=2796

Posted by: Kai Carver (May 15, 2005 08:34 AM) ______________________________________

Great script! Here's a suggested minor enhancement to allow making the TextAreas smaller too (using Shift-Ctrl-Enter, Shift-Ctrl-Space):

(I updated the script with your suggestion, and removed the code from the comment -- Julien)

Posted by: Matt Sherwood (May 18, 2005 04:35 PM) ______________________________________

Kai, that extension is pretty cool. I especially like that way it manages to resize some textareas that my script still can't, that are contained in a fixed size element/div.

But I still like that ability to resize via the keyboard, rather than the mouse ;-)

Posted by: Julien (May 19, 2005 09:30 AM) ______________________________________

Yeah, it's pretty good. I wrote the author (but got no response) to suggest an improvement that would help me out: to be able to switch the wrap attribute between hard and soft and off (also known as virtual/physical or something). It's a non standard attribute but I've got at least one app I use all the time in which the textarea doesn't wrap right, and it's very annoying :-) I haven't tried yours, but I'd switch if it had that ability, since using the keyboard is nice too.

Posted by: Kai Carver (June 6, 2005 08:58 AM) ______________________________________

This script doesn't seem to work for Firefox on OS X. I really want a script like this, so I'm hoping you or someone can/will get it to work there!

Posted by: Gary Robinson (October 28, 2005 07:26 AM) ______________________________________

does not work with Firefox 1.5rc2 and GM 0.6.3

Posted by: cognominal (November 15, 2005 11:21 AM) ______________________________________

Yes, there is a number of scripts that broke with the latest version of Firefox. I'm going to be on vacation for the next couple of weeks, but I'll fix them when I return.

Posted by: Julien Couvreur (November 15, 2005 12:20 PM) ______________________________________

HI Julian
Your code proved to be very useful but it does not solve my problem.If u can please help.
Description of the problem :
I have a page which has numerous textboxes of fixed size.
This page is required to be printed on click of a button.
we are doing this by opening the same page with all the control by using window.open() function.

Now the problem is ,we have to have the same size of text box in the Main page but when this page is open in PRINT MODE the textbox should be adjustable to accomodate all the content by adjusting the size.

Ex.when the textarea exceeds the normal size of the box .. a scroll bar is put i.e. if size of TEXTBOX is 5 rows and we include 10 rows of characters,then we get a scrollbar .but when the same page is printed with window.open and print method,only 5 rows of text appears in the PRINT PAGE and other 5 rows remain invisible.
I want to have all 10 Rows Printed on the paper.
Can someone help me.
I am sorry if my problem confused u ..cause it is very difficult to explain it sans an actuall application.
Thanks

Posted by: Tintin (June 20, 2006 11:24 PM)
comments powered by Disqus