SEGAbits Forums

SEGAbits Website => Announcements & Feedback => Topic started by: Happy Cat on June 25, 2013, 02:26:40 pm

Title: Youtube video embeds are back
Post by: Happy Cat on June 25, 2013, 02:26:40 pm
Maybe you were wondering what happened to the youtube embeds we used to have. Well i upgraded the forum one day, and accidentally over wrote my script i made. and i couldn’t figure out how to do it again, well they are back finally, in a different way

this time they are parsed automatically so you don't have to press any weird buttons to go about press to make youtube videos embedded.

You need to have javascript enabled or else the URL's won't change to youtube videos for you. Big thanks to my friend ingolme for helping me out with the javascript and regular expressions, would of never gotten this done on my own. I was struggling so bad, heh

anyways, just paste a URL, and it works! (it wont work in previews though, you gotta post it to see it working)

http://www.youtube.com/watch?v=ygBA2GhLowA

you can go ahead and post a video in this topic to try it out if you want

Edit: Please note that the URL's won't change into videos if your browsing space is less then 960px wide.
Title: Re: Youtube video embeds are back
Post by: Barry the Nomad on June 25, 2013, 02:35:43 pm
http://www.youtube.com/watch?v=BTeOcVelYi0
Title: Re: Youtube video embeds are back
Post by: crackdude on June 25, 2013, 04:30:04 pm
https://www.youtube.com/watch?v=Kd40WN0Pw7M

it works
Title: Re: Youtube video embeds are back
Post by: Happy Cat on June 25, 2013, 05:19:30 pm
hmm its quite annoying on mobile when you zoom in. makes it hard to scroll. will need to figure something out.
Title: Re: Youtube video embeds are back
Post by: Happy Cat on June 25, 2013, 10:08:05 pm
Okay I tweaked the video size, so they aren't as needlessly tall.

Also, if you are on a device with a resolution less then 960pixels wide for your browsing window space, the URL's won't convert over to videos.
Title: Re: Youtube video embeds are back
Post by: Barry the Nomad on June 26, 2013, 08:28:58 am
Great stuff! Thanks Will!

http://www.youtube.com/watch?v=5Q7O6GD1Q5w
Title: Re: Youtube video embeds are back
Post by: Happy Cat on June 26, 2013, 10:26:41 am
Great stuff! Thanks Will!

Your welcome!

I've had to edit it yet again, noticed it was having problems with the window.onload function, like say just a minute ago barry's sig wasnt loading so the url's wouldn't convert over until his sig was fully loaded, but i found a solution

http://stackoverflow.com/a/16196548
Title: Re: Youtube video embeds are back
Post by: crackdude on June 26, 2013, 12:28:20 pm
And the links show up below the videos! This is marvelous. Great job Will!
Title: Re: Youtube video embeds are back
Post by: Happy Cat on June 26, 2013, 01:07:16 pm
And the links show up below the videos! This is marvelous. Great job Will!
Thanks!

I'm glad you like that little touch, I thought it would be nice incase anyone wanted to share a video elsewhere they could easily do it without having to click the video to open in a new window / tab. Also, I thought it would be nice to add in case someone is on a device that's width is is higher then 960 and can't support youtube videos, although that's very unlikely as most youtube videos are HTML5 supported now, but, still, was another reason I added it.

Sadly I can't make it clickable. I tried but the javascript freaks out. cause, what the script basically does is, captures the ID out of the URL with regular expressions, and then makes a new div element, and i got the youtube embed code inside that div element, and a variable for the video ID number. and i got the plain text URL under that. Then after that I tell javascript to delete the URL, so, that causes it to freak out and delete any URL associated with that youtube ID.

I don't know if i explained that very good xD, but i tried!