inherit
210338
0
Apr 26, 2024 22:43:02 GMT -8
RichardInTN
472
June 2014
richardintn
|
Post by RichardInTN on Aug 6, 2017 17:26:28 GMT -8
I need a piece of javascript or html that I can add to the header or footer (general or global) that will open all spoilers for one specific member/user.
Something like
If user.is "28" then open spoilers Obviously that's not the code... but that's the gist of what I need it to do.
Thanks!
|
|
inherit
210338
0
Apr 26, 2024 22:43:02 GMT -8
RichardInTN
472
June 2014
richardintn
|
Post by RichardInTN on Aug 9, 2017 16:19:11 GMT -8
Bump!
|
|
inherit
217348
0
Jul 27, 2022 7:26:44 GMT -8
Lynx
5,780
January 2015
msg
|
Post by Lynx on Aug 9, 2017 19:27:43 GMT -8
Sorry, but this sounds like overkill for just one member. How hard is it to click the "Click to Show" to reveal the spoiler? It doesn't sound like this would be very beneficial, considering revealing a spoiler is only a click away. Just my $0.02 worth though - as I would not go to this length for just one member. The cost in time to code probably wouldn't be worth the time lost.
|
|
inherit
210338
0
Apr 26, 2024 22:43:02 GMT -8
RichardInTN
472
June 2014
richardintn
|
Post by RichardInTN on Aug 10, 2017 2:34:02 GMT -8
It might be just for one member now, but that could easily change, and it could probably be written in such a way that it could include more than one person.
When I came across this member's dislike of them, I had a brainstorm of another use. I'm also thinking of members with faulty track-pads on their laptops who navigate via shift/tab/arrow/f-key commands (I actually did that for almost a year before I could scare up enough money to buy a new laptop!). There's no command key combination to open spoilers (at least none that I know of anyway). Anyone that has this issue could ask to be listed in the code as well.
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,858
December 2005
horace
|
Post by Chris on Aug 11, 2017 13:03:31 GMT -8
<script> $(function(){ /** "I’m going to show these people what you don’t want them to see" -Neo (The One) */ var zion = [1,2,3,210338]; //enter user_id function there_is_no_spoon(){ if( pb.data("user") && pb.data('proboards.post') && zion.indexOf(pb.data("user").id ) !== -1){ $('.spoiler_header > a').click() } } there_is_no_spoon() pb.events.on('afterSearch', there_is_no_spoon ) }) </script>
|
|
inherit
210338
0
Apr 26, 2024 22:43:02 GMT -8
RichardInTN
472
June 2014
richardintn
|
Post by RichardInTN on Aug 11, 2017 17:12:36 GMT -8
LOL... love the Matrix references!!! I'll give it a test run tonight. ETA: one question, Chris... where would you suggest I include it? General header, General footer, Global header, Global footer...?
|
|
Kami
Forum Cat
Posts: 40,031
Mini-Profile Theme: Kami's Mini-Profile
#f35f71
156500
0
Offline
Jul 24, 2021 11:48:29 GMT -8
Kami
40,031
July 2010
kamiyakaoru
Kami's Mini-Profile
|
Post by Kami on Aug 11, 2017 17:30:53 GMT -8
LOL... love the Matrix references!!! I'll give it a test run tonight. ETA: one question, Chris... where would you suggest I include it? General header, General footer, Global header, Global footer...? I know I'm not Chris, but it really depends on where you want it to take effect. If you only want it, in Board A but not Board B, put it in the header or footer of Board A only. If you want it universally, put it in your Global.
As far as positioning (header versus footer) it depends on when you want the code to take effect. I'll leave it to Chris to confirm but since the spoilers on the page need to load before the script attempts to open them, my instinct would be to say footer. Not 100% sure though!
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,858
December 2005
horace
|
Post by Chris on Aug 11, 2017 18:08:53 GMT -8
In this case, since the code uses jQuery's document ready event it really doesn't matter if header or footer since it will register itself as a listener for the event then go to sleep until called upon.
Note: $(func) is a shortcut for $(document).ready(func)
|
|
inherit
210338
0
Apr 26, 2024 22:43:02 GMT -8
RichardInTN
472
June 2014
richardintn
|
Post by RichardInTN on Aug 11, 2017 19:11:31 GMT -8
It definitely will need to be "universal"... so Global it is!
|
|
inherit
210338
0
Apr 26, 2024 22:43:02 GMT -8
RichardInTN
472
June 2014
richardintn
|
Post by RichardInTN on Aug 11, 2017 19:22:10 GMT -8
Okay... just tested it and... that was ... umm... interesting and not what I expected. LOL.
It works (sort of) It doesn't OPEN the spoiler per se (with the spoiler plugin that I use, spoilers pop open with a box around their contents, and a certain font and point size)... it removes/copies the content from being IN the spoiler (in my test thread what I had spoilered just appeared as regular as if there wasn't a spoiler... but under the spoiler "button" itself... and clicking on the spoiler "button" still opened the spoiler revealing the text inside as if this code had never even been added) and then just places it below the spoiler as if the spoiler itself never existed (but leaving the spoiler marker there, visible, and clickable).
Interestingly if the spoiler marker gets clicked, the text then still displays in the box, at the appropriate font and point sizes as determined by the spoiler plugin.
I can definitely use this though if there's no way to just "click open" the spoilers via script (changing the "onclick" status somehow to "clicked", maybe?).
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,858
December 2005
horace
|
Post by Chris on Aug 11, 2017 19:39:12 GMT -8
Well since you are using a plugin that modifies the standard spoiler it might have been helpful to mention that. Can you give me a link to a post with a spoiler on your forum so I can see what changes the plugin makes to the standard spoiler structure?
|
|
inherit
210338
0
Apr 26, 2024 22:43:02 GMT -8
RichardInTN
472
June 2014
richardintn
|
Post by RichardInTN on Aug 11, 2017 20:32:05 GMT -8
Well since you are using a plugin that modifies the standard spoiler it might have been helpful to mention that. Can you give me a link to a post with a spoiler on your forum so I can see what changes the plugin makes to the standard spoiler structure? My apologies on not including that information. I didn't think it relevant since I was looking for a "faked click" (and I thought "a click is a click"). That's my bad and it's on me. I'm using "http://support.proboards.com/thread/433410/spoiler-tags" (v 1.4.5 Beta) Link to a thread with a spoiler in it that's accessible by guests (first one I found, it's a little past half way down the thread by a member called "tignanello"): buildinggreatness.proboards.com/thread/659/master-chef-usa-summer-2017?page=2ETA: for testing purposes I have it set for only me (user #2), for now ETA II: is there a way that I can include "guests" so you can see what it does as a guest?
|
|
inherit
Official Code Helper
65613
0
1
Apr 15, 2024 17:01:41 GMT -8
Chris
"'Oops' is the sound we make when we improve"
8,858
December 2005
horace
|
Post by Chris on Aug 12, 2017 1:15:48 GMT -8
A guest would effectively have user_id of 0.
...anyhow the plugin hides the original spoiler_header link and adds its own, it also calls a global function that basically flips the class of the spoiler to 'spbody' so it can be styled in a targeted manner, so to be compatible with that plugin the following small change should do it:
change the line:
$('.spoiler_header > a').click()
to: $('.spoiler_header > .sptitle').click()
|
|
inherit
210338
0
Apr 26, 2024 22:43:02 GMT -8
RichardInTN
472
June 2014
richardintn
|
Post by RichardInTN on Aug 12, 2017 2:19:46 GMT -8
That's got it! Magnifico! Chris, You rock dude.
|
|