Page 1 of 1
Posted: 31 May 2013, 20:30
jigebren
Embed YouTube video

I've just added support for a new BBCode to embed Youtube video directly in the post.

This works this way (the video ID is the 11 chars that can usually be found after "watch?v=" in the video URL, for example u67CWFvl5Qk):

Code: Select all

[youtube]video ID[/youtube]
Using the full URL is also supported (not officially though):

Code: Select all

[youtube]http://www.youtube.com/watch?v=u67CWFvl5Qk[/youtube]
(It just makes it easier to copy-paste the URL in case javascript in not supported by the browser...)

Here's an example:

[youtube]u67CWFvl5Qk[/youtube]

There's even a new YouTube button to insert the tags when editing a post. B)

BBCode insertion fix:

I've also added a fix (at least for Firefox) so that the BBCode tags are properly inserted at the cursor position instead of the end of the post. If some text is already selected, it will be properly placed between the opening and closing tags.

xIMG ?

I was wondering about xIMG but I'm not sure there's really a point using it...


Note that all of that only work if javascript is enabled (most users don't care, but there could be NoScript users).

Posted: 31 May 2013, 21:12
urnemanden
Awesome jigebren, I tried the new youtube support out and it seem to work nicely! Cannot seem to get the BBCode insertion fix to work for the youtube tags though. But for the rest it does so thats nice :)

Posted: 31 May 2013, 22:14
jigebren
urnemanden @ May 31 2013, 04:42 PM wrote:Cannot seem to get the BBCode insertion fix to work for the youtube tags though.
Fixed.
I had not really finished it in fact... Anyway thanks for the report. Now the youtube code share the same code than the other tags, making it use the fix.
I've also modified it a bit: now a popup asks for the video ID or the video URL (the same way it's done for the IMG or URL tags).

Posted: 01 Jun 2013, 02:28
Phantom
Congratulations! Great addition. :)

Posted: 01 Jun 2013, 11:42
VaiDuX461
Thanks a lot, especially for BBCode fixes, it's now much easier and faster to use them.
To let you know, fixes works on Android internet browser too.

Posted: 01 Jun 2013, 13:01
RacerBG
Good addition. Also Im glad to see that there are other peoples from Bulgaria too. :)

Posted: 02 Jun 2013, 13:10
urnemanden
Fixed.
I had not really finished it in fact... Anyway thanks for the report. Now the youtube code share the same code than the other tags, making it use the fix.
Great! Can report that it works here now - using Chromium under Arch Linux 64-bit.


Btw, do you have any control over the Undo behavior in the editor?

Posted: 02 Jun 2013, 17:51
jigebren
urnemanden @ Jun 2 2013, 08:40 AM wrote: Btw, do you have any control over the Undo behavior in the editor?
Not that I know of. Why?
Because we can't undo after previewing, maybe?

Posted: 02 Jun 2013, 21:59
urnemanden
Not that I know of. Why?
Because we can't undo after previewing, maybe?
No, just because the undo behavior seemed to behave oddly for me - it didn't seem very consistent. Anyway, if it is not something in your hands then i guess it doesn't matter all that much. :)

Posted: 09 Jun 2013, 19:32
Huki
Hey nice.. during the original revamp, I was going to suggest enabling doHTML just for this YouTube embedding feature. BTW, I find the popup on the home button quite handy.
I don't recommend xIMG though, for the obvious reasons...

Posted: 10 Jun 2013, 18:01
jigebren
Huki @ Jun 9 2013, 03:02 PM wrote: BTW, I find the popup on the home button quite handy.
Oh yes, I didn't mention this one. This is a convenient way to go back to the current section - to read / reply other thread for example, which I used to miss.
It may update it eventually to display only the last member instead of the whole path (which is not really necessary).