SoFunction
Updated on 2025-04-06

Ub conversion for jb51 Original


<%
Function UBBCode(strContent)
If isEmpty(strContent) Or isNull(strContent) Then
Exit Function
Else
dim regex,strMatch
set regex=new RegExp
 =True
=True
="\[html\]((\r\n)?([\s\S]+?))\[\/html\]"
Set strMatchs=(strContent)
For Each strMatch in strMatchs
' (3)
Randomize
rndID="runcode"&Int(100000 * Rnd)
strContent=Replace(strContent,,"<br/><font color=red>HTML Code:</font><TEXTAREA style=""width:96%; height:300px;"" id=""&rndID&""" class=""htmlarea"">"&UBBFilter(HTMLDecode((2))))& "</TEXTAREA><br/><INPUT onclick=""runEx('"&rn dID&"')" type=""button"" value=""Run this code""/><br/> <INPUT onclick=""doCopy("&rndID&")"" type=""button"" value=""Copy this code""/><br/> [Ctrl+A Select all Tip: You can modify some code first, then press Run]")
Next
Set strMatchs=nothing
'Get out of the empty line
="\n[\s]*\r"
Set strMatchs=(strContent)
For Each strMatch in strMatchs
strContent=Replace(strContent,,"")
Next
'Code block
="\[code\]((\r\n)?([\s\S]+?))\[\/code\]"
Set strMatchs=(strContent)
For Each strMatch in strMatchs
Randomize
rndID="code"&Int(100000 * Rnd)
strContent=Replace(strContent,,"<br/><div style=""float:left""><font color=green>CODE code:</font></div><div style=""float:right;text-align:right;"">[<a href=""javascript:void(null)"" onclick=""doCopy("&rndID&")"">Copy this code</a>]</div><br/><div class=""codetextarea"" id="""&rndID&"""">"&(2)&"</div>")
Next
Set strMatchs=nothing
'Implementation of inserting audio and video files
="\[(swf|wma|wmv|rm|ra|qt)(=\d*?|)(,\d*?|)\]([^<>]*?)\[\/(swf|wma|wmv|rm|ra|qt)\]"
Set strMatchs=(strContent)
dim strType,strWidth,strHeight,strSRC,TitleText
        For Each strMatch in strMatchs
            RAndomize
              strType=(0)
              if strType="swf" then
TitleText="<img src=""../images/"" alt=""""" style=""margin:0px 2px -3px 0px"" border=""0""/>Flash animation"
              elseif strType="wma" then
TitleText="<img src=""../images/"" alt=""""" style=""margin:0px 2px -3px 0px"" border=""0""/>Play audio files"
              elseif strType="wmv" then
TitleText="<img src=""../images/"" alt=""""" style=""margin:0px 2px -3px 0px"" border=""0""/>Play video file"
              elseif strType="rm" then
TitleText="<img src=""../images/"" alt=""""" style=""margin:0px 2px -3px 0px"" border=""0""/>Play real video streaming file"
              elseif strType="ra" then
TitleText="<img src=""../images/"" alt=""""" style=""margin:0px 2px -3px 0px"" border=""0""/>Play real audio stream file"
              elseif strType="qt" then
TitleText="<img src=""../images/"" alt="""" style=""margin:0px 2px -3px 0px"" border=""0""/>Play mov video file"
              end if
              strWidth=(1)
              strHeight=(2)
              if (len(strWidth)=0) then 
                strWidth="400"
                else
               strWidth=right(strWidth,(len(strWidth)-1))
              end if
              if (len(strHeight)=0) then
               strHeight="300"
                else
              strHeight=right(strHeight,(len(strHeight)-1))
              end if
              strSRC=(3)
            rndID="temp"&Int(100000 * Rnd)
strContent= Replace(strContent,,"<div class=""UBBPanel""><div class=""UBBTitle"">"&TitleText&"</div><div class=""UBBContent"><a id=""+rndID+"_href"" href=""javascript:MediaShow('"+strType+"','"+rndID+"',' "+strWidth+"','"+strHeight+"')"><img name="""+rndID+"_img"" src=""../images/mm_snd.gif"" style=""margin:0px 3px -2px 0px"" border=""0"" alt=""""/><span id="""+rndID+"_text"">Online playback</span></a><div id="""+rndID+"""></div></div>")
        Next
        Set strMatchs=nothing
        ="(\[mid\])(.[^\]]*)\[\/mid\]"
        strContent= (strContent,"<embed src=""$2"" height=""45"" width=""314"" autostart=""0""></embed>")
="<br>([\s|&nbsp;| ]*)?<br>"
strContent=(strContent,"<br>")
strContent=replace(strContent,"&amp;","&")
strContent=replace(strContent,"'","'")
strContent=replace(strContent,"","") 'Because the image was uploaded before

set regex=nothing
end if
UBBCode=strContent
end function
%>