Spoiler With Title
#1
Okay, so I want to edit the code so that the title is inside the button, instead of beside it.

My current replacement:
<div><div style="margin-bottom:2px; font-size: 12px"><b>Spoiler</b>: $1<input type="button" value="Show" style="width:45px;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">$2</div>
</div></div>

Not sure where to even begin.

Reply
#2
<div><div style="margin-bottom:2px; font-size: 12px"><b>Spoiler</b>: <input type="button" value="$1" style="width:auto;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';this.innerText = ''; this.value = '$1'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = '$1'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">$2</div>
</div></div>

that should do it. i also fixed the button width (it would not stretch with text, it will now)

just so you know that will not work with spoilers without an appendix.
so you'd need a new expression for regular spoilers if you dont have one already



For anybody wanting working "as is" spoiler codes, you will have to make 2 Mycodes (call them spoiler and modspoiler or whatever).

Regular Spoiler;
Expression
\[spoiler\](.*?)\[/spoiler\]

Replacement
<div><div style="margin-bottom:2px; font-size: 12px"><b>Spoiler</b>: <input type="button" value="Show" style="width:auto;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';this.innerText = ''; this.value = 'Hide'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">$1</div>
</div></div>


Extended Spoiler (where spoiler=something, and the something is in the button)
Expression
\[spoiler=(.*?)\](.*?)\[/spoiler\]

Replacement
<div><div style="margin-bottom:2px; font-size: 12px"><b>Spoiler</b>: <input type="button" value="$1" style="width:auto;font-size:10px;margin:0px;padding:0px;" onClick="if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';this.innerText = ''; this.value = '$1'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = '$1'; }">
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">$2</div>
</div></div>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)