Custom BBCodes [Deprecated]

Get help developing custom BBCodes or request one.
Locked
User avatar
Brogan
Registered User
Posts: 479
Joined: Thu Jul 10, 2008 10:12 pm
Location: Docklands, London, UK

Re: Custom BBCodes

Post by Brogan »

For everyone looking for a spoiler code, this is what I use.

BBCode

Code: Select all

[button={TEXT1}]{TEXT2}[/button]
HTML Replacement

Code: Select all

<div class="quotetitle"><input type="button" value="{TEXT1}" style="font-size:11px;margin:0px;padding:0px;" onclick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';        this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = '{TEXT1}'; }" /></div><div class="quotecontent"><div style="display: none;">{TEXT2}</div></div>
Example

Code: Select all

[button={TEXT1}]{TEXT2}[/button]
It can be seen working here: http://www.cliptheapex.com/forum/viewto ... =128#p1635

--
avillabon
Registered User
Posts: 68
Joined: Mon Jul 14, 2008 3:51 am
Location: Venezuela
Contact:

Re: Custom BBCodes

Post by avillabon »

hey everyone!

i'm building a forum and i think this is the place to ask for help or even requesdt a bbcocde...

I want to be able to embed videos from a site called sputnik7 (http://www.sputnik7.com/) how hard is it to create a code to embed videos from this site? is there one already?

thanks!

Alex
User avatar
jimdunn
Registered User
Posts: 1570
Joined: Tue Mar 25, 2008 11:49 am
Location: Australia

Re: Custom BBCodes

Post by jimdunn »

avillabon wrote: I want to be able to embed videos from a site called sputnik7 (http://www.sputnik7.com/) how hard is it to create a code to embed videos from this site? is there one already?
Try this:
ACP-Posting-BBCodes- Add a new BBcode

BBCode Usage:

Code: Select all

[sputnik7]{TEXT}[/sputnik7]
HTML replacement:

Code: Select all

<embed src="http://sputnik7.com/v/{TEXT}" width="430" height="350" type="application/x-shockwave-flash" allowfullscreen="true"></embed>
and use it like this in your posts:

Code: Select all

[sputnik7]3666[/sputnik7]
where 3666 is the numeric video id from the url of the video page, like:
http ://sputnik7.com/file/3666-artifex-build-an-elephant-for-nissan.html
avillabon
Registered User
Posts: 68
Joined: Mon Jul 14, 2008 3:51 am
Location: Venezuela
Contact:

Re: Custom BBCodes

Post by avillabon »

wow that was fast and works like a charm!

one more question though... i would for the video to be centered once they are posted with their bbcode, currently i use [center][/center] code to center my videos, any way to add this to the bbcodes such as the one for sputnik?

Alex
avillabon
Registered User
Posts: 68
Joined: Mon Jul 14, 2008 3:51 am
Location: Venezuela
Contact:

Re: Custom BBCodes

Post by avillabon »

never mind.. i figured it out! i guess im learning from reading so much code!!!

this is what i changed:

<center><embed src="http://sputnik7.com/v/{TEXT}" width="550" height="350" type="application/x-shockwave-flash" allowfullscreen="true"></embed></center>

hope this helps someone! thanks for all the help!

Alex
avillabon
Registered User
Posts: 68
Joined: Mon Jul 14, 2008 3:51 am
Location: Venezuela
Contact:

Re: Custom BBCodes

Post by avillabon »

this is probably getting to be boring for everyone to see me post one time after the other but i just realized i would like to post sputnik videos using the whole address instead of just the number since the search in that site is really bad and i were to need the url again. What modifications do i have to make to the code for it to work?

Alex
Ezzzy
Registered User
Posts: 139
Joined: Fri Feb 22, 2008 2:50 am

Re: Custom BBCodes

Post by Ezzzy »

I found this spoilerblkout here and I love it but it's got one problem the blackout overlaps the text.
Can someone correct this if possible 8-)

example:
Image


Code: Select all

[spoilerblkout]{TEXT}[/spoilerblkout]

<strong>spoiler:</strong><br /><br /><span style="padding: 11px; background-color: black; font-size: 0.8em; color: black;" onmouseover='javascript:this.style.color="white";' onmouseout='javascript:this.style.color="black";' bgcolor="black">{TEXT}</span>

[spoilerblkout]Your text goes here double line space[/spoilerblkout]

Thanks a Million
Last edited by Ezzzy on Thu Aug 07, 2008 5:20 am, edited 1 time in total.
Ezzzy
Registered User
Posts: 139
Joined: Fri Feb 22, 2008 2:50 am

Re: Custom BBCodes

Post by Ezzzy »

A frequent problem with these Javascript codes is that they only work once in a post or topic. All subsequent instances fail. Anyone know why that is or how to fix it?

Code: Select all

[colortext]{TEXT}[/colortext]

Code: 
<script type="text/javascript">
function cfc() {
x=0; y=0; color= "#";
while (x<6) {
y= Math.round(Math.random()*15).toString(16);
color = color + y; x= x+1; }
document.getElementById("a").color = color; 
t=setTimeout("cfc()",300);}
</script>
<font id="a">{TEXT}</font>
<script type="text/javascript">window.onload = cfc();</script>

Thanks :)
User avatar
jimdunn
Registered User
Posts: 1570
Joined: Tue Mar 25, 2008 11:49 am
Location: Australia

