[MyCode] Spoiler text
#1
Title: Spoiler text
Short Description: Allow user to put text on value of the button.
Regular Expression:
Quote:\[spoiler\=(.*?)](.*?)\[/spoiler\=(.*?)]
Replacement:
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><input type="button" value="$1" style="width:auto;font-size:12px;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 = '$3'; } 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>

Enabled? : Yes

Example code in post

[spoiler=You can put your txt here to show the spoiler]Something here[/spoiler=You can put your txt here to hide the spoiler]

Result:
   

- Code are valid the markup validity.
- If you looking for standard spoiler, you can use this code on Replacement box.
<div style="margin:20px; margin-top:5px">
<div class="smallfont" style="margin-bottom:2px"><input type="button" value="Show Spoiler" style="width:100px;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 Spoiler'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.innerText = ''; this.value = 'Show Spoiler'; }" />
</div>
<div class="alt2" style="margin: 0px; padding: 6px; border: 1px inset;">
<div style="display: none;">$1</div>
</div>
</div>

with this regular expression.
Quote:\[spoiler\](.*?)\[/spoiler\]
Example code in post
[spoiler]text here[/spoiler]



Thanks
Reply
#2
It doesn't Show "Hide Spoiler" button when I click "Show Spoiler"
[Image: affectionhost1.png]

AffectionHost is back with a PROMOTION(Click for info)!
Reply
#3
Wow nice coding!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)