Template talk:Hidden/Archive 1

Latest comment: 3 years ago by Plastikspork in topic Verbose instructions
Archive 1

Why doesn't this work?

{{Hidden|Kennedys hut|{{Wikipedia:Featured picture candidates/Kennedys hut}}}}

-->

{{Hidden|Kennedys hut|{{Wikipedia:Featured picture candidates/Kennedys hut}}}}

Please advise. :( pfctdayelise (translate?) 23:35, 1 April 2006 (UTC)

I don't know. However, if I understand what you're trying to do correctly, it can be made to work by using a numbered parameter, like this:
{{Hidden|Kennedys hut|2={{Wikipedia:Featured picture candidates/Kennedys hut}}}}
yields

{{Hidden|Kennedys hut|2={{Wikipedia:Featured picture candidates/Kennedys hut}}}}

Help:Template says that a parameter cannot contain }} so in particular templates cannot be nested. But this is apparently not the whole story. Is the work-around good enough for your purposes? I'm not sure it works in all cases. -- Jitse Niesen (talk) 06:12, 27 April 2006 (UTC)
Man, so easy to fix, thankyou! It's pretty much exactly what I want to do. I'll test it out and see how it goes. Thanks! pfctdayelise (translate?) 07:25, 27 April 2006 (UTC)

Expand all for printable pages

Is there a way to expand all hidden text for printable pages, but hide them all for regular pages? -- Sy / (talk) 01:32, 10 May 2006 (UTC)

Practical interference on AfD pages

This template is not working correctly on AfD nominated pages and its intrusiveness literally affects the outcome. I have brought this up with the {{afd1}} group, but they appear not to have the bug. If this could be made to work universally on all mediawiki skins it would be great, but until then could there be a note somewhere that it doesn't work currently and to restrict usage to non-essential purposes. Thanks, Ansell 02:40, 2 June 2006 (UTC)

JavaScript

How was JavaScript added to a Wikipedia template? I looked at the source code, but couldn't find any JS code. I would love to create scripted templates like that! Please explain!

FLaRN2005 (talk) 17:17, 21 August 2006 (UTC)

JavaScript cannot be added to a template. The JS code for this template is in MediaWiki:Monobook.js, whose contents are added to every web page (if the Monobook skin is used). See Help:User style for some more explanations. -- Jitse Niesen (talk) 05:26, 22 August 2006 (UTC)

Limitations

Note that this template, 'hidden begin', and the 'NavFrame' methodology in general do not work in all Wikipedia 'skins', for users with non-CSS browsers browsers and screen readers, or on mirrors and foreign language versions which have not copied the MediaWiki:Monobook.css classes. In all such cases the user sees the full output all the time with no 'show/hide' feature. --CBDunkerson 11:22, 27 April 2006 (UTC)

Oh, is that the problem? I will edit Cologne Blue to fix this. Ashibaka tock 22:51, 4 May 2006 (UTC)
I can't get it to work... Ashibaka tock 22:58, 4 May 2006 (UTC)
You need relevant js from MediaWiki:Monobook.js also. AzaToth 05:24, 5 May 2006 (UTC)
Okay, currently MediaWiki:Cologneblue.js isn't actually loaded anywhere, but I added it to User:Ashibaka/cologneblue.js. Ashibaka tock 14:59, 5 May 2006 (UTC)
I got it working on a custom skin by adding this line to Skin.php in method getHeadScripts under the $r= line that looks just like it and before the if statement:
$r .= "<script type=\"{$wgJsMimeType}\" src=\"/index.php?title=MediaWiki:DSS.js\"></script>\n";
DSS is the name of my skin and i inserted the jscript into MediaWiki:DSS.js. There is probably a more elegant way. Let me know if this doesn't work, i wrestled for a while and wasn't controlling variables so there may be some other edit i made somewhere else that enabled it. Oh, that just covers the js side of the template, the css i just appended to the end of my skin's copy of main.css. Thanks a lot Gro.ikiwaidem 22:55, 3 November 2006 (UTC)

Bug?

Did this template just stop working for everyone? Because none of them work for me on any browser whether I'm logged in or not. I noticed that MediaWiki:Monobook.js just got moved to MediaWiki:Common.js[1]. Does something there need to get fixed? Koweja 23:21, 21 November 2006 (UTC)

Nevermind, it's working now. Koweja 00:55, 22 November 2006 (UTC)

Accessibility fix

Can someone modify the template so it provides a direct link to the page? That way if the show button doesn't work (because the page doesn't load properly or the user doesn't have javascript enabled) they can still see the page? Koweja 02:02, 23 November 2006 (UTC)

Style questions

The designer in me must ask: What is the purpose of this hide/show mechanism? What kind of content should be used for this? What problem does it solve and is it the best solution to that problem? hateless 20:10, 19 January 2007 (UTC)

