MediaWiki:Common: Difference between revisions

From OniGalore
Jump to navigation Jump to search
(→‎Common.js: adding note on "sep" argument to ModifySidebar())
(general update and improvement)
Line 1: Line 1:
The purpose of [[MediaWiki:Common.css]] and [[MediaWiki:Common.js]] is to augment the MediaWiki CSS and JS code, in a way that is effective for all users.
The purpose of [[MediaWiki:Common.css]] and [[MediaWiki:Common.js]] is to augment the MediaWiki CSS and JS code, in a way that is effective for all users. Note that changes to [[MediaWiki:Vector.css]] and [[MediaWiki:Vector.js]] override these general changes for anyone using the default Vector skin. On top of ''that'' come any changes made to users' local vector.css and vector.js pages.


==Common.css==
==Common.css==
*Common.css mainly contains fixes for annoying glitches in MediaWiki's appearance or behavior, and minor style tweaks.
*Common.css mainly contains fixes for annoying glitches in MediaWiki's appearance or behavior, and minor style tweaks (these are all more or less borrowed from Wikipedia).


*There are also various extended standards declared here for the appearance of things like infoboxes.
*There are also various classes declared here for standard additions to the wiki, such as:
 
**[[Template:Fmbox|infoboxes]]
*The NavFrame class is declared here, which is used by message templates such as the nifty [[Template:Divhide|divhide box]].
**[[Template:Divhide|divhide boxes]]
**optional mods for the table of contents (use <nowiki><div class="nonumtoc"></nowiki> for an un-numbered TOC and see [[Template:TOClimit]] for the use of the "toclimit-*" classes)


*There's also a modified fix brought over from WP for the annoyingly small text MediaWiki uses for monospaced fonts, which show up when you use <nowiki><code>, <tt>, and <pre></nowiki> tags.
*There's also a modified fix brought over from WP for the annoyingly small text MediaWiki uses for monospaced fonts, which show up when you use <nowiki><code>, <tt>, and <pre></nowiki> tags.


==Common.js==
==Common.js==
*Common.js first looks at whether we're editing a page, and if so, it imports the code from [[MediaWiki:Common.js/edit.js]].
*Common.js allows for a user to add an "&withJS=MediaWiki:__.js" to a URL in order to view that page with a custom JS file that normally does not load for you (untested, so this documentation may be incorrect).
 
*Next, it looks at whether we're editing a page, and if so, it imports the code from [[MediaWiki:Common.js/edit.js]] for customizations to the editing interface. It does the same for the search page with [[MediaWiki:Common.js/search.js]].
 
*More fixes for Internet Explorer.
 
*Then we set up hasClass(), which is used by various subsequent code.
 
*Hover tables are added next, which can display a description of the table cell being pointed to. They are demonstrated [[User:Iritscen/HoverTableDemo|here]].


*If we're on our watchlist page, [[MediaWiki:Common.js/watchlist.js]] is imported.
*Next is an even more unfinished feature called hover GIFs, which are GIFs that only animate when hovered over. It accomplishes this by swapping a still image with a GIF. However, this method does not work as written because it merely changes the suffix of an image between .gif and .jpg; since images are stored in various "random" sub-directories on the server, the entire path for both images would be needed in order to perform a successful swap. These paths could be supplied using an approach similar to the hover table class "hovertable_descrip", if one was determined to make this feature work.


* Next, Common.js sets up hasClass(), which is used by the next code, which places the show/hide buttons in those divhide boxes mentioned above.  The code after ''that'' uses the NavFrame class from Common.css to create the collapsible tables that divhide uses.
*The next code uses the NavFrame class from Common.css to create the collapsible tables that divhide boxes use.


* A function called ModifySidebar() is made available for customizing the items listed in the sections on the left of all wiki pages. See Iritscen's [[User:Iritscen/monobook.js|custom JS page]] for a sample usage.
* A function called ModifySidebar() is made available for customizing the items listed in the sections on the left of all wiki pages. See Iritscen's [[User:Iritscen/vector.js|custom JS page]] for a sample usage.
** Parameter 1: The string "add", "remove", or "sep" (which adds a separator line).
** Parameter 1: The string "add", "remove", or "sep" (which adds a separator line, however the line is currently not displaying for some reason).
** Parameter 2: The name of the section; "navigation", "languages" (not displayed on this wiki), or "toolbox".
** Parameter 2: The name of the section; "navigation", "languages" (not displayed on this wiki), or "toolbox".
** Parameter 3: The display name of the URL you will be adding.
** Parameter 3: The display name of the URL you will be adding.
** Parameter 4: The full URL of the wiki page to add (this should allow the adding of external links as well).
** Parameter 4: The full URL of the wiki page to add (this should allow the adding of external links as well).


* There are also some fixes for IE and table sorting.
*Finally, there is also an untested fix for table sorting and a tweak to the Upload page for unregistered users (does this do anything?).


[[Category:Policies and documentation]]
[[Category:Policies and documentation]]

Revision as of 04:18, 13 November 2015

The purpose of MediaWiki:Common.css and MediaWiki:Common.js is to augment the MediaWiki CSS and JS code, in a way that is effective for all users. Note that changes to MediaWiki:Vector.css and MediaWiki:Vector.js override these general changes for anyone using the default Vector skin. On top of that come any changes made to users' local vector.css and vector.js pages.

Common.css

  • Common.css mainly contains fixes for annoying glitches in MediaWiki's appearance or behavior, and minor style tweaks (these are all more or less borrowed from Wikipedia).
  • There are also various classes declared here for standard additions to the wiki, such as:
  • There's also a modified fix brought over from WP for the annoyingly small text MediaWiki uses for monospaced fonts, which show up when you use <code>, <tt>, and <pre> tags.

Common.js

  • Common.js allows for a user to add an "&withJS=MediaWiki:__.js" to a URL in order to view that page with a custom JS file that normally does not load for you (untested, so this documentation may be incorrect).
  • More fixes for Internet Explorer.
  • Then we set up hasClass(), which is used by various subsequent code.
  • Hover tables are added next, which can display a description of the table cell being pointed to. They are demonstrated here.
  • Next is an even more unfinished feature called hover GIFs, which are GIFs that only animate when hovered over. It accomplishes this by swapping a still image with a GIF. However, this method does not work as written because it merely changes the suffix of an image between .gif and .jpg; since images are stored in various "random" sub-directories on the server, the entire path for both images would be needed in order to perform a successful swap. These paths could be supplied using an approach similar to the hover table class "hovertable_descrip", if one was determined to make this feature work.
  • The next code uses the NavFrame class from Common.css to create the collapsible tables that divhide boxes use.
  • A function called ModifySidebar() is made available for customizing the items listed in the sections on the left of all wiki pages. See Iritscen's custom JS page for a sample usage.
    • Parameter 1: The string "add", "remove", or "sep" (which adds a separator line, however the line is currently not displaying for some reason).
    • Parameter 2: The name of the section; "navigation", "languages" (not displayed on this wiki), or "toolbox".
    • Parameter 3: The display name of the URL you will be adding.
    • Parameter 4: The full URL of the wiki page to add (this should allow the adding of external links as well).
  • Finally, there is also an untested fix for table sorting and a tweak to the Upload page for unregistered users (does this do anything?).