PDA

View Full Version : Center and Space buttons for vBcode


Boofo
07-25-2002, 10:00 PM
Space Button to insert a space into messages
Center Button to center text in messages.
Version 1.1 (By Boofo)

A special thanks goes out to bad_madman for all of his help and advice in developing this small hack. It never would have been without him. Thank you, sir. :)

What this hack does:

This hack will add a "Space" and "Center" button to your vB Code in newreply, newthread and editpost templates. If you try to add a space with the spacebar in a message, it will be parsed out when you save the message. With this it actually inserts a hidden & nbsp; (space code) into the message. The "center" button will allow you to center text in your message.

Tested on vBulletin 2.2.5

NOTE: Updated for version 2.2.6
Due to the censorship parsing of the hard space which is being parsed to the underscore character, you will need to make an additional file edit for the SPACE button to work. The file attachment has been updated.

Install time: less than 2 minutes
Files to edit: 2 (root/vbcode_language.js and admin/functions.php)
Templates to edit: 1 (vbcode_buttons)

DestyNova
07-26-2002, 08:39 PM
any example or screenshot?

Boofo
07-26-2002, 08:46 PM
Here is a screenshot of the buttons installed. :)

Floris
07-26-2002, 08:51 PM
Why have a space button? You can just press space on keyboard. In vB 2.2.6 0160 (hard space) will appear as _ (underscore)

Boofo
07-26-2002, 09:19 PM
this is a test
This is a test.

xiphoid: You are wrong about the spaces in 2.2.6. I just tried it here. The first line above had 10 spaces with the spacebar added to the beginning of it and the second line had 5 spaces in between each word. As you can see, the spaces were parsed out when I used the spacebar and lined up on the left again. They didn't change that yet in 2.2.6. :) So you will need this if you want to add any spaces anywhere in your message. ;)

Chris M
07-26-2002, 09:34 PM
Ah excellent:)

Nice hack!

Satan

DestyNova
07-27-2002, 05:30 AM
:thumb up:

==install==

I realize that I put too many custom codes and buttons so space button cannot fit into that and result come out just ">" lol

I fix it by add more space for buttons :rolleyes:

vdinh
07-29-2002, 08:54 PM
Originally posted by xiphoid
Why have a space button? You can just press space on keyboard. In vB 2.2.6 0160 (hard space) will appear as _ (underscore)

Same problem ... If I use this hack for version 2.2.6, it replace the space created by the hacked button with an underscore _ ...

Boofo
07-29-2002, 09:16 PM
That is strange. I am using 2.2.5 and it works fine here. I will do some reasearch on it and see what I can do to fix it to work on 2.2.6, too. Thanks for letting me know that. :)

And xiphoid, I apologize for misunderstanding what you meant in your message above. I thought you were trying to say that 2.2.6 already does the spaces without parsing. Again, my apologies. :)

Originally posted by vdinh


Same problem ... If I use this hack for version 2.2.6, it replace the space created by the hacked button with an underscore _ ...

DrkFusion
07-29-2002, 09:26 PM
Nice work boofo...sure install ;)

Drk

DrkFusion
07-29-2002, 09:47 PM
Uhh...doesn't work for me on 2.2.6...I click the Button, and I enter the text I want, and when I submit, on show thread it shows up like this
Booofffaaaasssuuu

Boofo
07-29-2002, 10:00 PM
Did you do this, too? Won't work without it. ;)

Add new custom vB Code for the "center" tag (in vB Admin CP):

vB Code tag: center
vB Code replacement: <div align="center">{param}</div> (or you can use: <p align="center">{param}</p>)
vB Code example: Centered Text
Use {option} ?: No

NOTE: Only use

<div align="center">{param}</div>

or

<p align="center">{param}</p>

I put them both in there so you could choose which one you want to use. I use <div align="center">{param}</div>.

Originally posted by DrkFusion
Uhh...doesn't work for me on 2.2.6...I click the Button, and I enter the text I want, and when I submit, on show thread it shows up like this