Spoilers

Something with this functionality could be used for Wikipedia:Spoilers. --84.20.17.84 10:12, 22 January 2007 (UTC)

Displaying "hide" when the content is hidden

Why does this template display hide when the content is hidden? This is only when I open the template page, after clicking "hide" it starts to behave normally. --Eleassar my talk 13:02, 18 January 2007 (UTC)

Because, technically, it's fucked up.  :) It has to do with a variable setting in MediaWiki:Common.js. The bug only appears if there are 2 or fewer NavFrames on a page. I am attempting a fix. BenB4 00:41, 23 July 2007 (UTC)

Bug

Every template that uses this one demonstrates not entirely correct behaviour. It shows "Hide" by default and when you click it nothing happens, but the button changes to "Show". When you click it the second time the hidden content finally shows up. Is there a way to fix it? This seems to be fairly recent change.  Grue  11:34, 17 May 2006 (UTC)

This problem was caused by my edit which inserted optional CSS styles to it. The Javascript apparently depends on a particular style, so that it assumed from the extra characters that the content was currently visible. Clicking the show/hide button the first time thus cleared the extra characters. I've reverted my changes; sorry for the long delay, but I was without Internet access for a while. // [admin] Pathoschild (talk/map) 15:28, 23 May 2006 (UTC)
Close, but it's a JavaScript variable problem. Currently the bug occurs if there are 1 or 2, but not more, NavFrames on a page. Working on it. BenB4 01:15, 23 July 2007 (UTC)

Bug fixed, can get rid of the nested navframe crap

{{editprotected}}

My bug fix was approved to Mediawiki:Common.js, so this page should be changed to:

<div class="NavFrame" style="border:none;"><div class="NavHead" 
style="font-weight:{{{fw1|bold}}}; background-color:{{{bg1|transparent}}}; 
text-align:{{{ta1|center}}}; {{{headercss|}}}">{{{header|{{{1}}}}}} </div>
<div class="NavContent" style="font-weight:{{{fw2|normal}}}; 
background-color:{{{bg2|transparent}}}; text-align:{{{ta2|left}}}; 
display:none; {{{contentcss|}}}">{{{content|{{{2}}}}}}</div></div><noinclude>
{{/doc}}
</noinclude>

Thank you. ←BenB4 10:27, 8 August 2007 (UTC)

  Done. Cheers. --MZMcBride 18:21, 8 August 2007 (UTC)

Transclusion of other templates

Is it possible to transclude other templates into the "content" section? If so, can somebody tell me how, because I've beem expirimenting all day with no success. MITB LS (t·c) 21:32, 29 August 2007 (UTC)

It can be done like this, {{Hidden|title|2={{template name}}}} Doctor Sunshine talk 16:52, 6 October 2007 (UTC)

I cannot see the "show" button

Take 2007 Writers Guild of America strike#Response for example. I run Internet Explorer 6 on Windows XP Professional. Thanks, –thedemonhog talkcontributions 05:01, 12 December 2007 (UTC)

Not rendering transcluded tables

