Author: JACP
Description: With the Password Spoiler BBCode you can post a spoiler where a password is needed to see the content.
Note that users always can see the password if the have edit rights or can quote the post.
The password can also be fetched it they view source.
So this is more for fun
BBCode:
Code: Select all
[pswdspoil={SIMPLETEXT}]{TEXT}[/pswdspoil]
Code: Select all
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px">
<b>Spoiler</b>: <input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="password=prompt('Please enter password to view this message...',' ');
if (password=='{SIMPLETEXT}')
{
alert('Password Accepted!');
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>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">
{TEXT}
</div>
</div>
</div>
Code: Select all
Password Spoiler: [pswdspoil=password]Message[/pswdspoil]
Code: Select all
[pswdspoil=Test]Tested with phpBB3. When a person clicks the "Show" button, a prompt for a password pops up. If an incorrect password is entered, the popup goes away, and things stay just as they were. If a correct password is entered, the popup goes away and the spoiler opens up. If a person wants to re-hide the spoiler, they must enter the password again. Of course, the spoiler is reset when the person navigates away from that page.
Please note: Anyone that has editing rights to the message will be able to see the password and the message. So, while this is good for general public viewing, I wouldn't suggest hiding your deep, dark secrets with it.[/pswdspoil]
[pswdspoil=test]Tested with phpBB3. When a person clicks the "Show" button, a prompt for a password pops up. If an incorrect password is entered, the popup goes away, and things stay just as they were. If a correct password is entered, the popup goes away and the spoiler opens up. If a person wants to re-hide the spoiler, they must enter the password again. Of course, the spoiler is reset when the person navigates away from that page.
Please note: Anyone that has editing rights to the message will be able to see the password and the message. So, while this is good for general public viewing, I wouldn't suggest hiding your deep, dark secrets with it.[/pswdspoil]