function ubb2html(f){function o(h){return h!=null&&h!=""?!isNaN(h):false}var b=String(f),p=[],n=0;b=b.replace(/&/ig,"&");b=b.replace(/[<>]/g,function(h){return{"<":"<",">":">"}[h]});b=b.replace(/\r?\n/g,"
");b=b.replace(/\[code\s*(?:=\s*([^\]]+?))?\]([\s\S]*?)\[\/code\]/ig,function(h){n++;p[n]=h;return"[\tubbcodeplace_"+n+"\t]"});b=b.replace(/\[(\/?)(b|u|i|s|sup|sub)\]/ig,"<$1$2>");b=b.replace(/\[color\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]/ig,'');b=b.replace(/\[size\s*=\s*(\d+?)\s*\]/ig, '');b=b.replace(/\[font\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]/ig,'');b=b.replace(/\[\/(color|size|font)\]/ig,"");b=b.replace(/\[back\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]/ig,'');b=b.replace(/\[\/back\]/ig,"");for(f=0;f<3;f++)b=b.replace(/\[align\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\](((?!\[align(?:\s+[^\]]+)?\])[\s\S])*?)\[\/align\]/ig,'

$2

');b=b.replace(/\[img\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*?)?\s*\[\/img\]/ig, '');b=b.replace(/\[img\s*=([^,\]]*)(?:\s*,\s*(\d*%?)\s*,\s*(\d*%?)\s*)?(?:,?\s*(\w+))?\s*\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*)?\s*\[\/img\]/ig,function(h,i,a,k,m,g){h=''+i+'');b=b.replace(/\[url\]\s*(((?!")[\s\S])*?)(?:"[\s\S]*?)?\s*\[\/url\]/ig,'$1'); b=b.replace(/\[url\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]\s*([\s\S]*?)\s*\[\/url\]/ig,'$2');b=b.replace(/\[email\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*?)?\s*\[\/email\]/ig,'$1');b=b.replace(/\[email\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]\s*([\s\S]+?)\s*\[\/email\]/ig,'$2');b=b.replace(/\[quote\]([\s\S]*?)\[\/quote\]/ig,"
$1
");b=b.replace(/\[flash\s*(?:=\s*(\d+)\s*,\s*(\d+)\s*)?\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*?)?\s*\[\/flash\]/ig, function(h,i,a,k){i||(i=480);a||(a=400);return''});b=b.replace(/\[media\s*(?:=\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+)\s*)?)?\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*?)?\s*\[\/media\]/ig,function(h,i,a,k,m){i||(i=480);a||(a=400);return''});b=b.replace(/\[table\s*(?:=\s*(\d{1,4}%?)\s*(?:,\s*([^\]"]+)(?:"[^\]]*?)?)?)?\s*\]/ig,function(h,i,a){h=""});b=b.replace(/\[tr\s*(?:=\s*([^\]"]+?)(?:"[^\]]*?)?)?\s*\]/ig,function(h,i){return""});b=b.replace(/\[td\s*(?:=\s*(\d{1,2})\s*,\s*(\d{1,2})\s*(?:,\s*(\d{1,4}%?))?)?\s*\]/ig,function(h,i,a,k){return"1?' colspan="'+i+'"':"")+(a>1?' rowspan="'+a+'"': "")+(k?' width="'+k+'"':"")+">"});b=b.replace(/\[\/(table|tr|td)\]/ig,"");b=b.replace(/\[\*\]((?:(?!\[\*\]|\[\/list\]|\[list\s*(?:=[^\]]+)?\])[\s\S])+)/ig,"
  • $1
  • ");b=b.replace(/\[list\s*(?:=\s*([^\]"]+?)(?:"[^\]]*?)?)?\s*\]/ig,function(h,i){var a=""});b=b.replace(/\[\/list\]/ig,"");for(f=1;f<=n;f++)b=b.replace("[\tubbcodeplace_"+f+"\t]",p[f]);return b=b.replace(/(^|<\/?\w+(?:\s+[^>]*?)?>)([^<$]+)/ig,function(h,i,a){return i+a.replace(/[\t ]/g, function(k){return{"\t":"        "," ":" "}[k]})})} function html2ubb(f){function o(g){var c;if(c=g.match(/\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i)){for(g=(c[1]*65536+c[2]*256+c[3]*1).toString(16);g.length<6;)g="0"+g;g="#"+g}return g=g.replace(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,"#$1$1$2$2$3$3")}var b={"xx-small":1,"8pt":1,"x-small":2,"10pt":2,small:3,"12pt":3,medium:4,"14pt":4,large:5,"18pt":5,"x-large":6,"24pt":6,"xx-large":7,"36pt":7},p=/\s+src\s*=\s*(["']?)\s*(.+?)\s*\1(\s|$)/i,n=/\s+width\s*=\s*(["']?)\s*(\d+(?:\.\d+)?%?)\s*\1(\s|$)/i, h=/\s+height\s*=\s*(["']?)\s*(\d+(?:\.\d+)?%?)\s*\1(\s|$)/i,i=/(?:background|background-color|bgcolor)\s*[:=]\s*(["']?)\s*((rgb\s*\(\s*\d{1,3}%?,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\))|(#[0-9a-f]{3,6})|([a-z]{1,20}))\s*\1/i,a=String(f),k=[],m=0;a=a.replace(/\s*\r?\n\s*/g,"");a=a.replace(/<(script|style)(\s+[^>]*?)?>[\s\S]*?<\/\1>/ig,"");a=a.replace(/