Spoiler Buttons?

Status
Not open for further replies.

Kovy

is back, baby!
Est. Contributor
Messages
1,914
Age
27
Role
  1. Diaper Lover
  2. Little
  3. Carer
Whenever I see any of those buttons that read "Show" and need to be clicked to display text or images, I can only click on the first one of each thread. That's all. Any suggestions or comments would be appreciated.

By the way, I use a Mac with Safari.
 

chevre

Est. Contributor
Messages
1,434
Role
  1. Diaper Lover
Hm. They work fine on Firefox as Mandi says (though I use it from Linux).
 

Jon

Est. Contributor
Messages
595
Role
  1. Diaper Lover
What's the point of those buttons? They annoy the shit outta me...
 

Charlie

Est. Contributor
Messages
3,448
Role
  1. Adult Baby
  2. Diaper Lover
  3. Sissy
  4. Carer
  5. Other
Download FireFox!

I'd recommend that even if you didn't have this problem. :p
 

ShyBaby

Contributor
Messages
84
Role
  1. Adult Baby
Same problem on Google Chrome (on Vista,) these the burdens of running a beta... :frown:
As with others, FireFox 3.x okay. Haven't tried Exploder...
 

andysetra

Est. Contributor
Messages
1,407
Role
  1. Adult Baby
  2. Diaper Lover
  3. Other
I'm running Safari 3.1.2 and it doesn't work. Works for FF 3.x on the same machine though. Looks like a bug in Safari with the bbcode. Just browse ADISC in Opera or FF if you're on the Mac :)
 

Vladimir

Est. Contributor
Messages
1,784
Role
  1. Private
What's the point of those buttons? They annoy the shit outta me...
I'd rather not be spoiled, or having huge pictures that my widescreen monitor (1280x900) can't even display without a horizontal scroll bar.

I use Windows 7 with Firefox, and it works fine for me.
 

DannyTheNinja

Banned
Messages
852
Role
  1. Private
Obviously this is a WebKit issue... I'll have a look at the code.

[the following is a test, ignore it]



Edit: bug confirmed under midori (small GNOME WebKit browser for Linux).
Edit2: ok, apparently the douche that coded this mod had the lack of brains to actually give all the spoiler-hidden areas (the <div> tags) the same ID. If Moo wants a patch written up I'll do my best to do that.
Edit3: debugged. This code should work; to apply it, Moo, replace the onclick tag for the show buttons with this code:
Code:
var container = this.parentNode;
var inner = container.getElementsByTagName('div')[0];
if ( inner.style.display == 'none' )
{
  this.value = 'Hide';
  inner.style.display = 'block';
}
else
{
  this.value = 'Show';
  inner.style.display = 'none';
}
--Danny :ninja:
 

Moo

ADISC Admin
Staff
Messages
5,569
Role
  1. Private
Replacement made. Safari users: does it work for you now?
 
Messages
520
Role
  1. Adult Baby
  2. Diaper Lover
  3. Incontinent
I'd rather not be spoiled, or having huge pictures that my widescreen monitor (1280x900) can't even display without a horizontal scroll bar.

I use Windows 7 with Firefox, and it works fine for me.

What? Windows 7 , I didn't think win7 was out yet, do tell
 

Martin

Est. Contributor
Messages
3,833
Role
  1. Adult Baby
  2. Diaper Lover
  3. Little
kevin: IIRC it's in ALPHA or BETA testing.
 

DannyTheNinja

Banned
Messages
852
Role
  1. Private
Finally my otherwise useless knowledge of Javascript, the XML DOM, and funky browser quirks has come in handy. All those hours of firebugging, unwasted after all :p

Explanation:
The common thread here is that all the browsers that had this problem are based around a piece of software called WebKit, which in turn was based off of KHTML. WebKit and KHTML are rendering engines or pieces of software designed to tackle the immense task of looking at a web page and deciding how it should look. I realized that the problem affected only WebKit, because Gecko-based browsers (Firefox) and Trident-based browsers (IE) didn't display the problem. I think what went on, and I can't confirm this, is that the button traversed up two levels to find which box to open rather than one. See, the way a single spoiler is arranged is using invisible boxes (HTML programmers call them <div> tags) like this:

wrapper box said:
[ button ]
spoiler said:
The actual spoiler goes here

What the button does is it has this event called onclick, so that when you click it it has a function attached that basically means, "find the first <div> tag under the tag two levels up of where I am; if it's invisible, make it visible, otherwise make it invisible." If you look at an HTML document as a tree, going up two levels means look at the <div> that is ABOVE (outside of) the actual spoiler tag. So it's basically showing and hiding the wrong piece of the document. Hell, I'm surprised that didn't completely screw up every post it was in. What I did was rewrite the code so that it correctly traversed the document and correctly found the <div> it was looking for by using standardized DOM methods. It might break compatibility with older browsers or IE, but it is W3C compliant which means if it doesn't work, it's the fault of the person or company that wrote your web browser, not me. </geekrant>

--Danny :ninja:
 
Status
Not open for further replies.
Top