 |
boardom b2 message board
|
View previous topic :: View next topic |
Author |
Message |
dtdgoomba
Joined: 05 Aug 2002 Posts: 179 Location: Cambridge, MA
|
Posted: Tue Aug 20, 2002 2:50 pm Post subject: How to add your own quicktags |
|
|
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 |
|
 |
flickerfly
Joined: 06 May 2003 Posts: 49
|
Posted: Sun May 18, 2003 9:35 pm Post subject: |
|
|
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 |
|
 |
Mizkie
Joined: 19 Mar 2003 Posts: 51 Location: Bloomington, IN
|
|
Back to top |
|
 |
GAZ082
Joined: 15 Apr 2003 Posts: 39 Location: CDBA, Argentina.
|
Posted: Thu Oct 02, 2003 10:09 pm Post subject: |
|
|
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 |
|
 |
Viper007Bond
Joined: 15 Aug 2003 Posts: 266 Location: Portland, Oregon, USA
|
Posted: Thu Oct 02, 2003 10:39 pm Post subject: |
|
|
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 |
|
 |
alanp
Joined: 14 Sep 2003 Posts: 35
|
Posted: Sat Nov 01, 2003 3:56 am Post subject: |
|
|
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 |
|
 |
leticia
Joined: 22 Dec 2003 Posts: 12 Location: New York
|
|
Back to top |
|
 |
XianghuaALPHA
Joined: 05 Aug 2003 Posts: 79 Location: Tulsa, OK
|
Posted: Thu Jan 15, 2004 4:52 pm Post subject: |
|
|
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!@ ~ ]
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 |
|
 |
|
|
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
|