User:GreyCat/Comparison tables

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Comparison tables extension is a short JavaScript extension to ease the burden of viewing pages with comparison tables.

How does it help?[edit | edit source]

Some pages include so-called comparison tables. They usually have a long list of features, one per row, and long list of comparable items with these features, one per column. As tables grow, new comparable items appear, and, finally, such giant table doesn't seem to fit on any screen, while usually user that references such table just wants to see 2 or 3 columns.

With comparison tables extension installed, any page that has a comparison table would have a selector with checkboxes that one can use to select which columns are of interest. Selected columns instantly appear, unselected columns instantly disappear. It's that simple. Also, you'll get rid of those yellow notice boxes.

How to install[edit | edit source]

Installation is quick:

  1. Make sure you have a user account in Wikibooks and you're logged in.
  2. Add the following code into your your vector.js page:
document.write('<script type="text/javascript" src="'
+ ''
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');

Note that if you're using skin other than default "Vector", you should add this code to .js file used in your skin, i.e. use monobook.js page for Monobook skin, etc. You can find a full list of personal .js files for every skin in MediaWiki manual personal scripts description.

How to use this extension in pages[edit | edit source]

Generally, it's very simple to add this extension to any page:

  1. All tables that should be a comparison-enabled should have a class="wikitable".
  2. Add a template {{comparison tables}} to the top of the page. It serves both as a notice for readers and as a flag that enables the extension while a reader views such page. Otherwise, the extension just does nothing and doesn't interfere with any other scripts workflow.

Credits, support, license[edit | edit source]

The comparison tables extension was developed by GreyCat. Feel free to contact if any question arises.

The source code for extension is is available under GPL at User:GreyCat/comparison.js.