វិគីភីឌា:Reference desk/header
Welcome to the Reference Desk Header
This page must be transcluded with a desk ID for an argument.
Please use this page to view with example options.
(direct link to this documentation)
This header was designed by User:Froth to replace the old horizontal navigation bar, which I partially rewrote (1, 2) to replace an even earlier bar. Credit must also go to User:Freshgavin for his inspirational layout concept, as well as of course all the RD editors who tiptoed through minefields to summarize this beast for the left column information.
There's a big page describing the initial design process and somewhat documenting the early pages here. You can see the beginnings of the color collaboration, as well as several neat features that were regrettably thrown out, like the ToC running next to the text. Around this time, the main WP:RD page was overhauled to about its current look.
Every configuration variable that is used by header is used in the RD configuration file, so consider that a specification. However there is at this time one header parameter that is implemented in header but must be passed as an parameter: it is possible to specify a non-standard shortcut link to appear in the upper right. Currently the header identifies the desk by the parameter passed to it and looks up configuration information in the config array when needed. Calling it without an argument gives the default configuration, which isn't suitable for live use.
A great deal of the header's complexity goes into making the coloring customizable. In this spirit, and per User:VectorPotential's suggestions, the colors can be configured individually for each reference desk. This used to be done on separate configuration subpages so external pages can have their own subpage for settings. However in the interest of sanity, and of pushing the limit of the pre-expand parser size (not really, we're almost an order of magnitude away, even on misc), I've combined them all into one big configuration page.
This is called from within the header through the Template:Rdconfigarray interface. This is to streamline the header code, and to keep code out of the configuration file. If you need to use the header from an external page, you must add that page's alt shortcut to the external configuration file here and give it configuration settings. Then when you call header pass it two parameters: the alt shortcut, and the word external. The alt shortcut is not optional if you want your external page to have a unique configuration. So for example call it as {{/header|User:Froth|external}}. Then add User:Froth as a case in the main externopts switch statement. It's still possible to have an external page with just an alt shortcut but no external configuration (or a null alt shortcut)- in that case it'll automatically take the default configuration. The desk links are hard coded as "internal" so it's impossible to mess with the rainbow tabs.. this is because that is actually built out of the internal deskopts configuration file. There's currently no way to disentangle the reference desks from whatever external page you want the header styled for (you can't change the nav links to something other than the desks for only external-flagged header transclusions) though admittedly it wouldn't be difficult. The point of the "external" parameter is only to allow the header to be transcluded for (and styled for) any number of pages without affecting main reference desk performance. There's no difference between external and internal pages; if you can't do it with normal header styling then external won't help you. However, external may be useful in the future because that parameter is propagated through every styled subpage used by the header.
If you're writing a userscript to run on the reference desk, you can take advantage of this customizability. Include the following code in your script:
var rdcolors = new Array(); for (i=0;i<13;i++) rdcolors[i] = document.getElementById("refcolor" + i).innerHTML;
Now the array rdcolors contains all of the color information for the page it was called on. This works across differently colored desks- rdcolors will always contain the colors for the specific desk you're on. Simply plug in an index from rdcolors whenever you need a color for a border or a background or a highlight or anything.. try to match it up with how the colors are designed for the desk, for maximum visual compatibility.
rdcolors[0] => headingbg rdcolors[1] => mainbg rdcolors[2] => highlightbg rdcolors[3] => headborder rdcolors[4] => mainborder rdcolors[5] => highlightborder rdcolors[6] => navlinks rdcolors[7] => dottedlines rdcolors[8] => headertext rdcolors[9] => highlightlink rdcolors[10] => fullname rdcolors[11] => navname rdcolors[12] => exactname
Additionally, document.getElementById("refaltshortcut").innerHTML will evaluate as the alternate shortcut mentioned above, and document.getElementById("spplaceholder").innerHTML will evaluate as the value of {{SUBPAGENAME}}.
Feel free to modify the header but please:
- Keep the code consistent
- Keep a sharp eye out for accidental 1 pixel shifts and things
- Don't change colors without consensus at color collab
Here's a list of the header code pages in tree format.
- វិគីភីឌា:Reference desk/header
And a list of helper templates
- វិគីភីឌា:Reference desk/header/nav/aux
- វិគីភីឌា:Reference desk/header/heading
- Template:rdconfigarray
And some pages that used to serve a useful purpose but are no longer transcluded:
- វិគីភីឌា:Reference desk/headercfg
- វិគីភីឌា:Reference desk/header/toc
- វិគីភីឌា:Reference desk/header/giveback
- វិគីភីឌា:Reference desk/header/deskopts/Computing
- វិគីភីឌា:Reference desk/header/deskopts/Science
- វិគីភីឌា:Reference desk/header/deskopts/Mathematics
- វិគីភីឌា:Reference desk/header/deskopts/Humanities
- វិគីភីឌា:Reference desk/header/deskopts/Language
- វិគីភីឌា:Reference desk/header/deskopts/Entertainment
- វិគីភីឌា:Reference desk/header/deskopts/Miscellaneous
- វិគីភីឌា:Reference desk/header/deskopts/Reference desk
(don't delete them)
Shortcuts to various desks:
Main | WP:RD |
WP:RD/ | |
Wp:rd | |
All | WP:RD/ALL |
Computing | WP:RD/C |
WP:RD/COMP | |
Science | WP:RD/S |
WP:RD/s | |
WP:RD/SCI | |
WP:RD/Science | |
Mathematics | WP:RD/MA |
WP:RD/Math | |
WP:RD/MATH | |
WP:RD/Maths | |
Humanities | WP:RD/H |
WP:RD/h | |
Language | WP:RD/L |
WP:RD/LANG | |
Entertainment | WP:RD/E |
WP:RD/P (popular culture) | |
Miscellaneous | WP:RD/M |
WP:RD/MISC | |
WP:RD/Miscellaneous | |
Archives | WP:RD/A |
WP:RD/ARCHIVE | |
Guidelines | WP:RD/G |
Color collaboration | WP:RD/COLORS |
To do:
- Create a makelink helper template that writes text in color "navlinks", and implement throughout code