⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ubbcode.asp

📁 blog 程序 DIV BLOG 0.6 Readme [ http://www.IamTing.com ] DIV BLOG 0.6版更新说明 =====================
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%
noimg=0
noswf=0
noubb=0
nocovhtml=0
noautourl=0
%>
<%
dim ubb_temp_,text,ltext,text2

function unHtml(content)
ON ERROR RESUME NEXT
unHtml=content
if content <> "" then
unHtml=Server.HTMLEncode(unHtml)
unHtml=replace(unHtml,vbcrlf,"<br>")
unHtml=replace(unHtml,chr(9),"&nbsp;&nbsp;&nbsp;&nbsp;")
unHtml=replace(unHtml," ","&nbsp;")
end if
if Err.Number <>0 then
unHtml= "html转换中出错请联系管理员<br>"
Err.Clear
end if
end function

function ubb(text)
ubb=text
ubb=replace(ubb,"[swf]","[swf=500,350]",1,-1,1)
ubb=ubb_code(ubb)
ubb=ubb_html(ubb)
ubb=ubb_url(ubb)
ubb=ubb_url1(ubb)
ubb=ubb_email(ubb)
ubb=ubb_email1(ubb)
if not noimg=1 or isnull(noimg) then ubb=ubb_img(ubb)
//加入img扩展
if not noimg=1 or isnull(noimg) then ubb=ubb_img1(ubb)
if not noswf=1 or isnull(noswf) then ubb=ubb_swf(ubb)
ubb=ubb_move(ubb)
ubb=ubb_fly(ubb)
ubb=ubb_code(ubb)
ubb=ubb_quote(ubb)
ubb=ubb_size(ubb)
ubb=ubb_align(ubb)
ubb=ubb_font(ubb)
ubb=ubb_color(ubb)
ubb=ubb_order(ubb)
ubb=ubb_dir(ubb)
ubb=ubb_mp(ubb)
ubb=ubb_qt(ubb)
ubb=ubb_rm(ubb)
//poorfish增加标记
ubb=ubb_iframe(ubb)
ubb=ubb_down(ubb)
ubb=ubb_list(ubb)

if not noautourl=1 or isnull(noautourl) then
    UBB=AutoURL(ubb,"http://")
    UBB=AutoURL(ubb,"ftp://")
    UBB=AutoURL(ubb,"rtsp://")
    UBB=AutoURL(ubb,"mms://")
end if

ubb=unmsubb(ubb)

end function

function UBB_order(text)
    UBB_order=replace(text,"[b]","<b>",1,-1,1)
    UBB_order=replace(UBB_order,"[/b]","</b>",1,-1,1)
    UBB_order=replace(UBB_order,"[i]","<i>",1,-1,1)
    UBB_order=replace(UBB_order,"[/i]","</i>",1,-1,1)
    UBB_order=replace(UBB_order,"[u]","<u>",1,-1,1)
    UBB_order=replace(UBB_order,"[/u]","</u>",1,-1,1)
    UBB_order=replace(UBB_order,"[blue]","<font color='#000099'>",1,-1,1)
    UBB_order=replace(UBB_order,"[/blue]","</font>",1,-1,1)
    UBB_order=replace(UBB_order,"[red]","<font color='#990000'>",1,-1,1)
    UBB_order=replace(UBB_order,"[/red]","</font>",1,-1,1)
end function

function UBB_size(ubb_temp)
        ubb_temp_=ubb_temp
do while ubb_temp_ <> ""
        text=SearchUBB(ubb_temp_,"[size=","]")
    if text<>"" and IsNumeric(text) then
        if text>6 then text=6
        if text<1 then text=1
        ltext="<font size='"&text&"'>"
        text2=SearchUBB(ubb_temp_,"[size="&text&"]","[/size]")
            if text2<>"" then
                ubb_temp_=replace(ubb_temp_,"[size="&text&"]",ltext,1,1,1)
                ubb_temp_=replace(ubb_temp_,ltext&text2&"[/size]",ltext&text2&"</font>",1,1,1)
            else
                exit do
            end if
    else
        exit do
    end if
loop
        UBB_size=ubb_temp_
end function

function UBB_align(ubb_temp)
        ubb_temp_=ubb_temp
do while ubb_temp_ <> ""
        text=SearchUBB(ubb_temp_,"[align=","]")
    if text<>"" then
        ltext="<div align='"&text&"'>"
        text2=SearchUBB(ubb_temp_,"[align="&text&"]","[/align]")
            if text2<>"" then
                ubb_temp_=replace(ubb_temp_,"[align="&text&"]",ltext,1,1,1)
                ubb_temp_=replace(ubb_temp_,ltext&text2&"[/align]",ltext&text2&"</div>",1,1,1)
            else
                exit do
            end if
    else
        exit do
    end if
loop
        UBB_align=ubb_temp_
end function

function UBB_font(ubb_temp)
        ubb_temp_=ubb_temp
do while ubb_temp_ <> ""
        text=SearchUBB(ubb_temp_,"[font=","]")
    if text<>"" then
        ltext="<font face='"&text&"'>"
        text2=SearchUBB(ubb_temp_,"[font="&text&"]","[/font]")
            if text2<>"" then
                ubb_temp_=replace(ubb_temp_,"[font="&text&"]",ltext,1,1,1)
                ubb_temp_=replace(ubb_temp_,ltext&text2&"[/font]",ltext&text2&"</font>",1,1,1)
            else
                exit do
            end if
    else
        exit do
    end if
loop
        UBB_font=ubb_temp_
end function

function UBB_color(ubb_temp)
        ubb_temp_=ubb_temp
do while ubb_temp_ <> ""
        text=SearchUBB(ubb_temp_,"[color=","]")
    if text<>"" then
        ltext="<font color='"&text&"'>"
        text2=SearchUBB(ubb_temp_,"[color="&text&"]","[/color]")
            if text2<>"" then
                ubb_temp_=replace(ubb_temp_,"[color="&text&"]",ltext,1,1,1)
                ubb_temp_=replace(ubb_temp_,ltext&text2&"[/color]",ltext&text2&"</font>",1,1,1)
            else
                exit do
            end if
    else
        exit do
    end if
loop
        UBB_color=ubb_temp_
end function

function ubb_quote(ubb_temp)
        ubb_temp_=ubb_temp
do while ubb_temp_ <> ""
        text=SearchUBB(ubb_temp_,"[quote]","[/quote]")
    if text<>"" then
        if sColor=1 then
            qccolor=table_topic_dark_color
        else
            qccolor=table_topic_light_color
        end if
        ltext=msubb(text)
        ltext=replace(ltext,"[img]","",1,-1,1)
        ltext=replace(ltext,"[/img]","",1,-1,1)
        ltext=replace(ltext,"[swf]","",1,-1,1)
        ltext=replace(ltext,"[/swf]","",1,-1,1)
        ltext=replace(ltext,"[html]","",1,-1,1)
        ltext=replace(ltext,"[/html]","",1,-1,1)
        ltext=replace(ltext,"&lt;br&gt;","<br>",1,-1,1)
        ltext="<blockquote><div>以下为引用内容:<hr size='1' noshade>"&text
        ubb_temp_=replace(ubb_temp_,"[quote]"&text,ltext,1,1,1)
        ubb_temp_=replace(ubb_temp_,ltext&"[/quote]",ltext&"<hr size='1' noshade></div></blockquote>",1,1,1)
    else
        exit do
    end if
loop
        ubb_quote=ubb_temp_
end function

function ubb_code(ubb_temp)
        ubb_temp_=ubb_temp
do while ubb_temp_ <> ""
        text=SearchUBB(ubb_temp_,"[code]","[/code]")
    if text<>"" then
        if sColor=1 then
            qccolor=table_topic_dark_color
        else
            qccolor=table_topic_light_color
        end if
        ltext=msubb(text)
        ltext="<script src=highlight.js></script><font color=#CCCCCC>程序代码:</font><br><div id='html_code' name='html_code' style='display:none'></div><div id='html_lightcode' name='html_lightcode' style='font-size:11px;font-family: sans-serif; background-color: #f9f9f9;height:40px;padding:5px;border:1 dotted #999999'>"&ltext
        ubb_temp_=replace(ubb_temp_,"[code]"&text,ltext,1,1,1)
        ubb_temp_=replace(ubb_temp_,ltext&"[/code]",ltext&"</div><img src=images/hn2_sunny.gif width=0 height=0 onload=show(this)>",1,1,1)	'加入代码高亮显示 by Poorfish
    else
        exit do
    end if
loop
        ubb_code=ubb_temp_
end function


function ubb_html(ubb_temp)
        ubb_temp_=ubb_temp
do while ubb_temp_ <> ""
        text=SearchUBB(ubb_temp_,"[html]","[/html]")
    if text<>"" then
        ltext=replace(text,"<br>",vbcrlf,1,-1,1)
        ltext=replace(ltext,"&nbsp;",chr(32),1,-1,1)
        ltext=msubb(ltext)
        Randomize
        rid="temp"&Int(100000 * Rnd)
        ltext="<TEXTAREA  rows=12 style='width:100%' class='bk' id='"&rid&"'>"&ltext
        ubb_temp_=replace(ubb_temp_,"[html]"&text,ltext,1,1,1)
        ubb_temp_=replace(ubb_temp_,ltext&"[/html]",ltext&"</TEXTAREA><INPUT onclick=runEx('"&rid&"')  type=button value=运行代码 > <font color=#CCCCCC>[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]</font>",1,1,1)
    else
        exit do
    end if
loop
        ubb_html=ubb_temp_
end function

function ubb_url(ubb_temp)
        ubb_temp_=ubb_temp
do while ubb_temp_ <> ""
        text=SearchUBB(ubb_temp_,"[url]","[/url]")
    if text<>"" then
        ltext=furl(msubb(text))
        ltext="<a href='"&ltext&"' target=_blank class=ubblink>"&text
        ubb_temp_=replace(ubb_temp_,"[url]"&text,ltext,1,1,1)
        ubb_temp_=replace(ubb_temp_,ltext&"[/url]",ltext&"</a>",1,1,1)
    else
        exit do
    end if
loop
        ubb_url=ubb_temp_
end function

function ubb_email(ubb_temp)
        ubb_temp_=ubb_temp
do while ubb_temp_ <> ""
        text=SearchUBB(ubb_temp_,"[email]","[/email]")
    if text<>"" then
        ltext=furl(msubb(text))
        ltext="<a href='mailto:"&ltext&"' target=_blank class=ubblink>"&text
        ubb_temp_=replace(ubb_temp_,"[email]"&text,ltext,1,1,1)
        ubb_temp_=replace(ubb_temp_,ltext&"[/email]",ltext&"</a>",1,1,1)
    else
        exit do
    end if
loop
        ubb_email=ubb_temp_
end function

function ubb_move(ubb_temp)
        ubb_temp_=ubb_temp
do while ubb_temp_ <> ""
        text=SearchUBB(ubb_temp_,"[move]","[/move]")
    if text<>"" then
        ltext="<MARQUEE scrollamount=3>"&text
        ubb_temp_=replace(ubb_temp_,"[move]"&text,ltext,1,1,1)
        ubb_temp_=replace(ubb_temp_,ltext&"[/move]",ltext&"</marquee>",1,1,1)
    else
        exit do
    end if
loop
        ubb_move=ubb_temp_
end function

function ubb_fly(ubb_temp)
        ubb_temp_=ubb_temp
do while ubb_temp_ <> ""
        text=SearchUBB(ubb_temp_,"[fly]","[/fly]")
    if text<>"" then
        ltext="<marquee width=90% behavior=alternate scrollamount=3>"&text
        ubb_temp_=replace(ubb_temp_,"[fly]"&text,ltext,1,1,1)
        ubb_temp_=replace(ubb_temp_,ltext&"[/fly]",ltext&"</marquee>",1,1,1)
    else
        exit do
    end if
loop
        ubb_fly=ubb_temp_
end function

//poorfish修改图片显示

function ubb_img(ubb_temp)
        ubb_temp_=ubb_temp
do while ubb_temp_ <> ""
        text=SearchUBB(ubb_temp_,"[img]","[/img]")
    if text<>"" then
        ltext=furl(msubb(text))
        ltext="<div align=right id=imgtip style='color:#999999;display:none'>此图片仅显示局部,请点击查看完整图片</div><img src='"&ltext
        ubb_temp_=replace(ubb_temp_,"[img]"&text,ltext,1,1,1)
        ubb_temp_=replace(ubb_temp_,ltext&"[/img]",ltext&"' vspace=4 hspace=4 border=0 onload=""if(this.width>=514){this.style.cursor='hand';this.alt='!!!此图片仅显示局部,请点击查看完整图片!!!';this.previousSibling.style.display='';}"" onclick=""if(this.width>=514)window.open(this.src);else return false;"">",1,1,1)
		ubb_temp_=replace(ubb_temp_,"javascript","java script")
    else
        exit do
    end if
loop
        ubb_img=ubb_temp_
end function

//poorfish加入图片扩展标记

function ubb_img1(ubb_temp)
        ubb_temp_=ubb_temp
do while ubb_temp_ <> ""
        text=SearchUBB(ubb_temp_,"[img=","]")
    if text<>"" then
        ltext=furl(msubb(text))
        ltext="<img align="&ltext&" src="
		text2=SearchUBB(ubb_temp_,"[img="&text&"]","[/img]")
            if text2<>"" then
				ubb_temp_=replace(ubb_temp_,"[img="&text&"]",ltext,1,1,1)
				ubb_temp_=replace(ubb_temp_,ltext&text2&"[/img]",ltext&text2&" vspace=4 hspace=4 border=0>",1,1,1)
				ubb_temp_=replace(ubb_temp_,"javascript","java script")
            else
                exit do
            end if
			noautourl=1
    else
        exit do
    end if
loop
        UBB_img1=ubb_temp_
end function

//poorfish修改,加入iframe标记

function ubb_iframe(ubb_temp)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -