In inc_func_common.asp, find the extratags function and replace it with this (or just add the spoiler parts to your function) and add the two functions beneath it:
Code:
function extratags(fString)
fString = doCode(fString, "[spoiler2]", "[/spoiler2]", "<span class=""spoiler"">Spoiler:</span><div class=""spoiler""><kbd>", "</kbd></div>")
fString = doCode(fString, "[spoiler]", "[/spoiler]", "<div style=""margin:1em auto; width: 90%;"">" & vbNewline & " <div><strong>Spoiler:</strong> <input type=""button"" value=""Show"" style=""width:45px;font-size:10px;margin:0px;padding:0px;"" onclick=""if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }"" /></div>" & vbNewline & " <div style=""margin: 0px; padding: 6px; border: 1px inset;"">" & vbNewline & " <div style=""display: none;"">" & vbNewline, " </div>" & vbNewline & " </div>" & vbNewline & "</div>" & vbNewline)
extratags = fString
end function
function HideText(txt,mode)
If mode = 1 Then
Set regEx = New RegExp
regEx.Pattern = "\[hidden.*?\/hidden\]"
regEx.IgnoreCase = True
regEx.Global = True
Set Matches = regEx.Execute(txt)
HideText = regEx.Replace(txt, "<p><strong>You must log in to see this text.</strong></p>")
Else 'mode = 2
txt = Replace(txt,"[hidden]","")
txt = Replace(txt,"[/hidden]","")
HideText = txt
End If
end function
function ModNoteText(txt,mode)
Set regEx = New RegExp
regEx.Pattern = "\[modnote.*?\/modnote\]"
regEx.IgnoreCase = True
regEx.Global = True
Set Matches = regEx.Execute(txt)
If mode = 1 Then 'User is an admin
ModNoteText = txt
Else 'mode = 2
ModNoteText = regEx.Replace(txt, "")
End If
end function
Then, in topic.asp, do a search for the following text: "if Request.QueryString("SearchTerms") <> """. This should happen twice, and it's at the parts of topic.asp that display the text for the posts. Here's how I've got these working with the nested If..Then statements. You may or may not need to tweak it for your own forums.
Code:
if Request.QueryString("SearchTerms") <> "" then
If mlev = 0 Then
Response.Write ModNoteText(HideText(SearchHiLite(formatStr(Reply_Content)),1),2)
Else
If mlev > 2 Then 'User is a mod or admin
Response.Write ModNoteText(HideText(SearchHiLite(formatStr(Reply_Content)),2),1)
Else
Response.Write ModNoteText(HideText(SearchHiLite(formatStr(Reply_Content)),2),2)
End If
End If
else
If mlev = 0 Then
Response.Write ModNoteText(HideText(formatStr(Reply_Content),1),2)
Else
If mlev > 2 Then 'User is a mod or admin
Response.Write ModNoteText(HideText(formatStr(Reply_Content),2),1)
Else
Response.Write ModNoteText(HideText(formatStr(Reply_Content),2),2)
End If
End If
end if
and
Code:
if Request.QueryString("SearchTerms") <> "" then
If mlev = 0 Then
Response.Write ModNoteText(HideText(SearchHiLite(formatStr(Topic_Message)),1),2)
Else
If mlev > 2 Then 'User is a mod or admin
Response.Write ModNoteText(HideText(SearchHiLite(formatStr(Topic_Message)),2),1)
Else
Response.Write ModNoteText(HideText(SearchHiLite(formatStr(Topic_Message)),2),2)
End If
End If
else
If mlev = 0 Then
Response.Write ModNoteText(HideText(formatStr(Topic_Message),1),2)
Else
If mlev > 2 Then 'User is a mod or admin
Response.Write ModNoteText(HideText(formatStr(Topic_Message),2),1)
Else
Response.Write ModNoteText(HideText(formatStr(Topic_Message),2),2)
End If
End If
end if
Lastly, wherever you have your CSS information (mine is in a separate CSS file, but the base Snitz has it in inc_header.asp), add the following CSS info.
Code:
/* This is for the spoiler tag. */
div.spoiler {margin: 0 5%; border: 1px dashed <%=ReplaceColorWithHex(strPageBGColor)%>; background-color: <%=ReplaceColorWithHex(strHeadCellColor)%>; color: inherit;}
kbd {font-style: normal; font-weight: normal; display: block; color: <%=ReplaceColorWithHex(strHeadCellColor)%>; background-color: inherit;}
span.spoiler {font-style: normal; font-weight: normal; font-size: <%=ReplaceSizeWithPt(strFooterFontSize)%>; display: block; margin: 0 5%;}
/********************************/
Again, you'll probably have to tweak this to work with your individual forums. I've got a couple functions that translate the forum values for font sizes and colors into something that will validate and work across different browsers.
If there are any questions, ask away!
Edit: Flippin' forum code. I forgot there was a spoiler tag on this forum... I couldn't figure out for the life of me why the text wasn't showing up right in the post. Fixed now.<