Please login or register. Welcome to the Studio, guest!


Quick Links:


newBookmarkLockedFalling

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
<script type="text/Javascript">
// YouTube UBBC for Posts by Chris
// Do not redistribute without permisison of the creator

var ubbcURL = "http://img472.imageshack.us/img472/9892/yuotubeubbc8oa.png"; // URL of the YouTube UBBC image

// No need to edit
var aTD = document.getElementsByTagName("TD");
if(location.href.match(/action=view_topic/i)){
for(a=0;a<aTD.length;a++){
if(aTD[a].colSpan == 2 && aTD[a].vAlign == "top" && aTD[a].height == "100%" && aTD[a].innerHTML.match(/\[yt\](.+?)\[\/yt\]/gi)){
aTD[a].innerHTML = aTD[a].innerHTML.replace(/\[yt\](.+?)\[\/yt\]/gi,'<object width="425" height="355"><param name="movie" value="http://www.youtube.com/v/$1"></param><param name="wmode" value="transparent"></param><embed src="http://www.youtube.com/v/$1" type="application/x-shockwave-flash" wmode="transparent" width="425" height="355"></embed></object>');
}
}
} else if(document.create_post){
if(location.href.match(/type=quote/i)){
var m = document.postForm.message;
m.value = m.value.replace(/\[yt\].+?\[\/yt\]/gi,"");
}
if(document.create_post.message_color){
var h = document.createElement("span");
h.innerHTML = " <a href='javascript:add(document.create_post.message, \"[url=\", \"]YouTube Video[/url]\");'><img src='"+ubbcURL+"' border='0' alt='YouTube' /></a>";
var c = document.create_post.message_color.parentNode;
c.insertBefore(h, c.getElementsByTagName("br")[1]);
}
}
</script>


This code will let you embed YouTube videos in your posts. They won't automatically play until the user hits the play button, so it won't make computers load the page slowly.

The module should go in your global footers.

Please note that the YouTube UBBC is only supported in posts, not PMs.


When posting a video, you put the video ID between the [url= tags. The ID is the part of the URL following v=

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


Last Edit: Nov 4, 2008 1:35:31 GMT by Chris

newBookmarkLockedFalling