Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 YouTube forum code
 New Topic  Reply to Topic
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 7

lucapan
Starting Member

9 Posts

Posted - 29 August 2007 :  11:05:10  Show Profile  Visit lucapan's Homepage  Reply with Quote
I wrote a little mod to use a brand new youtube forum code, like:

[youtube]http://www.youtube.com/watch?v=gJmX1z1NY2c[/youtube]

Here is the code:
http://www.lucapanella.com/downloads/SnitzYouTubeForumCodeMod.zip
<

http://www.gpfun.net
GP Races with Grand Prix Legends

Edited by - lucapan on 01 September 2007 10:12:35

JJenson
Advanced Member

USA
2121 Posts

Posted - 29 August 2007 :  11:12:32  Show Profile  Visit JJenson's Homepage  Reply with Quote
That would be great but your text file isn't showing me the whole code?

But I like the idea.<
Go to Top of Page

Podge
Support Moderator

Ireland
3775 Posts

Posted - 29 August 2007 :  12:27:05  Show Profile  Send Podge an ICQ Message  Send Podge a Yahoo! Message  Reply with Quote
Marcel did a mod for this ages ago.

http://forum.snitz.com/forum/topic.asp?TOPIC_ID=60387

This is the updated function I'm using for the new YouTube code. It actually works for all three types of YouTube code.

