inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Dec 3, 2016 23:10:56 GMT -8
(also Peter uh... I may end up bugging you on some things) So I'm working on a code that lets users send PMs anonymously. I've got this so far: /* To Do
- Set up a checkbox on the conversastion starting page called 'Send anonymously' - Done
- If Checkbox is ticked (if is true?) show 'Anon div' and hide miniprofile and foot for just that message
- Else show as normal
- Store the checkbox is ticked value to key
*/
/*Useful Class Names
.anon-option - Anonymous Option
.signature - Signature
.mini-profile - Mini-profile*/
/*Ask Peter to go over setting and getting a conversastion key*/
// A $( document ).ready() block.
$( document ).ready(function() {
if(window.location.href.indexOf("conversation/new") > -1) {
alert("you're starting a new message!");
$(".recipients").prepend('<div class="checkboxybit"><form action=""><input type="checkbox" name="anonymous" id="anonymous" value="isAnon">Send Anonymously</form></div>');
if(document.getElementById('anonymous').checked) {
//Do I set the key here?
}
}
if(window.location.href.indexOf("conversation") > -1) {
alert("you're viewing a message!");
//Need to pull in a check as to whether or not the checkbox was checked to tell whether to set the anon-option to display and mini-profile and signature to hide or not
}
}); Could anyone help me with some answers on some of my questions, and any ideas on how I could fulfil the second bit. I'm going to guess the second bit would be checking the key but would something as simple as 'If the key has data do this stuff' or would it be more complex?
|
|
inherit
201984
0
Sept 11, 2023 1:23:07 GMT -8
P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓
Using My Talents Elsewhere
3,314
November 2013
pastuleo23
|
Post by P̌̓aͧś̀t̀u͒le͆o͂2̀3̃̓ on Dec 4, 2016 5:41:55 GMT -8
(also Peter uh... I may end up bugging you on some things) So I'm working on a code that lets users send PMs anonymously. I've got this so far: /* To Do
- Set up a checkbox on the conversastion starting page called 'Send anonymously' - Done
- If Checkbox is ticked (if is true?) show 'Anon div' and hide miniprofile and foot for just that message
- Else show as normal
- Store the checkbox is ticked value to key
*/
/*Useful Class Names
.anon-option - Anonymous Option
.signature - Signature
.mini-profile - Mini-profile*/
/*Ask Peter to go over setting and getting a conversastion key*/
// A $( document ).ready() block.
$( document ).ready(function() {
if(window.location.href.indexOf("conversation/new") > -1) {
alert("you're starting a new message!");
$(".recipients").prepend('<div class="checkboxybit"><form action=""><input type="checkbox" name="anonymous" id="anonymous" value="isAnon">Send Anonymously</form></div>');
if(document.getElementById('anonymous').checked) {
//Do I set the key here?
}
}
if(window.location.href.indexOf("conversation") > -1) {
alert("you're viewing a message!");
//Need to pull in a check as to whether or not the checkbox was checked to tell whether to set the anon-option to display and mini-profile and signature to hide or not
}
}); Could anyone help me with some answers on some of my questions, and any ideas on how I could fulfil the second bit. I'm going to guess the second bit would be checking the key but would something as simple as 'If the key has data do this stuff' or would it be more complex? V6 unlimited key space, save to a users key, totally anonymous. A conversation key would be useless on mobile, until v6. Right now it would be a game about trying to hide member names, links, user IDs and cross theme it. Which honestly wouldn't work
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Dec 4, 2016 7:04:20 GMT -8
(also Peter uh... I may end up bugging you on some things) So I'm working on a code that lets users send PMs anonymously. I've got this so far: /* To Do
- Set up a checkbox on the conversastion starting page called 'Send anonymously' - Done
- If Checkbox is ticked (if is true?) show 'Anon div' and hide miniprofile and foot for just that message
- Else show as normal
- Store the checkbox is ticked value to key
*/
/*Useful Class Names
.anon-option - Anonymous Option
.signature - Signature
.mini-profile - Mini-profile*/
/*Ask Peter to go over setting and getting a conversastion key*/
// A $( document ).ready() block.
$( document ).ready(function() {
if(window.location.href.indexOf("conversation/new") > -1) {
alert("you're starting a new message!");
$(".recipients").prepend('<div class="checkboxybit"><form action=""><input type="checkbox" name="anonymous" id="anonymous" value="isAnon">Send Anonymously</form></div>');
if(document.getElementById('anonymous').checked) {
//Do I set the key here?
}
}
if(window.location.href.indexOf("conversation") > -1) {
alert("you're viewing a message!");
//Need to pull in a check as to whether or not the checkbox was checked to tell whether to set the anon-option to display and mini-profile and signature to hide or not
}
}); Could anyone help me with some answers on some of my questions, and any ideas on how I could fulfil the second bit. I'm going to guess the second bit would be checking the key but would something as simple as 'If the key has data do this stuff' or would it be more complex? V6 unlimited key space, save to a users key, totally anonymous. A conversation key would be useless on mobile, until v6. Right now it would be a game about trying to hide member names, links, user IDs and cross theme it. Which honestly wouldn't work I... don't have time to sit around waiting for v6. I've checked with Peter in the past and yes this would be possible and would require a conversastion key.
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Dec 7, 2016 21:32:27 GMT -8
/* To Do - Set up a checkbox on the conversastion starting page called 'Send anonymously' - If Checkbox is ticked (if is true?) show 'Anon div' and hide miniprofile and foot for just that message - Else show as normal - Store the true value to key */ /*Useful Class Names .anon-option - Anonymous Option .signature - Signature .mini-profile - Mini-profile*/ /*Ask Peter to go over setting and getting a conversastion key*/
// A $( document ).ready() block. $( document ).ready(function() { if(pb.data("route").name == "new_conversation") { $(".recipients").prepend('<div class="checkboxybit"><form action=""><input type="checkbox" name="anonymous" id="anonymous" value="isAnon">Send Anonymously</form></div>'); /*Send Message button ID*/ $('input[type="button"][value="Create Message"]').on("click", function(){ if ($("#anonymous").is(':checked')) { pb.plugin.key('SHIELDRobAnon').set(object_id: ; value: true;); } }); } if(pb.data("route").name == "conversation") { if (pb.plugin.key('SHIELDRobAnon').get()) { $(".anonoption").css("display","inline-block"); $(".signature").css("display","none"); $(".mini-profile").css("display","none"); }
} });
Updated code. I've broke something somewhere and I'm not seeing it (its coming up with 'Uncaught SyntaxError: missing ) after argument list' ) and as I say I can't see where. So is there any chance someone could proof read. Tell me what I'm missing?
Also forgotten everything I was told about object id's with keys so again help? XD
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Dec 10, 2016 10:25:58 GMT -8
Anyone? Please?
|
|
inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,849
January 2015
msg
|
Post by Lynx on Dec 10, 2016 11:16:20 GMT -8
The only thing I could find, or think of, Boy_Wonder, is this line: pb.plugin.key('SHIELDRobAnon').set(object_id: ; value: true;);
As you don't have an object_id value, it may be seeing that as the error. Unfortunately, I still haven't used keys, but hopefully someone can tell you what to put in for the object_id. One thread that may help is this one: support.proboards.com/thread/558354/tutorial-keys-saving-data-proboardsOnce you get an ID for your object_id in there, I'd say test it again to see if that's what it was erroring on.
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Dec 10, 2016 11:41:04 GMT -8
I'm not sure how to dynamically 'grab' the ID for the current message that's my issue, I was hoping that it would make an educated guess xD so if someone like Peter or Brian etc or someone who's used keys could help me out a bit?
|
|
inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,849
January 2015
msg
|
Post by Lynx on Dec 10, 2016 12:24:30 GMT -8
According to the post I linked: This, to me, says you should be able to just have this line: pb.plugin.key('SHIELDRobAnon').set(object_id: ; value: true;);
to just be this: pb.plugin.key('SHIELDRobAnon').set(value: 'true');
I also added the quotes (which I noticed were missing) as well as remove the ; that you had after the true. I'm not saying this is correct, but it's what I see. Sorry I can't be more help. I really need to learn about keys.
|
|
#eb7100
33409
0
1
Nov 24, 2024 4:27:37 GMT -8
Brian
48,130
November 2004
smashmaster3
|
Post by Brian on Dec 11, 2016 9:24:23 GMT -8
When setting a key you need to supply a fully formatted object. You're currently missing braces around your properties.
In regards to the object ID: If you're viewing the thread/conversation you can ignore it completely. If you're on another page you'll need to obtain it from the page's HTML. On the default layout each thread/conversation has its ID specified as its ID attribute in the list HTML. You can typically obtain that using JS, then split up the ID to get only the number you need for your object ID.
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Dec 11, 2016 9:38:11 GMT -8
I figured it'd be something stupid that I'd forget xD
Which would be better to use in the case that I want it to be set by message (eg each message the user can select whether to be anonymous). Would it be message key (and can that still take an educated guess) or 'conversastion key)
|
|
#eb7100
33409
0
1
Nov 24, 2024 4:27:37 GMT -8
Brian
48,130
November 2004
smashmaster3
|
Post by Brian on Dec 11, 2016 9:53:08 GMT -8
If you're trying to change individual messages you'll want to use a message key instead of a conversation key.
Also, I'm sure you know this, but these won't be truly anonymous. Whoever submitted the message is going to be attributed in the Last Reply column and in the page's source. Similarly, if a user has notification emails on for PMs the person who sent the PM will also be name-dropped in the email.
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Dec 11, 2016 9:56:50 GMT -8
If you're trying to change individual messages you'll want to use a message key instead of a conversation key. Also, I'm sure you know this, but these won't be truly anonymous. Whoever submitted the message is going to be attributed in the Last Reply column and in the page's source. Similarly, if a user has notification emails on for PMs the person who sent the PM will also be name-dropped in the email. yes I do XD Okay my next issue - how do I check if the key has some form of data? Eg if its working. As I've sent a test PM to my other account on site and so far either I've broken something later on/something isn't being hidden etc. Can you help Brian xD I'm determined to make this work and I'm determined to do this thing myself (It's not meant to be 'serious serious' anonymous, just the idea of anonymity if that makes sense) /* To Do
- Set up a checkbox on the conversastion starting page called 'Send anonymously'
- If Checkbox is ticked (if is true?) show 'Anon div' and hide miniprofile and foot for just that message
- Else show as normal
- Store the true value to key
*/
/*Useful Class Names
.anon-option - Anonymous Option
.signature - Signature
.mini-profile - Mini-profile*/
/*Ask Peter to go over setting and getting a conversastion key*/
// A $( document ).ready() block.
$( document ).ready(function() {
if(pb.data("route").name == "new_conversation") {
$(".recipients").prepend('<div class="checkboxybit"><form action=""><input type="checkbox" name="anonymous" id="anonymous" value="isAnon">Send Anonymously</form></div>');
$('input[type="button"][value="Create Message"]').on("click", function(){
if ($("#anonymous").is(':checked')) {
pb.plugin.key('SHIELDRobAnon').set({value:'true'});
}
});
}
if(pb.data("route").name == "conversation") {
if (pb.plugin.key('SHIELDRobAnon').get()) {
$(".anonoption").css("display","inline-block");
$(".signature").css("display","none");
$(".mini-profile").css("display","none");
}
}
});
|
|
#eb7100
33409
0
1
Nov 24, 2024 4:27:37 GMT -8
Brian
48,130
November 2004
smashmaster3
|
Post by Brian on Dec 11, 2016 10:11:49 GMT -8
If it's a conversation key you can use:
If it's a message key you'll need to go through each message in the HTML and get its ID, then check against that for the existence of plugin key data.
|
|
inherit
Peabrained Codebreaker
107114
0
Mar 11, 2020 7:47:27 GMT -8
Boy_Wonder
6,249
July 2007
natzy24
|
Post by Boy_Wonder on Dec 11, 2016 10:20:47 GMT -8
ty venom XD As I say this is all new to me and I get it on some levels but its still 90% foreign language xD. And apparently something is still going wrong 'somewhere'. Is there any way to 'console.log' the key out? So I can see in the console if the key is even setting? Brian
|
|
#eb7100
33409
0
1
Nov 24, 2024 4:27:37 GMT -8
Brian
48,130
November 2004
smashmaster3
|
Post by Brian on Dec 11, 2016 10:58:55 GMT -8
You can run the plugin key get() command in the console at any time. No need to do a console log.
|
|