Template:ScrollBox: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Wow, should of fixed this template. Docs are being made.)
(Fixed typo in lang template. :) Moved border-bottom of title to border-top of scrolling <div>. Enabled bottom-border by default if a title exists. Simplified code for max-height and noscroll. Added color, border-color and style parameters.)
Line 1: Line 1:
{{lang|Template:Scrollbox}}<!--
{{lang|Template:ScrollBox}}<!--
--><onlyinclude><includeonly><!-- {{Lang}} causes mysterious line break due to ParserExtensions, but apparently this prevents indenting using :{{ExpandBox|...}}. Sigh -->
--><onlyinclude><includeonly><!--


<!--
   ++ HEADER ++
   ++ HEADER ++
-->
 
{{#if:{{{title|}}} | <p style="font-style:italic;border-bottom:1px solid #3A3937;">{{{title}}}&#58;</p> }}
-->{{#if:{{{title|}}} | <div style="font-style:italic;"><br>{{{title}}}&#58;</div> }}<!--
<!--
 
   ++ BOX CONTENTS ++
   ++ BOX CONTENTS ++
-->
 
<div style="overflow:auto;max-height:30em;
--><div style="
{{#if:{{{bottom-border|}}} | border-bottom:1px solid #3A3937;}}
  overflow: auto;
{{#if:{{{noscroll|}}} | max-height:100%; |
  background-color: {{{color|none}}};
   <!-- Since {{{noscroll|}}} isn't used, lets set if we should set the max-height.-->
  {{#if: {{{title|}}} | border-top:1px solid #444; }}
  <!-- Since {{{noscroll|}}} isn't used, lets set the max-height.-->
  {{#if: {{{bottom-border|{{{title|}}}}}} | border-bottom:1px solid #444; }}
   {{#if:{{{maxheight|}}} | max-height:{{{maxheight|}}};}}
   border-color: {{{border-color|#3A3937}}}; <!-- overrides previous colors -->
}}
   {{#if: {{{noscroll|}}} | max-height:100%; | max-height:{{{maxheight|30em}}}; }}
">{{{1}}}</div></includeonly></onlyinclude>
  {{{style|}}}; <!-- can override anything because it's the last -->
">{{{1}}}</div><!--
 
--></includeonly></onlyinclude>
{{documentation}}
{{documentation}}
<!-- Add categories to the /doc subpage, not here -->
<!-- Add categories to the /doc subpage, not here -->

Revision as of 06:49, 13 December 2021

English (en)Deutsch (de)Esperanto (eo)Español (es)Français (fr)Suomi (fi)Hrvatski (hr)Magyar (hu)Italiano (it)日本語 (ja)한국어 (ko)Nederlands (nl)Polski (pl)Português (pt)Português do Brasil (pt-br)Русский (ru)Slovenčina (sk)Svenska (sv)Türkçe (tr)Українська (uk)Tiếng Việt (vi)中文 (zh)中文(臺灣) (zh-tw)
Curly brackets white.pngTemplate Documentation [view] [edit]
Icon-translate.png Available doc translations
View
Page history

Use this to rein in lists such as KV, Input and Ouput lists on entity pages. Reaaally long lists won'tnot flood the entire page this way.

Parameters

  • {{{1}}} – The text inside the ScrollBox.
  • {{{title}}} – The title above the scroll box. Leave empty for no title.
  • {{{bottom-border}}} – If set to a non-empty value, then a short, thin line will be present at the bottom. Use if the scrollbar becomes unreliable from long lists.
  • {{{noscroll}}} – If set to a non-zero value, scrolling is disabled. Use if scrolling becomes problematic on nested ScrollBoxes.
  • {{{maxheight}}} – Change the height threshold for when the ScrollBox should be active. This isn't for things such as KV or I/O lists, as ideally these should use the default to maintain a consistency.
  • {{{color}}} – Sets the background color of the ScrollBox.
  • {{{border-color}}} – Sets the color of the border of the ScrollBox.
  • {{{style}}} – Allows the editor to throw in any other style attributes to the ScrollBox.

Examples

Wikitext Result
{{ScrollBox|maxheight=8em|
# One
# Two
# Three
# Four
# Five
# Six
# Seven
# Eight
# Nine
# Ten
}}
  1. One
  2. Two
  3. Three
  4. Four
  5. Five
  6. Six
  7. Seven
  8. Eight
  9. Nine
  10. Ten
{{ScrollBox|maxheight=8em|bottom-border=1|
# One
# Two
# Three
# Four
# Five
# Six
# Seven
# Eight
# Nine
# Ten
}}
  1. One
  2. Two
  3. Three
  4. Four
  5. Five
  6. Six
  7. Seven
  8. Eight
  9. Nine
  10. Ten
{{ScrollBox|maxheight=8em|bottom-border=1|noscroll=1|
# One
# Two
# Three
# Four
# Five
# Six
# Seven
# Eight
# Nine
# Ten
}}
  1. One
  2. Two
  3. Three
  4. Four
  5. Five
  6. Six
  7. Seven
  8. Eight
  9. Nine
  10. Ten
{{ScrollBox|maxheight=8em|bottom-border=1|noscroll=0|
# One
# Two
# Three
# Four
# Five
# Six
# Seven
# Eight
# Nine
# Ten
}}
  1. One
  2. Two
  3. Three
  4. Four
  5. Five
  6. Six
  7. Seven
  8. Eight
  9. Nine
  10. Ten
{{ScrollBox|maxheight=8em|color=#234|border-color=#456|style=border-left:10px solid #FC6|
# One
# Two
# Three
# Four
# Five
# Six
# Seven
# Eight
# Nine
# Ten
}}
  1. One
  2. Two
  3. Three
  4. Four
  5. Five
  6. Six
  7. Seven
  8. Eight
  9. Nine
  10. Ten