Installation

SeeSaw.py
Install SeeSaw.py in the place where you normally install third-party macros. This will probably be in data/plugin/macro within the wiki, or since 1.8, could be in a place listed in the wiki configuration variable plugin_dirs.

seesaw.js
The simplest place to install seesaw.js initially in order to get SeeSaw working is within MoinMoin's htdocs/common/js directory.

jquery-1.9.1.min.js
Install jquery-1.9.1.min.js in the same place as seesaw.js.

1.9.1 was the version of jQuery current at the time of release. SeeSaw uses basic jQuery features so is likely to work with older and future versions.

Configuration

Configure html_head in your wiki's wikiconfig.py configuration file as follows:
    html_head = '''
<script type="text/javascript" src="<url_prefix_static>/common/js/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="<url_prefix_static>/common/js/seesaw.js"></script>
'''
replacing <url_prefix_static> with the value of url_prefix_static used by the configuration file.

Testing

The following markup should work:
   <<SeeSaw()>> <<SeeSaw(type=button, image=arrow)>>
   {{{#!wiki seesaw section
   This is the section
   }}}
It should present a Show link and a button containing a right arrow, which change to Hide and a down arrow when either is clicked, revealing the section containing the text
   This is the section
Clicking either again should cause a return to the initial state.

Alternative Installation

You can install the .js files anywhere you like. I prefer not to install them within the MoinMoin installation tree in order to avoid having to re-install them at upgrades. If you put them somewhere else then you have to configure your server to be able to access them, e.g. through the use an Alias directive for Apache and suitably adjusted entries in html_head.

That's everything that's needed for all of SeeSaw's features to work.


Images in Links and Buttons

Two image sets, each consisting of an image for showing and one for hiding, are provided as embedded data in the source code for use with the image option. Further image sets can be added by adding to moreimages in the Configuration section of SeeSaw.py. The images can be provided as data or as files. The simplest place to install files would be in htdocs/common within MoinMoin's installation tree. If providing files, it is necessary to configure imageprefix. For the case above, the value would be
   imageprefix = '<url_prefix_static>/common'
Replace <url_prefix_static> with the value of the variable url_prefix_static in your wiki's configuration file.

Anti-jump Solution

If you experience page jump as a page is rendered, i.e. sections of the page that are to be hidden initially are seen briefly before being withdrawn, add the following to html_head in the wiki's wikiconfig.py configuration file:
   <style type="text/css"> 
   div.seesaw, span.seesaw { display: none; }
   div.seesaw.show { display: block; }
   span.seesaw.show { display: inline; }
   </style>

You may need to extend that for sections other than divs and spans.


Jim Wight
March 2013