boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to add your own quicktags

 
Post new topic   Reply to topic    boardom Forum Index -> How to ?
View previous topic :: View next topic  
Author Message
dtdgoomba



Joined: 05 Aug 2002
Posts: 179
Location: Cambridge, MA

PostPosted: Tue Aug 20, 2002 2:50 pm    Post subject: How to add your own quicktags Reply with quote

Well, I was trying to figure out how to add a target="_blank" to my link quicktags. Instead I was playing around and trying to figure out the quicktags and how to make my own. After checking out adamwalker's post: http://tidakada.com/board/viewtopic.php?t=638 I couldn't find any tutorial and I didn't see on on the readme so if there is one out there, let me know. I searched for quicktags and couldn't find it in the forum.

I tried to play around, hopefully someone can explain one part to me..

To add the code you would like added, open up b2quicktags.js and look for the array at the top:

Code:

bbtags = new Array('<b>','</b>','<i>','</i>','<u>','</u>','<strike>','</strike>','<blockquote>','</blockquote>','<p>','</p>','<li>','</li>','<img src="" border="0" alt="" />','','<a href="">','</a>');


I wanted to add the more tag, a next page tag, and a link tag that has a target="_blank" to my button list.. My array now looks like this:

Code:

bbtags = new Array('<b>','</b>','<i>','</i>','<u>','</u>','<strike>','</strike>','<blockquote>','</blockquote>','<p>','</p>','<li>','</li>','<img src="" border="0" alt="" />','','<a href="">','</a>','<!--more-->','','<!--nextpage-->','','<a href="" target="_blank">','</a>');


For anyone who doesn't understand what is going on, (I think this is right), when you add a '<tag>', the next item is the </tag>. If you leave it blank ' ' , the item has no close tag, so in my code the <!--more--> is followed by '', which means that if you clicked the more button again, nothing would happen b/c of no close tag.

The next important thing is to find the location of your new item in the array. The first <b> tag is at location 0, </b> is location 1, <i> location 2, etc..

Add your personal code to the end of the current array b/c the current locations of the tags are important for b2quicktags.php. IE, bold is expected to be at location 0 later on. If you put something before it, you have to change the code for all the times in b2quicktags.php b/c everything shifts....

Keep this in mind for your b2quicktags.php file which you now open. You'll see it's just a table with buttons. Let's add my external link tag. The order in the table doesn't matter as long as you call the right number from your array. So, let's say I wanted my tag before the close all tags button. Find:

Code:

<td>
<input type="button" class="quicktags" accesskey="h" name="addbbcode16" value="link" title="insert a link" style="text-decoration: underline; width: 40px" onClick="bblink(this.form,16)" />
</td>
<td>
<input type="button" class="quicktags" accesskey="c" name="closetags" value="X" title="Close all tags" style="width: 30px; font-weigh: bolder;"  onClick="bbstyle(document.post,-1)" /></td>


Before the last cell, add a cell similar to the other link tag with your alterations:
Code:

<td>
<input type="button" class="quicktags" accesskey="e" name="addbbcode22" value="link-ext" title="insert an ext-link" style="text-decoration: underline; width: 55px" onClick="bbstyle(this.form,22)" />
</td>


The number after the addbbcode and the this.form, is the position in your array. Mine happens to be at location 22. If you go back to the array, you'll see it at 22 and you'll see the necessary close tag at location 23, </a>.

That's pretty much it. Now I changed the accesskey to e for my ext-link. What are the accesskeys? I'm assuming they should be unique for each new quicktag, so I made mine unique.

Everyone feel free to comment, correct, add, whatever.. This should hopefully help a lot of newbies...
Back to top
View user's profile Send private message Visit poster's website
flickerfly



Joined: 06 May 2003
Posts: 49

PostPosted: Sun May 18, 2003 9:35 pm    Post subject: Reply with quote

I'm wondering if "accesskey" could be equated with "Keyboard Shortcut Key". I haven't found a key combo that works with them though. I tried Alt, Shift and Ctrl.

