Wikipedia talk:NavFrame
From Wikipedia, the free encyclopedia
[edit] Previously unsectioned comments
I found an example of a use of NafFrame which was apparently copied from another example, and was apparently messed right up. It used three layers of nested divs where only one was needed. I spent 45 minutes looking for docs, and although this was used in dozens of pages and templates, I could not find any docs.
So I started this page. Pleas fill in the copious blanks. —Michael Z. 2006-10-31 05:44 Z
- If there are more than 3 instances of the <div class="NavContent"> on a page then they will all automatically hide themselves. Have a look at MediaWiki:Common.js and find the variable called
NavigationBarShowDefault
. It is set to 3. Some people put 3 instances of <div class="NavContent"> on a page to force the content to be hidden. --Squilibob 10:02, 21 December 2006 (UTC)
[edit] Tabs
NavFrame is not bad, but what I want to see is an implementation of a tabbed interface. With multiple NavFrame elements in a row, I'd like to see all of the headings in one line as tabs, and clicking them shuffles between multiple virtual cards. Can this be done in Wikipedia? —Michael Z. 2006-10-31 05:49 Z
- Yes, it already is done in Wikipedia! ...Well, not so much Wikipedia, but MediaWiki — on the user preferences page using Monobook.css. It accomplished through some kind of JavaScript display trick with the form fieldsets. I have no idea how to apply the style into wiki content, but you're welcome to give it a shot. —Down10 TACO 09:06, 13 January 2007 (UTC)
[edit] table-based version
I've designed a similar solution based on tables. It should be slightly more robust and cause less accessibility issues (and separated the show/hide fucntionality from the navigation box layout at the same time). I'll try to document it here as well. —Ruud 12:44, 1 November 2006 (UTC)
[edit] Display issues in Classic skin
There's a minor problem with the javascript, but I don't know how to deal with. In the monobook skin, the [show]/[hide] button is successfully rendered on the right side of the header, in non-bold text. In the classic skin, there is no space between the button and the header text, and the button is bold if the header is bold. I would fix it, by my javascript skills are inadequte for the task of figuring out what's wrong. Karl Dickman talk 17:36, 28 November 2006 (UTC)
- Fixed by moving CSS code to MediaWiki:Common.css. Karl Dickman talk 09:43, 5 December 2006 (UTC)
[edit] Category:List templates: "hide" instead of "show"
Why does the template {{template category}} display "hide" instead of "show" (while the content is hidden) when the category page is opened? --Eleassar my talk 12:56, 18 January 2007 (UTC)
- Yes, this also seems to happen elsewhere; I'll try to remember to post some links here as/when I come by it again. I suspect it's a bug somewhere...? Regards, David Kernow (talk) 10:51, 25 January 2007 (UTC)
[edit] [hide]/[show] link on the left...?
Is it possible to instruct NavFrame to place the [hide]/[show] link on the left-hand side of the page,
e.g. (if using {{hidden begin}} and {{hidden end}}):
...? Thanks for any help, David Kernow (talk) 10:51, 25 January 2007 (UTC)
- I've made a hack that's achieved this but it very depend on the current code. --Dispenser 07:59, 10 February 2007 (UTC)
[edit] NavContent on span instead of div‽
What needs to be done so that the hiding will work if a SPAN is used instead of a DIV for the inner section? I have an application where I need a subset of the items (which is a run-on list of words) to be visible at all times. Some of them remain outside the NavContent element—basically the section is only semi-collapsed, which is exactly what I need. This "works" when DIVs are used, except that DIV is a block element, so when they are all visible there is a line break that I don't want which breaks up my run-on list. ⇔ ChristTrekker 19:03, 7 February 2007 (UTC)
- I suspect the answer may be "Sorry, you need to use a div for the HTML to work", but in lieu of any HTML experts passing by, is there a link to follow to the situation you describe...? Regards, David Kernow (talk) 01:36, 8 February 2007 (UTC)
- I'm thinking a small hack needs to be made to the JavaScript. MJtemplate is my WIP - original I'm trying to improve on top, my experiment underneath. ⇔ ChristTrekker 16:50, 8 February 2007 (UTC)
- You could try setting the
display:
CSS value to eitherinline-block
orinline
; however, this will likely break the functionality that you wanted. --Dispenser 07:56, 10 February 2007 (UTC)- Both of them looked/functioned identically to the original—no change at all. At least in Firefox, which has good CSS support, so I'm actually a bit surprised. ⇔ ChristTrekker 05:22, 13 February 2007 (UTC)
- I played around with the navframe code back in July to create inline expansion using span elements and
inline
Divs seem to have linebreaks built-in. It even supported alternate texts for hide/show with thetitle
attribute. Couldn't get anyone to test or implement it though. Gimmetrow 22:49, 24 February 2007 (UTC)
- I played around with the navframe code back in July to create inline expansion using span elements and
- Both of them looked/functioned identically to the original—no change at all. At least in Firefox, which has good CSS support, so I'm actually a bit surprised. ⇔ ChristTrekker 05:22, 13 February 2007 (UTC)
[edit] Printable version
Pages that use NavFrames hide content when the page is printed out. Pages or templates using NavFrame should have functionality built into them so that when the user is viewing the printable version of the page the NavFrame is automatically expanded. ~MDD4696 14:33, 16 February 2007 (UTC)
- Should be doable: NavFrame should be modified to use CSS classes to show and hide stuff (instead of directly setting the display property to inline or hidden) and those classes need to be added to common.js to correctly show and hide stuff in webbrowsers, but always show the contents when printed. I'll try to code something similar for the collapsible tables (which should also work correctly in combination with the navbox class, which should always hides the table when printed.) I refuse to work on the currently undocumented, unmaintained and unstable implementation of NavFrame (but might rewrite it from scratch in the future.) —Ruud 15:04, 16 February 2007 (UTC)
- That would be great. I'd try to unravel it myself but don't have the time. ⇔ ChristTrekker 16:13, 19 February 2007 (UTC)
- Suggest that if/when this issue addressed, the printable version mimics the state of each NavFrame on the page rather than automatically expanding all. Regards, David Kernow (talk) 16:17, 16 February 2007 (UTC)
- It's (obviously, I hope) quite hard to expand such frames after being printed so I don't beleive this is a good idea. NavFrame is abused in several places to hide portions of text (not just navigations boxes, actual paragraphs or sections of the article) and those should really be expanded when printed. On the other hand we have the navigational boxes which have absolutely no use on a printed version (paper not supporting hyperlinks and such) and should therefore not even leave a header of a collapsed box behind. —Ruud 18:03, 16 February 2007 (UTC)
[edit] Won't Hide to Start
I've been having some difficulty with this code here, whenever I enter it to my homepage (which is where I want it), it doesn't automatically hide the template I've put in - unless I say style="display:none" in the navcontent - but then the hide/show starts out as hide even though the content is hidden. Any ideas?
<div class="NavFrame">
<div class="NavHead">User Talk Templates</div>
<div class="NavContent">
{{User:Pilotguy/Warnings}} </div> </div>
Thanks for any help you guys can give (oh and note: if I use {{Hidden}} and say 2={{User:Pilotguy/Warnings}} for the second parameter - it works, strangeness.Daniel()Folsom T|C|U 21:22, 19 February 2007 (UTC)
[edit] Wrapping NavFrame around existing content
Hi! I just wrote some javascript to remove some, er, clutter from wikipages (if you've edited more than a few pages, the copywrite warnings are a little redundant). Source is in User:Saintrain/J/deSpamWiki.js. Among the functions, it will put the edit-page "special characters" text block into a collapsed NavFrame. This releases a lot of real estate.
The essence:
- look for the <div ... class="editpage-specialchars"> ... </div>
- create the NavFrame divs
- re-parent the "editpage" div as the NavContent div
- call toggleNavigationBar to collapse it.
So, to all of you who thought of NavFrame and implemented and documented it, Thanks!!! --Saintrain 01:44, 19 March 2007 (UTC)
P.s. and Thanks!!! to Firebug for helping me id the blocks (and maybe find a typo or two).
[edit] On another wiki
If I wanted this on another wiki, what would I have to copy? The stuff from Common.css and Common.js?--Richard (Talk - Contribs) 22:12, 20 May 2007 (UTC)
[edit] Keeping table width
How do you keep the table the same width when it is closed? I'm trying to replicate collapsible tables in another wikipedia, and they become narrower when the content is set to display:none (because the width is then determined by the width od the text in the first row only). This doesn't happen with the examples here, even though the code seems to be the same. Is there some trick to it? --Tgr 22:19, 20 May 2007 (UTC)
[edit] collapsable + sortable table?
Is it possible to get a collapsable and sortable table? ∞ΣɛÞ² (τ|c) 12:34, 26 May 2007 (UTC)
- See the new section Wikipedia:NavFrame#Sortable_collapsible_tables .--Patrick 08:12, 28 May 2007 (UTC)
[edit] Table of content
- If sections are hidden inside NavFrames, is it possible to make the associated link in the TOC functional?user:hillgentleman|user talk:hillgentleman|Sat, 26 May 2007 14:25:36 +14:25 14:25, 26 May 2007 (UTC)
[edit] How to install
This may be obvious to some, but others seem to find this NavFrames feature difficult to enable on their own wiki:
- View the source for MediaWiki:Common.js copy and past it's contents into the MediaWiki:Common.js article at your wiki.
- View the source for MediaWiki:Common.css copy and past it's contents into the MediaWiki:Common.css article at your wiki.
Note that only some portion of these articles is required for NavFrames and Sortable tables, though I'm not sure which parts, perhaps someone else can clarify which are required.
Note that the MediaWiki media player portion of these Common files will call some http .js code. This will cause some browsers to report an https/http SSL mismatch error as some of the content is not encrypted. If your site is running SSL you may want to remove or comment out this section of both articles to prevent this error.
--D0li0 00:36, 7 July 2007 (UTC)
- I need to know which specific parts are required because I thought I copied all relevant parts but I don't get the [show]/[hide] controls. :( --Gamer Eek 07:09, 22 August 2007 (UTC)
-
- Javascript error: "hasClass is not defined" in MediaWiki:Common.js on line 48:
function createCollapseButtons() { var tableIndex = 0; var NavigationBoxes = new Object(); var Tables = document.getElementsByTagName( "table" ); for ( var i = 0; i < Tables.length; i++ ) { if ( hasClass( Tables[i], "collapsible" ) ) { NavigationBoxes[ tableIndex ] = Tables[i]; Tables[i].setAttribute( "id", "collapsibleTable" + tableIndex );
-
- --Gamer Eek 03:23, 23 August 2007 (UTC)
-
-
- OK, turns out it was becuase I didn't have this variable defined in my MediaWiki:Common.js file:
-
/* Test if an element has a certain class ************************************** * * Description: Uses regular expressions and caching for better performance. * Maintainers: [[User:Mike Dillon]], [[User:R. Koot]], [[User:SG]] */ var hasClass = (function () { var reCache = {}; return function (element, className) { return (reCache[className] ? reCache[className] : (reCache[className] = new RegExp("(?:\\s|^)" + className + "(?:\\s|$)"))).test(element.className); }; })();
-
-
- --Gamer Eek 03:31, 23 August 2007 (UTC)
-
- I was able to get m:Help:Collapsing work in tables adding the "Collapsible tables" section from m:MediaWiki:Common.js into my skins/common/wikibits.js --Subfader (talk) 22:16, 27 March 2008 (UTC)
[edit] NavContent introduction improved
I elaborated the introductory comments on NavContent divs for the benefit of beginning coders. --Brad 12:16, 29 August 2007 (UTC)
[edit] Hide tags doubled up
For some reason on my Wiki it displays two [hide] links on the left hand side (rather than the right, which is where I thought it defaulted to), one of which hides, the other of which acts like a show, but then tries to hide. The table in question is supposed to be autocollapsed by default, but it never seems to be. Looking at the table code, the syntax seems to match the examples given, but I'm not sure why it's not working. Any ideas? --TheSweet 04:44, 4 September 2007 (UTC)
- Same with me. My wiki is in XML (perhaps it is related?). Any solution? SSPecter Talk|E-Mail ◆ 00:05, 7 April 2008 (UTC).
[edit] For dl element
Current NavFrame supports it only in a div element. I want the form that supported this in a dl, dt and dd element to do it. Because there is an undesirable case in semantic markup. --kahusi (Talk) 08:06, 3 November 2007 (UTC)
[edit] Problem with collapse
Can't get it to function around Levine2112 signature.[3] Thanks for any help you could give me. Anthon01 (talk) 22:12, 28 February 2008 (UTC)
His signature is here Levine2112 discuss Anthon01 (talk) 22:30, 28 February 2008 (UTC)
- I just compared the signature (as my browser sees it) here, where Anth copied it, and at L's talk. They are identical; however, at the talk page, the box with the word "discuss" does not link to L's talk, while here it does. I'm mystified. Pete St.John (talk) 17:08, 29 February 2008 (UTC)
- --- because the parser doesn't follow links to his talk page, from his talk page. D'uh. Thanks L. Pete St.John (talk) 18:30, 29 February 2008 (UTC)
[edit] Printable version revisited
There was a discussion of this above as I can see, but no apparently resolution. I would like to know if printing support is enabled for NavFrames, with all NavFrames expanded on printing. We are looking to incorporate this in an infobox through {{collapsible list}} but want to make sure that the info in the box is available when printed as it is info usually not fully duplicated in the text. --MASEM 19:42, 23 May 2008 (UTC)
[edit] Show/Hide links not showing on opera 9.27
At the moment, in Opera 9.27, the show/hide links are not visible. Tested on both, Windows and Linux. Is there a playe where this should be reported? ~ | twsx | talkcont | ~ 10:34, 31 May 2008 (UTC)
- They seem to be visible for me on Opera 9.27 on Windows Vista. Is there any specific template or page where they are not working for you? --CapitalR (talk) 16:16, 31 May 2008 (UTC)
They are globally not working for me, however, i noticed something interesting: They are only not working if i am logged in. If i log out, all is fine. Now, i remembered that i have played around a little with the Gadgets in the preferences dialog. It seems that the Twinkle Gadged will mess up those boxes for you. Should i report this to bugzilla? ~ | twsx | talkcont | ~ 11:11, 7 June 2008 (UTC)
[edit] Make Entire Title Bar the Show/Hide Link
Has anyone attempted to make the entire Title bar the link to Show/Hide or is this not possible? What I mean is, instead of the [Show]/[Hide] button, make the entire bar that holds each table title the link so that other users can click anywhere in the Title Bar to either show and hide. --Thanks --{~~Phaydn~~} (TaLk) 19:28, 3 June 2008 (UTC)