📄 code.asp
字号:
<%
function ChkBadWords(fString)
bwords = split(BadWords, "|")
for i = 0 to ubound(bwords)
fString = Replace(fString, bwords(i), string(len(bwords(i)),"*"), 1,-1,1)
next
ChkBadWords = fString
end function
function doCode(fString, fOTag, fCTag, fROTag, fRCTag)
fOTagPos = Instr(1, fString, fOTag, 1)
fCTagPos = Instr(1, fString, fCTag, 1)
while (fCTagPos > 0 and fOTagPos > 0)
fString = replace(fString, fOTag, fROTag, 1, 1, 1)
fString = replace(fString, fCTag, fRCTag, 1, 1, 1)
fOTagPos = Instr(1, fString, fOTag, 1)
fCTagPos = Instr(1, fString, fCTag, 1)
wend
doCode = fString
end function
function UBBCode(strContent)
strContent = Replace(strContent, vbcrlf, "[BR]")
dim re
set re = New RegExp
re.Global = True
re.IgnoreCase = True
re.Pattern="\[DIR=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/DIR]"
strContent=re.Replace(strContent,"<object classid=clsid:166B1BCA-3F9C-11CF-8075-444553540000 codebase=http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=7,0,2,0 width=$1 height=$2><param name=src value=$3><embed src=$3 pluginspage=http://www.macromedia.com/shockwave/download/ width=$1 height=$2></embed></object>")
re.Pattern="\[QT=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/QT]"
strContent=re.Replace(strContent,"<embed src=$3 width=$1 height=$2 autoplay=true loop=false controller=true playeveryframe=false cache=false scale=TOFIT bgcolor=#000000 kioskmode=false targetcache=false pluginspage=http://www.apple.com/quicktime/>")
re.Pattern="\[MP=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/MP]"
strContent=re.Replace(strContent,"<object align=middle classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95 class=OBJECT id=MediaPlayer width=$1 height=$2 ><param name=ShowStatusBar value=-1><param name=Filename value=$3><embed type=application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 flename=mp src=$3 width=$1 height=$2></embed></object>")
re.Pattern="\[RM=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/RM]"
strContent=re.Replace(strContent,"<OBJECT classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA class=OBJECT id=RAOCX width=$1 height=$2><PARAM NAME=SRC VALUE=$3><PARAM NAME=CONSOLE VALUE=Clip1><PARAM NAME=CONTROLS VALUE=imagewindow><PARAM NAME=AUTOSTART VALUE=true></OBJECT><br><OBJECT classid=CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA height=32 id=video2 width=$1><PARAM NAME=SRC VALUE=$3><PARAM NAME=AUTOSTART VALUE=-1><PARAM NAME=CONTROLS VALUE=controlpanel><PARAM NAME=CONSOLE VALUE=Clip1></OBJECT>")
re.Pattern="(\[ZIP\])(.[^\[]*)(\[\/ZIP\])"
strContent=re.Replace(strContent,"<br><IMG SRC=pic/zip.gif border=0> <a href=""$2"">点击下载该文件</a>")
re.Pattern="(\[RAR\])(.[^\[]*)(\[\/RAR\])"
strContent=re.Replace(strContent,"<br><IMG SRC=pic/rar.gif border=0> <a href=""$2"">点击下载该文件</a>")
re.Pattern="(\[UPLOAD=(.[^\[]*)\])(.[^\[]*)(\[\/UPLOAD\])"
strContent= re.Replace(strContent,"<br><IMG SRC=""pic/$2.gif"" border=0>此主题相关图片如下:<br><A HREF=""$3"" TARGET=_blank><IMG SRC=""$3"" border=0 alt=按此在新窗口浏览图片 onload=""javascript:if(this.width>screen.width-333)this.width=screen.width-333""></A>")
re.Pattern = "\[(\/|)(td|tr|th|tbody|table)]\[BR]"
strContent = re.Replace(strContent,"<$1$2>")
re.Pattern = "\[(\/|)(td|tr|th|tbody|table) (.[^]]*)]\[BR]"
strContent = re.Replace(strContent,"<$1$2 $3>")
re.Pattern = "\[(\/|)(td|tr|th|tbody|table)]"
strContent = re.Replace(strContent,"<$1$2>")
re.Pattern = "\[(\/|)(td|tr|th|tbody|table) (.[^]]*)]"
strContent = re.Replace(strContent,"<$1$2 $3>")
re.Pattern = "\[br]"
strContent = re.Replace(strContent,"<br>")
re.Pattern = "\[(center|right|left)](.[^\[]*)\[\/(center|right|left)]"
strContent = re.Replace(strContent,"<div align=$1>$2</div>")
re.Pattern = "\[div(.[^\]]*|)](.[^\[]*)\[\/div]"
strContent = re.Replace(strContent,"<div$1>$2</div>")
re.Pattern = "\[p(.[^\]]*|)](.[^\[]*)\[\/p]"
strContent = re.Replace(strContent,"<br>$2")
re.Pattern = "\[url=(.[^\]]*)\](.[^\[]*)\[\/url]"
strContent = re.Replace(strContent,"<a target=_blank href=$1>$2</a>")
re.Pattern = "\[url](.[^\[]*)\[\/url]"
strContent = re.Replace(strContent,"<a target=_blank href=$1>$1</a>")
re.Pattern = "\[email=(.[^\]]*)\](.[^\[]*)\[\/email]"
strContent = re.Replace(strContent,"<a href=$1>$2</a>")
re.Pattern = "\[email](.[^\[]*)\[\/email]"
strContent = re.Replace(strContent,"<a href=mailto:$1>$1</a>")
re.Pattern = "\[img](.[^\[]*)\[\/img]"
strContent = re.Replace(strContent,"<img src=$1 border=0>")
re.Pattern = "\[img(.[^\]]*)src=(.[^\]]*)\]"
strContent = re.Replace(strContent,"<img src=$2 $1 border=0>")
re.Pattern = "^(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
strContent = re.Replace(strContent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>")
re.Pattern = "(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$"
strContent = re.Replace(strContent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>")
re.Pattern = "[^>=""](http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
strContent = re.Replace(strContent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>")
re.Pattern = "^(ftp://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
strContent = re.Replace(strContent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>")
re.Pattern = "(ftp://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$"
strContent = re.Replace(strContent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>")
re.Pattern = "[^>=""](ftp://[A-Za-z0-9\.\/=\?%\-&_~`@':+!]+)"
strContent = re.Replace(strContent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>")
re.Pattern = "^(rtsp://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
strContent = re.Replace(strContent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>")
re.Pattern = "(rtsp://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$"
strContent = re.Replace(strContent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>")
re.Pattern = "[^>=""](rtsp://[A-Za-z0-9\.\/=\?%\-&_~`@':+!]+)"
strContent = re.Replace(strContent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>")
re.Pattern = "^(mms://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)"
strContent = re.Replace(strContent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>")
re.Pattern = "(mms://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$"
strContent = re.Replace(strContent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>")
re.Pattern = "[^>=""](mms://[A-Za-z0-9\.\/=\?%\-&_~`@':+!]+)"
strContent = re.Replace(strContent,"<img align=absmiddle src=pic/url.gif><a target=_blank href=$1>$1</a>")
re.Pattern = "\[FLASH](.[^\[]*)\[\/FLASH]"
strContent = re.Replace(strContent,"<OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 width=500 height=400><PARAM NAME=movie VALUE=""$1""><PARAM NAME=quality VALUE=high><embed src=""$1"" quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width=500 height=400>$1</embed></OBJECT>")
re.Pattern ="\[HTML](.[^\[]*)\[\/HTML]"
strContent =re.Replace(strContent,"<SPAN><IMG src=pic/code.gif align=absBottom> HTML 代码片段如下:<BR><TEXTAREA style=""WIDTH: 94%; BACKGROUND-COLOR: #f7f7f7"" name=textfield rows=10>$1</TEXTAREA><BR><INPUT onclick=runEx() type=button value=运行此代码 name=Button> [Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]</SPAN><BR>")
re.Pattern ="\[ALIGN=(.[^\]]*)\](.[^\[]*)\[\/ALIGN]"
strContent =re.Replace(strContent,"<div align=$1>$2</div>")
re.Pattern ="\[QUOTE](.[^\[]*)\[\/QUOTE]"
strContent =re.Replace(strContent,"<BLOCKQUOTE><b>引用</b>:<HR>$1<HR></BLOCKQUOTE>")
re.Pattern ="\[FLY](.[^\[]*)\[\/FLY]"
strContent =re.Replace(strContent,"<marquee width=90% behavior=alternate scrollamount=3>$1</marquee>")
re.Pattern ="\[MOVE](.[^\[]*)\[\/MOVE]"
strContent =re.Replace(strContent,"<MARQUEE scrollamount=3>$1</marquee>")
re.Pattern ="\[GLOW=(.[^\]]*),(.[^\]]*),(.[^\]]*)\](.[^\[]*)\[\/GLOW]"
strContent =re.Replace(strContent,"<table width=$1 style=""filter:glow(color=$2, strength=$3)"">$4</table>")
re.Pattern ="\[SHADOW=(.[^\]]*),(.[^\]]*),(.[^\]]*)\](.[^\[]*)\[\/SHADOW]"
strContent =re.Replace(strContent,"<table width=$1 style=""filter:shadow(color=$2, strength=$3)"">$4</table>")
re.Pattern = "\[(\/|)(b|u)]"
strContent = re.Replace(strContent,"<$1$2>")
re.Pattern = "\[I](.[^\[]*)\[\/I]"
strContent = re.Replace(strContent,"<I>$1</I>")
re.Pattern ="\[(color|face|size)=(.[^\]]*)]"
strContent =re.Replace(strContent,"<font $1=$2>")
re.Pattern ="\[\/font]"
strContent = re.Replace(strContent,"</font>")
strContent = doCode(strContent, "[list]", "[/list]", "<ul>", "</ul>")
strContent = doCode(strContent, "[list=1]", "[/list]", "<ol type=1>", "</ol id=1>")
strContent = doCode(strContent, "[list=a]", "[/list]", "<ol type=a>", "</ol id=a>")
strContent = doCode(strContent, "[*]", "[/*]", "<li>", "</li>")
strContent = doCode(strContent, "[code]", "[/code]", "<pre id=code><font size=1 face=""Verdana, Arial"" id=code>", "</font id=code></pre id=code>")
re.Pattern = "\[\*]"
strContent = re.Replace(strContent,"<li>")
strContent=ChkBadWords(strContent)
UBBCode = strContent
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -