FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » How To » How to add a Youtube "Formatting Tools" icon?  () 1 Vote
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
How to add a Youtube "Formatting Tools" icon? [message #163996] Thu, 23 December 2010 14:30 Go to next message
gotzoom? is currently offline  gotzoom?   United States
Messages: 20
Registered: December 2006
Location: Silicon Valley, CA
Karma: 0
Junior Member
I searched around and read what I can find on this subject and I'm still not able to figure out how to add a Youtube icon to the Formatting Tools.

From what I have read, I need to add a line to the "fud_code_icons" in post_common.tmpl and copy over the image into the theme.

I'd like to have a popup window come up where the user can paste in the Youtube tag in a manner similar to the way the URL or Image buttons work.

Here's the code for the Image button:
<td class="FormattingToolsCLR"><a title="{MSG: post_common_image}" accesskey="m" href="javascript: image_insert();"><img alt="" src="{THEME_IMAGE_ROOT}/b_image.gif" /></a></td>


It seems that I will need to make the "accesskey" value unique and call a particular "javascript" to make things work properly.

Can someone help point me in the right direction on this?
Re: How to add a Youtube "Formatting Tools" icon? [message #164002 is a reply to message #163996] Sat, 25 December 2010 17:30 Go to previous messageGo to next message
Ernesto is currently offline  Ernesto   Sweden
Messages: 413
Registered: August 2005
Karma: 0
Senior Member
You would have to edit the javascript to get the functionality you are asking. Why don't you just look at the B I or U tags and use that instead to just wrap [youtube] around the text, or insert into the form.

You can of course just look at the javascript (lib.js I think?) and find the image_insert function and copy/edit that to a youtube_insert.

You do not have to set an accesskey, there is no standard shortcut to insert a youtube link in any software, so having a keyboard shortcut would most likely never be used, or it would collide with already existing keyboard shortcuts.


Re: How to add a Youtube "Formatting Tools" icon? [message #164010 is a reply to message #164002] Tue, 28 December 2010 13:22 Go to previous messageGo to next message
gotzoom? is currently offline  gotzoom?   United States
Messages: 20
Registered: December 2006
Location: Silicon Valley, CA
Karma: 0
Junior Member
Thanks for the tip, Ernesto. Here's what I did to get this working:

* Edited /path/to/FUDforum/thm/default/i18n/en/msg and added in
post_common_youtube:Insert a YouTube Tag


* Edited /path/to/forum/js/lib.js and added
function youtube_insert()
{
        dialogTag(document.post_form.msg_body, 'YouTube Tag:', '', '[youtube]%s[/youtube]', '');
}


* Created an icon to use and copied it to /path/to/forum/theme/<Theme_Name>/images

* Edited post_common.tmpl -> fud_code_icons and added
<td class="FormattingToolsCLR"><a title="{MSG: post_common_youtube}" accesskey="yy" href="javascript: youtube_insert();"><img alt="" src="{THEME_IMAGE_ROOT}/youtube_icon.jpg" /></a></td>

(I figured "yy" won't be used, so I set the accesskey to that value)

* Rebuilt the theme.

Voila! I now have a YouTube button.
index.php?t=getfile&id=6061&private=0

[Updated on: Tue, 28 December 2010 13:27]

Report message to a moderator

Re: How to add a Youtube "Formatting Tools" icon? [message #164011 is a reply to message #164010] Tue, 28 December 2010 14:52 Go to previous messageGo to next message
naudefj is currently offline  naudefj   South Africa
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
This is cool!
Thanks for posting the solution here.
Re: How to add a Youtube "Formatting Tools" icon? [message #164023 is a reply to message #164011] Wed, 29 December 2010 10:43 Go to previous message
Ernesto is currently offline  Ernesto   Sweden
Messages: 413
Registered: August 2005
Karma: 0
Senior Member
You should remove the accesskey. You most definitely do not have any "YY" key on your keyboard, so it is impossible to press it. It is not at all needed. Accesskey defines a hotkey on your keyboard to do something. If you use for example Firefox and press CTRL+ALT+S it will submit the post you are writing. In other browsers you can just use ALT+S, etc - the shortcut combo depends on your browser.

So, since it's impossible to press CTRL+ALT+YY, your accesskey will not work. It will also never be used, since there is no standard shortcut to do "paste youtube BB code" in any major software, so noone will use it. While for example CTRL+ALT+I is quite often used by someone used to working in winword, or the likes


  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: mailing-list -> forum
Next Topic: I messed something up, not very serious though
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 01 00:33:27 GMT 2024

Total time taken to generate the page: 0.02592 seconds