User:GreyCat/Comparison tables
From Wikibooks, the open-content textbooks collection
Comparison tables extension is a short JavaScript extension to ease the burden of viewing pages with comparison tables.
Contents |
[edit] How does it help?
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.
[edit] How to install
Installation is quick:
- Make sure you have a user account in Wikibooks and you're logged in.
- Add the following code into your your monobook.js page:
document.write('<script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:GreyCat/comparison.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"></script>');
[edit] How to use this extension in pages
Generally, it's very simple to add this extension to any page:
- All tables that should be a comparison-enabled should have a
class="wikitable". - 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.
[edit] Credits, support, license
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.