Jump to content

Template:Show: Difference between revisions

From Insurer Brain
Content deleted Content added
No edit summary
Tags: Manual revert Reverted
No edit summary
Tag: Reverted
Line 1: Line 1:
<includeonly><{{#ifeq:{{{inline|}}}|yes|span|div}} class="mw-collapsible {{#ifeq:{{lc:{{{state|collapsed}}}}}|expanded||mw-collapsed}} {{#ifeq:{{{compact|}}}|yes|mw-compact-toggle|}}"
<includeonly><{{#ifeq:{{{inline|}}}|yes|span|div}} class="mw-collapsible {{#ifeq:{{lc:{{{state|collapsed}}}}}|expanded||mw-collapsed}} {{#ifeq:{{{compact|}}}|yes|mw-compact-toggle|}}"
style="{{#ifeq:{{{inline|}}}|yes|display:inline;}}{{#ifeq:{{{compact|}}}|yes|display:inline;}} {{{style|}}}">
data-expandtext="{{{expandtext|more ▾}}}"

data-collapsetext="{{{collapsetext|less ▴}}}"
{{#ifeq:{{{compact|}}}|yes|
style="{{#ifeq:{{{inline|}}}|yes|display:inline;}}{{#ifeq:{{{compact|}}}|yes|display:inline-block; vertical-align:top;}} {{{style|}}}">
<span class="mw-collapsible-toggle mw-compact-show" style="cursor:pointer; color:#0645ad;" role="button" tabindex="0">{{{expandtext|more ▾}}}</span>
|}}

<{{#ifeq:{{{inline|}}}|yes|span|div}} class="mw-collapsible-content" style="{{#ifeq:{{{inline|}}}|yes|display:inline;}}">
<{{#ifeq:{{{inline|}}}|yes|span|div}} class="mw-collapsible-content" style="{{#ifeq:{{{inline|}}}|yes|display:inline;}}">
{{{text|}}}</{{#ifeq:{{{inline|}}}|yes|span|div}}>
{{{text|}}}
{{#ifeq:{{{compact|}}}|yes|
&nbsp;<span class="mw-collapsible-toggle mw-compact-hide" style="cursor:pointer; color:#0645ad;" role="button" tabindex="0">{{{collapsetext|less ▴}}}</span>
|}}
</{{#ifeq:{{{inline|}}}|yes|span|div}}>

</{{#ifeq:{{{inline|}}}|yes|span|div}}></includeonly><noinclude>
</{{#ifeq:{{{inline|}}}|yes|span|div}}></includeonly><noinclude>
== Usage ==
== Usage ==
Line 15: Line 23:


== Compact Usage ==
== Compact Usage ==
This version prevents the "jump" and keeps the link next to the text.
This version keeps the link inline at the natural end of the text.
<pre>
<pre>
{{show
{{show
Line 28: Line 36:
* '''collapsetext''': The text for the "hide" link (Defaults to "less ▴").
* '''collapsetext''': The text for the "hide" link (Defaults to "less ▴").
* '''inline''': Set to "yes" to use span tags.
* '''inline''': Set to "yes" to use span tags.
* '''compact''': Set to "yes" to keep the toggle link next to the text and fix the "push down" alignment issue.
* '''compact''': Set to "yes" to use the inline run-in toggle style.
* '''state''': Set to "expanded" to have the text visible on page load.
* '''state''': Set to "expanded" to have the text visible on page load.
* '''style''': Pass additional CSS styles directly.
* '''style''': Pass additional CSS styles directly.


== Required CSS ==
== Required CSS ==
Add this to your [[MediaWiki:Common.css]] to ensure the "more" link doesn't float away:
Add this to your [[MediaWiki:Common.css]]:
<pre>
<pre>
/* Compact Toggle Logic */
.mw-compact-toggle .mw-collapsible-toggle {
/* 1. When expanded, hide the 'Show' link */
float: none !important;
.mw-collapsible:not(.mw-collapsed) .mw-compact-show {
display: inline-block !important;
margin-left: 0.5em;
display: none !important;
}
vertical-align: top !important;

/* 2. When collapsed, the 'Hide' link is naturally hidden because
its parent (.mw-collapsible-content) is hidden by MW default CSS. */

/* Optional: Ensure pointer cursor if inline styles are stripped */
.mw-compact-show, .mw-compact-hide {
cursor: pointer;
}
}
</pre>
</pre>

Revision as of 01:31, 20 December 2025

Usage

Standard block usage (floats toggle to the far right):

{{show
|text=The primary driver for the acquisition was the target's proprietary AI technology.
}}

Compact Usage

This version keeps the link inline at the natural end of the text.

{{show
|compact=yes
|text=This text is short and the button stays close and aligned.
}}

Parameters

  • text: The content to be hidden/shown.
  • expandtext: The text for the "show" link (Defaults to "more ▾").
  • collapsetext: The text for the "hide" link (Defaults to "less ▴").
  • inline: Set to "yes" to use span tags.
  • compact: Set to "yes" to use the inline run-in toggle style.
  • state: Set to "expanded" to have the text visible on page load.
  • style: Pass additional CSS styles directly.

Required CSS

Add this to your MediaWiki:Common.css:

/* Compact Toggle Logic */
/* 1. When expanded, hide the 'Show' link */
.mw-collapsible:not(.mw-collapsed) .mw-compact-show {
    display: none !important;
}

/* 2. When collapsed, the 'Hide' link is naturally hidden because 
      its parent (.mw-collapsible-content) is hidden by MW default CSS. */

/* Optional: Ensure pointer cursor if inline styles are stripped */
.mw-compact-show, .mw-compact-hide {
    cursor: pointer;
}