Commit | Line | Data |
---|---|---|
442a3ea1 | 1 | <div class="spoilerBox jsSpoilerBox"> |
82456fe9 | 2 | <div class="jsOnly spoilerBoxHeader"> |
442a3ea1 | 3 | <a class="button small jsSpoilerToggle"{if $buttonLabel} data-has-custom-label="true"{/if}>{if $buttonLabel}{$buttonLabel}{else}{lang}wcf.bbcode.spoiler.show{/lang}{/if}</a> |
82456fe9 | 4 | </div> |
442a3ea1 | 5 | |
82456fe9 | 6 | <div class="spoilerBoxContent" style="display: none"> |
442a3ea1 AE |
7 | <!-- META_CODE_INNER_CONTENT --> |
8 | </div> | |
f27e5de2 AE |
9 | |
10 | {if !$__wcfSpoilerBBCodeJavaScript|isset} | |
11 | {assign var='__wcfSpoilerBBCodeJavaScript' value=true} | |
12 | <script data-relocate="true"> | |
13 | elBySelAll('.jsSpoilerBox', null, function(spoilerBox) { | |
14 | spoilerBox.classList.remove('jsSpoilerBox'); | |
442a3ea1 | 15 | |
f27e5de2 AE |
16 | var toggleButton = elBySel('.jsSpoilerToggle', spoilerBox); |
17 | var container = toggleButton.parentNode.nextElementSibling; | |
442a3ea1 | 18 | |
f27e5de2 AE |
19 | toggleButton.addEventListener(WCF_CLICK_EVENT, function(event) { |
20 | event.preventDefault(); | |
21 | ||
22 | toggleButton.classList.toggle('active'); | |
23 | window[(toggleButton.classList.contains('active') ? 'elShow' : 'elHide')](container); | |
24 | ||
25 | if (!elDataBool(toggleButton, 'has-custom-label')) { | |
26 | toggleButton.textContent = (toggleButton.classList.contains('active')) ? '{lang}wcf.bbcode.spoiler.hide{/lang}' : '{lang}wcf.bbcode.spoiler.show{/lang}'; | |
27 | } | |
28 | }); | |
442a3ea1 | 29 | }); |
f27e5de2 AE |
30 | </script> |
31 | {/if} | |
32 | </div> |