When a transcluded page begins with a standard table, namely a page begins with "{|", that table's code is printed out instead of the actual table. When one adds some filler code in front of the transclusion it renders properly but I thought I'd mention it here. I'm not sure when this started happened but apparently the work around was not needed at some point. Here's a before and after (it's used at the bottom of the template under "statistics"). Thanks, Doctor Sunshine talk 16:52, 6 October 2007 (UTC)

Anyone knows how to get the trascluded tables displayed correctly? - Thanks. 12:58, Oct. 16, 2007User:Guoqian —Preceding unsigned comment added by 129.176.151.6 (talk) 17:59, 16 October 2007 (UTC)
It might have to do with the "|", which separates parameters in templates. Gimmetrow 01:21, 17 March 2008 (UTC)
When transcluding a template starting with a wikitable, a newline is added at the start. However, if the result is assigned to a named parameter the newline is stripped again.--Patrick (talk) 08:28, 17 March 2008 (UTC)

Can we have graceful degradation?

When JavaScript is disabled and CSS is enabled, the content of those boxes which are initially hidden remains inaccessible. I think this can be fixed by adding the "display: none" using JavaScript, instead of having it in the style attribute. Is this reasonable? --Cameltrader (talk) 23:01, 22 March 2008 (UTC)

Overcoming some limitations

abcdefgh
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
77
66
55
44
33
22
11
abcdefgh

Botvinnik-Yudovich, USSR Championship 1933

After sacrificing a piece to expose Black's King, Botvinnik played 1. Bh5+ and Yudovich resigned as mate is inevitable, e.g. 1. ... Kxh5; 2. Ng3+ followed by 3. Qe4+ Rf4; 4. Qxf4#.

I wanted to show chess diagrams with the continuation hidden, and I came up with an adaptation of Template:Hidden for the diagram's caption that did what I wanted and as a by-product fixed some limitations of Template:Hidden -

  • Uses multiple lines for header text that's wider than the available width, which in the example is the width of the diagram.
  • Avoids over-writing "show"/"hide" if the header text is long or right-aligned.

Sorry about the lurid colour scheme, I wanted to show as many options in use as possible. The code for the diagram's caption area uses Template:Hidden as follows:

{{Hidden|titlestyle = background-color: yellow; text-align: right; height:auto;|contentstyle = background-color: lime; 
|header=<p style="margin-right:5em; height=auto; 
background-color: cyan;">Botvinnik-Yudovich, USSR 
Championship 1933</p> 
|content=After [[sacrifice (chess)|sacrificing]] 
a piece to expose Black's King, Botvinnik played 
1. Bh5+ and Yudovich resigned as mate is inevitable, 
e.g. 1. ... Kxh5; 2. Ng3+ followed by 3. Qe4+ Rf4; 4. Qxf4#.
 
|fw1=normal
 
 
 
 }}

I think the remaining limitations are:

  • In this case the caption created by using Template:Hidden is a little further below the diagram than a plain text caption would be.
  • Template:Hidden's inability to default to show the content and display a "hide" link, which is apparently a limitation of the standard Javascript.

It's undesirable to require editors to code the additional HTML and CSS that this example uses. I could create a wrapper template that takes a plain text header and calls Template:Hidden with the specified text inserted into an HTML P tag, as in the example. Alternatively Template:Hidden could be made more generalised, which would mean adding some optional parameters and some conditional processing. Which approach do you prefer?Philcha (talk) 13:56, 16 June 2008 (UTC)

Accessibility

{{editprotected}} Please replace the page with the following:

<div class="NavFrame collapsed" style="border:none;"><div class="NavHead" 
style="font-weight:{{{fw1|bold}}}; background-color:{{{bg1|transparent}}}; 
text-align:{{{ta1|center}}}; {{{headercss|}}}">{{{header|{{{1}}}}}} </div>
<div class="NavContent" style="font-weight:{{{fw2|normal}}}; 
background-color:{{{bg2|transparent}}}; text-align:{{{ta2|left}}}; 
{{{contentcss|}}}"> {{{content|{{{2}}}}}}</div></div><noinclude>
{{documentation}}
</noinclude>

This allows those who have JavaScript disabled to see the contents of the box, while still collapsing it automatically. Thanks. —Ms2ger (talk) 19:37, 3 November 2008 (UTC)

Declining, as the description of the change does not seem to match the actual change. For example, it's getting rid of the category and some conditional "if" checks. There seem to have been some interim changes, so please re-check the code? Thanks, --Elonka 22:29, 4 November 2008 (UTC)
  Already done by User:Happy-melon. Thanks. —Ms2ger (talk) 14:21, 9 November 2008 (UTC)

Cannot handle external links

The markup

{{Hidden|titlestyle = background-color: #def3bd;|[http://www.chessgames.com/perl/chessgame?gid=1031833 Botvinnik-Yudovich, USSR Championship 1933]|After [[sacrifice (chess)|sacrificing]] a piece to expose Black's King, [http://www.chessgames.com/perl/chessgame?gid=1031833 Botvinnik played] 1. Bh5+ and Yudovich resigned as mate is inevitable, e.g. 1. ... Kxh5; 2. Ng3+ followed by 3. Qe4+ Rf4; 4. Qxf4#. }}

produces this:

{{{1}}}
{{{2}}}

{{ cite web}} works, but produces unwanted quotes round the title in both the caption and the hidden text:

"Botvinnik-Yudovich, USSR Championship 1933".
After sacrificing a piece to expose Black's King, "Botvinnik played". 1. Bh5+ and Yudovich resigned as mate is inevitable, e.g. 1. ... Kxh5; 2. Ng3+ followed by 3. Qe4+ Rf4; 4. Qxf4#.

Can you please make {{hidden}} handle simple external links (e.g. Botvinnik-Yudovich, USSR Championship 1933) correctly in both the caption and the hidden text. --Philcha (talk) 08:13, 2 January 2009 (UTC)

Yes we can:
{{Hidden|titlestyle = background-color: #def3bd;|<ins>header=</ins>[http://www.chessgames.com/perl/chessgame?gid=1031833 Botvinnik-Yudovich, USSR Championship 1933]|<ins>content=</ins>After [[sacrifice (chess)|sacrificing]] a piece to expose Black's King, [http://www.chessgames.com/perl/chessgame?gid=1031833 Botvinnik played] 1. Bh5+ and Yudovich resigned as mate is inevitable, e.g. 1. ... Kxh5; 2. Ng3+ followed by 3. Qe4+ Rf4; 4. Qxf4#. }}
Ms2ger (talk) 15:20, 18 January 2009 (UTC)

Styling

{{editprotected}}
I'd like to be able to style the whole box, as opposed to the header and content areas. To make this possible, please change this line:

<div class="NavFrame collapsed" style="border:none;">

to this:

<div class="NavFrame collapsed" style="border:none; {{{css|}}}">

I believe this is a trivial change. Thanks. —Ms2ger (talk) 15:26, 18 January 2009 (UTC)

Looks like a good change to me. Gary King (talk) 16:01, 18 January 2009 (UTC)
  Done — {{Nihiltres|talk|log}} 19:00, 18 January 2009 (UTC)

Question

Hello, I was wondering if it would be possible to tie several hidden templates together so that they open and close at the same time. For example, in the "men" and "women" tables here, would it be possible to make it so that all three hidden boxes in a row open at the same time? Thanks, Scorpion0422 21:32, 17 February 2009 (UTC)

No, I don't believe that's possible. Also, in the docs, it says right at the top: There is no facility for collapse all or reveal all. Gary King (talk) 21:51, 17 February 2009 (UTC)

Fixing automatic paragraph issue

{{editprotected}} Check out these two examples:

Separated into paragraphs, as expected
{{{1}}}

1 2

3
Not separated into paragraphs, but should be two paragraphs
{{{1}}}

1

2

Also,

Bullet does not work
{{{1}}}
  • Bullet

This fixes both problems by simply adding lines around the content. It doesn't actually change the spacing above or below the content, though. Also, see this. Gary King (talk) 09:00, 14 February 2009 (UTC)

There's a sandbox for this template. Please use it to propose changes. Your oldid removes {{documentation}} and such. --MZMcBride (talk) 08:29, 20 February 2009 (UTC)
[2] Gary King (talk) 18:33, 20 February 2009 (UTC)
Looks good to me.   Done. Martinmsgj 09:47, 25 February 2009 (UTC)

Within article text

I understand and endorse the use of this function in navigational templates, but why is it used in the body of articles? Increasingly, film and music articles are hiding awards and track listings under this template in the midst of article text. If scrolling lists

should never be used because of issues with readability, accessibility, printing, and site mirroring. Additionally, such lists may not display properly in all web browsers.

why does the same not apply to this template within the body of an article? Does it print and mirror correctly? It doesn't work in the printable version, for example, so why is text included in the body of an article if it can't be seen on the printable versions or mirrors? SandyGeorgia (Talk) 22:25, 22 August 2008 (UTC)

Note: {{hidden}} is currently used in 745 pages in the article namespace alone. --Lightsup55 ( T | C ) 22:54, 22 August 2008 (UTC)
Another note: {{hide}} (a redirect to Template:Hidden) is currently used in 0 pages in the article namespace alone. --Lightsup55 ( T | C ) 23:28, 22 August 2008 (UTC)
I'm not questioning use in article namespace alone, since hidden navigational templates at the bottom of an article make sense, per WP:LAYOUT. I'm asking about hiding content in the prose, in the middle of an article. That content won't be viewable in printable version or on mirrors, so why should it be there? SandyGeorgia (Talk) 23:44, 22 August 2008 (UTC)
Well yeah, YouTube doesn't use it directly because a screenshot of the website www.youtube.com is defined in the {{Infobox Dotcom company}} template, however Elizabeth A. Smart uses the {{hidden}} template directly to show the "abduction timeline" (a list that defines what happened and when). --Lightsup55 ( T | C ) 23:53, 22 August 2008 (UTC)
Right. Elizabeth Smart provides an example of the application I'm questioning; I don't believe we should have hidden text in the middle of an article. SandyGeorgia (Talk) 23:55, 22 August 2008 (UTC)
To take this from the top:
  • "not in all web browsers" is a red herring. Some browsers are known to implement CSS incorrectly. Since there are free web browsers, may based on the Gecko (engine), whose CSS support is good and whose download sizes are only about 5MB, it's reasonable to expect that users will use good browsers.
  • The printing issue can be resolved by fixing Wikipedia's CSS with a handful of statements in an @media block. The most foolproof may be to move the rules that hide content (those that contain display:none) to an @media screen blcok, so that text is only hidden when the page is displayed on a screen.
  • As for mirrors, it's their responsibility to use appropriate CSS, which is not difficult.
  • There may be an issue about screenreaders' rendering of text wrapped in a display:none block but, if so, that's a defect in the screen readers and should be fixed by the suppliers.
Elizabeth Smart is an interesting example. I'd prefer the article without the day-by-day itemisation of events, others might want it. How should that be handled? --Philcha (talk) 21:35, 6 January 2009 (UTC)

FYI, I raised the question in mid-June 2009 at the village pump [3] and it didn't catch on. I'll bring it up again in a few months, after our law topics have developed further and the need for this system becomes more apparent (unless some new technology miraculously solves the problem.) Agradman appreciates civility/makes occasional mistakes 19:04, 25 June 2009 (UTC)

I took a quick scan through this and see that one of the issues is with printing. This has been resolved: hidden boxes now expand when printing, unless they are classed as nonprintable, such as navboxes.

Show/hide functions in other wikipedias

I know I'm probably in the wrong section for this, but does anybody have any idea how to enable the show/hide function for Navboxes in another wikipedia. I'm currently an admin on the Manx language project and we've been trying for months to get the function to work but to no avail. If anyone could take a look at our .css and .js pages or give us some information on how to do it/who to contact about it, we would very much appreciate it. Regards, --MacTire02 (talk) 13:58, 11 February 2009 (UTC)

Did anything come of this? I am in the same boat --Boy.pockets (talk) 23:41, 30 July 2009 (UTC)

Default is SHOWN

The default on my local MediaWiki installation is to SHOW all text. Considering the comments above, this is pretty weird. Can anyone explain why this is happening? I've set up:

Any ideas? MediaWiki version: 1.13.2 --Robinson weijman (talk) 16:01, 26 February 2010 (UTC)

Cut a chart in two with SHOW part

Hi, I'd like to cut the Template:Yakuza 3 Completion chart in two. the first part of the chart should be shown COMPLETIOn + SUB-SCENARIO while PSN TROPHIES til bottom chart should be hidden with a SHOW button. i tried "{{Hidden|header=PSN TROPHIES|content=" with the ending "}}" coming later in the chart but it doesn't work. part is hidden but cannot be not displayed. any idea on how to solve this issue? thanks.Cliché Online (talk) 12:11, 3 March 2010 (UTC)

Box alignment

I've been fiddling with this:

{{Hidden|style = width: 14em;|titlestyle = font-weight:normal; background:#add8e6; text-align:left; 
|header= Abridged List of Birds
|css=margin-left:0; left-border:0;
|content=*[[Common Loon]] 
*[[Western Grebe]] 
*[[Blue-footed Booby]] 
*[[Brown Booby]]
* etc.}}

which produces:

I'd like to see the left side of the box flush with the left side the "page". I can't see any margin or border and yet the box is offset. I tried {{{css}}} with no success and I can't see where it might inherent the style from. Any ideas. I'm kind of a newbie at this sort of stuff. –droll [chat] 01:24, 1 July 2010 (UTC)

If you use FireFox, there is a plugin that will allow you to look at and fiddle with the attributes dynamically (as you see the web page). The plugin is called 'FireBug'. - sorry for not offering more specific help +( --Boy.pockets (talk) 04:44, 2 July 2010 (UTC)

Interwiki links:ru

Template:Hidden=ru:Шаблон:Скрытый (redirected ru:Шаблон:Hidden) Fractaler 15:22, 5 March 2011 (UTC)

Bold title

Is it possible to avoid the bold header, as in have a normal font style? McLerristarr | Mclay1 15:23, 25 May 2011 (UTC)

  • The example in the section above uses normal font weight. Also:
{{Hidden
|fw1=normal
|header=An example
|content=*some stuff 
*some more stuff }}
An example
  • some stuff
  • some more stuff

For other valid font weights see this. –droll [chat] 18:27, 25 May 2011 (UTC)

Thank you. I tried so many things but I didn't realise there was a separate "font-weight" thing. McLerristarr | Mclay1 12:31, 26 May 2011 (UTC)

Default to show

Can I set this up so it will default to showing, and then people can hide the text? (Like the TOC box) --michael180 21:58, 17 June 2006 (UTC)
Anyone? --michael180 15:15, 24 August 2006 (UTC)

Sorry to see no-one's ridden to the rescue, Michael; I don't know whether or not this is possible, but in lieu of anyone else responding, something that might be worth trying is to visit some of the pages using this template to see if/when/how they achieve a default setting of show. If you find one, please list it here!  Meanwhile, it'd be useful to know whether or not it's possible to set TOC contents to hidden...
Hope you find a result one way or another, David Kernow 19:00, 24 August 2006 (UTC)
Update: Take a look at {{Ukraine topics}}, which was displayed as shown when I arrived at Subdivisions of Ukraine. It uses an HTML-based method to implement show/hide which looks as if it can meet your case. Best wishes, David 20:42, 24 August 2006 (UTC)
Ah, I found what affected this behavior. In the wikibits javascript there is a statement which says that boxes should be auto hidden if there is more then 1 of these boxes. This number can be changed, if you happen to have access to the javascript file (so if you run your own wiki, you can change this). There seems to be no way to change this on a case by case basis. The {{Ukraine topics}} example was auto shown because it was by itself. However, go to a page where it was included with other show/hides (eg. the page Ukraine), the box will be automatically hidden along with the rest. I think we need a smart developer to let this show/hide thing be controlled on a case by case basis. I will ask at the Wikipedia:Village pump (technical) --michael180 23:30, 1 September 2006 (UTC)
Update: The following line added to User:USERNAME/monobook.js makes the boxes default to open, if there is less then 999 of them on that page. However, this only affects you, and does not control the boxes individually. --michael180 00:33, 2 September 2006 (UTC)
NavigationBarShowDefault = 999;
Thanks for the insights. "...a statement which says that boxes should be auto hidden if there is more then 1 of these boxes" seems somewhat arbitrary, but perhaps it's an emergent limitation of the system. The "999" setting seems like a workaround... Yours, David 03:07, 2 September 2006 (UTC)
Check Wikipedia:Village_pump_(technical)#Template:Hidden_-_Auto_Show.2FHide, User:CesarB came up with a fix and he will change the wiki js in a few days. Way to go, User:CesarB. --michael180 21:42, 2 September 2006 (UTC)
I managed to derive a workaround for the "default to show" issue. I set the NavFrame id to 'show' or 'hide' and have modified the javascript code to handle this just before the id is changed to "NavFrame" + indexNavigationBar.
My (modified) code for my own wiki (it ignores NavPic and uses left allowed arrows for expanding / contracting):
 /** Dynamic Navigation Bars (experimental) *************************************
  *
  *  Description: See http://en.wikipedia.org/wiki/Wikipedia:NavFrame
  */
 var strHide = '▼';
 var strShow = '►';
 
 function toggleNavigationBar(indexNavigationBar) {
   var NavToggle = document.getElementById('NavToggle' + indexNavigationBar);
   var NavFrame = document.getElementById('NavFrame' + indexNavigationBar);
   
   if (!NavFrame || !NavToggle) return false;
   
   for (var NavChild = NavFrame.firstChild; NavChild != null; NavChild = NavChild.nextSibling) {
     if (NavChild.className == 'NavContent') {
       NavChild.style.display = (NavChild.style.display=='none') ? 'block' : 'none';
     }
   }
   NavToggle.firstChild.data = (NavToggle.firstChild.data==strShow) ? strHide : strShow;
 }
 
 function createNavigationBarToggleButton() {
   var indexNavigationBar = 0;
   for(var i=0; NavFrame = document.getElementsByTagName('div')[i]; i++) {
     if (NavFrame.className == 'NavFrame') {
       indexNavigationBar++;
       
       var NavToggle = document.createElement('a');
       NavToggle.className = 'NavToggle';
       NavToggle.setAttribute('id', 'NavToggle' + indexNavigationBar);
       NavToggle.setAttribute('href', 'javascript:toggleNavigationBar(' + indexNavigationBar + ');');
       var NavToggleText = document.createTextNode(strHide);
       NavToggle.appendChild(NavToggleText);
       
       // Find the NavHead and attach the toggle link
       for(var j=0; j < NavFrame.childNodes.length; j++) {
         if (NavFrame.childNodes[j].className == 'NavHead') {
           NavFrame.childNodes[j].appendChild(NavToggle);
         }
       }
       switch (NavFrame.getAttribute('id')) {
         case 'hide':
           NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
           toggleNavigationBar(indexNavigationBar);
           break;
         default:
           NavFrame.setAttribute('id', 'NavFrame' + indexNavigationBar);
       }
     }
   }
 }
 
 addLoadEvent(createNavigationBarToggleButton);
And my NavFrames look like this:
 <div class="NavFrame" id="show"> /* or id="hide" */
 <div class="NavHead">Header goes here</div>
 <div class="NavContent">
 Content goes here
 </div>
 </div>
--210.23.133.248 02:07, 10 January 2007 (UTC)
You might want to use collapsible tables, they can be nitially expanded or initially collapsed. Maybe a look at Wikipedia:NavFrame will be usefull too? --Rougieux (talk) 11:05, 19 January 2012 (UTC)
I have made an edit request to add an 'expanded=yes' option, which matches template:hidden begin. Frietjes (talk) 18:50, 19 January 2012 (UTC)

Default to expanded

I want to use the hide/expand function in a template, but I don't know how to default it so the template is expanded, and it shows the "hide" button when you first go to it. Uh, how do you do that? VolatileChemical (talk) 03:43, 14 June 2008 (UTC)

I have made an edit request to add 'expanded=yes' to this template, which matches template:hidden begin. Frietjes (talk) 18:58, 19 January 2012 (UTC)

Impossible to port template between wikis

I've been trying to figure out how to copy this template from here to wmuk:Template:Hidden, but haven't managed to figure it out. Can anyone help, please? Thanks. Mike Peel (talk) 04:27, 3 August 2012 (UTC)

You probably need to extract the sections from MediaWiki:Common.js which mention NavFrame. -- WOSlinker (talk) 08:34, 3 August 2012 (UTC)
Thanks for the reply, but I'm not sure that's it - wmuk:MediaWiki:Common.js already has all of the relevant JS (and then some). Perhaps it's a problem with wmuk:MediaWiki:Common.css, but I can't spot anything wrong... Thanks. Mike Peel (talk) 06:13, 5 August 2012 (UTC)

Usage this template on wiki-site.com

I tried to use this template on wiki-site.com, but I failed. This template is identified as unknown template. What can I do? NAME XXX (talk) 20:06, 6 October 2013 (UTC).

refactored to use hidden begin/hidden end

I just rewrote this to use {{hidden begin}}/{{hidden end}} which will help keep the functionality of the two in sync. please let me know if there is a problem. Frietjes (talk) 23:19, 22 December 2014 (UTC)

Multiline titles

I just added |multiline=y for multiple line titles. it should have no impact on existing transclusions, but helps when the title takes up more than one line. Frietjes (talk) 00:21, 23 December 2014 (UTC)

Excision discography

How do I uncollapse all of the tables at Excision discography#Mixes. --Jax 0677 (talk) 22:33, 1 January 2016 (UTC)

Hiding Sortable Tables

Hello all!

I was wondering if you could help me out ... I've been staring at this problem for a while now and can't seem to work out what I'm doing wrong. I'm trying to hide a sortable table ... can it even be done? Here's my code and what I'm getting;

{{hidden|Hide My Sortable Table|{|class="wikitable sortable" style="text-align:center;" !One!!Two!!Three |- |001||002||<span style="display:none">001c</span> |}}}

Hide My Sortable Table
{

}

Thanks for your help and advice! --LookingYourBest (talk) 15:15, 12 April 2009 (UTC)

Title
Table
See my example above, which is how you create a table inside a template. However, the way the code is parsed, it seems that the table code is forced outside of the hidden div anyways. Gary King (talk) 18:09, 12 April 2009 (UTC)
? Example now always shows me 'Table' even when hidden. (Hide/Show does toggle. Am using Firefox 43.0.3) . - Rod57 (talk) 05:25, 6 January 2016 (UTC)

Use for track listings in infobox song

@Frietjes: I see that {{Astral Weeks track listing}} was created to add track listings to the infoboxes for songs from the album. It is more convenient than adding {{hidden}} and listing the tracks for each song. The point was made during a recent TfD (that you participated in) that templates such as this with little use (10–20 articles) should not be allowed. Is there anything to this view (and aside from the collapsed and trivia arguments)? Documentation for the merged infobox song/single is being developed and it would be helpful to know if adding {{hidden}} and listing the tracks for each song (such as in "Spirit of the Season") should be presented as an option. —Ojorojo (talk) 22:01, 18 May 2017 (UTC)

Ojorojo, who, other than you said that templates such as this with little use (10–20 articles) should not be allowed in the TfD? I have no idea what changes, if any, you are asking to have made to template:hidden. if this discussion is not about changes to template:hidden, then this is the wrong venue. Frietjes (talk) 12:16, 19 May 2017 (UTC)
@Frietjes: There is a misunderstanding. That point was made by two other editors; I did not say or imply this at all. I am not pushing for one use or the other, just seeking clarification about the proper use(s). I am not asking for any changes to this template, but this talk page is appropriate for questions about using the template. —Ojorojo (talk) 14:31, 19 May 2017 (UTC)
Ojorojo, see here. I see no other editors equating "little use" to "10 to 20". the thread was already started at Template talk:Infobox song (as you have already noted), this thread will go nowhere. Frietjes (talk) 14:40, 19 May 2017 (UTC)
@Frietjes: You're misreading my comment. I listed three of the arguments that were used in the TfD for possible future discussion – they are presented as questions and not statements of fact or my preference. SMcCandlish wrote: "We cannot have one template for this stuff per album or band, or we'd have thousands upon thousands of redundant templates" and "The key point for TfD is that no template is needed for something like this; it has few uses, won't have an expanding set of them, and the same content can be put into a stock template; and we don't want 1,000 such templates for various albums, artists, etc." Gonejackal made a similar point. This is not my view and I'm not trying to push anything. Again, I am simply seeking clarification regarding this template's use. It seems odd that no one is willing to address this. —Ojorojo (talk) 14:56, 19 May 2017 (UTC)
@Ojorojo: I personally think they should be replaced with navboxes whenever possible (i.e. if a navbox exists), but there don't appear to be appropriate navboxes for the 180 or so extant track listing templates. Jc86035 (talk) Use {{re|Jc86035}}
to reply to me
15:40, 19 May 2017 (UTC)
@Jc86035: A problem with album navboxes is that if they contain any unlinked songs, these often are removed or the navbox deleted (the idea being that a navbox is solely for navigation and not a track listing per se). I'm continuing this discussion at Template talk:Infobox song#… and a bugbear: partial track listing. —Ojorojo (talk) 15:51, 19 May 2017 (UTC)

Edit request on 19 January 2012

Please make this change to the template, which will allow for it to be expanded by default, if 'expanded=yes' is set. This matches the more fully featured {{hidden begin}} template. I plan to suggest more small feature tweaks to match that template later. thank you. Frietjes (talk) 18:48, 19 January 2012 (UTC)

Done. Let me know if I broke anything. ;) Killiondude (talk) 05:56, 21 January 2012 (UTC)
no nothing broke, it looks great. I will update the documentation. thank you. Frietjes (talk) 17:20, 21 January 2012 (UTC)
(2016) Template doc (4 lines down) says "The template does not provide an argument to designate the initial state of the show/hide control." which now seems misleading since there is |expanded= . ... or is 'control' referring to just the show/hide switch. Sh/Could doc be changed to add "although the initial display state of the template can be controlled (with |expanded= )" ? - Rod57 (talk) 05:34, 6 January 2016 (UTC)
(2018) Two years later and I'm seeing the same issue. The current text is: The template does not provide a parameter to designate whether the link starts at a show or hide state. If this template is nested in another, the show/hide links in the hidden content keep their state; there is no parameter for collapse all or reveal all.
If this is not accurate, the instructions should be changed.
While I'm talking about the instructions, according to them this template should never be used in the main namespace due to accessibility reasons. If that is the case this template needs to be removed from a LOT of pages... - PaulT+/C 15:49, 31 March 2018 (UTC)

Documentation conflicts with MOS guideline

The third paragraph of the documentation includes: "Do not use this template to hide content in articles. This violates the WP:Manual of Style § Scrolling lists and collapsible content and WP:Accessibility guidelines. This template is intended for use in pages in namespaces other than the article namespace." However, the linked MOS section specifically allows for certain uses:

Collapsed or auto-collapsing cells or sections may be used with tables if it simply repeats information covered in the main text (or is purely supplementary, e.g. several past years of statistics in collapsed tables for comparison with a table of uncollapsed current stats). Auto-collapsing is often a feature of navboxes. A few infoboxes also use pre-collapsed sections for infrequently accessed details.

Propose to change the third paragraph to: "Generally, collapsible templates should not be used in articles. For allowable uses and other considerations, please see MOS:COLLAPSE." If no one objects, I'll make the change.
Ojorojo (talk) 14:11, 18 August 2019 (UTC)

Can't see any problem with that. While we don't want to encourage the practice, the message here should be consistent with the MOS guideline. JG66 (talk) 13:39, 21 August 2019 (UTC)
The documentation in question was likely not a careless addition. It would probably be best to invite comment from SMcCandlish, who added the first two sentences, and Geekdiva, who added the third; both of these users remain active editors. LifeofTau 10:09, 22 August 2019 (UTC)

Hidden content on mobile pages

Hello,

The template works fine when I read pages, like riboswitch and Alexander the Great, with a desktop computer or a laptop, but the content is hidden on a smartphone or an iPad (when browsing the mobile adress, en.m.wikipedia.org).

Cantons-de-l'Est (talk) 01:38, 14 January 2020 (UTC)

@Cantons-de-l'Est: This template isn't being used in riboswitch (if you check the code, it's using {{navbox}} but someone had incorrectly set the VTE links). As for Alexander the Great, the problem is with Template:Ancient Egyptian royal titulary case which uses {{sidebar}}. Both {{navbox}} and {{sidebar}} are not visible on mobile. Thanks! Plastikspork ―Œ(talk) 14:15, 16 March 2021 (UTC)

How to hide text in an edit, rather than delete it?

I'm working on Mark Z. Jacobson. I considered deleting the lengthy article listing, but decided to use this template. Is there a better way to make "invisible" the excessive listing in case my edit is inappropriate? I know one could undo it, but I'm trying to be more diplomatic. Thank you. Trilotat (talk) 16:21, 16 February 2021 (UTC)

The standard way to "comment out" text is to use HTML comments (<!-- and -->). Other methods include using Template:^ which redirects to Template:Void. If text really doesn't need to be in the article, then the best thing to do is remove it. Thanks! Plastikspork ―Œ(talk) 14:17, 16 March 2021 (UTC)

Verbose instructions

Per this discussion the "collapsible section" template is being merged here. The main difference between these two templates is that "collapsible section" has a verbose usage note that is turned on by default, while this template has no verbose usage note. Are there any opinions on adding this as an option to this template? I have put a version in the sandbox that uses |verbose=y to turn on the verbose usage note if anyone wants to see what this would look like. Thanks! Plastikspork ―Œ(talk) 14:31, 16 March 2021 (UTC)