-<div class="container codeBox {$highlighter|get_class|substr:30|lcfirst}">
+<div class="container codeBox {$highlighter|get_class|substr:30|lcfirst}{if $lines > 10} minimized{/if}">
<div>
<div>
<h3>{@$highlighter->getTitle()}{if $filename}: {@$filename}{/if}</h3>
{/foreach}
</ol>
</div>
+
+ {if $lines > 10}
+ <span class="codeBoxExpand jsButtonCodeBoxExpand">{lang}wcf.bbcode.button.showAll{/lang}</span>
+ <script data-relocate="true">
+ $(function() {
+ $('.jsButtonCodeBoxExpand').removeClass('jsButtonCodeBoxExpand').click(function() {
+ $(this).parent().removeClass('minimized').end().remove();
+ });
+ });
+ </script>
+ {/if}
</div>
'startLineNumber' => $this->startLineNumber,
'content' => $highlightedContent,
'highlighter' => $className::getInstance(),
- 'filename' => $this->filename
+ 'filename' => $this->filename,
+ 'lines' => substr_count($content, "\n") + 1
));
return WCF::getTPL()->fetch('codeBBCodeTag');
}
}
}
}
+
+ &.minimized {
+ max-height: 200px;
+ overflow: hidden;
+ position: relative;
+
+ > .codeBoxExpand {
+ background-color: @wcfContainerBackgroundColor;
+ border-top: 1px solid @wcfContainerBorderColor;
+ bottom: 0;
+ cursor: pointer;
+ display: block;
+ height: 20px;
+ left: 0;
+ padding: 4px;
+ position: absolute;
+ right: 0;
+ text-align: center;
+
+ .boxShadow(0, -10px, @wcfContainerBackgroundColor, 25px, 5px);
+ }
+ }
}
// rtl fix
<item name="wcf.bbcode.button.code"><![CDATA[Code]]></item>
<item name="wcf.bbcode.button.inlineCode"><![CDATA[Inline-Code]]></item>
<item name="wcf.bbcode.button.quote"><![CDATA[Zitat]]></item>
+ <item name="wcf.bbcode.button.showAll"><![CDATA[Alles anzeigen]]></item>
<item name="wcf.bbcode.button.spoiler"><![CDATA[Spoiler]]></item>
<item name="wcf.bbcode.code.text"><![CDATA[{@$highlighterTitle} ({#$lines} Zeile{if $lines != 1}n{/if})]]></item>
<item name="wcf.bbcode.code.bash.title"><![CDATA[Shell-Script]]></item>
<item name="wcf.bbcode.button.code"><![CDATA[Code]]></item>
<item name="wcf.bbcode.button.inlineCode"><![CDATA[Inline-Code]]></item>
<item name="wcf.bbcode.button.quote"><![CDATA[Quote]]></item>
+ <item name="wcf.bbcode.button.showAll"><![CDATA[Show All]]></item>
<item name="wcf.bbcode.button.spoiler"><![CDATA[Spoiler]]></item>
<item name="wcf.bbcode.code.text"><![CDATA[{@$highlighterTitle} ({#$lines} line{if $lines != 1}s{/if})]]></item>
<item name="wcf.bbcode.code.bash.title"><![CDATA[Shell-Script]]></item>