Re: Custom BBCodes

Post by jimdunn »

avillabon wrote:this is probably getting to be boring for everyone to see me post one time after the other but i just realized i would like to post sputnik videos using the whole address instead of just the number since the search in that site is really bad and i were to need the url again. What modifications do i have to make to the code for it to work?

Alex
I can't see an easy way to do that because the url for the embedded player is different format to the url for the full pageitself,

full page url:

Code: Select all

http://sputnik7.com/file/3666-artifex-build-an-elephant-for-nissan.html
source for the embedded video:

Code: Select all

http://sputnik7.com/v/3666

But hey, guess what - you don't need to do it anyway - because once you have embedded a video in a post with the existing code, the little grey Sputnik logo on the player is a "link" to the full video page. ;)
User avatar
jimdunn
Registered User
Posts: 1570
Joined: Tue Mar 25, 2008 11:49 am
Location: Australia

Re: Custom BBCodes

Post by jimdunn »

Ezzzy wrote:A frequent problem with these Javascript codes is that they only work once in a post or topic. All subsequent instances fail. Anyone know why that is or how to fix it?
That one fails because getElementById only finds the first instance of the font id on the page.

You can use getElementsByTagName to get an array, and then loop through it to catch multiples.

This worked when I tested it:

HTML Replacement

Code: Select all

<script type="text/javascript">
function cfc() 
{
x=0; y=0; color= "#";
while (x<6) 
{
    y= Math.round(Math.random()*15).toString(16);
    color = color + y; x= x+1; 
}

var el=document.getElementsByTagName('span');

for (i=0;i<el.length;i++)
{
    if (el[i].className == "multicolor")
    {
        el[i].style.color = color;
    }
}

t=setTimeout("cfc()",300);
}
</script>
<span class="multicolor">{TEXT}</span>
<script type="text/javascript">window.onload = cfc();</script>
Ezzzy
Registered User
Posts: 139
Joined: Fri Feb 22, 2008 2:50 am

Re: Custom BBCodes

Post by Ezzzy »

jimdunn wrote:
Ezzzy wrote:A frequent problem with these Javascript codes is that they only work once in a post or topic. All subsequent instances fail. Anyone know why that is or how to fix it?
That one fails because getElementById only finds the first instance of the font id on the page.

You can use getElementsByTagName to get an array, and then loop through it to catch multiples.

This worked when I tested it:
That works perfect ;)
Thanks so much "jimdunn"
User avatar
Linda Carter
Registered User
Posts: 514
Joined: Fri Feb 15, 2008 6:45 am

Re: Custom BBCodes

Post by Linda Carter »

:mrgreen:

Embedding videos hosted on your website

Here's the other Spoiler HTML Replacement code which I also like it:

