I saw him adding the running code function to z-blog. After a few days off, I was afraid that I would rust if I stayed idle like this. After an hour and a half, I also added the running function to the blog. Because it was modified from L-Blog, it is also suitable for L-Blog. In addition, FBS was also modified from L-Blog, and you should also use the methods in this article to add the running code function. In addition, since copying and saving code have not found a solution that is compatible with each browser, it has not been added.
Example:
The steps are as follows:
1. Add the following code in include/common.js:
The code copy is as follows:
functionrunCode(codeobjid){
varcodeobj=document.getElementById(codeobjid)
varcodestr=codeobj.value;
if(codestr!=""){
varcodewin=window.open('','','');
codewin.document.open('text/html','replace');
codewin.opener=null
codewin.document.write(codestr);
codewin.document.close();
}
}
2. Find strContent=re.Replace(strContent,"【code】") in include/ubbcode.asp (change [】 to []), and add the following code after that:
L-Blog:
The code copy is as follows:
re.Pattern="/[html/](<br>)+"
strContent=re.Replace(strContent,"【html】")
FBS:
The code copy is as follows:
re.Pattern="/[html/](<br/>)+"
strContent=re.Replace(strContent,"【html】")
Then find re.Pattern="/[code/](.*?)/[//code/]", and then add the following code after SetstrMatches=Nothing of the segment code:
The code copy is as follows:
re.Pattern="/[html/](.*?)/[//html/]"
SetstrMatches=re.Execute(strContent)
ForEachstrMatchInstrMatches
RNDStr=Int(7999*Rnd+2000)
tmpStr1=strMatch.SubMatches(0)
strContent=Replace(strContent,strMatch.Value,"<textarearows=""10"""_
&"style=""width:90%;""class=""input_border""id=""HTML_"&RNDStr&"""">"_
&tmpStr1&"</textarea><br/>"_
&"<inputtype=""button""onclick=""runCode('HTML_"&RNDStr&"');"value=""Runcode""/>"_
&"[Ctrl+A All Selection Tips: You can modify some code first, then press Run]")
Next
SetstrMatches=Nothing
3. The modification is completed. When publishing the log, you can use the code to run [/html] to [] (replace [] with []) to use the running code function.