Current time: 04-24-2014, 03:31 PM Hello There, Guest! (LoginRegister)


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My Custom MyCodes
03-23-2007, 12:25 PM (This post was last modified: 03-23-2007 12:27 PM by Yumi.)
Post: #1
My Custom MyCodes
My site is pretty much bloated with useless MyCodes... *sigh*
Oh well, I've decided to post them here, if anyone finds them useful Toungue Most are quite useless and very simple, but meh.
(Note, I'm sorda lazy, so I've just put the Regular expression followed by the replacement for each tag)

Background Color of Text
PHP Code:
\[bg=([a-zA-Z]*|\#?[0-9a-fA-F]{6})\](.*?)\[/bg\] 
PHP Code:
<SPAN STYLE="background-color: $1">$2</SPAN

Background Picture of Text
PHP Code:
\[bgimg=([^"'[]+?)\](.*?)\[/bgimg\] 
PHP Code:
<SPAN STYLE="background-image: url('$1')">$2</SPAN

Embedded Webpage
(note that I have three versions of this - you could probably make a "neater" version by editing the parser; also note that I suggest you change the image it points to)
PHP Code:
\[page\]([^"[]+?)\[/page\] 
PHP Code:
<small><i><a href="$1" title="Link to the original flash object">Object Link</a></i></small>
<
div style="padding: 0 0 0 0; width: 480px; height: 360px;">
<
a href="javascript:void(0);" onClick="this.parentNode.getElementsByTagName('div')[0].innerHTML='<iframe width=\'480\' height=\'360\' src=\'$1\'>[Embedded Webpage]</iframe>';" onMouseOver="this.getElementsByTagName('div')[0].style.background='#C0C0C0';" onMouseOut="this.getElementsByTagName('div')[0].style.background='#E0E0E0';"><div style="text-align: center; vertical-align: middle; font-size: 1.3em; background: #E0E0E0; border-width: 1px; border-color: #A0A0A0; border-style: solid; width: 480px; height: 360px; overflow: hidden"><img src="http://zingaburga.freehostia.com/img/webpage.gif" style="margin-top: 20px"><br>Click here to view embedded webpage
<br /><font size="-2">Please note that by activating this featurethere may be undesirable consequences</font></div></a></div
...with dimensions
PHP Code:
\[page=([0-9]{1,3})x([0-9]{1,3})\]([^"[]+?)\[/page\] 
PHP Code:
<small><i><a href="$3" title="Link to the original flash object">Object Link</a></i></small>
<
div style="padding: 0 0 0 0; width: $1px; height: $2px;">
<
a href="javascript:void(0);" onClick="this.parentNode.getElementsByTagName('div')[0].innerHTML='<iframe width=\'$1\' height=\'$2\' src=\'$3\'>[Embedded Webpage]</iframe>';" onMouseOver="this.getElementsByTagName('div')[0].style.background='#C0C0C0';" onMouseOut="this.getElementsByTagName('div')[0].style.background='#E0E0E0';"><div style="text-align: center; vertical-align: middle; font-size: 1.3em; background: #E0E0E0; border-width: 1px; border-color: #A0A0A0; border-style: solid; width: $1px; height: $2px; overflow: hidden"><img src="http://zingaburga.freehostia.com/img/webpage.gif" style="margin-top: 20px"><br>Click here to view embedded webpage
<br /><font size="-2">Please note that by activating this featurethere may be undesirable consequences</font></div></a></div
...with just a height dimension (will make width = 100%)
PHP Code:
\[page=(x|)([0-9]{1,3})\]([^"[]+?)\[/page\] 
PHP Code:
<small><i><a href="$3" title="Link to the original flash object">Object Link</a></i></small>
<
div style="padding: 0 0 0 0; width: 100%; height: $2px;">
<
a href="javascript:void(0);" onClick="this.parentNode.getElementsByTagName('div')[0].innerHTML='<iframe width=\'100%\' height=\'$2\' src=\'$3\'>[Embedded Webpage]</iframe>';" onMouseOver="this.getElementsByTagName('div')[0].style.background='#C0C0C0';" onMouseOut="this.getElementsByTagName('div')[0].style.background='#E0E0E0';"><div style="text-align: center; vertical-align: middle; font-size: 1.3em; background: #E0E0E0; border-width: 1px; border-color: #A0A0A0; border-style: solid; width: 100%; height: $2px; overflow: hidden"><img src="http://zingaburga.freehostia.com/img/webpage.gif" style="margin-top: 20px"><br>Click here to view embedded webpage
<br /><font size="-2">Please note that by activating this featurethere may be undesirable consequences</font></div></a></div

Fieldset
PHP Code:
\[fieldset\](.*?)\[/fieldset\] 
PHP Code:
<FIELDSET>$1</FIELDSET
...with colour
PHP Code:
\[fieldset=([a-zA-Z]*|\#?[0-9a-fA-F]{6})\](.*?)\[/fieldset\] 
PHP Code:
<FIELDSET STYLE="background-color: $1">$2</FIELDSET
...legend
PHP Code:
\[legend\](.*?)\[/legend\] 
PHP Code:
<LEGEND>$1</LEGEND
(I preferred to use this instead of a fieldset= type tag to allow MyCode to be entered into the legend)

Flash Object
(note that this is loaded through DHTML to prevent possible exploitation via Flash; also, please change the URL of the icon)
PHP Code:
\[flash\]([^"[]+?)\[/flash\] 
PHP Code:
<small><i><a href="$1" title="Link to the original flash object">Object Link</a></i></small>
<
div style="padding: 0 0 0 0; width: 320px; height: 240px;">
<
a href="javascript:void(0);" onClick="this.parentNode.getElementsByTagName('div')[0].innerHTML='<object width=\'320\' height=\'240\'><param name=\'movie\' value=\'$1\'><embed src=\'$1\' width=\'320\' height=\'240\' type=\'application/x-shockwave-flash\' quality=\'best\'></embed></object>';" onMouseOver="this.getElementsByTagName('div')[0].style.background='#C0C0C0';" onMouseOut="this.getElementsByTagName('div')[0].style.background='#E0E0E0';"><div style="text-align: center; valign: middle; font-size: 1.3em; background: #E0E0E0; border-width: 1px; border-color: #A0A0A0; border-style: solid; width: 320px; height: 240px; overflow: hidden"><img src="http://zingaburga.freehostia.com/img/flash.gif" style="margin-top: 20px"><br>Click here to view flash object</div></a></div
...with dimensions
PHP Code:
\[flash=([0-9]{1,3})x([0-9]{1,3})\]([^"[]+?)\[/flash\] 
PHP Code:
<small><i><a href="$3" title="Link to the original flash object">Object Link</a></i></small>
<
div style="padding: 0 0 0 0; width: $1px; height: $2px;">
<
a href="javascript:void(0);" onClick="this.parentNode.getElementsByTagName('div')[0].innerHTML='<object width=\'$1\' height=\'$2\'><param name=\'movie\' value=\'$3\'><embed src=\'$3\' width=\'$1\' height=\'$2\' type=\'application/x-shockwave-flash\' quality=\'best\'></embed></object>';" onMouseOver="this.getElementsByTagName('div')[0].style.background='#C0C0C0';" onMouseOut="this.getElementsByTagName('div')[0].style.background='#E0E0E0';"><div style="text-align: center; valign: middle; font-size: 1.3em; background: #E0E0E0; border-width: 1px; border-color: #A0A0A0; border-style: solid; width: $1px; height: $2px; overflow: hidden"><img src="http://zingaburga.freehostia.com/img/flash.gif" style="margin-top: 20px"><br>Click here to view flash object</div></a></div

Google Video
PHP Code:
\[gvid\]http\://video\.google\.com/videoplay\?docid=([^"[]+?)\[/gvid\] 
PHP Code:
<SMALL STYLE="margin-top: -100"><I><A HREF="http://video.google.com/videoplay?docid=$1">SourceGoogle Video</A></I></SMALL>
<
embed style=\"width:400px; height:326px;\" id=\"VideoPlayback\" align=\"middle\" type=\"application/x-shockwave-flash\" src=\"$1&hl=en\" quality=\"best\"  FlashVars=\"playerMode=embedded\"> </embed> 

Indent
PHP Code:
\[indent\](.*?)\[/indent\] 
PHP Code:
<DIV STYLE="margin-left: 15px">$1</DIV

Link in new window
PHP Code:
\[popup=([^"'\\[]+?)\](.*?)\[/popup\] 
PHP Code:
<A HREF="javascript:window.open('$1',0,'toolbars=0,location=0,status=0,resizable=1,scroll​bars=1');void(0);">$2</A

List (images as items)
PHP Code:
\[list=http://([^"'[]+?)\](.*?)\[/list\] 
PHP Code:
<UL STYLE="list-style-image: url('http://$1')">$2</UL
...you'll also need to add this
PHP Code:
\[\*\] 
PHP Code:
<LI

Overline
PHP Code:
\[o\](.*?)\[/o\] 
PHP Code:
<SPAN STYLE="text-decoration: overline">$1</SPAN

Small caps
PHP Code:
\[sc\](.*?)\[/sc\] 
PHP Code:
<SPAN STYLE="font-variant: small-caps">$1</SPAN

Sound (embedded link)
PHP Code:
\[sound=([^"'\\[]+?)\](.*?)\[/sound\] 
PHP Code:
<span><a href="javascript:void(0);" onClick="this.parentNode.getElementsByTagName('span')[0].innerHTML='<embed src=\'$1\' hidden=true autostart=true loop=false style=\'visibility: hidden; visible: hide; width:1;height:1;position:absolute\'>';" TITLE="Click to play sound"><img src="images/smilies/sound.gif" style="padding-top: 2px; vertical-align: top" border=/> $2</A><span STYLE="visibility: hidden; visible: hide;height:1;width:1;overflow:hidden"></span></span

Spoiler
PHP Code:
\[spoiler\](.*?)\[/spoiler\] 
PHP Code:
<div><div style="margin-bottom:2px; font-size: 12px"><b>Spoiler</b>: <input type="button" value="Show" style="width:45px;font-size:10px;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 = 'Show'; }">
</
div>
<
div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<
div style="display: none;">
$
1
</div>
</
div></div
...with description
PHP Code:
\[spoiler=(.*?)\](.*?)\[/spoiler\] 
PHP Code:
<div><div style="margin-bottom:2px; font-size: 12px"><b>Spoiler</b> for <i>$1</i>: <input type="button" value="Show" style="width:45px;font-size:10px;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 = 'Show'; }">
</
div>
<
div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<
div style="display: none;">
$
2
</div>
</
div></div

Subscript
PHP Code:
\[sub\](.*?)\[/sub\] 
PHP Code:
<SUB>$1</SUB

Superscript
PHP Code:
\[sup\](.*?)\[/sup\] 
PHP Code:
<SUP>$1</SUP

Tables
PHP Code:
\[table\](.*?)\[/table\] 
PHP Code:
<TABLE STYLE="border-style: ridge; border-width: 1px; padding: 5 5 5 5; margin: 5 0 5 5" ALIGN="center" CELLSPACING=0 CELLPADDING=4 BORDER=0>$1</TABLE
...Table Row
PHP Code:
\[tr\](.*?)\[/tr\] 
PHP Code:
<TR><TH STYLE="height:1px; padding: 0 0 0 0; margin: 0 0 0 0" COLSPAN=100 CLASS="trow_sep"></TH></TR><TR>$1</TR
...Table Row with colour
PHP Code:
\[tr=([a-zA-Z]*|\#?[0-9a-fA-F]{6})\](.*?)\[/tr\] 
PHP Code:
<TR><TH STYLE="height:1px; padding: 0 0 0 0; margin: 0 0 0 0; background-color: $1" COLSPAN=100 CLASS="trow_sep"></TH></TR><TR>$2</TR
......Table Element
PHP Code:
\[td\](.*?)\[/td\] 
PHP Code:
<TD>$1</TD
......Table Element with colour
PHP Code:
\[td=([a-zA-Z]*|\#?[0-9a-fA-F]{6})\](.*?)\[/td\] 
PHP Code:
<TD BGCOLOR="$1">$2</TD
......Table Element, spanned
PHP Code:
\[td span=([^" []+?)\](.*?)\[/td\] 
PHP Code:
<TD COLSPAN="$1">$2</TD
......Table Element, spanned with colour
PHP Code:
\[td=([a-zA-Z]*|\#?[0-9a-fA-F]{6}) span=([0-9]+?)\](.*?)\[/td\] 
PHP Code:
<TD BGCOLOR="$1" COLSPAN="$2">$3</TD

Tooltip
PHP Code:
<TD BGCOLOR="$1" COLSPAN="$2">$3</TD
PHP Code:
<SPAN TITLE="$1">$2</SPAN

Youtube
PHP Code:
\[youtube\]http\://(www\.|)youtube\.com/watch\?v=([^"'[]+?)\[/youtube\] 
PHP Code:
<SMALL STYLE="margin-top: -100"><I><A HREF="http://www.youtube.com/watch?v=$2">SourceYouTube</A></I></SMALL>
<
object width="425" height="350"><param name="movie" value="http://www.youtube.com/v/$2"></param><embed src="http://www.youtube.com/v/$2" type="application/x-shockwave-flash" width="425" height="350"></embed></object



Hope someone finds this useful Smile
Visit this user's website Find all posts by this user
Quote this message in a reply
03-23-2007, 01:09 PM
Post: #2
RE: My Custom MyCodes
Just wanted to let you know, but your regex syntax is flawed. For example this is what it should be for subscript:
Code:
\[sub\](.*?)\[sub\]
Otherwise your codes won't work on most servers out there.

¡Mi ombligo esta en llamas!
Visit this user's website Find all posts by this user
Quote this message in a reply
03-23-2007, 06:01 PM
Post: #3
RE: My Custom MyCodes
Apart from the above mentioned flaws in the regex, you have most of your html tags in uppercase when the standard is lowercase...

You also seem to switch between the old html tag attributes and CSS stylings quite randomly...

The "bgcolor" attribute for example, should be a css style:
Code:
background-color:
or just
Code:
background:

Visit this user's website Find all posts by this user
Quote this message in a reply
03-23-2007, 08:01 PM
Post: #4
RE: My Custom MyCodes
Cool thanks

[Image: jag100sigaf5.jpg]
[Image: poptartFINALTINY.gif]
Visit this user's website Find all posts by this user
Quote this message in a reply
03-24-2007, 12:34 AM
Post: #5
RE: My Custom MyCodes
DrPoodle Wrote:you have most of your html tags in uppercase when the standard is lowercase...
Big deal.... It's not like it's going to effect the output any. Confused

But you got a nice list, and I have some on my localhost, that I've never released...

Dr Small
Visit this user's website Find all posts by this user
Quote this message in a reply
03-24-2007, 12:56 AM
Post: #6
RE: My Custom MyCodes
The Wicked Flea Wrote:Just wanted to let you know, but your regex syntax is flawed. For example this is what it should be for subscript:
Code:
\[sub\](.*?)\[sub\]
Otherwise your codes won't work on most servers out there.
Really? Wow, thanks.
I'm sorda new to all this, so thanks for your input!
So, basically, you can't use an end-tag?

DrPoodle Wrote:Apart from the above mentioned flaws in the regex, you have most of your html tags in uppercase when the standard is lowercase...
Yeah. Actually, I was taught to use uppercase, so I'm sorda used to using uppercase.

DrPoodle Wrote:You also seem to switch between the old html tag attributes and CSS stylings quite randomly...

The "bgcolor" attribute for example, should be a css style:
Code:
background-color:
or just
Code:
background:
Yeah probably. I'm not very consistent >_>
Made them at different times.

Thanks everyone for their input! Smile
Visit this user's website Find all posts by this user
Quote this message in a reply
03-24-2007, 12:58 AM (This post was last modified: 03-24-2007 01:00 AM by Dr Small.)
Post: #7
RE: My Custom MyCodes
Quote:So, basically, you can't use an end-tag?
No. You missed the "/" in front of the expressions on your MyCode. You can have end tags, but it is almost always necessary to have the complete expression, or something'll go wrong.

Dr Small
Visit this user's website Find all posts by this user
Quote this message in a reply
03-24-2007, 01:07 AM
Post: #8
RE: My Custom MyCodes
Dr Small Wrote:
Quote:So, basically, you can't use an end-tag?
No. You missed the "/" in front of the expressions on your MyCode. You can have end tags, but it is almost always necessary to have the complete expression, or something'll go wrong.
*checks code*

ZOMG, the glitch in the MyBB parser!!! If I edit the post, it's there (you may have trouble quoting it, but if you do, you'll see the \ characters there).
I made a suggestion to fix that bug Smile
http://community.mybboard.net/showthread...#pid117712
Visit this user's website Find all posts by this user
Quote this message in a reply
03-24-2007, 01:14 AM
Post: #9
RE: My Custom MyCodes
Lowercase is the proper way and "xhtml valid". Otherwise you will be producing invalid xhtml and it's looked down upon.
Visit this user's website Find all posts by this user
Quote this message in a reply
03-24-2007, 01:20 AM
Post: #10
RE: My Custom MyCodes
Tikitiki Wrote:Lowercase is the proper way and "xhtml valid". Otherwise you will be producing invalid xhtml and it's looked down upon.
Oh okay. Didn't know that >_>

Thanks for the info!
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)

Contact Us | MyBB | Return to Top | Return to Content | Lite (Archive) Mode | RSS Syndication