Original conversion using ubb for jb51

Source: Internet
Author: User

Ubbcode. asp Copy codeThe Code is as follows: <%
Function UBBCode (strContent)
If isEmpty (strContent) Or isNull (strContent) Then
Exit Function
Else
Dim regex, strMatch
Set regex = new RegExp
Regex. IgnoreCase = True
Regex. Global = True
Regex. Pattern = "\ [html \] (\ r \ n )? ([\ S \ S] + ?)) \ [\/Html \]"
Set strMatchs = regex. Execute (strContent)
For Each strMatch in strMatchs
'Response. write strMatch. SubMatches (3)
Randomize
RndID = "runcode" & Int (100000 * Rnd)
StrContent = Replace (strContent, strMatch. value, "<br/> <font color = red> HTML code: </font> <TEXTAREA style =" "width: 96%; height: 300px; "" id = "& rndID &" class = "" htmlarea ""> "& UBBFilter (HTMLDecode (strMatch. subMatches (2) & "</TEXTAREA> <br/> <INPUT onclick =" "runEx ('" & rndID &"') "" type = "" button "" value = "" Run this code ""/> <INPUT onclick = "" doCopy ("& rndID &") "" type = "" button "" value = "" Copy this code ""/> <INPUT onclick = "" doSave ("& rndID &") "" type = "" button "" value = "" Save code "/> <br/> [Ctrl + A select all prompt: you can modify some code first, then press run] ")
Next
Set strMatchs = nothing
'Empty row Removal
Regex. pattern = "\ n [\ s] * \ r"
Set strMatchs = regex. Execute (strContent)
For Each strMatch in strMatchs
StrContent = Replace (strContent, strMatch. Value ,"")
Next
'Code Block
Regex. Pattern = "\ [code \] (\ r \ n )? ([\ S \ S] + ?)) \ [\/Code \]"
Set strMatchs = regex. Execute (strContent)
For Each strMatch in strMatchs
Randomize
RndID = "code" & Int (100000 * Rnd)
StrContent = Replace (strContent, strMatch. value, "<br/> <div style =" "float: left" "> <font color = green> 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 &" "> "& strMatch. subMatches (2) & "</div> ")
Next
Set strMatchs = nothing
'Insert audio and video files
Regex. Pattern = "\ [(swf | wma | wmv | rm | ra | qt) (= \ d *? |) (, \ D *? |) \] ([^ <>] *?) \ [\/(Swf | wma | wmv | rm | ra | qt) \]"
Set strMatchs = regex. Execute (strContent)
Dim strType, strWidth, strHeight, strSRC, TitleText
For Each strMatch in strMatchs
RAndomize
StrType = strMatch. SubMatches (0)
If strType = "swf" then
TitleText = " Flash Animation"
Elseif strType = "wma" then
TitleText = " play audio files"
Elseif strType = "wmv" then
TitleText = " play a video file"
Elseif strType = "rm" then
TitleText = " play a real video stream file"
Elseif strType = "ra" then
TitleText = " play a real audio stream file"
Elseif strType = "qt" then
TitleText = " play mov video files"
End if
StrWidth = strMatch. SubMatches (1)
StrHeight = strMatch. SubMatches (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 = strMatch. SubMatches (3)
RndID = "temp" & Int (100000 * Rnd)
StrContent = Replace (strContent, strMatch. value, "<div class =" "UBBPanel" "> <div class =" "UBBTitle"> "& TitleText &" </div> <div class = "" UBBContent "> <a id = "+ rndID +" _ href "" href = "" javascript: mediaShow ('"+ strType +"', '"+ rndID +"', '"+ strSRC +"', '"+ strWidth + "', '"+ strHeight +"') "> <span id =" + rndID + "_ text"> online playback </span> </a> <div id = "+ rndID +" "> </div> ")
Next
Set strMatchs = nothing
Regex. Pattern = "(\ [mid \]) (. [^ \] *) \ [\/mid \]"
StrContent = regex. replace (strContent, "<embed src =" "$2" "height =" "45" "width =" "314" "autostart =" "0" "> </embed> ")
Regex. pattern = "<br> ([\ s |] *)? <Br>"
StrContent = regex. replace (strContent, "<br> ")
StrContent = replace (strContent ,"&","&")
StrContent = replace (strContent ,"'","'")
StrContent = replace (strContent, "", "")'

Set regex = nothing
End if
UBBCode = strContent
End function
%>

Basically from pjhome

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.