View Full Version : Spoiler Tags
Red Dragon
12-11-2006, 01:05 PM
I don't know what N-Sider uses for a board (I think it's VBulletin but I believe I am wrong) but I was wondering if it was possible to use this.
Example (http://forums.n-sider.com/showpost.php?p=99598&postcount=12)(Warning: Zelda spoilers)
I think it would be better than what we use now for spoilers (with the loads of spaces and junk).
Big Rick Cook
12-11-2006, 01:11 PM
Looks like V-Bulletin to me.
Red Dragon
12-11-2006, 01:17 PM
I'm always wrong about everything, so meh.
Draygone
12-11-2006, 01:22 PM
I clicked on the link and my mouse happened to be sitting right over the spoiler.
Valkysas
12-11-2006, 01:22 PM
It's vBulletin.
While I've seen that type of spoiler tag on many vBulletin forums, I've never found the code for it, and no one I ask will tell me it. It's a custom addition to the forum, so that means I have to hunt for it.
I might have found the code here:
http://www.vbulletin.org/forum/archive/index.php/t-105176.html
I can't view the code, however, because I don't have a vB license.
Valkysas
12-11-2006, 01:36 PM
I tried that before, and could never get it to work.
You could always try simply putting white text inside of [CODE] tags. It's not the same, but at least it's better than massive spaces. Or, you could use Rot13 (http://www.rot13.com/).
Bu lrn yvxr V'q ernyyl hfr gung...yby
Oh yea like I'd really use that...lol
Well, you could.
thetruecoolness
12-11-2006, 07:14 PM
Well it isn't be too difficult assuming Valk knows how vBulletin parses it's BB code (which can be pretty difficult, as it was hard to find and understand in phpBB).
What you could do is find where the board code tags are parsed and add in one for Spoilers, then find where it is replaced and do this
$post_text = preg_replace('/\[Spoilers\]([.]*?)\[/Spoilers\]/i', '<span class="spoilers">$1</span>', $post_text);
Hurray for regular expressions.
Then in the style sheet for the Pav add
.spoilers {
color: #49566D; //background for pav posts
background: #49566D;
}
.spoilers:hover {
color: white;
}
Or like nintendo did, use the non CSS file way of
$post_text = preg_replace('/\[Spoilers\]([.]*?)\[/Spoilers\]/i', '<span style="color: #49566D; background: #49566D;"
"class="spoilers" onmouseover="this.style.color=\'#FFFFFF\'" onmouseout="this.style.color=this.style.backgroundColor">$1</span>', $post_text);
yea that rot13's pretty cool, I wonder if perversion would use it in one of his puzzle games:lol thatd be cool
And wow TTC never ceases to amaze me:)
BlueSenshi
12-12-2006, 02:28 PM
You could always try simply putting white text inside of [code] tags.
The main problem with that is that the different backgrounds would need different colors associated with them. Text already shows up as white on a dark blue-ish background for me. So simply making text white wouldn't make any difference. If there was a way to use the background color variable instead of a color constant, that would work. But I don't know anything about vB, so I can't help with that.
[Edit: But it looks like TTC already posted that. So nevermind.]
Alzar
12-17-2006, 10:46 PM
why not just make the background and text black, then you can highlight it with your mouse to see it without any .hover css tag
Dreamknight
12-17-2006, 10:51 PM
Can't we do it like we had the old pavilion forums and the mag forums?
It's appear as a link that said spoiler and when you clicked it the text appears.
Alzar
12-17-2006, 11:26 PM
clearly we should do something anyway, cos
*spoiler*
balbhlabha
*/spoiler*
is shiznitty
Then in the style sheet for the Pav add
.spoilers {
color: #49566D; //background for pav posts
background: #49566D;
}
.spoilers:hover {
color: white;
}
:hover doesn't work in IE except in <a> tags. That's like, 90% of the internet that won't be able to view the spoilers properly.
Zieg Rauros
12-18-2006, 05:44 PM
Are you saying 90% of the pav uses IE?
OBJECTION!
thetruecoolness
12-18-2006, 05:56 PM
:hover doesn't work in IE except in <a> tags. That's like, 90% of the internet that won't be able to view the spoilers properly.
Well that's because IE is web standards retarded. But that's why I provided the non-CSS way which does work in all of them. Also I'm pretty sure less than 90% of the internet uses IE. Some people are finally realizing other browsers are better (well to developers, since you don't have to worry about whether your standard compliant code will look retarded in IE, and if your transparent pngs are going to display right or not). Of course I consider IE to be the bane of my web development so I might be a bit biased.
As for the hiding with a button thing, sure it's possible but a bit more complicated as it involves manipulating the DOM to find the spoiler. You would output something similar too
<div>
<a onclick='show_spoiler(this)'>Spoilers Ahead</a>
<span class='spoilers'>Spoiler text</span>
</div>
Then your CSS would be
.spoilers {
display: none;
}
And Javascript
function show_spoilers(obj) {
var parent = obj.parentNode
var children_spans = parent.getElementsByTagName('span');
var spoiler_tag = children_spans[0];
if (spoiler_tag != null) {
if (spoiler_tag.style.display == 'none') {
spoiler_tag.style.display = 'inline';
} else {
spoiler_tag.style.display = 'none';
}
}
So the PHP code would become
$post_text = preg_replace('/\[Spoilers\]([.]*?)\[/Spoilers\]/i',
'<div><a onclick="show_spoilers(this)">Spoiler Ahead</a><span class="spoilers">$1</span></div>',
$post_text);
So slightly more complicated to get right. Also possible it might also not be cross browser compatible, since almost every browser has their own JS syntax.
EDIT: Also I highly doubt 90% of the internet still uses IE (probably around 60%). Firefox, especially, and Opera to a lesser extent, have been gaining a lot of ground as people open their eyes. Not that those aren't without their faults, but they're certainly not worse than IE, and don't make me feel like throwing the computer when I'm developing a webpage.
Red Dragon
12-21-2006, 11:01 AM
I get more fustrated with Firefox when making webpages. iframes refuse to work for me...
Then again, last time I made a web page it was the Bush/Kerry elections.
EDIT: Also I highly doubt 90% of the internet still uses IE (probably around 60%).
Yeah, W3Schools says that IE is around 60%, with Firefox at 30%. So, yeah, I was exagerating a bit.
Red Dragon
01-01-2007, 06:11 AM
I use IE :)
vBulletin® v3.8.6, Copyright ©2000-2012, Jelsoft Enterprises Ltd.