PDA

View Full Version : [RELEASE] textarea resize button hack for vb2 by n3n



n3n
Mon 9th Apr '01, 4:52am
this hack is able to expand or reduce the default column and rows of textarea by pressing javascript buttons..

place following code into "newthread" template right
above textarea tag


<SCRIPT LANGUAGE=JavaScript>
<!--
function fresize(value) {
if (value == 0) {
document.newthread.message.cols = 60;
document.newthread.message.rows = 20;
}
if (value == 1) {
if (document.newthread.message.cols > 60)
document.newthread.message.cols -= 5;
}
if (value == 2) document.newthread.message.cols += 5;
if (value == 3) {
if (document.newthread.message.rows > 20)
document.newthread.message.rows -= 5;
}
if (value == 4) document.newthread.message.rows += 5;
}
// -->
</SCRIPT>
<INPUT TYPE=BUTTON VALUE="¡ç" onClick="fresize(1);" TITLE="Col - 5"><INPUT TYPE=BUTTON VALUE="¡æ" onClick="fresize(2);" TITLE="Col + 5"><INPUT TYPE=BUTTON VALUE="¢Ã" onClick="fresize(0);" TITLE="Reset"><INPUT TYPE=BUTTON VALUE="¡è" onClick="fresize(3);" TITLE="Row - 5"><INPUT TYPE=BUTTON VALUE="¡é" onClick="fresize(4);" TITLE="Row + 5">
<br>


place following code into "newreply" template right above textarea tag


<SCRIPT LANGUAGE=JavaScript>
<!--
function fresize(value) {
if (value == 0) {
document.REPLIER.message.cols = 60;
document.REPLIER.message.rows = 20;
}
if (value == 1) {
if (document.REPLIER.message.cols > 60)
document.REPLIER.message.cols -= 5;
}
if (value == 2) document.REPLIER.message.cols += 5;
if (value == 3) {
if (document.REPLIER.message.rows > 20)
document.REPLIER.message.rows -= 5;
}
if (value == 4) document.REPLIER.message.rows += 5;
}
// -->
</SCRIPT>
<INPUT TYPE=BUTTON VALUE="¡ç" onClick="fresize(1);" TITLE="Col - 5"><INPUT TYPE=BUTTON VALUE="¡æ" onClick="fresize(2);" TITLE="Col + 5"><INPUT TYPE=BUTTON VALUE="¢Ã" onClick="fresize(0);" TITLE="Reset"><INPUT TYPE=BUTTON VALUE="¡è" onClick="fresize(3);" TITLE="Row - 5"><INPUT TYPE=BUTTON VALUE="¡é" onClick="fresize(4);" TITLE="Row + 5">
<br>


i hope you enjoy..
i attached bitmap file for an example :)

n3n
Mon 9th Apr '01, 5:08am
done!! :)
upload as gif file..

conan
Mon 9th Apr '01, 4:50pm
That's great man, one question.
Will it save the user's configuration? It would not be practical to change every time

n3n
Mon 9th Apr '01, 7:02pm
thanks for your feedback.. :)

Great idea. I might give it a try..
but default values of text area ( which is 20rows and 60 columns) are usually enough.. i think..

here are two options to save the custom values
1) saving the values into the user table is not good idea..
(u have to modify the table.. <-- don't like very much)

2) saving it by cookies may be better idea..
but i don't know much about how vbulletin uses cookies..
(have to figure it out.. <-- don't know how long it will take..

hmm..
which one will you choose?
what do you like?
need more feedback plz :)

conan
Mon 9th Apr '01, 8:09pm
I think it should be saved on the database, because cookies will clear everytime you log out.
I know it's a change on the user table, but it's worth imo, if you want to have this option of course ;)

Just my 2 cents!

PS. is there a demo?

ldydvr
Thu 5th Jul '01, 8:13am
Have you thought about maybe just having a JavaScript launched window that lets them adjust its size and when they press submit it places everything back into the main page and closes the popup. No database hacks needed there.

Just a thought.

=-)