https://www.icyphoenix.com/viewtopic.php?f=35&t=597&p=4866#p4866
-----------------------------------
Zuker
Sat 18 Nov, 2006 17:16

Re: Google/Youtube Video In BBCode
-----------------------------------
[code]

#
#-----[ UPLOAD ]------------------------------------------
#

youtube.gif to images/bbcb_mg/images/gif/

#
#-----[ OPEN ]------------------------------------------
#

templates/ca_aphrotite/bbcb_mg.tpl

#
#-----[ FIND ]------------------------------------------
#

<a href="javascript:BBCquick()"><img border="0" src="{BBCB_MG_IMG_PATH}quick{BBCB_MG_IMG_EXT}" name="quick" type="image" onMouseOver="helpline('quick')" alt="Quicktime" title="Quicktime" class="bbimages" /></a>

#
#-----[AFTER, ADD]------------------------------------------
#

<a href="javascript:BBCyoutube()" accesskey="p"><img border="0" src="{BBCB_MG_IMG_PATH}youtube{BBCB_MG_IMG_EXT}" name="img" type="image" onMouseOver="helpline('youtube')" alt="Youtube" title="youtube" class="bbimages" /></a>

#
#-----[ OPEN ]------------------------------------------
#

 language/lang_english/bbcb_mg.js

#
#-----[ FIND ]------------------------------------------
#

s_img_error = 'You didn't write the image URL';

#
#-----[ AFTER, ADD]------------------------------------------
#

s_youtube_insert = 'Enter the Youtube video code';
s_youtube_error = 'You didn't write the Youtube video code';

#
#-----[ FIND ]------------------------------------------
#

s_image_upload_help = 'Upload image to PostImage.org and add to message';

#
#-----[ AFTER, ADD]------------------------------------------
#

s_youtube_help = 'Insert a Youtube video';

#
#-----[ FIND ]------------------------------------------
#

'[quote]','[/quote]',

#
#-----[ AFTER, ADD]------------------------------------------
#

'[youtube]','[/youtube]',

#
#-----[ FIND ]------------------------------------------
#

var Code = 0;

#
#-----[ AFTER, ADD]------------------------------------------
#

var youtube = 0;

#
#-----[ FIND ]------------------------------------------
#

function BBCcode()
{
	var txtarea = document.post.message;
	
	if ((clientVer >= 4) && is_ie && is_win)
	{
		theSelection = document.selection.createRange().text;
		if (theSelection != '')
		{
			document.selection.createRange().text = "[code linenumbers=false]" + theSelection + "[/code]";
			document.post.message.focus();
			return;
		}
	}
	else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
	{
		mozInsert(txtarea, "[code linenumbers=false]", "[/code]");
		return;
	}	
	if (Code == 0)
	{
		ToAdd = "[code linenumbers=false]";
		document.post.code.src = bbcb_mg_img_path + "code1" + bbcb_mg_img_ext;
		Code = 1;
	}
	else
	{
		ToAdd = "[/code]";
		document.post.code.src = bbcb_mg_img_path + "code" + bbcb_mg_img_ext;
		Code = 0;
	}
	PostWrite(ToAdd);
}

#
#-----[ BEFORE, ADD]------------------------------------------
#

function BBCyoutube()
{
	var FoundErrors = '';
	var enterURL = prompt(s_youtube_insert, s_url_insert_tip);
	if (!enterURL)
	{
		FoundErrors += s_youtube_error;
	}
	if (FoundErrors)
	{
		alert(s_gen_error + FoundErrors);
		return;
	}
	var ToAdd = "[youtube]"+enterURL+"[/youtube]";
	PostWrite(ToAdd);
}[/code]