DrkFusion
07-29-2002, 10:08 PM
Uhh..it wasn't in the txt....

Edit: nm...I see it, I was ina hurry :-D
Thanks

Drk

Boofo
07-29-2002, 10:41 PM
Looks like remedial reading for you, Drk. Report to class! :)

Originally posted by DrkFusion
Uhh..it wasn't in the txt....

Edit: nm...I see it, I was ina hurry :-D
Thanks

Drk

Boofo
07-30-2002, 05:42 PM
Ok, as far as I can tell, the underscore is new part of the censorship option in 2.2.6. (The file attachment in the first post has been updated.) Please test this and let me know if it fixes your problem.

If you want to be able to use the SPACE button in 2.2.6, you can go to your admin/functions.php and replace this line:

$text = str_replace(chr(160), '_', $text);

with this line:

// $text = str_replace(chr(160), '_', $text);

Originally posted by vdinh


Same problem ... If I use this hack for version 2.2.6, it replace the space created by the hacked button with an underscore _ ...

vdinh
08-03-2002, 03:57 AM
Originally posted by Boofo
Ok, as far as I can tell, the underscore is new part of the censorship option in 2.2.6. (The file attachment in the first post has been updated.) Please test this and let me know if it fixes your problem.

If you want to be able to use the SPACE button in 2.2.6, you can go to your admin/functions.php and replace this line:

$text = str_replace(chr(160), '_', $text);

with this line:

// $text = str_replace(chr(160), '_', $text);



Boofo, it worked !!! :) Thanks a lot, I needed this :)

Boofo
08-03-2002, 04:22 AM
vdinh,

Make sure you hit the install button. The wife says when it reaches 15, I can have supper (and I am getting hungry). :)

vdinh
08-03-2002, 04:28 AM
Originally posted by Boofo
vdinh,

Make sure you hit the install button. The wife says when it reaches 15, I can have supper (and I am getting hungry). :)

Hehe ... I just hit it 1 min ago :D

There is a slight problem ... Wonder if it is my own problem or the script's ... When I try to edit a message, any time I hit the SPACE button, it gives a SPACE at the end of the message, not at the intended place ... Can you help clarify this? Thanks again :)

Boofo
08-03-2002, 04:37 AM
That will happen with any button you use there. That is a feature in vb. There is a fix out for it. It has something to do with the textarea. I'll see if I can find it around here somewhere. Try a search for it, too. :)

Originally posted by vdinh


Hehe ... I just hit it 1 min ago :D

There is a slight problem ... Wonder if it is my own problem or the script's ... When I try to edit a message, any time I hit the SPACE button, it gives a SPACE at the end of the message, not at the intended place ... Can you help clarify this? Thanks again :)

Boofo
08-27-2002, 10:36 PM
I found an answer fo you. :)

Change this:

<textarea name="message" rows="10" cols="$textareacols" wrap="virtual" tabindex="1"></textarea>

to this:


<textarea name="message" rows="10" cols="$textareacols" wrap="virtual" tabindex="1" onChange=getActiveText(this) onclick=getActiveText(this)></textarea>


Originally posted by vdinh
There is a slight problem ... Wonder if it is my own problem or the script's ... When I try to edit a message, any time I hit the SPACE button, it gives a SPACE at the end of the message, not at the intended place ... Can you help clarify this? Thanks again :)

zootsuit
08-28-2002, 05:27 AM
Thanks, Boofo... :)

I've been looking for something like this!

Awesome!

Boofo
08-28-2002, 05:36 AM
My pleasure. ;)

vdinh
08-28-2002, 01:57 PM
Thanks a lot, Boofo :) ... That's what I have been looking for ... :laugh:

Boofo
08-28-2002, 02:05 PM
You're welcome. Actually, I had that code all along and forgot about it until I was doing something in my code the other day. Sorry about that. :)

Originally posted by vdinh
Thanks a lot, Boofo :) ... That's what I have been looking for ... :laugh: