📄 ubbcode.asp
字号:
<%
function autourl(str)
on error resume next
Set url=new RegExp
url.IgnoreCase =True
url.Global=True
url.MultiLine = True
url.Pattern = "^(http://[A-Za-z0-9\./=\?%\-&_~`@:+!]+)"
str = url.Replace(str,"[url=$1]$1[/url]")
url.Pattern = "(http://[A-Za-z0-9\./=\?%\-&_~`@:+!]+)$"
str = url.Replace(str,"[url=$1]$1[/url]")
url.Pattern = "^(www.[A-Za-z0-9\./=\?%\-&_~`@:+!]+)"
str = url.Replace(str,"[url=http://$1]$1[/url]")
url.Pattern = "(www.[A-Za-z0-9\./=\?%\-&_~`@:+!]+)$"
str = url.Replace(str,"[url=http://$1]$1[/url]")
set url=Nothing
autourl=str
end function
function ubbhtml(str)
on error resume next
if not str<>"" then exit Function
str=autourl(str)
str=replace(str,chr(13),"")
str=replace(str,"<","<")
str=replace(str,">",">")
str=replace(str,chr(10)&chr(10),"<br/><br/>")
str=replace(str,chr(10),"<br/>")
str=replace(str,chr(32)," ")
str=ubbstr(str,"color")
str=ubbstr(str,"size")
str=ubbstr(str,"url")
str=ubbstr(str,"img")
str=ubbstr(str,"swf")
str=ubbstr(str,"wmv")
str=ubbstr(str,"rm")
str=replace(str,"[b]","<b>",1,-1,1)
str=replace(str,"[/b]","</b>",1,-1,1)
str=replace(str,"[i]","<i>",1,-1,1)
str=replace(str,"[/i]","</i>",1,-1,1)
str=replace(str,"[center]","<center>",1,-1,1)
str=replace(str,"[/center]","</center>",1,-1,1)
str=Replace(str,"[left]","<p align=left>",1,-1,1)
str=Replace(str,"[/left]","</p>",1,-1,1)
str=Replace(str,"[right]","<p align=right>",1,-1,1)
str=Replace(str,"[/right]","</p>",1,-1,1)
str=replace(str,"[img]","<img src=",1,-1,1)
str=replace(str,"[/img]"," border=0>",1,-1,1)
for i=1 to 12
str=replace(str,"[face"&i&"]","<img src='../images/smilies/Face"&i&".gif'>",1,6,1)
Next
ubbhtml=str
end function
function ubbstr(str,ubbtype)
on error resume next
beginstr=1
endstr=1
do while ubbtype="color" or ubbtype="size" or ubbtype="url" or ubbtype="swf" or ubbtype="wmv" or ubbtype="rm"
Randomize
divid = Int((10000 * Rnd) + 1)
If ubbtype="swf" Or ubbtype="wmv" Or ubbtype="rm" then
beginstr=instr(beginstr,str,"["&ubbtype&"=",1)
if beginstr=0 then exit do
middlestr=InStr(beginstr,str,"]",1)
If middlestr=0 Then Exit do
endstr=instr(beginstr,str,"[/"&ubbtype&"]",1)
if endstr=0 then exit do
beginstr=beginstr+len(ubbtype)+2
hwstr=Mid(str,beginstr,middlestr-beginstr)
hw=Split(hwstr,",")
objwidth=hw(0)
objheight=hw(1)
middlestr=middlestr+1
text=mid(str,middlestr,endstr-middlestr)
Else
beginstr=instr(beginstr,str,"["&ubbtype&"=",1)
if beginstr=0 then exit do
endstr=instr(beginstr,str,"]",1)
if endstr=0 then exit do
beginstr=beginstr+len(ubbtype)+2
text=mid(str,beginstr,endstr-beginstr)
End if
select case ubbtype
case "color"
str=replace(str,"[color="&text&"]","<font color="&text&">",1,1,1)
str=replace(str,"[/color]","</font>",1,1,1)
case "size"
str=replace(str,"[size="&text&"]","<font size="&text&">",1,1,1)
str=replace(str,"[/size]","</font>",1,1,1)
case "url"
str=replace(str,"[url="&text&"]","<a href="&text&" target=_blank>",1,1,1)
str=replace(str,"[/url]","</a>",1,1,1)
case "swf"
str=replace(str,"[swf="&objwidth&","&objheight&"]","<div id=playmediabody><div id=playmedia><img src=../images/flash.gif style='margin:4px 0px -4px 4px'> Flash文件</div><div id=divid><a href=javascript:playmedia('swf','"&divid&"','"&text&"','"&objwidth&"','"&objheight&"') style='background:url(../images/mv_on.gif) no-repeat;padding-left:16px;' id=m"&divid&">点击打开/关闭flash</a></div>",1,1,1)
str=replace(str,""&text&"[/swf]","<div name=divid id="&divid&" style='display:none;padding:4px;'></div></div>",1,1,1)
case "wmv"
str=replace(str,"[wmv="&objwidth&","&objheight&"]","<div id=playmediabody><div id=playmedia><img src=../images/wmv.gif style='margin:4px 0px -4px 4px'> WindowMedia文件</div><div id=divid><a href=javascript:playmedia('wmv','"&divid&"','"&text&"','"&objwidth&"','"&objheight&"') style='background:url(../images/mv_on.gif) no-repeat;padding-left:16px;' id=m"&divid&">点击打开/关闭Media媒体文件</a></div>",1,1,1)
str=replace(str,""&text&"[/wmv]","<div id="&divid&" style='display:none;padding:4px;'></div></div>",1,1,1)
case "rm"
str=replace(str,"[rm="&objwidth&","&objheight&"]","<div id=playmediabody><div id=playmedia><img src=../images/rm.gif style='margin:4px 0px -4px 4px'> RealPlay文件</div><div id=divid><a href=javascript:playmedia('rm','"&divid&"','"&text&"','"&objwidth&"','"&objheight&"') style='background:url(../images/mv_on.gif) no-repeat;padding-left:16px;' id=m"&divid&">点击打开/关闭real媒体文件</a></div>",1,1,1)
str=replace(str,""&text&"[/rm]","<div id="&divid&" style='display:none;padding:4px;'></div></div>",1,1,1)
end select
loop
ubbstr=str
end Function
function ubbhtml2(str)
on error resume next
if not str<>"" then exit function
str=replace(str,chr(13),"")
str=replace(str,"<","<")
str=replace(str,">",">")
str=replace(str,chr(10)&chr(10),"<br/><br/>")
str=replace(str,chr(10),"<br/>")
str=ubbstr2(str,"color")
str=ubbstr2(str,"size")
str=ubbstr2(str,"url")
str=ubbstr2(str,"img")
str=ubbstr2(str,"swf")
str=ubbstr2(str,"wmv")
str=ubbstr2(str,"rm")
str=replace(str,"[b]","<b>",1,-1,1)
str=replace(str,"[/b]","</b>",1,-1,1)
str=replace(str,"[i]","<i>",1,-1,1)
str=replace(str,"[/i]","</i>",1,-1,1)
str=replace(str,"[center]","<center>",1,-1,1)
str=replace(str,"[/center]","</center>",1,-1,1)
str=Replace(str,"[left]","<p align=left>",1,-1,1)
str=Replace(str,"[/left]","</p>",1,-1,1)
str=Replace(str,"[right]","<p align=right>",1,-1,1)
str=Replace(str,"[/right]","</p>",1,-1,1)
str=replace(str,"[img]","<img src=",1,-1,1)
str=replace(str,"[/img]"," border=0>",1,-1,1)
for i=1 to 12
str=replace(str,"[face"&i&"]","<img src='../images/smilies/Face"&i&".gif'>",1,6,1)
next
ubbhtml2=str
end function
function ubbstr2(str,ubbtype)
on error resume next
beginstr=1
endstr=1
do while ubbtype="color" or ubbtype="size" or ubbtype="url" or ubbtype="img" or ubbtype="swf" or ubbtype="wmv" or ubbtype="rm"
Randomize
divid = Int((10000 * Rnd) + 1)
If ubbtype="swf" Or ubbtype="wmv" Or ubbtype="rm" then
beginstr=instr(beginstr,str,"["&ubbtype&"=",1)
if beginstr=0 then exit do
middlestr=InStr(beginstr,str,"]",1)
If middlestr=0 Then Exit do
endstr=instr(beginstr,str,"[/"&ubbtype&"]",1)
if endstr=0 then exit do
beginstr=beginstr+len(ubbtype)+2
hwstr=Mid(str,beginstr,middlestr-beginstr)
hw=Split(hwstr,",")
objwidth=hw(0)
objheight=hw(1)
middlestr=middlestr+1
text=mid(str,middlestr,endstr-middlestr)
Else
beginstr=instr(beginstr,str,"["&ubbtype&"=",1)
if beginstr=0 then exit do
endstr=instr(beginstr,str,"]",1)
if endstr=0 then exit do
beginstr=beginstr+len(ubbtype)+2
text=mid(str,beginstr,endstr-beginstr)
End if
select case ubbtype
case "color"
str=replace(str,"[color="&text&"]","<font color="&text&">",1,1,1)
str=replace(str,"[/color]","</font>",1,1,1)
case "size"
str=replace(str,"[size="&text&"]","<font size="&text&">",1,1,1)
str=replace(str,"[/size]","</font>",1,1,1)
case "url"
str=replace(str,"[url="&text&"]","<a href="&text&" target=_blank>",1,1,1)
str=replace(str,"[/url]","</a>",1,1,1)
case "img"
str=replace(str,"[img="&text&"]","<img src="&text&" border=0>",1,1,1)
case "swf"
str=replace(str,"[swf="&objwidth&","&objheight&"]","<div id=playmedia><img src=images/flash.gif> Flash文件</div><div id=divid><a href=javascript:playmedia('swf','"&divid&"','"&text&"','"&objwidth&"','"&objheight&"')>点击打开/关闭flash</a></div>",1,1,1)
str=replace(str,""&text&"[/swf]","<div id="&divid&" style=display:none></div>",1,1,1)
case "wmv"
str=replace(str,"[wmv="&objwidth&","&objheight&"]","<object classid=clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95 codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902 type=application/x-oleobject standby=Loading... width="&objwidth&" height="&objheight&"><param name=FileName VALUE="&text&" /><PARAM NAME=loop value=true><param name=AutoStart value=true />",1,1,1)
str=replace(str,""&text&"[/wmv]","</object>",1,1,1)
case "rm"
str=replace(str,"[rm="&objwidth&","&objheight&"]","<OBJECT ID=WMPlay WIDTH="&objwidth&" HEIGHT="&objheight&" align=center classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA TYPE=application/x-oleobject><PARAM NAME=loop value=True><PARAM NAME=AutoStart value=-1><param name=CONTROLS value=controlpanel><param name=CONSOLE value=Clip1><PARAM NAME=src value="&text&">",1,1,1)
str=replace(str,""&text&"[/rm]","</object>",1,1,1)
end select
loop
ubbstr2=str
end function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -