inherit
220772
0
Mar 24, 2023 21:43:23 GMT -8
Tiffy-Bean
I support plugin and theme makers rights to create themes and plugins that are paid for.
1,052
April 2015
tiffythecodingwhiz
|
Post by Tiffy-Bean on Mar 2, 2016 17:54:35 GMT -8
Chris: Is there any chance you might be able to help me? I was pointed to this: link as a possible similar way to get around my problem. I'm hoping to have my forum automatically click the "yes" to enable drafts on my forum. Do you happen to know a way I might be able to code this in so it'll do it on my forum?
|
|
Former Member
inherit
guest@proboards.com
223026
0
Nov 22, 2024 21:41:57 GMT -8
Former Member
0
January 1970
Former Member
|
Post by Former Member on Mar 2, 2016 18:05:31 GMT -8
Man, I was so looking for how to do this too just didn't know where to ask it. Maybe you could like, put the variable for the draft enabled thing, in the home page, and set it to either True or Yes, depending on if it is a string, or boolean, or whatever it is. But Idk what the variable is for it so
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,017
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Mar 2, 2016 18:18:04 GMT -8
Chris : Is there any chance you might be able to help me? I was pointed to this: link as a possible similar way to get around my problem. I'm hoping to have my forum automatically click the "yes" to enable drafts on my forum. Do you happen to know a way I might be able to code this in so it'll do it on my forum? It should be possible, I would have to study the mechanics of how Proboards accomplishes it before I can say for sure though. You should also be aware that this kind of code will most likely be short-lived since V6 will be revamping the editor thus making anything this code or any other code that hooks into the internals of the editor obsolete. From the POV of a user looking at their profile options nothing will change since this would activate at the time the editor loads and force the switch to "on" regardless of whether the user has actively made that change in their profile.
|
|
inherit
220772
0
Mar 24, 2023 21:43:23 GMT -8
Tiffy-Bean
I support plugin and theme makers rights to create themes and plugins that are paid for.
1,052
April 2015
tiffythecodingwhiz
|
Post by Tiffy-Bean on Mar 2, 2016 18:47:54 GMT -8
I'm okay with a shortlived version for now. Can you take a look at it if you're not too busy?
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,017
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Mar 2, 2016 19:41:26 GMT -8
Drop this in your Global Header and see if it does indeed enable drafts even if user has not actively enable the feature <!-- Force Proboards Autosave to "on" --> <script> (function () { if (!pb.data('enable_autosave') || !pb.data('type')) { pb.data('enable_autosave', 1) if (pb.data('proboards.message')) { pb.data('type', 6) } if (pb.data('proboards.post')) { pb.data('type', 3) } if ("visualHtml" in proboards.dataHash || "bbcode_message" in proboards.dataHash) { switch (pb.data('route').name) { case "quote_messages": case "new_message": pb.data('type', 5); break; case "new_conversation": pb.data('type', 4); break; case "quote_posts": case "new_post": pb.data('type', 2); break; case "new_thread": pb.data('type', 1); break; } } } })()
</script> updates:- added ".name" to switch statement -- derp
- 03 March 2016: changed if(pb.data('css_wysiwyg_style')){ to if ("visualHtml" in proboards.dataHash || "bbcode_message" in proboards.dataHash) { since that is added during wysiwyg build and may not be available by the time the code runs.
OLD CODES<!-- Force Proboards Autosave to "on" --> <script> (function () { if (!pb.data('enable_autosave') || !pb.data('type')) { pb.data('enable_autosave', 1) if (pb.data('proboards.message')) { pb.data('type', 6) }else if (pb.data('proboards.post')) { pb.data('type', 3) }else { switch (pb.data('route').name) { case "quote_messages": case "new_message": pb.data('type', 5); break; case "new_conversation": pb.data('type', 4); break; case "quote_posts": case "new_post": pb.data('type', 2); break; case "new_thread": pb.data('type', 1); break; } } } })() </script>
|
|
inherit
220772
0
Mar 24, 2023 21:43:23 GMT -8
Tiffy-Bean
I support plugin and theme makers rights to create themes and plugins that are paid for.
1,052
April 2015
tiffythecodingwhiz
|
Post by Tiffy-Bean on Mar 3, 2016 0:08:16 GMT -8
no it didn't work.
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,017
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Mar 3, 2016 15:24:22 GMT -8
How 'bout now? I changed the detection for wysiwyg to something more reliable and installed it on an actual forum and it appears to be working (even for guests!)
|
|
inherit
220772
0
Mar 24, 2023 21:43:23 GMT -8
Tiffy-Bean
I support plugin and theme makers rights to create themes and plugins that are paid for.
1,052
April 2015
tiffythecodingwhiz
|
Post by Tiffy-Bean on Mar 4, 2016 23:48:05 GMT -8
YUP! That fixed it! Thank you for the temporary fix. Don't be surprised if I hit you up on V6 if I don't figure it out for myself. I really appreciate it. mwuah!!
|
|
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 Mar 8, 2016 2:41:16 GMT -8
Drop this in your Global Header and see if it does indeed enable drafts even if user has not actively enable the feature <!-- Force Proboards Autosave to "on" --> <script> (function () { if (!pb.data('enable_autosave') || !pb.data('type')) { pb.data('enable_autosave', 1) if (pb.data('proboards.message')) { pb.data('type', 6) } if (pb.data('proboards.post')) { pb.data('type', 3) } if ("visualHtml" in proboards.dataHash || "bbcode_message" in proboards.dataHash) { switch (pb.data('route').name) { case "quote_messages": case "new_message": pb.data('type', 5); break; case "new_conversation": pb.data('type', 4); break; case "quote_posts": case "new_post": pb.data('type', 2); break; case "new_thread": pb.data('type', 1); break; } } } })()
</script> updates:- added ".name" to switch statement -- derp
- changed if(pb.data('css_wysiwyg_style')){ to if ("visualHtml" in proboards.dataHash || "bbcode_message" in proboards.dataHash) { since that is added during wysiwyg build and may not be available by the time the code runs.
pb.data('type', 5); What do those lines do?
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,017
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Mar 8, 2016 7:45:10 GMT -8
If you pass a second argument then it is a set rather than a get. That particular line for example adds "type" to the dataHash and sets its value to 5 ((pb.data('type') == 5). During initialization autosave looks for this value in order to know which input it should attach to and how it should behave so basically we're faking these values before autosave loads so autosave thinks the user has enabled it.
If you want to set multiple values then pass it an array of arrays (e.g pb.data([ ["newProp1","val1"], ["newProp2", "val2"] ])
|
|
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 Mar 8, 2016 10:52:20 GMT -8
If you pass a second argument then it is a set rather than a get. That particular line for example adds "type" to the dataHash and sets its value to 5 ( pb.data('type') == 5). During initialization autosave looks for this value in order to know which input it should attach to and how it should behave so basically we're faking these values before autosave loads so autosave thinks the user has enabled it. If you want to set multiple values then pass it an array of arrays (e.g pb.data([ ["newProp1","val1"], ["newProp2", "val2"] ]) Hopefully v6 includes documentation with the dataHash. This is what most complicated plugins use but its a learn for yourself situation for coders. I never looked at faking any values, honestly you might as well have wrote v5, 'Earl'. You do that in the templates or header? What other things can be "faked"? Does that allow the potential to maliciously increase the max-size of super keys or disable ads? Fake birthdays perhaps?
|
|
inherit
Official Code Helper
65613
0
1
Oct 22, 2024 1:56:19 GMT -8
Chris
"'Oops' is the sound we make when we improve"
9,017
December 2005
horace
RedBassett's Mini-Profile
|
Post by Chris on Mar 8, 2016 12:01:53 GMT -8
The ultimate documentation is already there, use your console to view the structure of proboards.dataHash and view the Proboards JS framework to see how that data is being used, that's what I meant when I said I had to "study the mechanics of how Proboards accomplishes it". The array within an array usage of the proboards.data() method for example can be observed simply by doing a view source of any Proboards page.
The only reason the autosave and wysiwyg editors could be faked out is because it runs code client-side to perform its duties. Decisions such as whether ads are displayed or the max key size are made server-side and in the overwhelming majority of cases are made before the page even gets sent out to your browser. The values present in the hash serve only as a guideline for you the developer, so whether you choose to follow it or not has no effect on the value server-side.
Any code could add fake birthdays to the homepage after the page hits the browser as you know, that however has no effect on what Proboards has for birthdays on the backend. A relevant analogy would be you watching a game on television and you do not like the score since your team is losing badly so you whip out a permanent marker and write over the score on the tv screen with your own preferred score. This however changes nothing for the millions of people watching the game or has even the slightest effect on what the official score keeper has on her card or what is displayed on the scoreboard at the stadium.
|
|
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 Mar 8, 2016 18:34:06 GMT -8
The ultimate documentation is already there, use your console to view the structure of proboards.dataHash and view the Proboards JS framework to see how that data is being used, that's what I meant when I said I had to "study the mechanics of how Proboards accomplishes it". The array within an array usage of the proboards.data() method for example can be observed simply by doing a view source of any Proboards page. The only reason the autosave and wysiwyg editors could be faked out is because it runs code client-side to perform its duties. Decisions such as whether ads are displayed or the max key size are made server-side and in the overwhelming majority of cases are made before the page even gets sent out to your browser. The values present in the hash serve only as a guideline for you the developer, so whether you choose to follow it or not has no effect on the value server-side. Any code could add fake birthdays to the homepage after the page hits the browser as you know, that however has no effect on what Proboards has for birthdays on the backend. I meant documentation on page based value pairs more so. But yeah ive studied it a lot myself. Thanks for the info
|
|