Code: Select all

<div style="padding: 3px; background-color: #FFFFFF; border: 1px solid #d8d8d8; font-size: 1em;"><div style="text-transform: uppercase; border-bottom: 1px solid #CCCCCC; margin-bottom: 3px; font-size: 0.8em; font-weight: bold; display: block;"><span onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') {  this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = ''; this.innerHTML = '<b>Spoiler: </b><a href=\'#\' onClick=\'return false;\'>Hide</a>'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerHTML = '<b>Spoiler: </b><a href=\'#\' onClick=\'return false;\'>Show</a>'; }" /><b>Spoiler: </b><a href="#" onClick="return false;">show</a></span></div><div class="quotecontent"><div style="display: none;">{TEXT}</div></div></div>
And what about the GameTrailers videos? :)

http://www.gametrailers.com/player/38016.html

We might use the ID (38016) on the BBCode. Is it possible? I saw these working on vbulletin last week.
"Whoever has not known himself has known nothing. But whoever has known himself has simultaneously achieved knowledge about the depth of all things."
User avatar
jimdunn
Registered User
Posts: 1570
Joined: Tue Mar 25, 2008 11:49 am
Location: Australia

Re: Custom BBCodes

Post by jimdunn »

And what about the GameTrailers videos?
BBcode

Code: Select all

[gametrailers]{TEXT}[/gametrailers]
HTML Replacement

Code: Select all

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="gtembed" width="480" height="392">	<param name="allowScriptAccess" value="sameDomain" /> 	<param name="allowFullScreen" value="true" /> <param name="movie" value="http://www.gametrailers.com/remote_wrap.php?mid={TEXT}"/> <param name="quality" value="high" /> <embed src="http://www.gametrailers.com/remote_wrap.php?mid={TEXT}" swLiveConnect="true" name="gtembed" align="middle" allowScriptAccess="sameDomain" allowFullScreen="true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="480" height="392"></embed> </object>
Use like

Code: Select all

[gametrailers]38016[/gametrailers]
Really these video BBcodes are all the same and very easy to do - you just copy the Embed code they give on the website, find the unique ID and replace it with a {TEXT} variable - sometimes in more than one place like this one :)

The previous one with getElementsByTagName was more fun to work out. :mrgreen:
Furbs
Registered User
Posts: 10
Joined: Fri Aug 01, 2008 2:05 pm

Re: Custom BBCodes

Post by Furbs »

New to this and i have been trying to get Videojug clips embedded and laying on my forum. Does anyone have the bbcode for this to save me pulling me hair out please?
User avatar
jimdunn
Registered User
Posts: 1570
Joined: Tue Mar 25, 2008 11:49 am
Location: Australia

Re: Custom BBCodes

Post by jimdunn »

jimdunn wrote:Really these video BBcodes are all the same and very easy to do - you just copy the Embed code they give on the website, find the unique ID and replace it with a {TEXT} variable
Furbs wrote:New to this and i have been trying to get Videojug clips embedded and laying on my forum. Does anyone have the bbcode for this to save me pulling me hair out please?
Ok, on this occasion the ID is a bit harder to find (and a bit longer) .

You have to click the "Share" Link on the site, then look at the Embed code for the relevant stuff after player?id=:

But the principle I alluded to a couple of posts ago still is true - find the Embed code, replace the ID with a text variable :)

BBcode

Code: Select all

[videojug]{TEXT1}[/videojug]
HTML Replacement:

Code: Select all

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" id="vjplayer07082008" width="400" height="345" align="middle" allowFullScreen="true"><param name="movie" value="http://www.videojug.com/film/player?id={TEXT}" /><PARAM value="true" name="allowFullScreen" /><PARAM value="always" name="allowScriptAccess" /><embed src="http://www.videojug.com/film/player?id={TEXT}" quality="high" width="400" height="345" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" allowfullscreen="true"></embed></object><br />
Use Like:

Code: Select all

[videojug]3ff6e533-5eaf-4ff8-540e-02334f7ac808[/videojug]
Locked

Return to “Custom BBCode Development and Requests”