Ok i modified this to a better way of doing this. Adding this code 3 or 4 times is not efficient enough for me and can get complicated. For those of you who want an easy way to do this follow this step.
in clientscript/vbulletin_textedit.js find
Code:
case 'PHP':
{
this.apply_format('removeformat');
}
Add right below that
Code:
case 'VIDEO':
{
var video = this.get_selection();
if((video=="") || (video==null)){
var video=prompt("MySpace, YouTube, Google video, eBaum's World or Metacafe URL","");
}
if (video.match("youtube.com"))
{
var col_array=video.split("?v=");
var part_num=1;
if(col_array[part_num] == null || col_array[part_num] == ""){
alert("Please Highlight the Full URL!");
return false;
}
return this.insert_text("[youtube]" + col_array[part_num] + "[/youtube]");
}
else if (video.match("myspace.com"))
{
if (video.match("videoID="))
{
var col_array=video.split("videoID=");
}
else
{
var col_array=video.split("videoid=");
}
var part_num=1;
if(col_array[part_num] == null || col_array[part_num] == ""){
alert("Please Highlight the Full URL!");
return false;
}
return this.insert_text("[myspace]" + col_array[part_num] + "[/myspace]");
}
else if (video.match("video.google."))
{
var col_array=video.split("docid=");
var part_num=1;
if(col_array[part_num] == null || col_array[part_num] == ""){
alert("Please Highlight the Full URL!");
return false;
}
return this.insert_text("[googlevideo]" + col_array[part_num] + "[/googlevideo]");
}
else if (video.match("ebaumsworld.com")) {
var video = video.replace(".html","");
var col_array = video.split("ebaumsworld.com/");
if(col_array[part_num] == null || col_array[part_num] == ""){
alert("Please Highlight the Full URL!");
return false;
}
return this.insert_text("[ebaumsvideo]" + col_array[1] + "[/ebaumsvideo]");
}
else if (video.match("metacafe.com"))
{
var video = video.replace(new RegExp(/\/$/),"");
var col_array = video.split(new RegExp(/\/watch\//g));
if(col_array[part_num] == null || col_array[part_num] == ""){
alert("Please Highlight the Full URL!");
return false;
}
return this.insert_text("[metacafe]" + col_array[1] + "[/metacafe]");
}
else{
alert("Please Enter The Full URL!");
return false;
}
return false;
}
now in the templates editor_toolbar_on and postbit_quickedit and showthread_quickreply
find:
Code:
<if condition="$show['img_bbcode']">
<td><div class="imagebutton" id="{$editorid}_cmd_insertimage"><img src="$stylevar[imgdir_editor]/insertimage.gif" width="21" height="20" alt="$vbphrase[insert_image]" /></div></td>
</if>
and add below
Code:
<td><div class="imagebutton" id="{$editorid}_cmd_wrap0_VIDEO"><img src="http://wwwstagemc.nhmccd.edu/resources/images/live/locations/mc/general/MC_video_icon.gif" width="21" height="20" alt="$vbphrase[insert_link]" /></div></td>
Install the product file and thats it. Also if they highlight the URL it will add tags, if they highlight it but it doesnt have any type of video url it will tell them to select the entire url. if they dont highlight anything it will prompt them for something.