We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Locked Topic
[ C ] Passworded Spoilers
Topic Started: Jun 13 2011, 12:51 PM (963 Views)
Owen532
Member Avatar
Member
[ * ]
Board Address: Private
Board Software: Zetaboards
Description:

Even though I do not want it (I'd probably require it), but wouldn't it be good instead of PM'ing something to everyone. Staff members have a special password to unlocking spoilers, or members/certain groups can, etc.

So you open the spoiler and then inside is a password box and if the password is correct, then if opens fully, if not try again or close it.
Offline Profile Goto Top
 
Xero
Member Avatar
Member
[ *  *  *  * ]
I apologize. I have failed and am unable to complete this request.
Edited by Xero, Jun 19 2011, 02:09 AM.
Offline Profile Goto Top
 
Quozzo
Member Avatar
By the blood of Sanguinius!
[ *  *  *  *  * ]
In a spoiler, place the password like so:
[password=bar]

Code: Below the Board
 
<script type="text/javascript">
$('.spoiler:contains("[password=")').each(function(){
$(this).html($(this).html().replace(/\[password=([^'"]+?)\]/, "<span style='display:none;'>$&</span>"))
}).prev().click(function(event){
if($(this).next().css('display') == "none"){
event.stopImmediatePropagation();
$(this).next().html().match(/\[password=([^"']+?)\]/)
pass = prompt("What is the password","")
if(pass == RegExp.$1){
$(this).next().toggle();
}else{
alert('Sorry, try again')
};
};
});
</script>
Offline Profile Goto Top
 
anubis505-ZNR
Member Avatar
Member
[ * ]
I wanted to use this but no matter what I try it won't work.

Code:
 
[spoiler][password=bar]Some text[/spoiler]
[spoiler[password=bar]]Some text[/spoiler]
[spoiler password=bar]Some text[/spoiler]
[spoiler=[password=bar]]Some text[/spoiler]
[spoiler]Some text[/spoiler] [password=bar]
[spoiler][password="bar"]Some text[/spoiler]


etc... Nothing worked in FF or Chrome. I put the script in Below the Board.

[password=bar] does disappear when inbetween the spoiler tags. But the normal spoiler text does not. Nor does it prompt for a password. I even tried logging in as a different user in case it let the poster see it unconditionally.
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Try the first one only, if it still doesn't work, please post your Board Template.
Offline Profile Goto Top
 
anubis505-ZNR
Member Avatar
Member
[ * ]
The first one is what I had initially tried and retried.

Spoiler: click to toggle


Good luck, it's kind of a mess. That's just my below the board. I can post the rest if you need it.
Offline Profile Goto Top
 
Quozzo
Member Avatar
By the blood of Sanguinius!
[ *  *  *  *  * ]
It works if you place it at the bottom of the Below the Board section, something is clearly clashing with it. I also increased its functionality by opening if the user is the poster.
Code:
 
<script type="text/javascript">
$('.spoiler:contains("[password=")').each(function(){
$(this).html($(this).html().replace(/\[password=([^'"]+?)\]/, "<span style='display:none;'>$&</span>"))
}).prev().click(function(event){
if($(this).next().css('display') == "none" && !$(this).parent(".c_post").parent().prev().find(".c_username").text().match($('#top_info strong').text()) ){
event.stopImmediatePropagation();
$(this).next().html().match(/\[password=([^"']+?)\]/)
pass = prompt("What is the password","")
if(pass == RegExp.$1){
$(this).next().toggle();
}else{
alert('Sorry, try again')
};
};
});
</script>
Offline Profile Goto Top
 
anubis505-ZNR
Member Avatar
Member
[ * ]
Well, I just briefly took out everything in my Below the Boards section except for your script and it still doesn't work. So it must be somewhere else... *attacks forum*

Yep. Something else is definitely messing with it. I took out everything and it worked. I guess I'll go through each script at a time and try to find the conflict.

EDIT

This makes sense.

Code:
 
<script type="text/javascript">
//SMOOTH spoiler
$(function(){
$(".spoiler_toggle").unbind("click").live("click", function(){
$(this).next().slideToggle("fast");
});
});
</script>


The Smooth Spoiler seems to be the problem. Fortunately it was the first thing in my Board Template.
Edited by anubis505-ZNR, Jul 2 2011, 03:48 AM.
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
So you know the solution to get both to work now, yes?
Offline Profile Goto Top
 
Professor Jango
Member Avatar
Member
[ * ]
Forgive my ignorance, but what would prohibit a user from quoting your post to see what the password was?
Offline Profile Goto Top
 
Quozzo
Member Avatar
By the blood of Sanguinius!
[ *  *  *  *  * ]
Professor Jango
Jul 5 2011, 01:01 PM
Forgive my ignorance, but what would prohibit a user from quoting your post to see what the password was?
or what the content is.
Code:
 
<script type="text/javascript">
$('.spoiler:contains("[password=")').each(function(){
$(this).html($(this).html().replace(/\[password=([^'"]+?)\]/, "<span style='display:none;'>$&</span>"))
}).prev().click(function(event){
if($(this).next().css('display') == "none" && !$(this).parent(".c_post").parent().prev().find(".c_username").text().match($('#top_info strong').text()) ){
event.stopImmediatePropagation();
$(this).next().html().match(/\[password=([^"']+?)\]/)
var pass = prompt("What is the password","")
if(pass == RegExp.$1){
$(this).next().toggle();
}else{
alert('Sorry, try again')
};
};
});
var q = $('#txt_quote');
if(q.length){
q.val(q.val().replace(/\[spoiler(?:=(?:.+?))?\](?:.+?)\[\/spoiler\]/gi, function(txt){
if(/\[password=(.+?)\]/.test(txt))
return "";
else return txt;
}));
};
</script>

If a spoiler has a password then you can't quote it to see the content or the password :)
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
But you'll still be able to see the password in the page source and Firebug and whatnot, so there's probably no foolproof method to deterring that without the use of PHP/MySQL?
Offline Profile Goto Top
 
Quozzo
Member Avatar
By the blood of Sanguinius!
[ *  *  *  *  * ]
Cory
Jul 6 2011, 08:49 AM
But you'll still be able to see the password in the page source and Firebug and whatnot, so there's probably no foolproof method to deterring that without the use of PHP/MySQL?
Or turn JS off (but i specifically wanted the password in the spoiler for such an occurrence :wink: )

As Cory said, there's no way to possibly secure something using JS alone and nor is it designed for that purpose. JS is executed in the browser so the browser must first see what it needs to secure before executing the JS and for that very reason JS is not used for security. If the JS is hiding omething on the page then disabling JS will mostly be enough to view the content, but if the JS calls content from another page through various methods then its possible to intercept that JS code and change its values to allow it to show the content.

Using JS to hide the protected content is enough to throw off most users who wont know how to circumvent it, or even know its possible.
Offline Profile Goto Top
 
Reid
Member Avatar
È una trappola!

Completed!

Your request has been completed. If you have any questions or concerns regarding the state of your request, please feel free to contact me via PM.
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Closed Requests · Next Topic »
Locked Topic