|
![]() |
![]() |
#31 | |
A Threat to the District
|
![]() Quote:
Code:
onClick="this.style.background=this.style.background=='#606060'?'#111111':'#606060';"
__________________
Twitter! Last edited by Vault Of Thrones; 04-17-2009 at 11:15 PM. |
|
![]() |
![]() |
#32 |
Friendly Neighborhood Quantum Hobo
Join Date: Mar 2004
Location: Outside the M-brane look'n in
Posts: 5,403
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]()
Oh man JavaScript works in BBcode. That is totally awesome. If I was more up on standardized JavaScript and the DOM I could totally whip up some JS that would actually replace anything in the spoiler tag with say the word *spoiler* which when clicked would reveal the spoiler text. Its been a few years since I got that one to work and I think it only worked in like Firefox or something like that.
|
![]() |
![]() |
#33 | ||
Blue Psychic, Programmer
Join Date: Feb 2007
Location: Home!
Posts: 8,814
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() Quote:
Code:
onClick="this.style.background=this.style.background=='#606060'?'#111111':'#606060'; this.style.color=this.style.color=='#606060'?'white':'#606060';"
__________________
Quote:
Journal | Twitter | FF Wiki (Talk) | Projects | Site |
||
![]() |
![]() |
#34 |
Friendly Neighborhood Quantum Hobo
Join Date: Mar 2004
Location: Outside the M-brane look'n in
Posts: 5,403
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]() Code:
<span id='spoiler' onclick="document.getElementById('moreinfo').style.display = 'block'; document.getElementById('spoiler').style.display = 'none';">Spoiler Alert!</span> <span style='background:black'><script type="text/javascript"><!-- document.write("<span onclick=\"document.getElementById('moreinfo').style.display = 'none'; document.getElementById('spoiler').style.display = 'block';\" style='display:none; background:black;' id='moreinfo'>"); //--> </script>Spoilers go here!<script type="text/javascript"><!-- document.write("</span>"); //--></script></span> |
![]() |
![]() |
#35 |
ahahah
Join Date: Mar 2004
Posts: 3,456
![]() ![]() ![]() ![]() |
![]()
Oh my. We're starting to get fancy.
I like fancy. Highlighting spoiler text makes my head hurt. |
![]() |
![]() |
#36 |
Friendly Neighborhood Quantum Hobo
Join Date: Mar 2004
Location: Outside the M-brane look'n in
Posts: 5,403
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]()
Whoops made a mistake. In order to avoid spoilering people without javascript enabled or people with old browsers I had to put a span tag in that would black out the text and I forgot to make the script undo that.
Code:
<span id='spoiler' onclick="document.getElementById('moreinfo').style.display = 'block';document.getElementById('moreinfo').style.background = ''; document.getElementById('spoiler').style.display = 'none';">Spoiler Alert!</span> <span id='nojava' style='background:black'><script type="text/javascript"><!-- document.write("<span onclick=\"document.getElementById('moreinfo').style.display = 'none'; document.getElementById('spoiler').style.display = 'block';\" style='display:none; background:black;' id='moreinfo'>"); //--> </script>Spoilers go here!<script type="text/javascript"><!-- document.write("</span>"); //--></script></span> |
![]() |
![]() |
#37 |
synk-ism
|
![]()
I am a fan of forum communities that reveal spoiler text on hover instead of requiring any clicks. A good example of this can be seen in SA LP threads, archived and otherwise. This would simply require the appropriate text styles added as events in the CSS for the spoiler tag: an onmouseover for hovering over the hidden area with a color that can be seen over the background and onmouseout for when not wishing to view the spoiler with the same color as the background.
However, I see that the advantage of the click method is that it remains visible without worrying about mouse placement, so maybe folks prefer that. I've just grown fond of the highlighting version. You would still need the catch for those without javascript enabled.
__________________
Find love.
|
![]() |
![]() |
#38 |
Friendly Neighborhood Quantum Hobo
Join Date: Mar 2004
Location: Outside the M-brane look'n in
Posts: 5,403
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
![]()
That change is relatively simple really. The onclick trigger just changes to whatever you happen to want to trigger the spoiler switch. In other news I fixed the line break problem.
Code:
<span id='spoiler' onclick="document.getElementById('moreinfo').style.display = 'inline';document.getElementById('nojava').style.background = ''; document.getElementById('spoiler').style.display = 'none';">Spoiler Alert!</span> <span id='nojava' style='background:black'><script type="text/javascript"><!-- document.write("<span onclick=\"document.getElementById('moreinfo').style.display = 'none'; document.getElementById('spoiler').style.display = 'inline';\" style='display:none;' id='moreinfo'>"); //--> </script>Spoilers go here!<script type="text/javascript"><!-- document.write("</span>"); //--></script></span> Last edited by Sithdarth; 04-18-2009 at 02:07 AM. |
![]() |
![]() |
#39 |
synk-ism
|
![]()
Quite right, it's just a matter of changing the function name used. However, you'd need to add the onmouseout for when the mouse pointer is moved away.
__________________
Find love.
|
![]() |
![]() |
#40 |
Pure joy
|
![]()
Fun fact: this is exactly what I was going for with the newly coloured spoiler text, because I saw it on SA and it's the bees knees as far as I'm concerned. But a few seconds in the project I realized I don't know jack about javascript.
|
![]() |
|
|