function EmbedTubeVideoT(YTPermalink, width, height, autostart) {   
	if(YTPermalink == null || YTPermalink == "illegal"){
		//Nope, we can't.
		document.writeln(" error: illegal use of video tag! ");
	}else{
		//Add the code to the document.
		genCode = YTPermalink.replace(new RegExp(/http\:\/\/www\.youtube\.com\/\?v\=/g), ""); 
		genCode = genCode.replace(new RegExp(/http\:\/\/www\.youtube\.com\/watch\?v\=/g), ""); 
		genCode = genCode.replace(new RegExp(/http\:\/\/www\.youtube\.com\/v\//g), "");
		//document.writeln("gencode-"+genCode);
		document.writeln('<object width="' + width + '" height="' + height + '"><param name="movie" value="http://www.youtube.com/v/' + genCode + '"><param name="wmode" value="transparent" /></param>');
		document.writeln('<embed src="http://www.youtube.com/v/' + genCode + '" type="application/x-shockwave-flash" width="' + width + '" height="' + height + '" wmode="transparent"></embed></object>'); 
		document.writeln('<br><center>Hosted by <a href ="' + YTPermalink + '" target="_blank">YouTube</a></center>');
	}
}
<

Podge.

The Hunger Site - Click to donate free food | My Blog | Snitz 3.4.05 AutoInstall (Beta!)

My Mods: CAPTCHA Mod | GateKeeper Mod
Tutorial: Enable subscriptions on your board

Warning: The post above or below may contain nuts.
Go to Top of Page

lucapan
Starting Member

9 Posts

Posted - 29 August 2007 :  14:13:37  Show Profile  Visit lucapan's Homepage  Reply with Quote
quote:
Originally posted by Podge

Marcel did a mod for this ages ago.

http://forum.snitz.com/forum/topic.asp?TOPIC_ID=60387



Marcel's mod is powerfull!

My mod is simpler, it is for youtube videos only and doesn't involve javascripts. I did't want to embed other type of videos, so i made my own.

I thought to post my mod to contribute in this great community. If you like it, use it. Otherwise use Marcel's one.
<

http://www.gpfun.net
GP Races with Grand Prix Legends
Go to Top of Page

lucapan
Starting Member

9 Posts

Posted - 29 August 2007 :  14:15:15  Show Profile  Visit lucapan's Homepage  Reply with Quote
quote:
Originally posted by JJenson

That would be great but your text file isn't showing me the whole code?



It shows only the piece of code to modify... is it not enough?
Maybe i missed something?? <

http://www.gpfun.net
GP Races with Grand Prix Legends
Go to Top of Page

JJenson
Advanced Member

USA
2121 Posts

Posted - 29 August 2007 :  14:31:17  Show Profile  Visit JJenson's Homepage  Reply with Quote
this is all I see.

I wrote this mod for Snitz Forum to use a simple forum code like: [youtube]gJmX1z1NY2c[/youtube] to embed a youtube video in the forum. Modify "inc_func_common.asp" adding the following function at the end of the file, before the<
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 29 August 2007 :  14:40:25  Show Profile  Visit AnonJr's Homepage  Reply with Quote
JJenson, do a "View Source" or Right-click on the link and "Save Target As..." - his web server is processing the page instead of displaying it as a .txt file. Doing a "View Source" showed this:

I wrote this mod for Snitz Forum to use a simple forum code like:

[youtube]gJmX1z1NY2c[/youtube]

to embed a youtube video in the forum.

Modify "inc_func_common.asp" adding the following function at the end of the file, before the <script> section:

____________________________________

<%
Function ReplaceYouTubeTags(fString)
Dim oTag, cTag
Dim roTag1, rcTag1, roTag2, rcTag2
Dim oTagPos, cTagPos
Dim nTagPos
Dim counter1, counter2
Dim strCodeText
Dim Tagcount
Dim strTempString, strResultString
TagCount = 1
Dim CodeTags(1,2,3)
Dim strArray, strArray2

CodeTags(1,1,1) = "[youtube]"
CodeTags(1,2,1) = "[/youtube]"
CodeTags(1,1,2) = "<object width=""425"" height=""353""><param name=""movie"" value=""http://www.youtube.com/v/"
CodeTags(1,2,2) = """></param><param name=""wmode"" value=""transparent""></param>"
CodeTags(1,1,3) = "<embed src=""http://www.youtube.com/v/"
CodeTags(1,2,3) = """ type=""application/x-shockwave-flash"" wmode=""transparent"" width=""425"" height=""353""></embed></object>"

strResultString = ""
strTempString = fString

for counter1 = 1 to TagCount

oTag = CodeTags(counter1,1,1)
roTag1 = CodeTags(counter1,1,2)
roTag2 = CodeTags(counter1,1,3)
cTag = CodeTags(counter1,2,1)
rcTag1 = CodeTags(counter1,2,2)
rcTag2 = CodeTags(counter1,2,3)
oTagPos = InStr(1, strTempString, oTag, 1)
cTagPos = InStr(1, strTempString, cTag, 1)

if (oTagpos > 0) and (cTagPos > 0) then
strArray = Split(strTempString, oTag, -1, 1)
for counter2 = 0 to Ubound(strArray)
if (Instr(1, strArray(counter2), cTag) > 0) then
strArray2 = split(strArray(counter2), cTag, -1, 1)
strCodeText = trim(strArray2(0))
strCodeText = replace(strCodeText, """", " ") ' ## filter out "
'## Added to exclude Javascript and other potentially hazardous characters
strCodeText = replace(strCodeText, "&", " ", 1, -1, 1) ' ## filter out &
strCodeText = replace(strCodeText, "#", " ", 1, -1, 1) ' ## filter out #
strCodeText = replace(strCodeText, ";", " ", 1, -1, 1) ' ## filter out ;
strCodeText = replace(strCodeText, "+", " ", 1, -1, 1) ' ## filter out +
strCodeText = replace(strCodeText, "(", " ", 1, -1, 1) ' ## filter out (
strCodeText = replace(strCodeText, ")", " ", 1, -1, 1) ' ## filter out )
strCodeText = replace(strCodeText, "[", " ", 1, -1, 1) ' ## filter out [
strCodeText = replace(strCodeText, "]", " ", 1, -1, 1) ' ## filter out ]
strCodeText = replace(strCodeText, "=", " ", 1, -1, 1) ' ## filter out =
strCodeText = replace(strCodeText, "*", " ", 1, -1, 1) ' ## filter out *
strCodeText = replace(strCodeText, "'", " ", 1, -1, 1) ' ## filter out '
strCodeText = replace(strCodeText, vbTab, " ", 1, -1, 1) ' ## filter out Tabs
strCodeText = replace(strCodeText, "view-source", " ", 1, -1, 1) ' ## filter out view-source
strCodeText = replace(strCodeText, "javascript", " ", 1, -1, 1) ' ## filter out javascript
strCodeText = replace(strCodeText, "jscript", " ", 1, -1, 1) ' ## filter out jscript
strCodeText = replace(strCodeText, "vbscript", " ", 1, -1, 1) ' ## filter out vbscript
strCodeText = replace(strCodeText, "mailto", " ", 1, -1, 1) ' ## filter out mailto
'## End Added
strCodeText = replace(strCodeText, "<", " ") ' ## filter out <
strCodeText = replace(strCodeText, ">", " ") ' ## filter out >
strCodeText = replace(strCodeText, "<br />", vbNewLine)
strResultString = strResultString & roTag1 & strCodeText & rcTag1 & roTag2 & strCodeText & rcTag2 & strArray2(1)
else
strResultString = strResultString & strArray(counter2)
end if
next

strTempString = strResultString
strResultString = ""
end if
next

ReplaceYouTubeTags = strTempString
end function
%>
____________________________________

At line 239 change:

____________________________________

if strAllowForumCode = "1" then
fString = extratags(fString)
end if
____________________________________

to
____________________________________

if strAllowForumCode = "1" then
fString = extratags(fString)
fString = ReplaceYouTubeTags(fString)
end if
____________________________________

Now you can use the brand new forum code!

If you want, you can modify "pop_forum_code.asp",
adding the following code before if (strIMGInPosts = "1"), at line 158.

____________________________________

Response.Write "<p><b>YouTube:</b> Enclose the video hash code with [youtube] and [/youtube] .  <i>Example:</i> Here is a video: <b>[youtube]</b>gJmX1z1NY2c<b>[/youtube]</b></p>" & vbNewLine
____________________________________

Ciao!
Luca Panella

29-Aug-2007
<
Go to Top of Page

JJenson
Advanced Member

USA
2121 Posts

Posted - 29 August 2007 :  14:48:35  Show Profile  Visit JJenson's Homepage  Reply with Quote
Ahh didn't even think about the view source. At work and paying attention to my jobs here sort of I just want to stop working today. I am having one of those weeks.<
Go to Top of Page

Podge
Support Moderator

Ireland
3775 Posts

Posted - 29 August 2007 :  18:00:22  Show Profile  Send Podge an ICQ Message  Send Podge a Yahoo! Message  Reply with Quote
Its because of the <script> tag.<

Podge.

The Hunger Site - Click to donate free food | My Blog | Snitz 3.4.05 AutoInstall (Beta!)

My Mods: CAPTCHA Mod | GateKeeper Mod
Tutorial: Enable subscriptions on your board

Warning: The post above or below may contain nuts.
Go to Top of Page

leatherlips
Senior Member

USA
1838 Posts

Posted - 29 August 2007 :  21:44:21  Show Profile  Visit leatherlips's Homepage  Reply with Quote
I just tried this on my forum and it works great! It would be nice to have a YouTube button to automatically add the YouTube tags...<

Mangione Magic Forum - The Music of Chuck Mangione

My Mods: Googiespell MOD | Link To Reply MOD | Petition MOD | Contact Page MOD | Share This Topic MOD | MP3 MOD | PageEar MOD | Google Viewer MOD
Go to Top of Page

lucapan
Starting Member

9 Posts

Posted - 30 August 2007 :  04:32:26  Show Profile  Visit lucapan's Homepage  Reply with Quote
quote:
Originally posted by Podge

Its because of the <script> tag.



Right. I put the text file in a zip archive, so there is no problem about that.<

http://www.gpfun.net
GP Races with Grand Prix Legends
Go to Top of Page

lucapan
Starting Member

9 Posts

Posted - 30 August 2007 :  05:03:09  Show Profile  Visit lucapan's Homepage  Reply with Quote
quote:
Originally posted by leatherlips

It would be nice to have a YouTube button to automatically add the YouTube tags...



Done! There's a new link in the first post! <

http://www.gpfun.net
GP Races with Grand Prix Legends
Go to Top of Page

leatherlips
Senior Member

USA
1838 Posts

Posted - 30 August 2007 :  15:37:59  Show Profile  Visit leatherlips's Homepage  Reply with Quote
Looking good! Thanks for adding the button. I have one more request...

Is it possible to allow members to insert the entire YouTube URL? It seems this mod requires members to only insert the section of the URL that appears after the equal sign (=). I'm afraid this will confuse some members. They'll simply insert the entire URL which will not work. Or is it possible to have this MOD automatically strip out everything in the URL expect for the unique code?<

Mangione Magic Forum - The Music of Chuck Mangione

My Mods: Googiespell MOD | Link To Reply MOD | Petition MOD | Contact Page MOD | Share This Topic MOD | MP3 MOD | PageEar MOD | Google Viewer MOD
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 30 August 2007 :  15:51:46  Show Profile  Visit AnonJr's Homepage  Reply with Quote
I know Marcel was working on something like that... I'm not sure if he finished. I think the code he was playing with is over at oxle.com though, as he was planning to post it here to when he was done.... but this is mostly speculation on my part as I am over-tired and under-caffinated.<
Go to Top of Page

leatherlips
Senior Member

USA
1838 Posts

Posted - 30 August 2007 :  16:32:00  Show Profile  Visit leatherlips's Homepage  Reply with Quote
Hmmm... Doing some more testing, it seems that the YouTube button will not work on a Mac using Safari. All of the other buttons do work. Any ideas?<

Mangione Magic Forum - The Music of Chuck Mangione

My Mods: Googiespell MOD | Link To Reply MOD | Petition MOD | Contact Page MOD | Share This Topic MOD | MP3 MOD | PageEar MOD | Google Viewer MOD
Go to Top of Page

phy1729
Average Member

USA
589 Posts

Posted - 30 August 2007 :  17:04:29  Show Profile  Reply with Quote
Could you give a link to where it's implemented?<
Go to Top of Page
Page: of 7 Previous Topic Topic Next Topic  
Next Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000 Version 3.4.07