BTW, the keys don't appear to work at all in Opera 6.05, even the pre-existing ones. I have the variable for them turned of in my b2config.php.

Other users should note that b2config.php has a variable to toggle the appearance of these keys.
Back to top
View user's profile Send private message Visit poster's website
Mizkie



Joined: 19 Mar 2003
Posts: 51
Location: Bloomington, IN

PostPosted: Tue Jul 29, 2003 3:36 pm    Post subject: Reply with quote

what's accesskey?
_________________
Mick

HSS = High School Sucks
Back to top
View user's profile Send private message Visit poster's website AIM Address
GAZ082



Joined: 15 Apr 2003
Posts: 39
Location: CDBA, Argentina.

PostPosted: Thu Oct 02, 2003 10:09 pm    Post subject: Reply with quote

I edited the JS file:

Code:

Array('<b>','</b>','<i>','</i>','<u>','</u>','<strike>','</strike>','<blockquote>','</blockquote>','<p>','</p>','<li>','</li>','<img src="" border="0" alt="" align="right" />','','<a href="" class="Enlace" target="_blank">','</a>');
imageTag = false;


I didnt add, just chaged few things like the align of an image of the target of a link. I uploaded the file and the modifications dont show up. Wazup?
_________________
GAZ082
Back to top
View user's profile Send private message Visit poster's website
Viper007Bond



Joined: 15 Aug 2003
Posts: 266
Location: Portland, Oregon, USA

PostPosted: Thu Oct 02, 2003 10:39 pm    Post subject: Reply with quote

Sorta OT, but for those who want to add target="_blank" to their link button, open "/b2-include/b2quicktags.js" and find this line (line 173):

Code:
      final_link = '<a href="' + current_url + '">' + current_link_text + '</a>';

and replace it with:

Code:
      final_link = '<a href="' + current_url + '" target="_blank">' + current_link_text + '</a>';

_________________
http://www.viper007bond.com

If you haven't already installed b2, I advise you look into WordPress or b2evo instead as b2 is dead.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
alanp



Joined: 14 Sep 2003
Posts: 35

PostPosted: Sat Nov 01, 2003 3:56 am    Post subject: Reply with quote

flickerfly wrote:
I'm wondering if "accesskey" could be equated with "Keyboard Shortcut Key". I haven't found a key combo that works with them though. I tried Alt, Shift and Ctrl.

BTW, the keys don't appear to work at all in Opera 6.05, even the pre-existing ones. I have the variable for them turned of in my b2config.php.

Other users should note that b2config.php has a variable to toggle the appearance of these keys.


Yes, you hold down the "ALT" button and click the desired key and the tag will come up. Jazzy huh?
Back to top
View user's profile Send private message
leticia



Joined: 22 Dec 2003
Posts: 12
Location: New York

PostPosted: Wed Jan 14, 2004 7:39 pm    Post subject: what's a quick tag? Reply with quote

what's a quick tag?!
I want one!
_________________
thanks,
Leticia

http://www.leticiajohn.com/notsomuch
Back to top
View user's profile Send private message Visit poster's website AIM Address
XianghuaALPHA



Joined: 05 Aug 2003
Posts: 79
Location: Tulsa, OK

PostPosted: Thu Jan 15, 2004 4:52 pm    Post subject: Reply with quote

So - in the plane english - and with the goal of say - wanting to have a pop up to put in the code for a Lj link -

This is a way to add a button on the edit / entry screen that will auto do code - just like the link key does? And all I have to do is add it to the array balh balh balh? Right?


[ hint hint I'm a b2+lj-update user, that REALLY WANTS that ability - that'd own to just be able to click "lj-link" - put in their lj user name - and then bam it put the code on there....

AND WAIT - then I could also use the whole lj-cut thing easily! OH MY GOODNESS YES!@ ~ Smile ]

Please someone respond heh - I am getting excited now...


X A
_________________
[ [ - - There can be only 2 or 3 - - ]]

You know what. On a quite board - you end up talking to yourself alot....


Friends don't let friends play Tekken™
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> How to ? All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group