Post by Ross on Nov 12, 2005 15:59:58 GMT -8
I'm pretty sure they're a few bugs with this which I haven't yet figured out. But I'm posting it anyway since so many people have been requesting it.
What it does is allows you to use [hide]Message[/hide] tags in your posts that will hide that text from any member/guest until they reply to that thread.
However, there are some downsides. The main one being that the information being displayed isn't permanent. That is, when the user clears their cookies or their cookies get full, the message will become hidden again.
Another downside is that if it is in a thread with a poll, then the user must use the full reply (not quick reply) and if they vote on the poll, then they will most probably be able to see the message then too.
Anyway, here's the code. You can edit any of the blue to change the style of the box around the hidden message. The red is the text that will appear in place of the message when it is hidden. If you want to use a ' apostrophe in this message, put a \ backslash before it
Global Footer Or Board footers to only affect certain boards (recommended)
<style type="text/css">
.unhid
{
border-width: 1px;
border-style: solid;
border-color: #000000;
width: 90%;
}
.hid
{
border-width: 1px;
border-style: solid;
border-color: #000000;
width: 90%;
text-align: center;
font-weight: bold;
}
</style>
<script type="text/javascript">
<!--
/*
hidden message in posts - v0.5
created by ross - support.proboards.com
please do not redistribute without permission
*/
var mes = 'Please Reply to View this Message';
if(!location.href.match(/ion=headersfooters/)) {
function setCookie(y)
{
var d = new Date();
d.setYear('2020');
var t = location.href.match(/&thread=(.+?)($|&)/)? RegExp.$1 : getCookie();
document.cookie = 'h'+ t +'='+ y +';Expires='+ d;
}
function checkCookie()
{
var t = location.href.match(/&thread=(.+?)($|&)/)? RegExp.$1 : '';
if(document.cookie.match(new RegExp(t+'=r')))
return true;
}
function getCookie()
{
var t = (document.cookie.match(/h(.+?)=p/))? RegExp.$1 : '';
return t;
}
var re = /\[hide\](.+?)\[\/hide\]/gi
var td = document.getElementsByTagName('td');
if(location.href.match(/&thread=/)) {
for(i=0; i<td.length; i++) {
if(((td.item(i).colSpan == '3' && td.item(i).firstChild.width == '100%') || (td.item(i).width == '100%' && td.item(i).className == 'windowbg2')) && td.item(i).innerHTML.match(re)) {
if(checkCookie() || pb_username == 'admin')
td.item(i).innerHTML = td.item(i).innerHTML.replace(re, '<div class=unhid>$1</div>');
else
td.item(i).innerHTML = td.item(i).innerHTML.replace(re, '<div class=hid>'+ mes +'</div>');
}
}
}
var font = document.getElementsByTagName('font');
for(f=0; f<font.length; f++) {
if(font.item(f).innerHTML.match(re) && !font.item(f).innerHTML.match(/<textarea/i))
font.item(f).innerHTML = font.item(f).innerHTML.replace(re, '<div class=hid>'+ mes +'</div>');
}
if(document.postForm) {
document.postForm.onsubmit = function() {
if(document.postForm.nextaction.value == 'post')
setCookie('r');
else
setCookie('p');
}
}
else if(document.getElementsByName('message').item(0)) {
document.forms.item(0).onsubmit = function() {
setCookie('r');
}
}
}
//-->
</script>
Note: The main admin account will be able to see all hidden messages
Bug Fix: 06th Dec
What it does is allows you to use [hide]Message[/hide] tags in your posts that will hide that text from any member/guest until they reply to that thread.
However, there are some downsides. The main one being that the information being displayed isn't permanent. That is, when the user clears their cookies or their cookies get full, the message will become hidden again.
Another downside is that if it is in a thread with a poll, then the user must use the full reply (not quick reply) and if they vote on the poll, then they will most probably be able to see the message then too.
Anyway, here's the code. You can edit any of the blue to change the style of the box around the hidden message. The red is the text that will appear in place of the message when it is hidden. If you want to use a ' apostrophe in this message, put a \ backslash before it
Global Footer Or Board footers to only affect certain boards (recommended)
<style type="text/css">
.unhid
{
border-width: 1px;
border-style: solid;
border-color: #000000;
width: 90%;
}
.hid
{
border-width: 1px;
border-style: solid;
border-color: #000000;
width: 90%;
text-align: center;
font-weight: bold;
}
</style>
<script type="text/javascript">
<!--
/*
hidden message in posts - v0.5
created by ross - support.proboards.com
please do not redistribute without permission
*/
var mes = 'Please Reply to View this Message';
if(!location.href.match(/ion=headersfooters/)) {
function setCookie(y)
{
var d = new Date();
d.setYear('2020');
var t = location.href.match(/&thread=(.+?)($|&)/)? RegExp.$1 : getCookie();
document.cookie = 'h'+ t +'='+ y +';Expires='+ d;
}
function checkCookie()
{
var t = location.href.match(/&thread=(.+?)($|&)/)? RegExp.$1 : '';
if(document.cookie.match(new RegExp(t+'=r')))
return true;
}
function getCookie()
{
var t = (document.cookie.match(/h(.+?)=p/))? RegExp.$1 : '';
return t;
}
var re = /\[hide\](.+?)\[\/hide\]/gi
var td = document.getElementsByTagName('td');
if(location.href.match(/&thread=/)) {
for(i=0; i<td.length; i++) {
if(((td.item(i).colSpan == '3' && td.item(i).firstChild.width == '100%') || (td.item(i).width == '100%' && td.item(i).className == 'windowbg2')) && td.item(i).innerHTML.match(re)) {
if(checkCookie() || pb_username == 'admin')
td.item(i).innerHTML = td.item(i).innerHTML.replace(re, '<div class=unhid>$1</div>');
else
td.item(i).innerHTML = td.item(i).innerHTML.replace(re, '<div class=hid>'+ mes +'</div>');
}
}
}
var font = document.getElementsByTagName('font');
for(f=0; f<font.length; f++) {
if(font.item(f).innerHTML.match(re) && !font.item(f).innerHTML.match(/<textarea/i))
font.item(f).innerHTML = font.item(f).innerHTML.replace(re, '<div class=hid>'+ mes +'</div>');
}
if(document.postForm) {
document.postForm.onsubmit = function() {
if(document.postForm.nextaction.value == 'post')
setCookie('r');
else
setCookie('p');
}
}
else if(document.getElementsByName('message').item(0)) {
document.forms.item(0).onsubmit = function() {
setCookie('r');
}
}
}
//-->
</script>
Note: The main admin account will be able to see all hidden messages
Bug Fix: 06th Dec